| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708697096971069711697126971369714697156971669717697186971969720697216972269723697246972569726697276972869729697306973169732697336973469735697366973769738697396974069741697426974369744697456974669747697486974969750697516975269753697546975569756697576975869759697606976169762697636976469765697666976769768697696977069771697726977369774697756977669777697786977969780697816978269783697846978569786697876978869789697906979169792697936979469795697966979769798697996980069801698026980369804698056980669807698086980969810698116981269813698146981569816698176981869819698206982169822698236982469825698266982769828698296983069831698326983369834698356983669837698386983969840698416984269843698446984569846698476984869849698506985169852698536985469855698566985769858698596986069861698626986369864698656986669867698686986969870698716987269873698746987569876698776987869879698806988169882698836988469885698866988769888698896989069891698926989369894698956989669897698986989969900699016990269903699046990569906699076990869909699106991169912699136991469915699166991769918699196992069921699226992369924699256992669927699286992969930699316993269933699346993569936699376993869939699406994169942699436994469945699466994769948699496995069951699526995369954699556995669957699586995969960699616996269963699646996569966699676996869969699706997169972699736997469975699766997769978699796998069981699826998369984699856998669987699886998969990699916999269993699946999569996699976999869999700007000170002700037000470005700067000770008700097001070011700127001370014700157001670017700187001970020700217002270023700247002570026700277002870029700307003170032700337003470035700367003770038700397004070041700427004370044700457004670047700487004970050700517005270053700547005570056700577005870059700607006170062700637006470065700667006770068700697007070071700727007370074700757007670077700787007970080700817008270083700847008570086700877008870089700907009170092700937009470095700967009770098700997010070101701027010370104701057010670107701087010970110701117011270113701147011570116701177011870119701207012170122701237012470125701267012770128701297013070131701327013370134701357013670137701387013970140701417014270143701447014570146701477014870149701507015170152701537015470155701567015770158701597016070161701627016370164701657016670167701687016970170701717017270173701747017570176701777017870179701807018170182701837018470185701867018770188701897019070191701927019370194701957019670197701987019970200702017020270203702047020570206702077020870209702107021170212702137021470215702167021770218702197022070221702227022370224702257022670227702287022970230702317023270233702347023570236702377023870239702407024170242702437024470245702467024770248702497025070251702527025370254702557025670257702587025970260702617026270263702647026570266702677026870269702707027170272702737027470275702767027770278702797028070281702827028370284702857028670287702887028970290702917029270293702947029570296702977029870299703007030170302703037030470305703067030770308703097031070311703127031370314703157031670317703187031970320703217032270323703247032570326703277032870329703307033170332703337033470335703367033770338703397034070341703427034370344703457034670347703487034970350703517035270353703547035570356703577035870359703607036170362703637036470365703667036770368703697037070371703727037370374703757037670377703787037970380703817038270383703847038570386703877038870389703907039170392703937039470395703967039770398703997040070401704027040370404704057040670407704087040970410704117041270413704147041570416704177041870419704207042170422704237042470425704267042770428704297043070431704327043370434704357043670437704387043970440704417044270443704447044570446704477044870449704507045170452704537045470455704567045770458704597046070461704627046370464704657046670467704687046970470704717047270473704747047570476704777047870479704807048170482704837048470485704867048770488704897049070491704927049370494704957049670497704987049970500705017050270503705047050570506705077050870509705107051170512705137051470515705167051770518705197052070521705227052370524705257052670527705287052970530705317053270533705347053570536705377053870539705407054170542705437054470545705467054770548705497055070551705527055370554705557055670557705587055970560705617056270563705647056570566705677056870569705707057170572705737057470575705767057770578705797058070581705827058370584705857058670587705887058970590705917059270593705947059570596705977059870599706007060170602706037060470605706067060770608706097061070611706127061370614706157061670617706187061970620706217062270623706247062570626706277062870629706307063170632706337063470635706367063770638706397064070641706427064370644706457064670647706487064970650706517065270653706547065570656706577065870659706607066170662706637066470665706667066770668706697067070671706727067370674706757067670677706787067970680706817068270683706847068570686706877068870689706907069170692706937069470695706967069770698706997070070701707027070370704707057070670707707087070970710707117071270713707147071570716707177071870719707207072170722707237072470725707267072770728707297073070731707327073370734707357073670737707387073970740707417074270743707447074570746707477074870749707507075170752707537075470755707567075770758707597076070761707627076370764707657076670767707687076970770707717077270773707747077570776707777077870779707807078170782707837078470785707867078770788707897079070791707927079370794707957079670797707987079970800708017080270803708047080570806708077080870809708107081170812708137081470815708167081770818708197082070821708227082370824708257082670827708287082970830708317083270833708347083570836708377083870839708407084170842708437084470845708467084770848708497085070851708527085370854708557085670857708587085970860708617086270863708647086570866708677086870869708707087170872708737087470875708767087770878708797088070881708827088370884708857088670887708887088970890708917089270893708947089570896708977089870899709007090170902709037090470905709067090770908709097091070911709127091370914709157091670917709187091970920709217092270923709247092570926709277092870929709307093170932709337093470935709367093770938709397094070941709427094370944709457094670947709487094970950709517095270953709547095570956709577095870959709607096170962709637096470965709667096770968709697097070971709727097370974709757097670977709787097970980709817098270983709847098570986709877098870989709907099170992709937099470995709967099770998709997100071001710027100371004710057100671007710087100971010710117101271013710147101571016710177101871019710207102171022710237102471025710267102771028710297103071031710327103371034710357103671037710387103971040710417104271043710447104571046710477104871049710507105171052710537105471055710567105771058710597106071061710627106371064710657106671067710687106971070710717107271073710747107571076710777107871079710807108171082710837108471085710867108771088710897109071091710927109371094710957109671097710987109971100711017110271103711047110571106711077110871109711107111171112711137111471115711167111771118711197112071121711227112371124711257112671127711287112971130711317113271133711347113571136711377113871139711407114171142711437114471145711467114771148711497115071151711527115371154711557115671157711587115971160711617116271163711647116571166711677116871169711707117171172711737117471175711767117771178711797118071181711827118371184711857118671187711887118971190711917119271193711947119571196711977119871199712007120171202712037120471205712067120771208712097121071211712127121371214712157121671217712187121971220712217122271223712247122571226712277122871229712307123171232712337123471235712367123771238712397124071241712427124371244712457124671247712487124971250712517125271253712547125571256712577125871259712607126171262712637126471265712667126771268712697127071271712727127371274712757127671277712787127971280712817128271283712847128571286712877128871289712907129171292712937129471295712967129771298712997130071301713027130371304713057130671307713087130971310713117131271313713147131571316713177131871319713207132171322713237132471325713267132771328713297133071331713327133371334713357133671337713387133971340713417134271343713447134571346713477134871349713507135171352713537135471355713567135771358713597136071361713627136371364713657136671367713687136971370713717137271373713747137571376713777137871379713807138171382713837138471385713867138771388713897139071391713927139371394713957139671397713987139971400714017140271403714047140571406714077140871409714107141171412714137141471415714167141771418714197142071421714227142371424714257142671427714287142971430714317143271433714347143571436714377143871439714407144171442714437144471445714467144771448714497145071451714527145371454714557145671457714587145971460714617146271463714647146571466714677146871469714707147171472714737147471475714767147771478714797148071481714827148371484714857148671487714887148971490714917149271493714947149571496714977149871499715007150171502715037150471505715067150771508715097151071511715127151371514715157151671517715187151971520715217152271523715247152571526715277152871529715307153171532715337153471535715367153771538715397154071541715427154371544715457154671547715487154971550715517155271553715547155571556715577155871559715607156171562715637156471565715667156771568715697157071571715727157371574715757157671577715787157971580715817158271583715847158571586715877158871589715907159171592715937159471595715967159771598715997160071601716027160371604716057160671607716087160971610716117161271613716147161571616716177161871619716207162171622716237162471625716267162771628716297163071631716327163371634716357163671637716387163971640716417164271643716447164571646716477164871649716507165171652716537165471655716567165771658716597166071661716627166371664716657166671667716687166971670716717167271673716747167571676716777167871679716807168171682716837168471685716867168771688716897169071691716927169371694716957169671697716987169971700717017170271703717047170571706717077170871709717107171171712717137171471715717167171771718717197172071721717227172371724717257172671727717287172971730717317173271733717347173571736717377173871739717407174171742717437174471745717467174771748717497175071751717527175371754717557175671757717587175971760717617176271763717647176571766717677176871769717707177171772717737177471775717767177771778717797178071781717827178371784717857178671787717887178971790717917179271793717947179571796717977179871799718007180171802718037180471805718067180771808718097181071811718127181371814718157181671817718187181971820718217182271823718247182571826718277182871829718307183171832718337183471835718367183771838718397184071841718427184371844718457184671847718487184971850718517185271853718547185571856718577185871859718607186171862718637186471865718667186771868718697187071871718727187371874718757187671877718787187971880718817188271883718847188571886718877188871889718907189171892718937189471895718967189771898718997190071901719027190371904719057190671907719087190971910719117191271913719147191571916719177191871919719207192171922719237192471925719267192771928719297193071931719327193371934719357193671937719387193971940719417194271943719447194571946719477194871949719507195171952719537195471955719567195771958719597196071961719627196371964719657196671967719687196971970719717197271973719747197571976719777197871979719807198171982719837198471985719867198771988719897199071991719927199371994719957199671997719987199972000720017200272003720047200572006720077200872009720107201172012720137201472015720167201772018720197202072021720227202372024720257202672027720287202972030720317203272033720347203572036720377203872039720407204172042720437204472045720467204772048720497205072051720527205372054720557205672057720587205972060720617206272063720647206572066720677206872069720707207172072720737207472075720767207772078720797208072081720827208372084720857208672087720887208972090720917209272093720947209572096720977209872099721007210172102721037210472105721067210772108721097211072111721127211372114721157211672117721187211972120721217212272123721247212572126721277212872129721307213172132721337213472135721367213772138721397214072141721427214372144721457214672147721487214972150721517215272153721547215572156721577215872159721607216172162721637216472165721667216772168721697217072171721727217372174721757217672177721787217972180721817218272183721847218572186721877218872189721907219172192721937219472195721967219772198721997220072201722027220372204722057220672207722087220972210722117221272213722147221572216722177221872219722207222172222722237222472225722267222772228722297223072231722327223372234722357223672237722387223972240722417224272243722447224572246722477224872249722507225172252722537225472255722567225772258722597226072261722627226372264722657226672267722687226972270722717227272273722747227572276722777227872279722807228172282722837228472285722867228772288722897229072291722927229372294722957229672297722987229972300723017230272303723047230572306723077230872309723107231172312723137231472315723167231772318723197232072321723227232372324723257232672327723287232972330723317233272333723347233572336723377233872339723407234172342723437234472345723467234772348723497235072351723527235372354723557235672357723587235972360723617236272363723647236572366723677236872369723707237172372723737237472375723767237772378723797238072381723827238372384723857238672387723887238972390723917239272393723947239572396723977239872399724007240172402724037240472405724067240772408724097241072411724127241372414724157241672417724187241972420724217242272423724247242572426724277242872429724307243172432724337243472435724367243772438724397244072441724427244372444724457244672447724487244972450724517245272453724547245572456724577245872459724607246172462724637246472465724667246772468724697247072471724727247372474724757247672477724787247972480724817248272483724847248572486724877248872489724907249172492724937249472495724967249772498724997250072501725027250372504725057250672507725087250972510725117251272513725147251572516725177251872519725207252172522725237252472525725267252772528725297253072531725327253372534725357253672537725387253972540725417254272543725447254572546725477254872549725507255172552725537255472555725567255772558725597256072561725627256372564725657256672567725687256972570725717257272573725747257572576725777257872579725807258172582725837258472585725867258772588725897259072591725927259372594725957259672597725987259972600726017260272603726047260572606726077260872609726107261172612726137261472615726167261772618726197262072621726227262372624726257262672627726287262972630726317263272633726347263572636726377263872639726407264172642726437264472645726467264772648726497265072651726527265372654726557265672657726587265972660726617266272663726647266572666726677266872669726707267172672726737267472675726767267772678726797268072681726827268372684726857268672687726887268972690726917269272693726947269572696726977269872699727007270172702727037270472705727067270772708727097271072711727127271372714727157271672717727187271972720727217272272723727247272572726727277272872729727307273172732727337273472735727367273772738727397274072741727427274372744727457274672747727487274972750727517275272753727547275572756727577275872759727607276172762727637276472765727667276772768727697277072771727727277372774727757277672777727787277972780727817278272783727847278572786727877278872789727907279172792727937279472795727967279772798727997280072801728027280372804728057280672807728087280972810728117281272813728147281572816728177281872819728207282172822728237282472825728267282772828728297283072831728327283372834728357283672837728387283972840728417284272843728447284572846728477284872849728507285172852728537285472855728567285772858728597286072861728627286372864728657286672867728687286972870728717287272873728747287572876728777287872879728807288172882728837288472885728867288772888728897289072891728927289372894728957289672897728987289972900729017290272903729047290572906729077290872909729107291172912729137291472915729167291772918729197292072921729227292372924729257292672927729287292972930729317293272933729347293572936729377293872939729407294172942729437294472945729467294772948729497295072951729527295372954729557295672957729587295972960729617296272963729647296572966729677296872969729707297172972729737297472975729767297772978729797298072981729827298372984729857298672987729887298972990729917299272993729947299572996729977299872999730007300173002730037300473005730067300773008730097301073011730127301373014730157301673017730187301973020730217302273023730247302573026730277302873029730307303173032730337303473035730367303773038730397304073041730427304373044730457304673047730487304973050730517305273053730547305573056730577305873059730607306173062730637306473065730667306773068730697307073071730727307373074730757307673077730787307973080730817308273083730847308573086730877308873089730907309173092730937309473095730967309773098730997310073101731027310373104731057310673107731087310973110731117311273113731147311573116731177311873119731207312173122731237312473125731267312773128731297313073131731327313373134731357313673137731387313973140731417314273143731447314573146731477314873149731507315173152731537315473155731567315773158731597316073161731627316373164731657316673167731687316973170731717317273173731747317573176731777317873179731807318173182731837318473185731867318773188731897319073191731927319373194731957319673197731987319973200732017320273203732047320573206732077320873209732107321173212732137321473215732167321773218732197322073221732227322373224732257322673227732287322973230732317323273233732347323573236732377323873239732407324173242732437324473245732467324773248732497325073251732527325373254732557325673257732587325973260732617326273263732647326573266732677326873269732707327173272732737327473275732767327773278732797328073281732827328373284732857328673287732887328973290732917329273293732947329573296732977329873299733007330173302733037330473305733067330773308733097331073311733127331373314733157331673317733187331973320733217332273323733247332573326733277332873329733307333173332733337333473335733367333773338733397334073341733427334373344733457334673347733487334973350733517335273353733547335573356733577335873359733607336173362733637336473365733667336773368733697337073371733727337373374733757337673377733787337973380733817338273383733847338573386733877338873389733907339173392733937339473395733967339773398733997340073401734027340373404734057340673407734087340973410734117341273413734147341573416734177341873419734207342173422734237342473425734267342773428734297343073431734327343373434734357343673437734387343973440734417344273443734447344573446734477344873449734507345173452734537345473455734567345773458734597346073461734627346373464734657346673467734687346973470734717347273473734747347573476734777347873479734807348173482734837348473485734867348773488734897349073491734927349373494734957349673497734987349973500735017350273503735047350573506735077350873509735107351173512735137351473515735167351773518735197352073521735227352373524735257352673527735287352973530735317353273533735347353573536735377353873539735407354173542735437354473545735467354773548735497355073551735527355373554735557355673557735587355973560735617356273563735647356573566735677356873569735707357173572735737357473575735767357773578735797358073581735827358373584735857358673587735887358973590735917359273593735947359573596735977359873599736007360173602736037360473605736067360773608736097361073611736127361373614736157361673617736187361973620736217362273623736247362573626736277362873629736307363173632736337363473635736367363773638736397364073641736427364373644736457364673647736487364973650736517365273653736547365573656736577365873659736607366173662736637366473665736667366773668736697367073671736727367373674736757367673677736787367973680736817368273683736847368573686736877368873689736907369173692736937369473695736967369773698736997370073701737027370373704737057370673707737087370973710737117371273713737147371573716737177371873719737207372173722737237372473725737267372773728737297373073731737327373373734737357373673737737387373973740737417374273743737447374573746737477374873749737507375173752737537375473755737567375773758737597376073761737627376373764737657376673767737687376973770737717377273773737747377573776737777377873779737807378173782737837378473785737867378773788737897379073791737927379373794737957379673797737987379973800738017380273803738047380573806738077380873809738107381173812738137381473815738167381773818738197382073821738227382373824738257382673827738287382973830738317383273833738347383573836738377383873839738407384173842738437384473845738467384773848738497385073851738527385373854738557385673857738587385973860738617386273863738647386573866738677386873869738707387173872738737387473875738767387773878738797388073881738827388373884738857388673887738887388973890738917389273893738947389573896738977389873899739007390173902739037390473905739067390773908739097391073911739127391373914739157391673917739187391973920739217392273923739247392573926739277392873929739307393173932739337393473935739367393773938739397394073941739427394373944739457394673947739487394973950739517395273953739547395573956739577395873959739607396173962739637396473965739667396773968739697397073971739727397373974739757397673977739787397973980739817398273983739847398573986739877398873989739907399173992739937399473995739967399773998739997400074001740027400374004740057400674007740087400974010740117401274013740147401574016740177401874019740207402174022740237402474025740267402774028740297403074031740327403374034740357403674037740387403974040740417404274043740447404574046740477404874049740507405174052740537405474055740567405774058740597406074061740627406374064740657406674067740687406974070740717407274073740747407574076740777407874079740807408174082740837408474085740867408774088740897409074091740927409374094740957409674097740987409974100741017410274103741047410574106741077410874109741107411174112741137411474115741167411774118741197412074121741227412374124741257412674127741287412974130741317413274133741347413574136741377413874139741407414174142741437414474145741467414774148741497415074151741527415374154741557415674157741587415974160741617416274163741647416574166741677416874169741707417174172741737417474175741767417774178741797418074181741827418374184741857418674187741887418974190741917419274193741947419574196741977419874199742007420174202742037420474205742067420774208742097421074211742127421374214742157421674217742187421974220742217422274223742247422574226742277422874229742307423174232742337423474235742367423774238742397424074241742427424374244742457424674247742487424974250742517425274253742547425574256742577425874259742607426174262742637426474265742667426774268742697427074271742727427374274742757427674277742787427974280742817428274283742847428574286742877428874289742907429174292742937429474295742967429774298742997430074301743027430374304743057430674307743087430974310743117431274313743147431574316743177431874319743207432174322743237432474325743267432774328743297433074331743327433374334743357433674337743387433974340743417434274343743447434574346743477434874349743507435174352743537435474355743567435774358743597436074361743627436374364743657436674367743687436974370743717437274373743747437574376743777437874379743807438174382743837438474385743867438774388743897439074391743927439374394743957439674397743987439974400744017440274403744047440574406744077440874409744107441174412744137441474415744167441774418744197442074421744227442374424744257442674427744287442974430744317443274433744347443574436744377443874439744407444174442744437444474445744467444774448744497445074451744527445374454744557445674457744587445974460744617446274463744647446574466744677446874469744707447174472744737447474475744767447774478744797448074481744827448374484744857448674487744887448974490744917449274493744947449574496744977449874499745007450174502745037450474505745067450774508745097451074511745127451374514745157451674517745187451974520745217452274523745247452574526745277452874529745307453174532745337453474535745367453774538745397454074541745427454374544745457454674547745487454974550745517455274553745547455574556745577455874559745607456174562745637456474565745667456774568745697457074571745727457374574745757457674577745787457974580745817458274583745847458574586745877458874589745907459174592745937459474595745967459774598745997460074601746027460374604746057460674607746087460974610746117461274613746147461574616746177461874619746207462174622746237462474625746267462774628746297463074631746327463374634746357463674637746387463974640746417464274643746447464574646746477464874649746507465174652746537465474655746567465774658746597466074661746627466374664746657466674667746687466974670746717467274673746747467574676746777467874679746807468174682746837468474685746867468774688746897469074691746927469374694746957469674697746987469974700747017470274703747047470574706747077470874709747107471174712747137471474715747167471774718747197472074721747227472374724747257472674727747287472974730747317473274733747347473574736747377473874739747407474174742747437474474745747467474774748747497475074751747527475374754747557475674757747587475974760747617476274763747647476574766747677476874769747707477174772747737477474775747767477774778747797478074781747827478374784747857478674787747887478974790747917479274793747947479574796747977479874799748007480174802748037480474805748067480774808748097481074811748127481374814748157481674817748187481974820748217482274823748247482574826748277482874829748307483174832748337483474835748367483774838748397484074841748427484374844748457484674847748487484974850748517485274853748547485574856748577485874859748607486174862748637486474865748667486774868748697487074871748727487374874748757487674877748787487974880748817488274883748847488574886748877488874889748907489174892748937489474895748967489774898748997490074901749027490374904749057490674907749087490974910749117491274913749147491574916749177491874919749207492174922749237492474925749267492774928749297493074931749327493374934749357493674937749387493974940749417494274943749447494574946749477494874949749507495174952749537495474955749567495774958749597496074961749627496374964749657496674967749687496974970749717497274973749747497574976749777497874979749807498174982749837498474985749867498774988749897499074991749927499374994749957499674997749987499975000750017500275003750047500575006750077500875009750107501175012750137501475015750167501775018750197502075021750227502375024750257502675027750287502975030750317503275033750347503575036750377503875039750407504175042750437504475045750467504775048750497505075051750527505375054750557505675057750587505975060750617506275063750647506575066750677506875069750707507175072750737507475075750767507775078750797508075081750827508375084750857508675087750887508975090750917509275093750947509575096750977509875099751007510175102751037510475105751067510775108751097511075111751127511375114751157511675117751187511975120751217512275123751247512575126751277512875129751307513175132751337513475135751367513775138751397514075141751427514375144751457514675147751487514975150751517515275153751547515575156751577515875159751607516175162751637516475165751667516775168751697517075171751727517375174751757517675177751787517975180751817518275183751847518575186751877518875189751907519175192751937519475195751967519775198751997520075201752027520375204752057520675207752087520975210752117521275213752147521575216752177521875219752207522175222752237522475225752267522775228752297523075231752327523375234752357523675237752387523975240752417524275243752447524575246752477524875249752507525175252752537525475255752567525775258752597526075261752627526375264752657526675267752687526975270752717527275273752747527575276752777527875279752807528175282752837528475285752867528775288752897529075291752927529375294752957529675297752987529975300753017530275303753047530575306753077530875309753107531175312753137531475315753167531775318753197532075321753227532375324753257532675327753287532975330753317533275333753347533575336753377533875339753407534175342753437534475345753467534775348753497535075351753527535375354753557535675357753587535975360753617536275363753647536575366753677536875369753707537175372753737537475375753767537775378753797538075381753827538375384753857538675387753887538975390753917539275393753947539575396753977539875399754007540175402754037540475405754067540775408754097541075411754127541375414754157541675417754187541975420754217542275423754247542575426754277542875429754307543175432754337543475435754367543775438754397544075441754427544375444754457544675447754487544975450754517545275453754547545575456754577545875459754607546175462754637546475465754667546775468754697547075471754727547375474754757547675477754787547975480754817548275483754847548575486754877548875489754907549175492754937549475495754967549775498754997550075501755027550375504755057550675507755087550975510755117551275513755147551575516755177551875519755207552175522755237552475525755267552775528755297553075531755327553375534755357553675537755387553975540755417554275543755447554575546755477554875549755507555175552755537555475555755567555775558755597556075561755627556375564755657556675567755687556975570755717557275573755747557575576755777557875579755807558175582755837558475585755867558775588755897559075591755927559375594755957559675597755987559975600756017560275603756047560575606756077560875609756107561175612756137561475615756167561775618756197562075621756227562375624756257562675627756287562975630756317563275633756347563575636756377563875639756407564175642756437564475645756467564775648756497565075651756527565375654756557565675657756587565975660756617566275663756647566575666756677566875669756707567175672756737567475675756767567775678756797568075681756827568375684756857568675687756887568975690756917569275693756947569575696756977569875699757007570175702757037570475705757067570775708757097571075711757127571375714757157571675717757187571975720757217572275723757247572575726757277572875729757307573175732757337573475735757367573775738757397574075741757427574375744757457574675747757487574975750757517575275753757547575575756757577575875759757607576175762757637576475765757667576775768757697577075771757727577375774757757577675777757787577975780757817578275783757847578575786757877578875789757907579175792757937579475795757967579775798757997580075801758027580375804758057580675807758087580975810758117581275813758147581575816758177581875819758207582175822758237582475825758267582775828758297583075831758327583375834758357583675837758387583975840758417584275843758447584575846758477584875849758507585175852758537585475855758567585775858758597586075861758627586375864758657586675867758687586975870758717587275873758747587575876758777587875879758807588175882758837588475885758867588775888758897589075891758927589375894758957589675897758987589975900759017590275903759047590575906759077590875909759107591175912759137591475915759167591775918759197592075921759227592375924759257592675927759287592975930759317593275933759347593575936759377593875939759407594175942759437594475945759467594775948759497595075951759527595375954759557595675957759587595975960759617596275963759647596575966759677596875969759707597175972759737597475975759767597775978759797598075981759827598375984759857598675987759887598975990759917599275993759947599575996759977599875999760007600176002760037600476005760067600776008760097601076011760127601376014760157601676017760187601976020760217602276023760247602576026760277602876029760307603176032760337603476035760367603776038760397604076041760427604376044760457604676047760487604976050760517605276053760547605576056760577605876059760607606176062760637606476065760667606776068760697607076071760727607376074760757607676077760787607976080760817608276083760847608576086760877608876089760907609176092760937609476095760967609776098760997610076101761027610376104761057610676107761087610976110761117611276113761147611576116761177611876119761207612176122761237612476125761267612776128761297613076131761327613376134761357613676137761387613976140761417614276143761447614576146761477614876149761507615176152761537615476155761567615776158761597616076161761627616376164761657616676167761687616976170761717617276173761747617576176761777617876179761807618176182761837618476185761867618776188761897619076191761927619376194761957619676197761987619976200762017620276203762047620576206762077620876209762107621176212762137621476215762167621776218762197622076221762227622376224762257622676227762287622976230762317623276233762347623576236762377623876239762407624176242762437624476245762467624776248762497625076251762527625376254762557625676257762587625976260762617626276263762647626576266762677626876269762707627176272762737627476275762767627776278762797628076281762827628376284762857628676287762887628976290762917629276293762947629576296762977629876299763007630176302763037630476305763067630776308763097631076311763127631376314763157631676317763187631976320763217632276323763247632576326763277632876329763307633176332763337633476335763367633776338763397634076341763427634376344763457634676347763487634976350763517635276353763547635576356763577635876359763607636176362763637636476365763667636776368763697637076371763727637376374763757637676377763787637976380763817638276383763847638576386763877638876389763907639176392763937639476395763967639776398763997640076401764027640376404764057640676407764087640976410764117641276413764147641576416764177641876419764207642176422764237642476425764267642776428764297643076431764327643376434764357643676437764387643976440764417644276443764447644576446764477644876449764507645176452764537645476455764567645776458764597646076461764627646376464764657646676467764687646976470764717647276473764747647576476764777647876479764807648176482764837648476485764867648776488764897649076491764927649376494764957649676497764987649976500765017650276503765047650576506765077650876509765107651176512765137651476515765167651776518765197652076521765227652376524765257652676527765287652976530765317653276533765347653576536765377653876539765407654176542765437654476545765467654776548765497655076551765527655376554765557655676557765587655976560765617656276563765647656576566765677656876569765707657176572765737657476575765767657776578765797658076581765827658376584765857658676587765887658976590765917659276593765947659576596765977659876599766007660176602766037660476605766067660776608766097661076611766127661376614766157661676617766187661976620766217662276623766247662576626766277662876629766307663176632766337663476635766367663776638766397664076641766427664376644766457664676647766487664976650766517665276653766547665576656766577665876659766607666176662766637666476665766667666776668766697667076671766727667376674766757667676677766787667976680766817668276683766847668576686766877668876689766907669176692766937669476695766967669776698766997670076701767027670376704767057670676707767087670976710767117671276713767147671576716767177671876719767207672176722767237672476725767267672776728767297673076731767327673376734767357673676737767387673976740767417674276743767447674576746767477674876749767507675176752767537675476755767567675776758767597676076761767627676376764767657676676767767687676976770767717677276773767747677576776767777677876779767807678176782767837678476785767867678776788767897679076791767927679376794767957679676797767987679976800768017680276803768047680576806768077680876809768107681176812768137681476815768167681776818768197682076821768227682376824768257682676827768287682976830768317683276833768347683576836768377683876839768407684176842768437684476845768467684776848768497685076851768527685376854768557685676857768587685976860768617686276863768647686576866768677686876869768707687176872768737687476875768767687776878768797688076881768827688376884768857688676887768887688976890768917689276893768947689576896768977689876899769007690176902769037690476905769067690776908769097691076911769127691376914769157691676917769187691976920769217692276923769247692576926769277692876929769307693176932769337693476935769367693776938769397694076941769427694376944769457694676947769487694976950769517695276953769547695576956769577695876959769607696176962769637696476965769667696776968769697697076971769727697376974769757697676977769787697976980769817698276983769847698576986769877698876989769907699176992769937699476995769967699776998769997700077001770027700377004770057700677007770087700977010770117701277013770147701577016770177701877019770207702177022770237702477025770267702777028770297703077031770327703377034770357703677037770387703977040770417704277043770447704577046770477704877049770507705177052770537705477055770567705777058770597706077061770627706377064770657706677067770687706977070770717707277073770747707577076770777707877079770807708177082770837708477085770867708777088770897709077091770927709377094770957709677097770987709977100771017710277103771047710577106771077710877109771107711177112771137711477115771167711777118771197712077121771227712377124771257712677127771287712977130771317713277133771347713577136771377713877139771407714177142771437714477145771467714777148771497715077151771527715377154771557715677157771587715977160771617716277163771647716577166771677716877169771707717177172771737717477175771767717777178771797718077181771827718377184771857718677187771887718977190771917719277193771947719577196771977719877199772007720177202772037720477205772067720777208772097721077211772127721377214772157721677217772187721977220772217722277223772247722577226772277722877229772307723177232772337723477235772367723777238772397724077241772427724377244772457724677247772487724977250772517725277253772547725577256772577725877259772607726177262772637726477265772667726777268772697727077271772727727377274772757727677277772787727977280772817728277283772847728577286772877728877289772907729177292772937729477295772967729777298772997730077301773027730377304773057730677307773087730977310773117731277313773147731577316773177731877319773207732177322773237732477325773267732777328773297733077331773327733377334773357733677337773387733977340773417734277343773447734577346773477734877349773507735177352773537735477355773567735777358773597736077361773627736377364773657736677367773687736977370773717737277373773747737577376773777737877379773807738177382773837738477385773867738777388773897739077391773927739377394773957739677397773987739977400774017740277403774047740577406774077740877409774107741177412774137741477415774167741777418774197742077421774227742377424774257742677427774287742977430774317743277433774347743577436774377743877439774407744177442774437744477445774467744777448774497745077451774527745377454774557745677457774587745977460774617746277463774647746577466774677746877469774707747177472774737747477475774767747777478774797748077481774827748377484774857748677487774887748977490774917749277493774947749577496774977749877499775007750177502775037750477505775067750777508775097751077511775127751377514775157751677517775187751977520775217752277523775247752577526775277752877529775307753177532775337753477535775367753777538775397754077541775427754377544775457754677547775487754977550775517755277553775547755577556775577755877559775607756177562775637756477565775667756777568775697757077571775727757377574775757757677577775787757977580775817758277583775847758577586775877758877589775907759177592775937759477595775967759777598775997760077601776027760377604776057760677607776087760977610776117761277613776147761577616776177761877619776207762177622776237762477625776267762777628776297763077631776327763377634776357763677637776387763977640776417764277643776447764577646776477764877649776507765177652776537765477655776567765777658776597766077661776627766377664776657766677667776687766977670776717767277673776747767577676776777767877679776807768177682776837768477685776867768777688776897769077691776927769377694776957769677697776987769977700777017770277703777047770577706777077770877709777107771177712777137771477715777167771777718777197772077721777227772377724777257772677727777287772977730777317773277733777347773577736777377773877739777407774177742777437774477745777467774777748777497775077751777527775377754777557775677757777587775977760777617776277763777647776577766777677776877769777707777177772777737777477775777767777777778777797778077781777827778377784777857778677787777887778977790777917779277793777947779577796777977779877799778007780177802778037780477805778067780777808778097781077811778127781377814778157781677817778187781977820778217782277823778247782577826778277782877829778307783177832778337783477835778367783777838778397784077841778427784377844778457784677847778487784977850778517785277853778547785577856778577785877859778607786177862778637786477865778667786777868778697787077871778727787377874778757787677877778787787977880778817788277883778847788577886778877788877889778907789177892778937789477895778967789777898778997790077901779027790377904779057790677907779087790977910779117791277913779147791577916779177791877919779207792177922779237792477925779267792777928779297793077931779327793377934779357793677937779387793977940779417794277943779447794577946779477794877949779507795177952779537795477955779567795777958779597796077961779627796377964779657796677967779687796977970779717797277973779747797577976779777797877979779807798177982779837798477985779867798777988779897799077991779927799377994779957799677997779987799978000780017800278003780047800578006780077800878009780107801178012780137801478015780167801778018780197802078021780227802378024780257802678027780287802978030780317803278033780347803578036780377803878039780407804178042780437804478045780467804778048780497805078051780527805378054780557805678057780587805978060780617806278063780647806578066780677806878069780707807178072780737807478075780767807778078780797808078081780827808378084780857808678087780887808978090780917809278093780947809578096780977809878099781007810178102781037810478105781067810778108781097811078111781127811378114781157811678117781187811978120781217812278123781247812578126781277812878129781307813178132781337813478135781367813778138781397814078141781427814378144781457814678147781487814978150781517815278153781547815578156781577815878159781607816178162781637816478165781667816778168781697817078171781727817378174781757817678177781787817978180781817818278183781847818578186781877818878189781907819178192781937819478195781967819778198781997820078201782027820378204782057820678207782087820978210782117821278213782147821578216782177821878219782207822178222782237822478225782267822778228782297823078231782327823378234782357823678237782387823978240782417824278243782447824578246782477824878249782507825178252782537825478255782567825778258782597826078261782627826378264782657826678267782687826978270782717827278273782747827578276782777827878279782807828178282782837828478285782867828778288782897829078291782927829378294782957829678297782987829978300783017830278303783047830578306783077830878309783107831178312783137831478315783167831778318783197832078321783227832378324783257832678327783287832978330783317833278333783347833578336783377833878339783407834178342783437834478345783467834778348783497835078351783527835378354783557835678357783587835978360783617836278363783647836578366783677836878369783707837178372783737837478375783767837778378783797838078381783827838378384783857838678387783887838978390783917839278393783947839578396783977839878399784007840178402784037840478405784067840778408784097841078411784127841378414784157841678417784187841978420784217842278423784247842578426784277842878429784307843178432784337843478435784367843778438784397844078441784427844378444784457844678447784487844978450784517845278453784547845578456784577845878459784607846178462784637846478465784667846778468784697847078471784727847378474784757847678477784787847978480784817848278483784847848578486784877848878489784907849178492784937849478495784967849778498784997850078501785027850378504785057850678507785087850978510785117851278513785147851578516785177851878519785207852178522785237852478525785267852778528785297853078531785327853378534785357853678537785387853978540785417854278543785447854578546785477854878549785507855178552785537855478555785567855778558785597856078561785627856378564785657856678567785687856978570785717857278573785747857578576785777857878579785807858178582785837858478585785867858778588785897859078591785927859378594785957859678597785987859978600786017860278603786047860578606786077860878609786107861178612786137861478615786167861778618786197862078621786227862378624786257862678627786287862978630786317863278633786347863578636786377863878639786407864178642786437864478645786467864778648786497865078651786527865378654786557865678657786587865978660786617866278663786647866578666786677866878669786707867178672786737867478675786767867778678786797868078681786827868378684786857868678687786887868978690786917869278693786947869578696786977869878699787007870178702787037870478705787067870778708787097871078711787127871378714787157871678717787187871978720787217872278723787247872578726787277872878729787307873178732787337873478735787367873778738787397874078741787427874378744787457874678747787487874978750787517875278753787547875578756787577875878759787607876178762787637876478765787667876778768787697877078771787727877378774787757877678777787787877978780787817878278783787847878578786787877878878789787907879178792787937879478795787967879778798787997880078801788027880378804788057880678807788087880978810788117881278813788147881578816788177881878819788207882178822788237882478825788267882778828788297883078831788327883378834788357883678837788387883978840788417884278843788447884578846788477884878849788507885178852788537885478855788567885778858788597886078861788627886378864788657886678867788687886978870788717887278873788747887578876788777887878879788807888178882788837888478885788867888778888788897889078891788927889378894788957889678897788987889978900789017890278903789047890578906789077890878909789107891178912789137891478915789167891778918789197892078921789227892378924789257892678927789287892978930789317893278933789347893578936789377893878939789407894178942789437894478945789467894778948789497895078951789527895378954789557895678957789587895978960789617896278963789647896578966789677896878969789707897178972789737897478975789767897778978789797898078981789827898378984789857898678987789887898978990789917899278993789947899578996789977899878999790007900179002790037900479005790067900779008790097901079011790127901379014790157901679017790187901979020790217902279023790247902579026790277902879029790307903179032790337903479035790367903779038790397904079041790427904379044790457904679047790487904979050790517905279053790547905579056790577905879059790607906179062790637906479065790667906779068790697907079071790727907379074790757907679077790787907979080790817908279083790847908579086790877908879089790907909179092790937909479095790967909779098790997910079101791027910379104791057910679107791087910979110791117911279113791147911579116791177911879119791207912179122791237912479125791267912779128791297913079131791327913379134791357913679137791387913979140791417914279143791447914579146791477914879149791507915179152791537915479155791567915779158791597916079161791627916379164791657916679167791687916979170791717917279173791747917579176791777917879179791807918179182791837918479185791867918779188791897919079191791927919379194791957919679197791987919979200792017920279203792047920579206792077920879209792107921179212792137921479215792167921779218792197922079221792227922379224792257922679227792287922979230792317923279233792347923579236792377923879239792407924179242792437924479245792467924779248792497925079251792527925379254792557925679257792587925979260792617926279263792647926579266792677926879269792707927179272792737927479275792767927779278792797928079281792827928379284792857928679287792887928979290792917929279293792947929579296792977929879299793007930179302793037930479305793067930779308793097931079311793127931379314793157931679317793187931979320793217932279323793247932579326793277932879329793307933179332793337933479335793367933779338793397934079341793427934379344793457934679347793487934979350793517935279353793547935579356793577935879359793607936179362793637936479365793667936779368793697937079371793727937379374793757937679377793787937979380793817938279383793847938579386793877938879389793907939179392793937939479395793967939779398793997940079401794027940379404794057940679407794087940979410794117941279413794147941579416794177941879419794207942179422794237942479425794267942779428794297943079431794327943379434794357943679437794387943979440794417944279443794447944579446794477944879449794507945179452794537945479455794567945779458794597946079461794627946379464794657946679467794687946979470794717947279473794747947579476794777947879479794807948179482794837948479485794867948779488794897949079491794927949379494794957949679497794987949979500795017950279503795047950579506795077950879509795107951179512795137951479515795167951779518795197952079521795227952379524795257952679527795287952979530795317953279533795347953579536795377953879539795407954179542795437954479545795467954779548795497955079551795527955379554795557955679557795587955979560795617956279563795647956579566795677956879569795707957179572795737957479575795767957779578795797958079581795827958379584795857958679587795887958979590795917959279593795947959579596795977959879599796007960179602796037960479605796067960779608796097961079611796127961379614796157961679617796187961979620796217962279623796247962579626796277962879629796307963179632796337963479635796367963779638796397964079641796427964379644796457964679647796487964979650796517965279653796547965579656796577965879659796607966179662796637966479665796667966779668796697967079671796727967379674796757967679677796787967979680796817968279683796847968579686796877968879689796907969179692796937969479695796967969779698796997970079701797027970379704797057970679707797087970979710797117971279713797147971579716797177971879719797207972179722797237972479725797267972779728797297973079731797327973379734797357973679737797387973979740797417974279743797447974579746797477974879749797507975179752797537975479755797567975779758797597976079761797627976379764797657976679767797687976979770797717977279773797747977579776797777977879779797807978179782797837978479785797867978779788797897979079791797927979379794797957979679797797987979979800798017980279803798047980579806798077980879809798107981179812798137981479815798167981779818798197982079821798227982379824798257982679827798287982979830798317983279833798347983579836798377983879839798407984179842798437984479845798467984779848798497985079851798527985379854798557985679857798587985979860798617986279863798647986579866798677986879869798707987179872798737987479875798767987779878798797988079881798827988379884798857988679887798887988979890798917989279893798947989579896798977989879899799007990179902799037990479905799067990779908799097991079911799127991379914799157991679917799187991979920799217992279923799247992579926799277992879929799307993179932799337993479935799367993779938799397994079941799427994379944799457994679947799487994979950799517995279953799547995579956799577995879959799607996179962799637996479965799667996779968799697997079971799727997379974799757997679977799787997979980799817998279983799847998579986799877998879989799907999179992799937999479995799967999779998799998000080001800028000380004800058000680007800088000980010800118001280013800148001580016800178001880019800208002180022800238002480025800268002780028800298003080031800328003380034800358003680037800388003980040800418004280043800448004580046800478004880049800508005180052800538005480055800568005780058800598006080061800628006380064800658006680067800688006980070800718007280073800748007580076800778007880079800808008180082800838008480085800868008780088800898009080091800928009380094800958009680097800988009980100801018010280103801048010580106801078010880109801108011180112801138011480115801168011780118801198012080121801228012380124801258012680127801288012980130801318013280133801348013580136801378013880139801408014180142801438014480145801468014780148801498015080151801528015380154801558015680157801588015980160801618016280163801648016580166801678016880169801708017180172801738017480175801768017780178801798018080181801828018380184801858018680187801888018980190801918019280193801948019580196801978019880199802008020180202802038020480205802068020780208802098021080211802128021380214802158021680217802188021980220802218022280223802248022580226802278022880229802308023180232802338023480235802368023780238802398024080241802428024380244802458024680247802488024980250802518025280253802548025580256802578025880259802608026180262802638026480265802668026780268802698027080271802728027380274802758027680277802788027980280802818028280283802848028580286802878028880289802908029180292802938029480295802968029780298802998030080301803028030380304803058030680307803088030980310803118031280313803148031580316803178031880319803208032180322803238032480325803268032780328803298033080331803328033380334803358033680337803388033980340803418034280343803448034580346803478034880349803508035180352803538035480355803568035780358803598036080361803628036380364803658036680367803688036980370803718037280373803748037580376803778037880379803808038180382803838038480385803868038780388803898039080391803928039380394803958039680397803988039980400804018040280403804048040580406804078040880409804108041180412804138041480415804168041780418804198042080421804228042380424804258042680427804288042980430804318043280433804348043580436804378043880439804408044180442804438044480445804468044780448804498045080451804528045380454804558045680457804588045980460804618046280463804648046580466804678046880469804708047180472804738047480475804768047780478804798048080481804828048380484804858048680487804888048980490804918049280493804948049580496804978049880499805008050180502805038050480505805068050780508805098051080511805128051380514805158051680517805188051980520805218052280523805248052580526805278052880529805308053180532805338053480535805368053780538805398054080541805428054380544805458054680547805488054980550805518055280553805548055580556805578055880559805608056180562805638056480565805668056780568805698057080571805728057380574805758057680577805788057980580805818058280583805848058580586805878058880589805908059180592805938059480595805968059780598805998060080601806028060380604806058060680607806088060980610806118061280613806148061580616806178061880619806208062180622806238062480625806268062780628806298063080631806328063380634806358063680637806388063980640806418064280643806448064580646806478064880649806508065180652806538065480655806568065780658806598066080661806628066380664806658066680667806688066980670806718067280673806748067580676806778067880679806808068180682806838068480685806868068780688806898069080691806928069380694806958069680697806988069980700807018070280703807048070580706807078070880709807108071180712807138071480715807168071780718807198072080721807228072380724807258072680727807288072980730807318073280733807348073580736807378073880739807408074180742807438074480745807468074780748807498075080751807528075380754807558075680757807588075980760807618076280763807648076580766807678076880769807708077180772807738077480775807768077780778807798078080781807828078380784807858078680787807888078980790807918079280793807948079580796807978079880799808008080180802808038080480805808068080780808808098081080811808128081380814808158081680817808188081980820808218082280823808248082580826808278082880829808308083180832808338083480835808368083780838808398084080841808428084380844808458084680847808488084980850808518085280853808548085580856808578085880859808608086180862808638086480865808668086780868808698087080871808728087380874808758087680877808788087980880808818088280883808848088580886808878088880889808908089180892808938089480895808968089780898808998090080901809028090380904809058090680907809088090980910809118091280913809148091580916809178091880919809208092180922809238092480925809268092780928809298093080931809328093380934809358093680937809388093980940809418094280943809448094580946809478094880949809508095180952809538095480955809568095780958809598096080961809628096380964809658096680967809688096980970809718097280973809748097580976809778097880979809808098180982809838098480985809868098780988809898099080991809928099380994809958099680997809988099981000810018100281003810048100581006810078100881009810108101181012810138101481015810168101781018810198102081021810228102381024810258102681027810288102981030810318103281033810348103581036810378103881039810408104181042810438104481045810468104781048810498105081051810528105381054810558105681057810588105981060810618106281063810648106581066810678106881069810708107181072810738107481075810768107781078810798108081081810828108381084810858108681087810888108981090810918109281093810948109581096810978109881099811008110181102811038110481105811068110781108811098111081111811128111381114811158111681117811188111981120811218112281123811248112581126811278112881129811308113181132811338113481135811368113781138811398114081141811428114381144811458114681147811488114981150811518115281153811548115581156811578115881159811608116181162811638116481165811668116781168811698117081171811728117381174811758117681177811788117981180811818118281183811848118581186811878118881189811908119181192811938119481195811968119781198811998120081201812028120381204812058120681207812088120981210812118121281213812148121581216812178121881219812208122181222812238122481225812268122781228812298123081231812328123381234812358123681237812388123981240812418124281243812448124581246812478124881249812508125181252812538125481255812568125781258812598126081261812628126381264812658126681267812688126981270812718127281273812748127581276812778127881279812808128181282812838128481285812868128781288812898129081291812928129381294812958129681297812988129981300813018130281303813048130581306813078130881309813108131181312813138131481315813168131781318813198132081321813228132381324813258132681327813288132981330813318133281333813348133581336813378133881339813408134181342813438134481345813468134781348813498135081351813528135381354813558135681357813588135981360813618136281363813648136581366813678136881369813708137181372813738137481375813768137781378813798138081381813828138381384813858138681387813888138981390813918139281393813948139581396813978139881399814008140181402814038140481405814068140781408814098141081411814128141381414814158141681417814188141981420814218142281423814248142581426814278142881429814308143181432814338143481435814368143781438814398144081441814428144381444814458144681447814488144981450814518145281453814548145581456814578145881459814608146181462814638146481465814668146781468814698147081471814728147381474814758147681477814788147981480814818148281483814848148581486814878148881489814908149181492814938149481495814968149781498814998150081501815028150381504815058150681507815088150981510815118151281513815148151581516815178151881519815208152181522815238152481525815268152781528815298153081531815328153381534815358153681537815388153981540815418154281543815448154581546815478154881549815508155181552815538155481555815568155781558815598156081561815628156381564815658156681567815688156981570815718157281573815748157581576815778157881579815808158181582815838158481585815868158781588815898159081591815928159381594815958159681597815988159981600816018160281603816048160581606816078160881609816108161181612816138161481615816168161781618816198162081621816228162381624816258162681627816288162981630816318163281633816348163581636816378163881639816408164181642816438164481645816468164781648816498165081651816528165381654816558165681657816588165981660816618166281663816648166581666816678166881669816708167181672816738167481675816768167781678816798168081681816828168381684816858168681687816888168981690816918169281693816948169581696816978169881699817008170181702817038170481705817068170781708817098171081711817128171381714817158171681717817188171981720817218172281723817248172581726817278172881729817308173181732817338173481735817368173781738817398174081741817428174381744817458174681747817488174981750817518175281753817548175581756817578175881759817608176181762817638176481765817668176781768817698177081771817728177381774817758177681777817788177981780817818178281783817848178581786817878178881789817908179181792817938179481795817968179781798817998180081801818028180381804818058180681807818088180981810818118181281813818148181581816818178181881819818208182181822818238182481825818268182781828818298183081831818328183381834818358183681837818388183981840818418184281843818448184581846818478184881849818508185181852818538185481855818568185781858818598186081861818628186381864818658186681867818688186981870818718187281873818748187581876818778187881879818808188181882818838188481885818868188781888818898189081891818928189381894818958189681897818988189981900819018190281903819048190581906819078190881909819108191181912819138191481915819168191781918819198192081921819228192381924819258192681927819288192981930819318193281933819348193581936819378193881939819408194181942819438194481945819468194781948819498195081951819528195381954819558195681957819588195981960819618196281963819648196581966819678196881969819708197181972819738197481975819768197781978819798198081981819828198381984819858198681987819888198981990819918199281993819948199581996819978199881999820008200182002820038200482005820068200782008820098201082011820128201382014820158201682017820188201982020820218202282023820248202582026820278202882029820308203182032820338203482035820368203782038820398204082041820428204382044820458204682047820488204982050820518205282053820548205582056820578205882059820608206182062820638206482065820668206782068820698207082071820728207382074820758207682077820788207982080820818208282083820848208582086820878208882089820908209182092820938209482095820968209782098820998210082101821028210382104821058210682107821088210982110821118211282113821148211582116821178211882119821208212182122821238212482125821268212782128821298213082131821328213382134821358213682137821388213982140821418214282143821448214582146821478214882149821508215182152821538215482155821568215782158821598216082161821628216382164821658216682167821688216982170821718217282173821748217582176821778217882179821808218182182821838218482185821868218782188821898219082191821928219382194821958219682197821988219982200822018220282203822048220582206822078220882209822108221182212822138221482215822168221782218822198222082221822228222382224822258222682227822288222982230822318223282233822348223582236822378223882239822408224182242822438224482245822468224782248822498225082251822528225382254822558225682257822588225982260822618226282263822648226582266822678226882269822708227182272822738227482275822768227782278822798228082281822828228382284822858228682287822888228982290822918229282293822948229582296822978229882299823008230182302823038230482305823068230782308823098231082311823128231382314823158231682317823188231982320823218232282323823248232582326823278232882329823308233182332823338233482335823368233782338823398234082341823428234382344823458234682347823488234982350823518235282353823548235582356823578235882359823608236182362823638236482365823668236782368823698237082371823728237382374823758237682377823788237982380823818238282383823848238582386823878238882389823908239182392823938239482395823968239782398823998240082401824028240382404824058240682407824088240982410824118241282413824148241582416824178241882419824208242182422824238242482425824268242782428824298243082431824328243382434824358243682437824388243982440824418244282443824448244582446824478244882449824508245182452824538245482455824568245782458824598246082461824628246382464824658246682467824688246982470824718247282473824748247582476824778247882479824808248182482824838248482485824868248782488824898249082491824928249382494824958249682497824988249982500825018250282503825048250582506825078250882509825108251182512825138251482515825168251782518825198252082521825228252382524825258252682527825288252982530825318253282533825348253582536825378253882539825408254182542825438254482545825468254782548825498255082551825528255382554825558255682557825588255982560825618256282563825648256582566825678256882569825708257182572825738257482575825768257782578825798258082581825828258382584825858258682587825888258982590825918259282593825948259582596825978259882599826008260182602826038260482605826068260782608826098261082611826128261382614826158261682617826188261982620826218262282623826248262582626826278262882629826308263182632826338263482635826368263782638826398264082641826428264382644826458264682647826488264982650826518265282653826548265582656826578265882659826608266182662826638266482665826668266782668826698267082671826728267382674826758267682677826788267982680826818268282683826848268582686826878268882689826908269182692826938269482695826968269782698826998270082701827028270382704827058270682707827088270982710827118271282713827148271582716827178271882719827208272182722827238272482725827268272782728827298273082731827328273382734827358273682737827388273982740827418274282743827448274582746827478274882749827508275182752827538275482755827568275782758827598276082761827628276382764827658276682767827688276982770827718277282773827748277582776827778277882779827808278182782827838278482785827868278782788827898279082791827928279382794827958279682797827988279982800828018280282803828048280582806828078280882809828108281182812828138281482815828168281782818828198282082821828228282382824828258282682827828288282982830828318283282833828348283582836828378283882839828408284182842828438284482845828468284782848828498285082851828528285382854828558285682857828588285982860828618286282863828648286582866828678286882869828708287182872828738287482875828768287782878828798288082881828828288382884828858288682887828888288982890828918289282893828948289582896828978289882899829008290182902829038290482905829068290782908829098291082911829128291382914829158291682917829188291982920829218292282923829248292582926829278292882929829308293182932829338293482935829368293782938829398294082941829428294382944829458294682947829488294982950829518295282953829548295582956829578295882959829608296182962829638296482965829668296782968829698297082971829728297382974829758297682977829788297982980829818298282983829848298582986829878298882989829908299182992829938299482995829968299782998829998300083001830028300383004830058300683007830088300983010830118301283013830148301583016830178301883019830208302183022830238302483025830268302783028830298303083031830328303383034830358303683037830388303983040830418304283043830448304583046830478304883049830508305183052830538305483055830568305783058830598306083061830628306383064830658306683067830688306983070830718307283073830748307583076830778307883079830808308183082830838308483085830868308783088830898309083091830928309383094830958309683097830988309983100831018310283103831048310583106831078310883109831108311183112831138311483115831168311783118831198312083121831228312383124831258312683127831288312983130831318313283133831348313583136831378313883139831408314183142831438314483145831468314783148831498315083151831528315383154831558315683157831588315983160831618316283163831648316583166831678316883169831708317183172831738317483175831768317783178831798318083181831828318383184831858318683187831888318983190831918319283193831948319583196831978319883199832008320183202832038320483205832068320783208832098321083211832128321383214832158321683217832188321983220832218322283223832248322583226832278322883229832308323183232832338323483235832368323783238832398324083241832428324383244832458324683247832488324983250832518325283253832548325583256832578325883259832608326183262832638326483265832668326783268832698327083271832728327383274832758327683277832788327983280832818328283283832848328583286832878328883289832908329183292832938329483295832968329783298832998330083301833028330383304833058330683307833088330983310833118331283313833148331583316833178331883319833208332183322833238332483325833268332783328833298333083331833328333383334833358333683337833388333983340833418334283343833448334583346833478334883349833508335183352833538335483355833568335783358833598336083361833628336383364833658336683367833688336983370833718337283373833748337583376833778337883379833808338183382833838338483385833868338783388833898339083391833928339383394833958339683397833988339983400834018340283403834048340583406834078340883409834108341183412834138341483415834168341783418834198342083421834228342383424834258342683427834288342983430834318343283433834348343583436834378343883439834408344183442834438344483445834468344783448834498345083451834528345383454834558345683457834588345983460834618346283463834648346583466834678346883469834708347183472834738347483475834768347783478834798348083481834828348383484834858348683487834888348983490834918349283493834948349583496834978349883499835008350183502835038350483505835068350783508835098351083511835128351383514835158351683517835188351983520835218352283523835248352583526835278352883529835308353183532835338353483535835368353783538835398354083541835428354383544835458354683547835488354983550835518355283553835548355583556835578355883559835608356183562835638356483565835668356783568835698357083571835728357383574835758357683577835788357983580835818358283583835848358583586835878358883589835908359183592835938359483595835968359783598835998360083601836028360383604836058360683607836088360983610836118361283613836148361583616836178361883619836208362183622836238362483625836268362783628836298363083631836328363383634836358363683637836388363983640836418364283643836448364583646836478364883649836508365183652836538365483655836568365783658836598366083661836628366383664836658366683667836688366983670836718367283673836748367583676836778367883679836808368183682836838368483685836868368783688836898369083691836928369383694836958369683697836988369983700837018370283703837048370583706837078370883709837108371183712837138371483715837168371783718837198372083721837228372383724837258372683727837288372983730837318373283733837348373583736837378373883739837408374183742837438374483745837468374783748837498375083751837528375383754837558375683757837588375983760837618376283763837648376583766837678376883769837708377183772837738377483775837768377783778837798378083781837828378383784837858378683787837888378983790837918379283793837948379583796837978379883799838008380183802838038380483805838068380783808838098381083811838128381383814838158381683817838188381983820838218382283823838248382583826838278382883829838308383183832838338383483835838368383783838838398384083841838428384383844838458384683847838488384983850838518385283853838548385583856838578385883859838608386183862838638386483865838668386783868838698387083871838728387383874838758387683877838788387983880838818388283883838848388583886838878388883889838908389183892838938389483895838968389783898838998390083901839028390383904839058390683907839088390983910839118391283913839148391583916839178391883919839208392183922839238392483925839268392783928839298393083931839328393383934839358393683937839388393983940839418394283943839448394583946839478394883949839508395183952839538395483955839568395783958839598396083961839628396383964839658396683967839688396983970839718397283973839748397583976839778397883979839808398183982839838398483985839868398783988839898399083991839928399383994839958399683997839988399984000840018400284003840048400584006840078400884009840108401184012840138401484015840168401784018840198402084021840228402384024840258402684027840288402984030840318403284033840348403584036840378403884039840408404184042840438404484045840468404784048840498405084051840528405384054840558405684057840588405984060840618406284063840648406584066840678406884069840708407184072840738407484075840768407784078840798408084081840828408384084840858408684087840888408984090840918409284093840948409584096840978409884099841008410184102841038410484105841068410784108841098411084111841128411384114841158411684117841188411984120841218412284123841248412584126841278412884129841308413184132841338413484135841368413784138841398414084141841428414384144841458414684147841488414984150841518415284153841548415584156841578415884159841608416184162841638416484165841668416784168841698417084171841728417384174841758417684177841788417984180841818418284183841848418584186841878418884189841908419184192841938419484195841968419784198841998420084201842028420384204842058420684207842088420984210842118421284213842148421584216842178421884219842208422184222842238422484225842268422784228842298423084231842328423384234842358423684237842388423984240842418424284243842448424584246842478424884249842508425184252842538425484255842568425784258842598426084261842628426384264842658426684267842688426984270842718427284273842748427584276842778427884279842808428184282842838428484285842868428784288842898429084291842928429384294842958429684297842988429984300843018430284303843048430584306843078430884309843108431184312843138431484315843168431784318843198432084321843228432384324843258432684327843288432984330843318433284333843348433584336843378433884339843408434184342843438434484345843468434784348843498435084351843528435384354843558435684357843588435984360843618436284363843648436584366843678436884369843708437184372843738437484375843768437784378843798438084381843828438384384843858438684387843888438984390843918439284393843948439584396843978439884399844008440184402844038440484405844068440784408844098441084411844128441384414844158441684417844188441984420844218442284423844248442584426844278442884429844308443184432844338443484435844368443784438844398444084441844428444384444844458444684447844488444984450844518445284453844548445584456844578445884459844608446184462844638446484465844668446784468844698447084471844728447384474844758447684477844788447984480844818448284483844848448584486844878448884489844908449184492844938449484495844968449784498844998450084501845028450384504845058450684507845088450984510845118451284513845148451584516845178451884519845208452184522845238452484525845268452784528845298453084531845328453384534845358453684537845388453984540845418454284543845448454584546845478454884549845508455184552845538455484555845568455784558845598456084561845628456384564845658456684567845688456984570845718457284573845748457584576845778457884579845808458184582845838458484585845868458784588845898459084591845928459384594845958459684597845988459984600846018460284603846048460584606846078460884609846108461184612846138461484615846168461784618846198462084621846228462384624846258462684627846288462984630846318463284633846348463584636846378463884639846408464184642846438464484645846468464784648846498465084651846528465384654846558465684657846588465984660846618466284663846648466584666846678466884669846708467184672846738467484675846768467784678846798468084681846828468384684846858468684687846888468984690846918469284693846948469584696846978469884699847008470184702847038470484705847068470784708847098471084711847128471384714847158471684717847188471984720847218472284723847248472584726847278472884729847308473184732847338473484735847368473784738847398474084741847428474384744847458474684747847488474984750847518475284753847548475584756847578475884759847608476184762847638476484765847668476784768847698477084771847728477384774847758477684777847788477984780847818478284783847848478584786847878478884789847908479184792847938479484795847968479784798847998480084801848028480384804848058480684807848088480984810848118481284813848148481584816848178481884819848208482184822848238482484825848268482784828848298483084831848328483384834848358483684837848388483984840848418484284843848448484584846848478484884849848508485184852848538485484855848568485784858848598486084861848628486384864848658486684867848688486984870848718487284873848748487584876848778487884879848808488184882848838488484885848868488784888848898489084891848928489384894848958489684897848988489984900849018490284903849048490584906849078490884909849108491184912849138491484915849168491784918849198492084921849228492384924849258492684927849288492984930849318493284933849348493584936849378493884939849408494184942849438494484945849468494784948849498495084951849528495384954849558495684957849588495984960849618496284963849648496584966849678496884969849708497184972849738497484975849768497784978849798498084981849828498384984849858498684987849888498984990849918499284993849948499584996849978499884999850008500185002850038500485005850068500785008850098501085011850128501385014850158501685017850188501985020850218502285023850248502585026850278502885029850308503185032850338503485035850368503785038850398504085041850428504385044850458504685047850488504985050850518505285053850548505585056850578505885059850608506185062850638506485065850668506785068850698507085071850728507385074850758507685077850788507985080850818508285083850848508585086850878508885089850908509185092850938509485095850968509785098850998510085101851028510385104851058510685107851088510985110851118511285113851148511585116851178511885119851208512185122851238512485125851268512785128851298513085131851328513385134851358513685137851388513985140851418514285143851448514585146851478514885149851508515185152851538515485155851568515785158851598516085161851628516385164851658516685167851688516985170851718517285173851748517585176851778517885179851808518185182851838518485185851868518785188851898519085191851928519385194851958519685197851988519985200852018520285203852048520585206852078520885209852108521185212852138521485215852168521785218852198522085221852228522385224852258522685227852288522985230852318523285233852348523585236852378523885239852408524185242852438524485245852468524785248852498525085251852528525385254852558525685257852588525985260852618526285263852648526585266852678526885269852708527185272852738527485275852768527785278852798528085281852828528385284852858528685287852888528985290852918529285293852948529585296852978529885299853008530185302853038530485305853068530785308853098531085311853128531385314853158531685317853188531985320853218532285323853248532585326853278532885329853308533185332853338533485335853368533785338853398534085341853428534385344853458534685347853488534985350853518535285353853548535585356853578535885359853608536185362853638536485365853668536785368853698537085371853728537385374853758537685377853788537985380853818538285383853848538585386853878538885389853908539185392853938539485395853968539785398853998540085401854028540385404854058540685407854088540985410854118541285413854148541585416854178541885419854208542185422854238542485425854268542785428854298543085431854328543385434854358543685437854388543985440854418544285443854448544585446854478544885449854508545185452854538545485455854568545785458854598546085461854628546385464854658546685467854688546985470854718547285473854748547585476854778547885479854808548185482854838548485485854868548785488854898549085491854928549385494854958549685497854988549985500855018550285503855048550585506855078550885509855108551185512855138551485515855168551785518855198552085521855228552385524855258552685527855288552985530855318553285533855348553585536855378553885539855408554185542855438554485545855468554785548855498555085551855528555385554855558555685557855588555985560855618556285563855648556585566855678556885569855708557185572855738557485575855768557785578855798558085581855828558385584855858558685587855888558985590855918559285593855948559585596855978559885599856008560185602856038560485605856068560785608856098561085611856128561385614856158561685617856188561985620856218562285623856248562585626856278562885629856308563185632856338563485635856368563785638856398564085641856428564385644856458564685647856488564985650856518565285653856548565585656856578565885659856608566185662856638566485665856668566785668856698567085671856728567385674856758567685677856788567985680856818568285683856848568585686856878568885689856908569185692856938569485695856968569785698856998570085701857028570385704857058570685707857088570985710857118571285713857148571585716857178571885719857208572185722857238572485725857268572785728857298573085731857328573385734857358573685737857388573985740857418574285743857448574585746857478574885749857508575185752857538575485755857568575785758857598576085761857628576385764857658576685767857688576985770857718577285773857748577585776857778577885779857808578185782857838578485785857868578785788857898579085791857928579385794857958579685797857988579985800858018580285803858048580585806858078580885809858108581185812858138581485815858168581785818858198582085821858228582385824858258582685827858288582985830858318583285833858348583585836858378583885839858408584185842858438584485845858468584785848858498585085851858528585385854858558585685857858588585985860858618586285863858648586585866858678586885869858708587185872858738587485875858768587785878858798588085881858828588385884858858588685887858888588985890858918589285893858948589585896858978589885899859008590185902859038590485905859068590785908859098591085911859128591385914859158591685917859188591985920859218592285923859248592585926859278592885929859308593185932859338593485935859368593785938859398594085941859428594385944859458594685947859488594985950859518595285953859548595585956859578595885959859608596185962859638596485965859668596785968859698597085971859728597385974859758597685977859788597985980859818598285983859848598585986859878598885989859908599185992859938599485995859968599785998859998600086001860028600386004860058600686007860088600986010860118601286013860148601586016860178601886019860208602186022860238602486025860268602786028860298603086031860328603386034860358603686037860388603986040860418604286043860448604586046860478604886049860508605186052860538605486055860568605786058860598606086061860628606386064860658606686067860688606986070860718607286073860748607586076860778607886079860808608186082860838608486085860868608786088860898609086091860928609386094860958609686097860988609986100861018610286103861048610586106861078610886109861108611186112861138611486115861168611786118861198612086121861228612386124861258612686127861288612986130861318613286133861348613586136861378613886139861408614186142861438614486145861468614786148861498615086151861528615386154861558615686157861588615986160861618616286163861648616586166861678616886169861708617186172861738617486175861768617786178861798618086181861828618386184861858618686187861888618986190861918619286193861948619586196861978619886199862008620186202862038620486205862068620786208862098621086211862128621386214862158621686217862188621986220862218622286223862248622586226862278622886229862308623186232862338623486235862368623786238862398624086241862428624386244862458624686247862488624986250862518625286253862548625586256862578625886259862608626186262862638626486265862668626786268862698627086271862728627386274862758627686277862788627986280862818628286283862848628586286862878628886289862908629186292862938629486295862968629786298862998630086301863028630386304863058630686307863088630986310863118631286313863148631586316863178631886319863208632186322863238632486325863268632786328863298633086331863328633386334863358633686337863388633986340863418634286343863448634586346863478634886349863508635186352863538635486355863568635786358863598636086361863628636386364863658636686367863688636986370863718637286373863748637586376863778637886379863808638186382863838638486385863868638786388863898639086391863928639386394863958639686397863988639986400864018640286403864048640586406864078640886409864108641186412864138641486415864168641786418864198642086421864228642386424864258642686427864288642986430864318643286433864348643586436864378643886439864408644186442864438644486445864468644786448864498645086451864528645386454864558645686457864588645986460864618646286463864648646586466864678646886469864708647186472864738647486475864768647786478864798648086481864828648386484864858648686487864888648986490864918649286493864948649586496864978649886499865008650186502865038650486505865068650786508865098651086511865128651386514865158651686517865188651986520865218652286523865248652586526865278652886529865308653186532865338653486535865368653786538865398654086541865428654386544865458654686547865488654986550865518655286553865548655586556865578655886559865608656186562865638656486565865668656786568865698657086571865728657386574865758657686577865788657986580865818658286583865848658586586865878658886589865908659186592865938659486595865968659786598865998660086601866028660386604866058660686607866088660986610866118661286613866148661586616866178661886619866208662186622866238662486625866268662786628866298663086631866328663386634866358663686637866388663986640866418664286643866448664586646866478664886649866508665186652866538665486655866568665786658866598666086661866628666386664866658666686667866688666986670866718667286673866748667586676866778667886679866808668186682866838668486685866868668786688866898669086691866928669386694866958669686697866988669986700867018670286703867048670586706867078670886709867108671186712867138671486715867168671786718867198672086721867228672386724867258672686727867288672986730867318673286733867348673586736867378673886739867408674186742867438674486745867468674786748867498675086751867528675386754867558675686757867588675986760867618676286763867648676586766867678676886769867708677186772867738677486775867768677786778867798678086781867828678386784867858678686787867888678986790867918679286793867948679586796867978679886799868008680186802868038680486805868068680786808868098681086811868128681386814868158681686817868188681986820868218682286823868248682586826868278682886829868308683186832868338683486835868368683786838868398684086841868428684386844868458684686847868488684986850868518685286853868548685586856868578685886859868608686186862868638686486865868668686786868868698687086871868728687386874868758687686877868788687986880868818688286883868848688586886868878688886889868908689186892868938689486895868968689786898868998690086901869028690386904869058690686907869088690986910869118691286913869148691586916869178691886919869208692186922869238692486925869268692786928869298693086931869328693386934869358693686937869388693986940869418694286943869448694586946869478694886949869508695186952869538695486955869568695786958869598696086961869628696386964869658696686967869688696986970869718697286973869748697586976869778697886979869808698186982869838698486985869868698786988869898699086991869928699386994869958699686997869988699987000870018700287003870048700587006870078700887009870108701187012870138701487015870168701787018870198702087021870228702387024870258702687027870288702987030870318703287033870348703587036870378703887039870408704187042870438704487045870468704787048870498705087051870528705387054870558705687057870588705987060870618706287063870648706587066870678706887069870708707187072870738707487075870768707787078870798708087081870828708387084870858708687087870888708987090870918709287093870948709587096870978709887099871008710187102871038710487105871068710787108871098711087111871128711387114871158711687117871188711987120871218712287123871248712587126871278712887129871308713187132871338713487135871368713787138871398714087141871428714387144871458714687147871488714987150871518715287153871548715587156871578715887159871608716187162871638716487165871668716787168871698717087171871728717387174871758717687177871788717987180871818718287183871848718587186871878718887189871908719187192871938719487195871968719787198871998720087201872028720387204872058720687207872088720987210872118721287213872148721587216872178721887219872208722187222872238722487225872268722787228872298723087231872328723387234872358723687237872388723987240872418724287243872448724587246872478724887249872508725187252872538725487255872568725787258872598726087261872628726387264872658726687267872688726987270872718727287273872748727587276872778727887279872808728187282872838728487285872868728787288872898729087291872928729387294872958729687297872988729987300873018730287303873048730587306873078730887309873108731187312873138731487315873168731787318873198732087321873228732387324873258732687327873288732987330873318733287333873348733587336873378733887339873408734187342873438734487345873468734787348873498735087351873528735387354873558735687357873588735987360873618736287363873648736587366873678736887369873708737187372873738737487375873768737787378873798738087381873828738387384873858738687387873888738987390873918739287393873948739587396873978739887399874008740187402874038740487405874068740787408874098741087411874128741387414874158741687417874188741987420874218742287423874248742587426874278742887429874308743187432874338743487435874368743787438874398744087441874428744387444874458744687447874488744987450874518745287453874548745587456874578745887459874608746187462874638746487465874668746787468874698747087471874728747387474874758747687477874788747987480874818748287483874848748587486874878748887489874908749187492874938749487495874968749787498874998750087501875028750387504875058750687507875088750987510875118751287513875148751587516875178751887519875208752187522875238752487525875268752787528875298753087531875328753387534875358753687537875388753987540875418754287543875448754587546875478754887549875508755187552875538755487555875568755787558875598756087561875628756387564875658756687567875688756987570875718757287573875748757587576875778757887579875808758187582875838758487585875868758787588875898759087591875928759387594875958759687597875988759987600876018760287603876048760587606876078760887609876108761187612876138761487615876168761787618876198762087621876228762387624876258762687627876288762987630876318763287633876348763587636876378763887639876408764187642876438764487645876468764787648876498765087651876528765387654876558765687657876588765987660876618766287663876648766587666876678766887669876708767187672876738767487675876768767787678876798768087681876828768387684876858768687687876888768987690876918769287693876948769587696876978769887699877008770187702877038770487705877068770787708877098771087711877128771387714877158771687717877188771987720877218772287723877248772587726877278772887729877308773187732877338773487735877368773787738877398774087741877428774387744877458774687747877488774987750877518775287753877548775587756877578775887759877608776187762877638776487765877668776787768877698777087771877728777387774877758777687777877788777987780877818778287783877848778587786877878778887789877908779187792877938779487795877968779787798877998780087801878028780387804878058780687807878088780987810878118781287813878148781587816878178781887819878208782187822878238782487825878268782787828878298783087831878328783387834878358783687837878388783987840878418784287843878448784587846878478784887849878508785187852878538785487855878568785787858878598786087861878628786387864878658786687867878688786987870878718787287873878748787587876878778787887879878808788187882878838788487885878868788787888878898789087891878928789387894878958789687897878988789987900879018790287903879048790587906879078790887909879108791187912879138791487915879168791787918879198792087921879228792387924879258792687927879288792987930879318793287933879348793587936879378793887939879408794187942879438794487945879468794787948879498795087951879528795387954879558795687957879588795987960879618796287963879648796587966879678796887969879708797187972879738797487975879768797787978879798798087981879828798387984879858798687987879888798987990879918799287993879948799587996879978799887999880008800188002880038800488005880068800788008880098801088011880128801388014880158801688017880188801988020880218802288023880248802588026880278802888029880308803188032880338803488035880368803788038880398804088041880428804388044880458804688047880488804988050880518805288053880548805588056880578805888059880608806188062880638806488065880668806788068880698807088071880728807388074880758807688077880788807988080880818808288083880848808588086880878808888089880908809188092880938809488095880968809788098880998810088101881028810388104881058810688107881088810988110881118811288113881148811588116881178811888119881208812188122881238812488125881268812788128881298813088131881328813388134881358813688137881388813988140881418814288143881448814588146881478814888149881508815188152881538815488155881568815788158881598816088161881628816388164881658816688167881688816988170881718817288173881748817588176881778817888179881808818188182881838818488185881868818788188881898819088191881928819388194881958819688197881988819988200882018820288203882048820588206882078820888209882108821188212882138821488215882168821788218882198822088221882228822388224882258822688227882288822988230882318823288233882348823588236882378823888239882408824188242882438824488245882468824788248882498825088251882528825388254882558825688257882588825988260882618826288263882648826588266882678826888269882708827188272882738827488275882768827788278882798828088281882828828388284882858828688287882888828988290882918829288293882948829588296882978829888299883008830188302883038830488305883068830788308883098831088311883128831388314883158831688317883188831988320883218832288323883248832588326883278832888329883308833188332883338833488335883368833788338883398834088341883428834388344883458834688347883488834988350883518835288353883548835588356883578835888359883608836188362883638836488365883668836788368883698837088371883728837388374883758837688377883788837988380883818838288383883848838588386883878838888389883908839188392883938839488395883968839788398883998840088401884028840388404884058840688407884088840988410884118841288413884148841588416884178841888419884208842188422884238842488425884268842788428884298843088431884328843388434884358843688437884388843988440884418844288443884448844588446884478844888449884508845188452884538845488455884568845788458884598846088461884628846388464884658846688467884688846988470884718847288473884748847588476884778847888479884808848188482884838848488485884868848788488884898849088491884928849388494884958849688497884988849988500885018850288503885048850588506885078850888509885108851188512885138851488515885168851788518885198852088521885228852388524885258852688527885288852988530885318853288533885348853588536885378853888539885408854188542885438854488545885468854788548885498855088551885528855388554885558855688557885588855988560885618856288563885648856588566885678856888569885708857188572885738857488575885768857788578885798858088581885828858388584885858858688587885888858988590885918859288593885948859588596885978859888599886008860188602886038860488605886068860788608886098861088611886128861388614886158861688617886188861988620886218862288623886248862588626886278862888629886308863188632886338863488635886368863788638886398864088641886428864388644886458864688647886488864988650886518865288653886548865588656886578865888659886608866188662886638866488665886668866788668886698867088671886728867388674886758867688677886788867988680886818868288683886848868588686886878868888689886908869188692886938869488695886968869788698886998870088701887028870388704887058870688707887088870988710887118871288713887148871588716887178871888719887208872188722887238872488725887268872788728887298873088731887328873388734887358873688737887388873988740887418874288743887448874588746887478874888749887508875188752887538875488755887568875788758887598876088761887628876388764887658876688767887688876988770887718877288773887748877588776887778877888779887808878188782887838878488785887868878788788887898879088791887928879388794887958879688797887988879988800888018880288803888048880588806888078880888809888108881188812888138881488815888168881788818888198882088821888228882388824888258882688827888288882988830888318883288833888348883588836888378883888839888408884188842888438884488845888468884788848888498885088851888528885388854888558885688857888588885988860888618886288863888648886588866888678886888869888708887188872888738887488875888768887788878888798888088881888828888388884888858888688887888888888988890888918889288893888948889588896888978889888899889008890188902889038890488905889068890788908889098891088911889128891388914889158891688917889188891988920889218892288923889248892588926889278892888929889308893188932889338893488935889368893788938889398894088941889428894388944889458894688947889488894988950889518895288953889548895588956889578895888959889608896188962889638896488965889668896788968889698897088971889728897388974889758897688977889788897988980889818898288983889848898588986889878898888989889908899188992889938899488995889968899788998889998900089001890028900389004890058900689007890088900989010890118901289013890148901589016890178901889019890208902189022890238902489025890268902789028890298903089031890328903389034890358903689037890388903989040890418904289043890448904589046890478904889049890508905189052890538905489055890568905789058890598906089061890628906389064890658906689067890688906989070890718907289073890748907589076890778907889079890808908189082890838908489085890868908789088890898909089091890928909389094890958909689097890988909989100891018910289103891048910589106891078910889109891108911189112891138911489115891168911789118891198912089121891228912389124891258912689127891288912989130891318913289133891348913589136891378913889139891408914189142891438914489145891468914789148891498915089151891528915389154891558915689157891588915989160891618916289163891648916589166891678916889169891708917189172891738917489175891768917789178891798918089181891828918389184891858918689187891888918989190891918919289193891948919589196891978919889199892008920189202892038920489205892068920789208892098921089211892128921389214892158921689217892188921989220892218922289223892248922589226892278922889229892308923189232892338923489235892368923789238892398924089241892428924389244892458924689247892488924989250892518925289253892548925589256892578925889259892608926189262892638926489265892668926789268892698927089271892728927389274892758927689277892788927989280892818928289283892848928589286892878928889289892908929189292892938929489295892968929789298892998930089301893028930389304893058930689307893088930989310893118931289313893148931589316893178931889319893208932189322893238932489325893268932789328893298933089331893328933389334893358933689337893388933989340893418934289343893448934589346893478934889349893508935189352893538935489355893568935789358893598936089361893628936389364893658936689367893688936989370893718937289373893748937589376893778937889379893808938189382893838938489385893868938789388893898939089391893928939389394893958939689397893988939989400894018940289403894048940589406894078940889409894108941189412894138941489415894168941789418894198942089421894228942389424894258942689427894288942989430894318943289433894348943589436894378943889439894408944189442894438944489445894468944789448894498945089451894528945389454894558945689457894588945989460894618946289463894648946589466894678946889469894708947189472894738947489475894768947789478894798948089481894828948389484894858948689487894888948989490894918949289493894948949589496894978949889499895008950189502895038950489505895068950789508895098951089511895128951389514895158951689517895188951989520895218952289523895248952589526895278952889529895308953189532895338953489535895368953789538895398954089541895428954389544895458954689547895488954989550895518955289553895548955589556895578955889559895608956189562895638956489565895668956789568895698957089571895728957389574895758957689577895788957989580895818958289583895848958589586895878958889589895908959189592895938959489595895968959789598895998960089601896028960389604896058960689607896088960989610896118961289613896148961589616896178961889619896208962189622896238962489625896268962789628896298963089631896328963389634896358963689637896388963989640896418964289643896448964589646896478964889649896508965189652896538965489655896568965789658896598966089661896628966389664896658966689667896688966989670896718967289673896748967589676896778967889679896808968189682896838968489685896868968789688896898969089691896928969389694896958969689697896988969989700897018970289703897048970589706897078970889709897108971189712897138971489715897168971789718897198972089721897228972389724897258972689727897288972989730897318973289733897348973589736897378973889739897408974189742897438974489745897468974789748897498975089751897528975389754897558975689757897588975989760897618976289763897648976589766897678976889769897708977189772897738977489775897768977789778897798978089781897828978389784897858978689787897888978989790897918979289793897948979589796897978979889799898008980189802898038980489805898068980789808898098981089811898128981389814898158981689817898188981989820898218982289823898248982589826898278982889829898308983189832898338983489835898368983789838898398984089841898428984389844898458984689847898488984989850898518985289853898548985589856898578985889859898608986189862898638986489865898668986789868898698987089871898728987389874898758987689877898788987989880898818988289883898848988589886898878988889889898908989189892898938989489895898968989789898898998990089901899028990389904899058990689907899088990989910899118991289913899148991589916899178991889919899208992189922899238992489925899268992789928899298993089931899328993389934899358993689937899388993989940899418994289943899448994589946899478994889949899508995189952899538995489955899568995789958899598996089961899628996389964899658996689967899688996989970899718997289973899748997589976899778997889979899808998189982899838998489985899868998789988899898999089991899928999389994899958999689997899988999990000900019000290003900049000590006900079000890009900109001190012900139001490015900169001790018900199002090021900229002390024900259002690027900289002990030900319003290033900349003590036900379003890039900409004190042900439004490045900469004790048900499005090051900529005390054900559005690057900589005990060900619006290063900649006590066900679006890069900709007190072900739007490075900769007790078900799008090081900829008390084900859008690087900889008990090900919009290093900949009590096900979009890099901009010190102901039010490105901069010790108901099011090111901129011390114901159011690117901189011990120901219012290123901249012590126901279012890129901309013190132901339013490135901369013790138901399014090141901429014390144901459014690147901489014990150901519015290153901549015590156901579015890159901609016190162901639016490165901669016790168901699017090171901729017390174901759017690177901789017990180901819018290183901849018590186901879018890189901909019190192901939019490195901969019790198901999020090201902029020390204902059020690207902089020990210902119021290213902149021590216902179021890219902209022190222902239022490225902269022790228902299023090231902329023390234902359023690237902389023990240902419024290243902449024590246902479024890249902509025190252902539025490255902569025790258902599026090261902629026390264902659026690267902689026990270902719027290273902749027590276902779027890279902809028190282902839028490285902869028790288902899029090291902929029390294902959029690297902989029990300903019030290303903049030590306903079030890309903109031190312903139031490315903169031790318903199032090321903229032390324903259032690327903289032990330903319033290333903349033590336903379033890339903409034190342903439034490345903469034790348903499035090351903529035390354903559035690357903589035990360903619036290363903649036590366903679036890369903709037190372903739037490375903769037790378903799038090381903829038390384903859038690387903889038990390903919039290393903949039590396903979039890399904009040190402904039040490405904069040790408904099041090411904129041390414904159041690417904189041990420904219042290423904249042590426904279042890429904309043190432904339043490435904369043790438904399044090441904429044390444904459044690447904489044990450904519045290453904549045590456904579045890459904609046190462904639046490465904669046790468904699047090471904729047390474904759047690477904789047990480904819048290483904849048590486904879048890489904909049190492904939049490495904969049790498904999050090501905029050390504905059050690507905089050990510905119051290513905149051590516905179051890519905209052190522905239052490525905269052790528905299053090531905329053390534905359053690537905389053990540905419054290543905449054590546905479054890549905509055190552905539055490555905569055790558905599056090561905629056390564905659056690567905689056990570905719057290573905749057590576905779057890579905809058190582905839058490585905869058790588905899059090591905929059390594905959059690597905989059990600906019060290603906049060590606906079060890609906109061190612906139061490615906169061790618906199062090621906229062390624906259062690627906289062990630906319063290633906349063590636906379063890639906409064190642906439064490645906469064790648906499065090651906529065390654906559065690657906589065990660906619066290663906649066590666906679066890669906709067190672906739067490675906769067790678906799068090681906829068390684906859068690687906889068990690906919069290693906949069590696906979069890699907009070190702907039070490705907069070790708907099071090711907129071390714907159071690717907189071990720907219072290723907249072590726907279072890729907309073190732907339073490735907369073790738907399074090741907429074390744907459074690747907489074990750907519075290753907549075590756907579075890759907609076190762907639076490765907669076790768907699077090771907729077390774907759077690777907789077990780907819078290783907849078590786907879078890789907909079190792907939079490795907969079790798907999080090801908029080390804908059080690807908089080990810908119081290813908149081590816908179081890819908209082190822908239082490825908269082790828908299083090831908329083390834908359083690837908389083990840908419084290843908449084590846908479084890849908509085190852908539085490855908569085790858908599086090861908629086390864908659086690867908689086990870908719087290873908749087590876908779087890879908809088190882908839088490885908869088790888908899089090891908929089390894908959089690897908989089990900909019090290903909049090590906909079090890909909109091190912909139091490915909169091790918909199092090921909229092390924909259092690927909289092990930909319093290933909349093590936909379093890939909409094190942909439094490945909469094790948909499095090951909529095390954909559095690957909589095990960909619096290963909649096590966909679096890969909709097190972909739097490975909769097790978909799098090981909829098390984909859098690987909889098990990909919099290993909949099590996909979099890999910009100191002910039100491005910069100791008910099101091011910129101391014910159101691017910189101991020910219102291023910249102591026910279102891029910309103191032910339103491035910369103791038910399104091041910429104391044910459104691047910489104991050910519105291053910549105591056910579105891059910609106191062910639106491065910669106791068910699107091071910729107391074910759107691077910789107991080910819108291083910849108591086910879108891089910909109191092910939109491095910969109791098910999110091101911029110391104911059110691107911089110991110911119111291113911149111591116911179111891119911209112191122911239112491125911269112791128911299113091131911329113391134911359113691137911389113991140911419114291143911449114591146911479114891149911509115191152911539115491155911569115791158911599116091161911629116391164911659116691167911689116991170911719117291173911749117591176911779117891179911809118191182911839118491185911869118791188911899119091191911929119391194911959119691197911989119991200912019120291203912049120591206912079120891209912109121191212912139121491215912169121791218912199122091221912229122391224912259122691227912289122991230912319123291233912349123591236912379123891239912409124191242912439124491245912469124791248912499125091251912529125391254912559125691257912589125991260912619126291263912649126591266912679126891269912709127191272912739127491275912769127791278912799128091281912829128391284912859128691287912889128991290912919129291293912949129591296912979129891299913009130191302913039130491305913069130791308913099131091311913129131391314913159131691317913189131991320913219132291323913249132591326913279132891329913309133191332913339133491335913369133791338913399134091341913429134391344913459134691347913489134991350913519135291353913549135591356913579135891359913609136191362913639136491365913669136791368913699137091371913729137391374913759137691377913789137991380913819138291383913849138591386913879138891389913909139191392913939139491395913969139791398913999140091401914029140391404914059140691407914089140991410914119141291413914149141591416914179141891419914209142191422914239142491425914269142791428914299143091431914329143391434914359143691437914389143991440914419144291443914449144591446914479144891449914509145191452914539145491455914569145791458914599146091461914629146391464914659146691467914689146991470914719147291473914749147591476914779147891479914809148191482914839148491485914869148791488914899149091491914929149391494914959149691497914989149991500915019150291503915049150591506915079150891509915109151191512915139151491515915169151791518915199152091521915229152391524915259152691527915289152991530915319153291533915349153591536915379153891539915409154191542915439154491545915469154791548915499155091551915529155391554915559155691557915589155991560915619156291563915649156591566915679156891569915709157191572915739157491575915769157791578915799158091581915829158391584915859158691587915889158991590915919159291593915949159591596915979159891599916009160191602916039160491605916069160791608916099161091611916129161391614916159161691617916189161991620916219162291623916249162591626916279162891629916309163191632916339163491635916369163791638916399164091641916429164391644916459164691647916489164991650916519165291653916549165591656916579165891659916609166191662916639166491665916669166791668916699167091671916729167391674916759167691677916789167991680916819168291683916849168591686916879168891689916909169191692916939169491695916969169791698916999170091701917029170391704917059170691707917089170991710917119171291713917149171591716917179171891719917209172191722917239172491725917269172791728917299173091731917329173391734917359173691737917389173991740917419174291743917449174591746917479174891749917509175191752917539175491755917569175791758917599176091761917629176391764917659176691767917689176991770917719177291773917749177591776917779177891779917809178191782917839178491785917869178791788917899179091791917929179391794917959179691797917989179991800918019180291803918049180591806918079180891809918109181191812918139181491815918169181791818918199182091821918229182391824918259182691827918289182991830918319183291833918349183591836918379183891839918409184191842918439184491845918469184791848918499185091851918529185391854918559185691857918589185991860918619186291863918649186591866918679186891869918709187191872918739187491875918769187791878918799188091881918829188391884918859188691887918889188991890918919189291893918949189591896918979189891899919009190191902919039190491905919069190791908919099191091911919129191391914919159191691917919189191991920919219192291923919249192591926919279192891929919309193191932919339193491935919369193791938919399194091941919429194391944919459194691947919489194991950919519195291953919549195591956919579195891959919609196191962919639196491965919669196791968919699197091971919729197391974919759197691977919789197991980919819198291983919849198591986919879198891989919909199191992919939199491995919969199791998919999200092001920029200392004920059200692007920089200992010920119201292013920149201592016920179201892019920209202192022920239202492025920269202792028920299203092031920329203392034920359203692037920389203992040920419204292043920449204592046920479204892049920509205192052920539205492055920569205792058920599206092061920629206392064920659206692067920689206992070920719207292073920749207592076920779207892079920809208192082920839208492085920869208792088920899209092091920929209392094920959209692097920989209992100921019210292103921049210592106921079210892109921109211192112921139211492115921169211792118921199212092121921229212392124921259212692127921289212992130921319213292133921349213592136921379213892139921409214192142921439214492145921469214792148921499215092151921529215392154921559215692157921589215992160921619216292163921649216592166921679216892169921709217192172921739217492175921769217792178921799218092181921829218392184921859218692187921889218992190921919219292193921949219592196921979219892199922009220192202922039220492205922069220792208922099221092211922129221392214922159221692217922189221992220922219222292223922249222592226922279222892229922309223192232922339223492235922369223792238922399224092241922429224392244922459224692247922489224992250922519225292253922549225592256922579225892259922609226192262922639226492265922669226792268922699227092271922729227392274922759227692277922789227992280922819228292283922849228592286922879228892289922909229192292922939229492295922969229792298922999230092301923029230392304923059230692307923089230992310923119231292313923149231592316923179231892319923209232192322923239232492325923269232792328923299233092331923329233392334923359233692337923389233992340923419234292343923449234592346923479234892349923509235192352923539235492355923569235792358923599236092361923629236392364923659236692367923689236992370923719237292373923749237592376923779237892379923809238192382923839238492385923869238792388923899239092391923929239392394923959239692397923989239992400924019240292403924049240592406924079240892409924109241192412924139241492415924169241792418924199242092421924229242392424924259242692427924289242992430924319243292433924349243592436924379243892439924409244192442924439244492445924469244792448924499245092451924529245392454924559245692457924589245992460924619246292463924649246592466924679246892469924709247192472924739247492475924769247792478924799248092481924829248392484924859248692487924889248992490924919249292493924949249592496924979249892499925009250192502925039250492505925069250792508925099251092511925129251392514925159251692517925189251992520925219252292523925249252592526925279252892529925309253192532925339253492535925369253792538925399254092541925429254392544925459254692547925489254992550925519255292553925549255592556925579255892559925609256192562925639256492565925669256792568925699257092571925729257392574925759257692577925789257992580925819258292583925849258592586925879258892589925909259192592925939259492595925969259792598925999260092601926029260392604926059260692607926089260992610926119261292613926149261592616926179261892619926209262192622926239262492625926269262792628926299263092631926329263392634926359263692637926389263992640926419264292643926449264592646926479264892649926509265192652926539265492655926569265792658926599266092661926629266392664926659266692667926689266992670926719267292673926749267592676926779267892679926809268192682926839268492685926869268792688926899269092691926929269392694926959269692697926989269992700927019270292703927049270592706927079270892709927109271192712927139271492715927169271792718927199272092721927229272392724927259272692727927289272992730927319273292733927349273592736927379273892739927409274192742927439274492745927469274792748927499275092751927529275392754927559275692757927589275992760927619276292763927649276592766927679276892769927709277192772927739277492775927769277792778927799278092781927829278392784927859278692787927889278992790927919279292793927949279592796927979279892799928009280192802928039280492805928069280792808928099281092811928129281392814928159281692817928189281992820928219282292823928249282592826928279282892829928309283192832928339283492835928369283792838928399284092841928429284392844928459284692847928489284992850928519285292853928549285592856928579285892859928609286192862928639286492865928669286792868928699287092871928729287392874928759287692877928789287992880928819288292883928849288592886928879288892889928909289192892928939289492895928969289792898928999290092901929029290392904929059290692907929089290992910929119291292913929149291592916929179291892919929209292192922929239292492925929269292792928929299293092931929329293392934929359293692937929389293992940929419294292943929449294592946929479294892949929509295192952929539295492955929569295792958929599296092961929629296392964929659296692967929689296992970929719297292973929749297592976929779297892979929809298192982929839298492985929869298792988929899299092991929929299392994929959299692997929989299993000930019300293003930049300593006930079300893009930109301193012930139301493015930169301793018930199302093021930229302393024930259302693027930289302993030930319303293033930349303593036930379303893039930409304193042930439304493045930469304793048930499305093051930529305393054930559305693057930589305993060930619306293063930649306593066930679306893069930709307193072930739307493075930769307793078930799308093081930829308393084930859308693087930889308993090930919309293093930949309593096930979309893099931009310193102931039310493105931069310793108931099311093111931129311393114931159311693117931189311993120931219312293123931249312593126931279312893129931309313193132931339313493135931369313793138931399314093141931429314393144931459314693147931489314993150931519315293153931549315593156931579315893159931609316193162931639316493165931669316793168931699317093171931729317393174931759317693177931789317993180931819318293183931849318593186931879318893189931909319193192931939319493195931969319793198931999320093201932029320393204932059320693207932089320993210932119321293213932149321593216932179321893219932209322193222932239322493225932269322793228932299323093231932329323393234932359323693237932389323993240932419324293243932449324593246932479324893249932509325193252932539325493255932569325793258932599326093261932629326393264932659326693267932689326993270932719327293273932749327593276932779327893279932809328193282932839328493285932869328793288932899329093291932929329393294932959329693297932989329993300933019330293303933049330593306933079330893309933109331193312933139331493315933169331793318933199332093321933229332393324933259332693327933289332993330933319333293333933349333593336933379333893339933409334193342933439334493345933469334793348933499335093351933529335393354933559335693357933589335993360933619336293363933649336593366933679336893369933709337193372933739337493375933769337793378933799338093381933829338393384933859338693387933889338993390933919339293393933949339593396933979339893399934009340193402934039340493405934069340793408934099341093411934129341393414934159341693417934189341993420934219342293423934249342593426934279342893429934309343193432934339343493435934369343793438934399344093441934429344393444934459344693447934489344993450934519345293453934549345593456934579345893459934609346193462934639346493465934669346793468934699347093471934729347393474934759347693477934789347993480934819348293483934849348593486934879348893489934909349193492934939349493495934969349793498934999350093501935029350393504935059350693507935089350993510935119351293513935149351593516935179351893519935209352193522935239352493525935269352793528935299353093531935329353393534935359353693537935389353993540935419354293543935449354593546935479354893549935509355193552935539355493555935569355793558935599356093561935629356393564935659356693567935689356993570935719357293573935749357593576935779357893579935809358193582935839358493585935869358793588935899359093591935929359393594935959359693597935989359993600936019360293603936049360593606936079360893609936109361193612936139361493615936169361793618936199362093621936229362393624936259362693627936289362993630936319363293633936349363593636936379363893639936409364193642936439364493645936469364793648936499365093651936529365393654936559365693657936589365993660936619366293663936649366593666936679366893669936709367193672936739367493675936769367793678936799368093681936829368393684936859368693687936889368993690936919369293693936949369593696936979369893699937009370193702937039370493705937069370793708937099371093711937129371393714937159371693717937189371993720937219372293723937249372593726937279372893729937309373193732937339373493735937369373793738937399374093741937429374393744937459374693747937489374993750937519375293753937549375593756937579375893759937609376193762937639376493765937669376793768937699377093771937729377393774937759377693777937789377993780937819378293783937849378593786937879378893789937909379193792937939379493795937969379793798937999380093801938029380393804938059380693807938089380993810938119381293813938149381593816938179381893819938209382193822938239382493825938269382793828938299383093831938329383393834938359383693837938389383993840938419384293843938449384593846938479384893849938509385193852938539385493855938569385793858938599386093861938629386393864938659386693867938689386993870938719387293873938749387593876938779387893879938809388193882938839388493885938869388793888938899389093891938929389393894938959389693897938989389993900939019390293903939049390593906939079390893909939109391193912939139391493915939169391793918939199392093921939229392393924939259392693927939289392993930939319393293933939349393593936939379393893939939409394193942939439394493945939469394793948939499395093951939529395393954939559395693957939589395993960939619396293963939649396593966939679396893969939709397193972939739397493975939769397793978939799398093981939829398393984939859398693987939889398993990939919399293993939949399593996939979399893999940009400194002940039400494005940069400794008940099401094011940129401394014940159401694017940189401994020940219402294023940249402594026940279402894029940309403194032940339403494035940369403794038940399404094041940429404394044940459404694047940489404994050940519405294053940549405594056940579405894059940609406194062940639406494065940669406794068940699407094071940729407394074940759407694077940789407994080940819408294083940849408594086940879408894089940909409194092940939409494095940969409794098940999410094101941029410394104941059410694107941089410994110941119411294113941149411594116941179411894119941209412194122941239412494125941269412794128941299413094131941329413394134941359413694137941389413994140941419414294143941449414594146941479414894149941509415194152941539415494155941569415794158941599416094161941629416394164941659416694167941689416994170941719417294173941749417594176941779417894179941809418194182941839418494185941869418794188941899419094191941929419394194941959419694197941989419994200942019420294203942049420594206942079420894209942109421194212942139421494215942169421794218942199422094221942229422394224942259422694227942289422994230942319423294233942349423594236942379423894239942409424194242942439424494245942469424794248942499425094251942529425394254942559425694257942589425994260942619426294263942649426594266942679426894269942709427194272942739427494275942769427794278942799428094281942829428394284942859428694287942889428994290942919429294293942949429594296942979429894299943009430194302943039430494305943069430794308943099431094311943129431394314943159431694317943189431994320943219432294323943249432594326943279432894329943309433194332943339433494335943369433794338943399434094341943429434394344943459434694347943489434994350943519435294353943549435594356943579435894359943609436194362943639436494365943669436794368943699437094371943729437394374943759437694377943789437994380943819438294383943849438594386943879438894389943909439194392943939439494395943969439794398943999440094401944029440394404944059440694407944089440994410944119441294413944149441594416944179441894419944209442194422944239442494425944269442794428944299443094431944329443394434944359443694437944389443994440944419444294443944449444594446944479444894449944509445194452944539445494455944569445794458944599446094461944629446394464944659446694467944689446994470944719447294473944749447594476944779447894479944809448194482944839448494485944869448794488944899449094491944929449394494944959449694497944989449994500945019450294503945049450594506945079450894509945109451194512945139451494515945169451794518945199452094521945229452394524945259452694527945289452994530945319453294533945349453594536945379453894539945409454194542945439454494545945469454794548945499455094551945529455394554945559455694557945589455994560945619456294563945649456594566945679456894569945709457194572945739457494575945769457794578945799458094581945829458394584945859458694587945889458994590945919459294593945949459594596945979459894599946009460194602946039460494605946069460794608946099461094611946129461394614946159461694617946189461994620946219462294623946249462594626946279462894629946309463194632946339463494635946369463794638946399464094641946429464394644946459464694647946489464994650946519465294653946549465594656946579465894659946609466194662946639466494665946669466794668946699467094671946729467394674946759467694677946789467994680946819468294683946849468594686946879468894689946909469194692946939469494695946969469794698946999470094701947029470394704947059470694707947089470994710947119471294713947149471594716947179471894719947209472194722947239472494725947269472794728947299473094731947329473394734947359473694737947389473994740947419474294743947449474594746947479474894749947509475194752947539475494755947569475794758947599476094761947629476394764947659476694767947689476994770947719477294773947749477594776947779477894779947809478194782947839478494785947869478794788947899479094791947929479394794947959479694797947989479994800948019480294803948049480594806948079480894809948109481194812948139481494815948169481794818948199482094821948229482394824948259482694827948289482994830948319483294833948349483594836948379483894839948409484194842948439484494845948469484794848948499485094851948529485394854948559485694857948589485994860948619486294863948649486594866948679486894869948709487194872948739487494875948769487794878948799488094881948829488394884948859488694887948889488994890948919489294893948949489594896948979489894899949009490194902949039490494905949069490794908949099491094911949129491394914949159491694917949189491994920949219492294923949249492594926949279492894929949309493194932949339493494935949369493794938949399494094941949429494394944949459494694947949489494994950949519495294953949549495594956949579495894959949609496194962949639496494965949669496794968949699497094971949729497394974949759497694977949789497994980949819498294983949849498594986949879498894989949909499194992949939499494995949969499794998949999500095001950029500395004950059500695007950089500995010950119501295013950149501595016950179501895019950209502195022950239502495025950269502795028950299503095031950329503395034950359503695037950389503995040950419504295043950449504595046950479504895049950509505195052950539505495055950569505795058950599506095061950629506395064950659506695067950689506995070950719507295073950749507595076950779507895079950809508195082950839508495085950869508795088950899509095091950929509395094950959509695097950989509995100951019510295103951049510595106951079510895109951109511195112951139511495115951169511795118951199512095121951229512395124951259512695127951289512995130951319513295133951349513595136951379513895139951409514195142951439514495145951469514795148951499515095151951529515395154951559515695157951589515995160951619516295163951649516595166951679516895169951709517195172951739517495175951769517795178951799518095181951829518395184951859518695187951889518995190951919519295193951949519595196951979519895199952009520195202952039520495205952069520795208952099521095211952129521395214952159521695217952189521995220952219522295223952249522595226952279522895229952309523195232952339523495235952369523795238952399524095241952429524395244952459524695247952489524995250952519525295253952549525595256952579525895259952609526195262952639526495265952669526795268952699527095271952729527395274952759527695277952789527995280952819528295283952849528595286952879528895289952909529195292952939529495295952969529795298952999530095301953029530395304953059530695307953089530995310953119531295313953149531595316953179531895319953209532195322953239532495325953269532795328953299533095331953329533395334953359533695337953389533995340953419534295343953449534595346953479534895349953509535195352953539535495355953569535795358953599536095361953629536395364953659536695367953689536995370953719537295373953749537595376953779537895379953809538195382953839538495385953869538795388953899539095391953929539395394953959539695397953989539995400954019540295403954049540595406954079540895409954109541195412954139541495415954169541795418954199542095421954229542395424954259542695427954289542995430954319543295433954349543595436954379543895439954409544195442954439544495445954469544795448954499545095451954529545395454954559545695457954589545995460954619546295463954649546595466954679546895469954709547195472954739547495475954769547795478954799548095481954829548395484954859548695487954889548995490954919549295493954949549595496954979549895499955009550195502955039550495505955069550795508955099551095511955129551395514955159551695517955189551995520955219552295523955249552595526955279552895529955309553195532955339553495535955369553795538955399554095541955429554395544955459554695547955489554995550955519555295553955549555595556955579555895559955609556195562955639556495565955669556795568955699557095571955729557395574955759557695577955789557995580955819558295583955849558595586955879558895589955909559195592955939559495595955969559795598955999560095601956029560395604956059560695607956089560995610956119561295613956149561595616956179561895619956209562195622956239562495625956269562795628956299563095631956329563395634956359563695637956389563995640956419564295643956449564595646956479564895649956509565195652956539565495655956569565795658956599566095661956629566395664956659566695667956689566995670956719567295673956749567595676956779567895679956809568195682956839568495685956869568795688956899569095691956929569395694956959569695697956989569995700957019570295703957049570595706957079570895709957109571195712957139571495715957169571795718957199572095721957229572395724957259572695727957289572995730957319573295733957349573595736957379573895739957409574195742957439574495745957469574795748957499575095751957529575395754957559575695757957589575995760957619576295763957649576595766957679576895769957709577195772957739577495775957769577795778957799578095781957829578395784957859578695787957889578995790957919579295793957949579595796957979579895799958009580195802958039580495805958069580795808958099581095811958129581395814958159581695817958189581995820958219582295823958249582595826958279582895829958309583195832958339583495835958369583795838958399584095841958429584395844958459584695847958489584995850958519585295853958549585595856958579585895859958609586195862958639586495865958669586795868958699587095871958729587395874958759587695877958789587995880958819588295883958849588595886958879588895889958909589195892958939589495895958969589795898958999590095901959029590395904959059590695907959089590995910959119591295913959149591595916959179591895919959209592195922959239592495925959269592795928959299593095931959329593395934959359593695937959389593995940959419594295943959449594595946959479594895949959509595195952959539595495955959569595795958959599596095961959629596395964959659596695967959689596995970959719597295973959749597595976959779597895979959809598195982959839598495985959869598795988959899599095991959929599395994959959599695997959989599996000960019600296003960049600596006960079600896009960109601196012960139601496015960169601796018960199602096021960229602396024960259602696027960289602996030960319603296033960349603596036960379603896039960409604196042960439604496045960469604796048960499605096051960529605396054960559605696057960589605996060960619606296063960649606596066960679606896069960709607196072960739607496075960769607796078960799608096081960829608396084960859608696087960889608996090960919609296093960949609596096960979609896099961009610196102961039610496105961069610796108961099611096111961129611396114961159611696117961189611996120961219612296123961249612596126961279612896129961309613196132961339613496135961369613796138961399614096141961429614396144961459614696147961489614996150961519615296153961549615596156961579615896159961609616196162961639616496165961669616796168961699617096171961729617396174961759617696177961789617996180961819618296183961849618596186961879618896189961909619196192961939619496195961969619796198961999620096201962029620396204962059620696207962089620996210962119621296213962149621596216962179621896219962209622196222962239622496225962269622796228962299623096231962329623396234962359623696237962389623996240962419624296243962449624596246962479624896249962509625196252962539625496255962569625796258962599626096261962629626396264962659626696267962689626996270962719627296273962749627596276962779627896279962809628196282962839628496285962869628796288962899629096291962929629396294962959629696297962989629996300963019630296303963049630596306963079630896309963109631196312963139631496315963169631796318963199632096321963229632396324963259632696327963289632996330963319633296333963349633596336963379633896339963409634196342963439634496345963469634796348963499635096351963529635396354963559635696357963589635996360963619636296363963649636596366963679636896369963709637196372963739637496375963769637796378963799638096381963829638396384963859638696387963889638996390963919639296393963949639596396963979639896399964009640196402964039640496405964069640796408964099641096411964129641396414964159641696417964189641996420964219642296423964249642596426964279642896429964309643196432964339643496435964369643796438964399644096441964429644396444964459644696447964489644996450964519645296453964549645596456964579645896459964609646196462964639646496465964669646796468964699647096471964729647396474964759647696477964789647996480964819648296483964849648596486964879648896489964909649196492964939649496495964969649796498964999650096501965029650396504965059650696507965089650996510965119651296513965149651596516965179651896519965209652196522965239652496525965269652796528965299653096531965329653396534965359653696537965389653996540965419654296543965449654596546965479654896549965509655196552965539655496555965569655796558965599656096561965629656396564965659656696567965689656996570965719657296573965749657596576965779657896579965809658196582965839658496585965869658796588965899659096591965929659396594965959659696597965989659996600966019660296603966049660596606966079660896609966109661196612966139661496615966169661796618966199662096621966229662396624966259662696627966289662996630966319663296633966349663596636966379663896639966409664196642966439664496645966469664796648966499665096651966529665396654966559665696657966589665996660966619666296663966649666596666966679666896669966709667196672966739667496675966769667796678966799668096681966829668396684966859668696687966889668996690966919669296693966949669596696966979669896699967009670196702967039670496705967069670796708967099671096711967129671396714967159671696717967189671996720967219672296723967249672596726967279672896729967309673196732967339673496735967369673796738967399674096741967429674396744967459674696747967489674996750967519675296753967549675596756967579675896759967609676196762967639676496765967669676796768967699677096771967729677396774967759677696777967789677996780967819678296783967849678596786967879678896789967909679196792967939679496795967969679796798967999680096801968029680396804968059680696807968089680996810968119681296813968149681596816968179681896819968209682196822968239682496825968269682796828968299683096831968329683396834968359683696837968389683996840968419684296843968449684596846968479684896849968509685196852968539685496855968569685796858968599686096861968629686396864968659686696867968689686996870968719687296873968749687596876968779687896879968809688196882968839688496885968869688796888968899689096891968929689396894968959689696897968989689996900969019690296903969049690596906969079690896909969109691196912969139691496915969169691796918969199692096921969229692396924969259692696927969289692996930969319693296933969349693596936969379693896939969409694196942969439694496945969469694796948969499695096951969529695396954969559695696957969589695996960969619696296963969649696596966969679696896969969709697196972969739697496975969769697796978969799698096981969829698396984969859698696987969889698996990969919699296993969949699596996969979699896999970009700197002970039700497005970069700797008970099701097011970129701397014970159701697017970189701997020970219702297023970249702597026970279702897029970309703197032970339703497035970369703797038970399704097041970429704397044970459704697047970489704997050970519705297053970549705597056970579705897059970609706197062970639706497065970669706797068970699707097071970729707397074970759707697077970789707997080970819708297083970849708597086970879708897089970909709197092970939709497095970969709797098970999710097101971029710397104971059710697107971089710997110971119711297113971149711597116971179711897119971209712197122971239712497125971269712797128971299713097131971329713397134971359713697137971389713997140971419714297143971449714597146971479714897149971509715197152971539715497155971569715797158971599716097161971629716397164971659716697167971689716997170971719717297173971749717597176971779717897179971809718197182971839718497185971869718797188971899719097191971929719397194971959719697197971989719997200972019720297203972049720597206972079720897209972109721197212972139721497215972169721797218972199722097221972229722397224972259722697227972289722997230972319723297233972349723597236972379723897239972409724197242972439724497245972469724797248972499725097251972529725397254972559725697257972589725997260972619726297263972649726597266972679726897269972709727197272972739727497275972769727797278972799728097281972829728397284972859728697287972889728997290972919729297293972949729597296972979729897299973009730197302973039730497305973069730797308973099731097311973129731397314973159731697317973189731997320973219732297323973249732597326973279732897329973309733197332973339733497335973369733797338973399734097341973429734397344973459734697347973489734997350973519735297353973549735597356973579735897359973609736197362973639736497365973669736797368973699737097371973729737397374973759737697377973789737997380973819738297383973849738597386973879738897389973909739197392973939739497395973969739797398973999740097401974029740397404974059740697407974089740997410974119741297413974149741597416974179741897419974209742197422974239742497425974269742797428974299743097431974329743397434974359743697437974389743997440974419744297443974449744597446974479744897449974509745197452974539745497455974569745797458974599746097461974629746397464974659746697467974689746997470974719747297473974749747597476974779747897479974809748197482974839748497485974869748797488974899749097491974929749397494974959749697497974989749997500975019750297503975049750597506975079750897509975109751197512975139751497515975169751797518975199752097521975229752397524975259752697527975289752997530975319753297533975349753597536975379753897539975409754197542975439754497545975469754797548975499755097551975529755397554975559755697557975589755997560975619756297563975649756597566975679756897569975709757197572975739757497575975769757797578975799758097581975829758397584975859758697587975889758997590975919759297593975949759597596975979759897599976009760197602976039760497605976069760797608976099761097611976129761397614976159761697617976189761997620976219762297623976249762597626976279762897629976309763197632976339763497635976369763797638976399764097641976429764397644976459764697647976489764997650976519765297653976549765597656976579765897659976609766197662976639766497665976669766797668976699767097671976729767397674976759767697677976789767997680976819768297683976849768597686976879768897689976909769197692976939769497695976969769797698976999770097701977029770397704977059770697707977089770997710977119771297713977149771597716977179771897719977209772197722977239772497725977269772797728977299773097731977329773397734977359773697737977389773997740977419774297743977449774597746977479774897749977509775197752977539775497755977569775797758977599776097761977629776397764977659776697767977689776997770977719777297773977749777597776977779777897779977809778197782977839778497785977869778797788977899779097791977929779397794977959779697797977989779997800978019780297803978049780597806978079780897809978109781197812978139781497815978169781797818978199782097821978229782397824978259782697827978289782997830978319783297833978349783597836978379783897839978409784197842978439784497845978469784797848978499785097851978529785397854978559785697857978589785997860978619786297863978649786597866978679786897869978709787197872978739787497875978769787797878978799788097881978829788397884978859788697887978889788997890978919789297893978949789597896978979789897899979009790197902979039790497905979069790797908979099791097911979129791397914979159791697917979189791997920979219792297923979249792597926979279792897929979309793197932979339793497935979369793797938979399794097941979429794397944979459794697947979489794997950979519795297953979549795597956979579795897959979609796197962979639796497965979669796797968979699797097971979729797397974979759797697977979789797997980979819798297983979849798597986979879798897989979909799197992979939799497995979969799797998979999800098001980029800398004980059800698007980089800998010980119801298013980149801598016980179801898019980209802198022980239802498025980269802798028980299803098031980329803398034980359803698037980389803998040980419804298043980449804598046980479804898049980509805198052980539805498055980569805798058980599806098061980629806398064980659806698067980689806998070980719807298073980749807598076980779807898079980809808198082980839808498085980869808798088980899809098091980929809398094980959809698097980989809998100981019810298103981049810598106981079810898109981109811198112981139811498115981169811798118981199812098121981229812398124981259812698127981289812998130981319813298133981349813598136981379813898139981409814198142981439814498145981469814798148981499815098151981529815398154981559815698157981589815998160981619816298163981649816598166981679816898169981709817198172981739817498175981769817798178981799818098181981829818398184981859818698187981889818998190981919819298193981949819598196981979819898199982009820198202982039820498205982069820798208982099821098211982129821398214982159821698217982189821998220982219822298223982249822598226982279822898229982309823198232982339823498235982369823798238982399824098241982429824398244982459824698247982489824998250982519825298253982549825598256982579825898259982609826198262982639826498265982669826798268982699827098271982729827398274982759827698277982789827998280982819828298283982849828598286982879828898289982909829198292982939829498295982969829798298982999830098301983029830398304983059830698307983089830998310983119831298313983149831598316983179831898319983209832198322983239832498325983269832798328983299833098331983329833398334983359833698337983389833998340983419834298343983449834598346983479834898349983509835198352983539835498355983569835798358983599836098361983629836398364983659836698367983689836998370983719837298373983749837598376983779837898379983809838198382983839838498385983869838798388983899839098391983929839398394983959839698397983989839998400984019840298403984049840598406984079840898409984109841198412984139841498415984169841798418984199842098421984229842398424984259842698427984289842998430984319843298433984349843598436984379843898439984409844198442984439844498445984469844798448984499845098451984529845398454984559845698457984589845998460984619846298463984649846598466984679846898469984709847198472984739847498475984769847798478984799848098481984829848398484984859848698487984889848998490984919849298493984949849598496984979849898499985009850198502985039850498505985069850798508985099851098511985129851398514985159851698517985189851998520985219852298523985249852598526985279852898529985309853198532985339853498535985369853798538985399854098541985429854398544985459854698547985489854998550985519855298553985549855598556985579855898559985609856198562985639856498565985669856798568985699857098571985729857398574985759857698577985789857998580985819858298583985849858598586985879858898589985909859198592985939859498595985969859798598985999860098601986029860398604986059860698607986089860998610986119861298613986149861598616986179861898619986209862198622986239862498625986269862798628986299863098631986329863398634986359863698637986389863998640986419864298643986449864598646986479864898649986509865198652986539865498655986569865798658986599866098661986629866398664986659866698667986689866998670986719867298673986749867598676986779867898679986809868198682986839868498685986869868798688986899869098691986929869398694986959869698697986989869998700987019870298703987049870598706987079870898709987109871198712987139871498715987169871798718987199872098721987229872398724987259872698727987289872998730987319873298733987349873598736987379873898739987409874198742987439874498745987469874798748987499875098751987529875398754987559875698757987589875998760987619876298763987649876598766987679876898769987709877198772987739877498775987769877798778987799878098781987829878398784987859878698787987889878998790987919879298793987949879598796987979879898799988009880198802988039880498805988069880798808988099881098811988129881398814988159881698817988189881998820988219882298823988249882598826988279882898829988309883198832988339883498835988369883798838988399884098841988429884398844988459884698847988489884998850988519885298853988549885598856988579885898859988609886198862988639886498865988669886798868988699887098871988729887398874988759887698877988789887998880988819888298883988849888598886988879888898889988909889198892988939889498895988969889798898988999890098901989029890398904989059890698907989089890998910989119891298913989149891598916989179891898919989209892198922989239892498925989269892798928989299893098931989329893398934989359893698937989389893998940989419894298943989449894598946989479894898949989509895198952989539895498955989569895798958989599896098961989629896398964989659896698967989689896998970989719897298973989749897598976989779897898979989809898198982989839898498985989869898798988989899899098991989929899398994989959899698997989989899999000990019900299003990049900599006990079900899009990109901199012990139901499015990169901799018990199902099021990229902399024990259902699027990289902999030990319903299033990349903599036990379903899039990409904199042990439904499045990469904799048990499905099051990529905399054990559905699057990589905999060990619906299063990649906599066990679906899069990709907199072990739907499075990769907799078990799908099081990829908399084990859908699087990889908999090990919909299093990949909599096990979909899099991009910199102991039910499105991069910799108991099911099111991129911399114991159911699117991189911999120991219912299123991249912599126991279912899129991309913199132991339913499135991369913799138991399914099141991429914399144991459914699147991489914999150991519915299153991549915599156991579915899159991609916199162991639916499165991669916799168991699917099171991729917399174991759917699177991789917999180991819918299183991849918599186991879918899189991909919199192991939919499195991969919799198991999920099201992029920399204992059920699207992089920999210992119921299213992149921599216992179921899219992209922199222992239922499225992269922799228992299923099231992329923399234992359923699237992389923999240992419924299243992449924599246992479924899249992509925199252992539925499255992569925799258992599926099261992629926399264992659926699267992689926999270992719927299273992749927599276992779927899279992809928199282992839928499285992869928799288992899929099291992929929399294992959929699297992989929999300993019930299303993049930599306993079930899309993109931199312993139931499315993169931799318993199932099321993229932399324993259932699327993289932999330993319933299333993349933599336993379933899339993409934199342993439934499345993469934799348993499935099351993529935399354993559935699357993589935999360993619936299363993649936599366993679936899369993709937199372993739937499375993769937799378993799938099381993829938399384993859938699387993889938999390993919939299393993949939599396993979939899399994009940199402994039940499405994069940799408994099941099411994129941399414994159941699417994189941999420994219942299423994249942599426994279942899429994309943199432994339943499435994369943799438994399944099441994429944399444994459944699447994489944999450994519945299453994549945599456994579945899459994609946199462994639946499465994669946799468994699947099471994729947399474994759947699477994789947999480994819948299483994849948599486994879948899489994909949199492994939949499495994969949799498994999950099501995029950399504995059950699507995089950999510995119951299513995149951599516995179951899519995209952199522995239952499525995269952799528995299953099531995329953399534995359953699537995389953999540995419954299543995449954599546995479954899549995509955199552995539955499555995569955799558995599956099561995629956399564995659956699567995689956999570995719957299573995749957599576995779957899579995809958199582995839958499585995869958799588995899959099591995929959399594995959959699597995989959999600996019960299603996049960599606996079960899609996109961199612996139961499615996169961799618996199962099621996229962399624996259962699627996289962999630996319963299633996349963599636996379963899639996409964199642996439964499645996469964799648996499965099651996529965399654996559965699657996589965999660996619966299663996649966599666996679966899669996709967199672996739967499675996769967799678996799968099681996829968399684996859968699687996889968999690996919969299693996949969599696996979969899699997009970199702997039970499705997069970799708997099971099711997129971399714997159971699717997189971999720997219972299723997249972599726997279972899729997309973199732997339973499735997369973799738997399974099741997429974399744997459974699747997489974999750997519975299753997549975599756997579975899759997609976199762997639976499765997669976799768997699977099771997729977399774997759977699777997789977999780997819978299783997849978599786997879978899789997909979199792997939979499795997969979799798997999980099801998029980399804998059980699807998089980999810998119981299813998149981599816998179981899819998209982199822998239982499825998269982799828998299983099831998329983399834998359983699837998389983999840998419984299843998449984599846998479984899849998509985199852998539985499855998569985799858998599986099861998629986399864998659986699867998689986999870998719987299873998749987599876998779987899879998809988199882998839988499885998869988799888998899989099891998929989399894998959989699897998989989999900999019990299903999049990599906999079990899909999109991199912999139991499915999169991799918999199992099921999229992399924999259992699927999289992999930999319993299933999349993599936999379993899939999409994199942999439994499945999469994799948999499995099951999529995399954999559995699957999589995999960999619996299963999649996599966999679996899969999709997199972999739997499975999769997799978999799998099981999829998399984999859998699987999889998999990999919999299993999949999599996999979999899999100000100001100002100003100004100005100006100007100008100009100010100011100012100013100014100015100016100017100018100019100020100021100022100023100024100025100026100027100028100029100030100031100032100033100034100035100036100037100038100039100040100041100042100043100044100045100046100047100048100049100050100051100052100053100054100055100056100057100058100059100060100061100062100063100064100065100066100067100068100069100070100071100072100073100074100075100076100077100078100079100080100081100082100083100084100085100086100087100088100089100090100091100092100093100094100095100096100097100098100099100100100101100102100103100104100105100106100107100108100109100110100111100112100113100114100115100116100117100118100119100120100121100122100123100124100125100126100127100128100129100130100131100132100133100134100135100136100137100138100139100140100141100142100143100144100145100146100147100148100149100150100151100152100153100154100155100156100157100158100159100160100161100162100163100164100165100166100167100168100169100170100171100172100173100174100175100176100177100178100179100180100181100182100183100184100185100186100187100188100189100190100191100192100193100194100195100196100197100198100199100200100201100202100203100204100205100206100207100208100209100210100211100212100213100214100215100216100217100218100219100220100221100222100223100224100225100226100227100228100229100230100231100232100233100234100235100236100237100238100239100240100241100242100243100244100245100246100247100248100249100250100251100252100253100254100255100256100257100258100259100260100261100262100263100264100265100266100267100268100269100270100271100272100273100274100275100276100277100278100279100280100281100282100283100284100285100286100287100288100289100290100291100292100293100294100295100296100297100298100299100300100301100302100303100304100305100306100307100308100309100310100311100312100313100314100315100316100317100318100319100320100321100322100323100324100325100326100327100328100329100330100331100332100333100334100335100336100337100338100339100340100341100342100343100344100345100346100347100348100349100350100351100352100353100354100355100356100357100358100359100360100361100362100363100364100365100366100367100368100369100370100371100372100373100374100375100376100377100378100379100380100381100382100383100384100385100386100387100388100389100390100391100392100393100394100395100396100397100398100399100400100401100402100403100404100405100406100407100408100409100410100411100412100413100414100415100416100417100418100419100420100421100422100423100424100425100426100427100428100429100430100431100432100433100434100435100436100437100438100439100440100441100442100443100444100445100446100447100448100449100450100451100452100453100454100455100456100457100458100459100460100461100462100463100464100465100466100467100468100469100470100471100472100473100474100475100476100477100478100479100480100481100482100483100484100485100486100487100488100489100490100491100492100493100494100495100496100497100498100499100500100501100502100503100504100505100506100507100508100509100510100511100512100513100514100515100516100517100518100519100520100521100522100523100524100525100526100527100528100529100530100531100532100533100534100535100536100537100538100539100540100541100542100543100544100545100546100547100548100549100550100551100552100553100554100555100556100557100558100559100560100561100562100563100564100565100566100567100568100569100570100571100572100573100574100575100576100577100578100579100580100581100582100583100584100585100586100587100588100589100590100591100592100593100594100595100596100597100598100599100600100601100602100603100604100605100606100607100608100609100610100611100612100613100614100615100616100617100618100619100620100621100622100623100624100625100626100627100628100629100630100631100632100633100634100635100636100637100638100639100640100641100642100643100644100645100646100647100648100649100650100651100652100653100654100655100656100657100658100659100660100661100662100663100664100665100666100667100668100669100670100671100672100673100674100675100676100677100678100679100680100681100682100683100684100685100686100687100688100689100690100691100692100693100694100695100696100697100698100699100700100701100702100703100704100705100706100707100708100709100710100711100712100713100714100715100716100717100718100719100720100721100722100723100724100725100726100727100728100729100730100731100732100733100734100735100736100737100738100739100740100741100742100743100744100745100746100747100748100749100750100751100752100753100754100755100756100757100758100759100760100761100762100763100764100765100766100767100768100769100770100771100772100773100774100775100776100777100778100779100780100781100782100783100784100785100786100787100788100789100790100791100792100793100794100795100796100797100798100799100800100801100802100803100804100805100806100807100808100809100810100811100812100813100814100815100816100817100818100819100820100821100822100823100824100825100826100827100828100829100830100831100832100833100834100835100836100837100838100839100840100841100842100843100844100845100846100847100848100849100850100851100852100853100854100855100856100857100858100859100860100861100862100863100864100865100866100867100868100869100870100871100872100873100874100875100876100877100878100879100880100881100882100883100884100885100886100887100888100889100890100891100892100893100894100895100896100897100898100899100900100901100902100903100904100905100906100907100908100909100910100911100912100913100914100915100916100917100918100919100920100921100922100923100924100925100926100927100928100929100930100931100932100933100934100935100936100937100938100939100940100941100942100943100944100945100946100947100948100949100950100951100952100953100954100955100956100957100958100959100960100961100962100963100964100965100966100967100968100969100970100971100972100973100974100975100976100977100978100979100980100981100982100983100984100985100986100987100988100989100990100991100992100993100994100995100996100997100998100999101000101001101002101003101004101005101006101007101008101009101010101011101012101013101014101015101016101017101018101019101020101021101022101023101024101025101026101027101028101029101030101031101032101033101034101035101036101037101038101039101040101041101042101043101044101045101046101047101048101049101050101051101052101053101054101055101056101057101058101059101060101061101062101063101064101065101066101067101068101069101070101071101072101073101074101075101076101077101078101079101080101081101082101083101084101085101086101087101088101089101090101091101092101093101094101095101096101097101098101099101100101101101102101103101104101105101106101107101108101109101110101111101112101113101114101115101116101117101118101119101120101121101122101123101124101125101126101127101128101129101130101131101132101133101134101135101136101137101138101139101140101141101142101143101144101145101146101147101148101149101150101151101152101153101154101155101156101157101158101159101160101161101162101163101164101165101166101167101168101169101170101171101172101173101174101175101176101177101178101179101180101181101182101183101184101185101186101187101188101189101190101191101192101193101194101195101196101197101198101199101200101201101202101203101204101205101206101207101208101209101210101211101212101213101214101215101216101217101218101219101220101221101222101223101224101225101226101227101228101229101230101231101232101233101234101235101236101237101238101239101240101241101242101243101244101245101246101247101248101249101250101251101252101253101254101255101256101257101258101259101260101261101262101263101264101265101266101267101268101269101270101271101272101273101274101275101276101277101278101279101280101281101282101283101284101285101286101287101288101289101290101291101292101293101294101295101296101297101298101299101300101301101302101303101304101305101306101307101308101309101310101311101312101313101314101315101316101317101318101319101320101321101322101323101324101325101326101327101328101329101330101331101332101333101334101335101336101337101338101339101340101341101342101343101344101345101346101347101348101349101350101351101352101353101354101355101356101357101358101359101360101361101362101363101364101365101366101367101368101369101370101371101372101373101374101375101376101377101378101379101380101381101382101383101384101385101386101387101388101389101390101391101392101393101394101395101396101397101398101399101400101401101402101403101404101405101406101407101408101409101410101411101412101413101414101415101416101417101418101419101420101421101422101423101424101425101426101427101428101429101430101431101432101433101434101435101436101437101438101439101440101441101442101443101444101445101446101447101448101449101450101451101452101453101454101455101456101457101458101459101460101461101462101463101464101465101466101467101468101469101470101471101472101473101474101475101476101477101478101479101480101481101482101483101484101485101486101487101488101489101490101491101492101493101494101495101496101497101498101499101500101501101502101503101504101505101506101507101508101509101510101511101512101513101514101515101516101517101518101519101520101521101522101523101524101525101526101527101528101529101530101531101532101533101534101535101536101537101538101539101540101541101542101543101544101545101546101547101548101549101550101551101552101553101554101555101556101557101558101559101560101561101562101563101564101565101566101567101568101569101570101571101572101573101574101575101576101577101578101579101580101581101582101583101584101585101586101587101588101589101590101591101592101593101594101595101596101597101598101599101600101601101602101603101604101605101606101607101608101609101610101611101612101613101614101615101616101617101618101619101620101621101622101623101624101625101626101627101628101629101630101631101632101633101634101635101636101637101638101639101640101641101642101643101644101645101646101647101648101649101650101651101652101653101654101655101656101657101658101659101660101661101662101663101664101665101666101667101668101669101670101671101672101673101674101675101676101677101678101679101680101681101682101683101684101685101686101687101688101689101690101691101692101693101694101695101696101697101698101699101700101701101702101703101704101705101706101707101708101709101710101711101712101713101714101715101716101717101718101719101720101721101722101723101724101725101726101727101728101729101730101731101732101733101734101735101736101737101738101739101740101741101742101743101744101745101746101747101748101749101750101751101752101753101754101755101756101757101758101759101760101761101762101763101764101765101766101767101768101769101770101771101772101773101774101775101776101777101778101779101780101781101782101783101784101785101786101787101788101789101790101791101792101793101794101795101796101797101798101799101800101801101802101803101804101805101806101807101808101809101810101811101812101813101814101815101816101817101818101819101820101821101822101823101824101825101826101827101828101829101830101831101832101833101834101835101836101837101838101839101840101841101842101843101844101845101846101847101848101849101850101851101852101853101854101855101856101857101858101859101860101861101862101863101864101865101866101867101868101869101870101871101872101873101874101875101876101877101878101879101880101881101882101883101884101885101886101887101888101889101890101891101892101893101894101895101896101897101898101899101900101901101902101903101904101905101906101907101908101909101910101911101912101913101914101915101916101917101918101919101920101921101922101923101924101925101926101927101928101929101930101931101932101933101934101935101936101937101938101939101940101941101942101943101944101945101946101947101948101949101950101951101952101953101954101955101956101957101958101959101960101961101962101963101964101965101966101967101968101969101970101971101972101973101974101975101976101977101978101979101980101981101982101983101984101985101986101987101988101989101990101991101992101993101994101995101996101997101998101999102000102001102002102003102004102005102006102007102008102009102010102011102012102013102014102015102016102017102018102019102020102021102022102023102024102025102026102027102028102029102030102031102032102033102034102035102036102037102038102039102040102041102042102043102044102045102046102047102048102049102050102051102052102053102054102055102056102057102058102059102060102061102062102063102064102065102066102067102068102069102070102071102072102073102074102075102076102077102078102079102080102081102082102083102084102085102086102087102088102089102090102091102092102093102094102095102096102097102098102099102100102101102102102103102104102105102106102107102108102109102110102111102112102113102114102115102116102117102118102119102120102121102122102123102124102125102126102127102128102129102130102131102132102133102134102135102136102137102138102139102140102141102142102143102144102145102146102147102148102149102150102151102152102153102154102155102156102157102158102159102160102161102162102163102164102165102166102167102168102169102170102171102172102173102174102175102176102177102178102179102180102181102182102183102184102185102186102187102188102189102190102191102192102193102194102195102196102197102198102199102200102201102202102203102204102205102206102207102208102209102210102211102212102213102214102215102216102217102218102219102220102221102222102223102224102225102226102227102228102229102230102231102232102233102234102235102236102237102238102239102240102241102242102243102244102245102246102247102248102249102250102251102252102253102254102255102256102257102258102259102260102261102262102263102264102265102266102267102268102269102270102271102272102273102274102275102276102277102278102279102280102281102282102283102284102285102286102287102288102289102290102291102292102293102294102295102296102297102298102299102300102301102302102303102304102305102306102307102308102309102310102311102312102313102314102315102316102317102318102319102320102321102322102323102324102325102326102327102328102329102330102331102332102333102334102335102336102337102338102339102340102341102342102343102344102345102346102347102348102349102350102351102352102353102354102355102356102357102358102359102360102361102362102363102364102365102366102367102368102369102370102371102372102373102374102375102376102377102378102379102380102381102382102383102384102385102386102387102388102389102390102391102392102393102394102395102396102397102398102399102400102401102402102403102404102405102406102407102408102409102410102411102412102413102414102415102416102417102418102419102420102421102422102423102424102425102426102427102428102429102430102431102432102433102434102435102436102437102438102439102440102441102442102443102444102445102446102447102448102449102450102451102452102453102454102455102456102457102458102459102460102461102462102463102464102465102466102467102468102469102470102471102472102473102474102475102476102477102478102479102480102481102482102483102484102485102486102487102488102489102490102491102492102493102494102495102496102497102498102499102500102501102502102503102504102505102506102507102508102509102510102511102512102513102514102515102516102517102518102519102520102521102522102523102524102525102526102527102528102529102530102531102532102533102534102535102536102537102538102539102540102541102542102543102544102545102546102547102548102549102550102551102552102553102554102555102556102557102558102559102560102561102562102563102564102565102566102567102568102569102570102571102572102573102574102575102576102577102578102579102580102581102582102583102584102585102586102587102588102589102590102591102592102593102594102595102596102597102598102599102600102601102602102603102604102605102606102607102608102609102610102611102612102613102614102615102616102617102618102619102620102621102622102623102624102625102626102627102628102629102630102631102632102633102634102635102636102637102638102639102640102641102642102643102644102645102646102647102648102649102650102651102652102653102654102655102656102657102658102659102660102661102662102663102664102665102666102667102668102669102670102671102672102673102674102675102676102677102678102679102680102681102682102683102684102685102686102687102688102689102690102691102692102693102694102695102696102697102698102699102700102701102702102703102704102705102706102707102708102709102710102711102712102713102714102715102716102717102718102719102720102721102722102723102724102725102726102727102728102729102730102731102732102733102734102735102736102737102738102739102740102741102742102743102744102745102746102747102748102749102750102751102752102753102754102755102756102757102758102759102760102761102762102763102764102765102766102767102768102769102770102771102772102773102774102775102776102777102778102779102780102781102782102783102784102785102786102787102788102789102790102791102792102793102794102795102796102797102798102799102800102801102802102803102804102805102806102807102808102809102810102811102812102813102814102815102816102817102818102819102820102821102822102823102824102825102826102827102828102829102830102831102832102833102834102835102836102837102838102839102840102841102842102843102844102845102846102847102848102849102850102851102852102853102854102855102856102857102858102859102860102861102862102863102864102865102866102867102868102869102870102871102872102873102874102875102876102877102878102879102880102881102882102883102884102885102886102887102888102889102890102891102892102893102894102895102896102897102898102899102900102901102902102903102904102905102906102907102908102909102910102911102912102913102914102915102916102917102918102919102920102921102922102923102924102925102926102927102928102929102930102931102932102933102934102935102936102937102938102939102940102941102942102943102944102945102946102947102948102949102950102951102952102953102954102955102956102957102958102959102960102961102962102963102964102965102966102967102968102969102970102971102972102973102974102975102976102977102978102979102980102981102982102983102984102985102986102987102988102989102990102991102992102993102994102995102996102997102998102999103000103001103002103003103004103005103006103007103008103009103010103011103012103013103014103015103016103017103018103019103020103021103022103023103024103025103026103027103028103029103030103031103032103033103034103035103036103037103038103039103040103041103042103043103044103045103046103047103048103049103050103051103052103053103054103055103056103057103058103059103060103061103062103063103064103065103066103067103068103069103070103071103072103073103074103075103076103077103078103079103080103081103082103083103084103085103086103087103088103089103090103091103092103093103094103095103096103097103098103099103100103101103102103103103104103105103106103107103108103109103110103111103112103113103114103115103116103117103118103119103120103121103122103123103124103125103126103127103128103129103130103131103132103133103134103135103136103137103138103139103140103141103142103143103144103145103146103147103148103149103150103151103152103153103154103155103156103157103158103159103160103161103162103163103164103165103166103167103168103169103170103171103172103173103174103175103176103177103178103179103180103181103182103183103184103185103186103187103188103189103190103191103192103193103194103195103196103197103198103199103200103201103202103203103204103205103206103207103208103209103210103211103212103213103214103215103216103217103218103219103220103221103222103223103224103225103226103227103228103229103230103231103232103233103234103235103236103237103238103239103240103241103242103243103244103245103246103247103248103249103250103251103252103253103254103255103256103257103258103259103260103261103262103263103264103265103266103267103268103269103270103271103272103273103274103275103276103277103278103279103280103281103282103283103284103285103286103287103288103289103290103291103292103293103294103295103296103297103298103299103300103301103302103303103304103305103306103307103308103309103310103311103312103313103314103315103316103317103318103319103320103321103322103323103324103325103326103327103328103329103330103331103332103333103334103335103336103337103338103339103340103341103342103343103344103345103346103347103348103349103350103351103352103353103354103355103356103357103358103359103360103361103362103363103364103365103366103367103368103369103370103371103372103373103374103375103376103377103378103379103380103381103382103383103384103385103386103387103388103389103390103391103392103393103394103395103396103397103398103399103400103401103402103403103404103405103406103407103408103409103410103411103412103413103414103415103416103417103418103419103420103421103422103423103424103425103426103427103428103429103430103431103432103433103434103435103436103437103438103439103440103441103442103443103444103445103446103447103448103449103450103451103452103453103454103455103456103457103458103459103460103461103462103463103464103465103466103467103468103469103470103471103472103473103474103475103476103477103478103479103480103481103482103483103484103485103486103487103488103489103490103491103492103493103494103495103496103497103498103499103500103501103502103503103504103505103506103507103508103509103510103511103512103513103514103515103516103517103518103519103520103521103522103523103524103525103526103527103528103529103530103531103532103533103534103535103536103537103538103539103540103541103542103543103544103545103546103547103548103549103550103551103552103553103554103555103556103557103558103559103560103561103562103563103564103565103566103567103568103569103570103571103572103573103574103575103576103577103578103579103580103581103582103583103584103585103586103587103588103589103590103591103592103593103594103595103596103597103598103599103600103601103602103603103604103605103606103607103608103609103610103611103612103613103614103615103616103617103618103619103620103621103622103623103624103625103626103627103628103629103630103631103632103633103634103635103636103637103638103639103640103641103642103643103644103645103646103647103648103649103650103651103652103653103654103655103656103657103658103659103660103661103662103663103664103665103666103667103668103669103670103671103672103673103674103675103676103677103678103679103680103681103682103683103684103685103686103687103688103689103690103691103692103693103694103695103696103697103698103699103700103701103702103703103704103705103706103707103708103709103710103711103712103713103714103715103716103717103718103719103720103721103722103723103724103725103726103727103728103729103730103731103732103733103734103735103736103737103738103739103740103741103742103743103744103745103746103747103748103749103750103751103752103753103754103755103756103757103758103759103760103761103762103763103764103765103766103767103768103769103770103771103772103773103774103775103776103777103778103779103780103781103782103783103784103785103786103787103788103789103790103791103792103793103794103795103796103797103798103799103800103801103802103803103804103805103806103807103808103809103810103811103812103813103814103815103816103817103818103819103820103821103822103823103824103825103826103827103828103829103830103831103832103833103834103835103836103837103838103839103840103841103842103843103844103845103846103847103848103849103850103851103852103853103854103855103856103857103858103859103860103861103862103863103864103865103866103867103868103869103870103871103872103873103874103875103876103877103878103879103880103881103882103883103884103885103886103887103888103889103890103891103892103893103894103895103896103897103898103899103900103901103902103903103904103905103906103907103908103909103910103911103912103913103914103915103916103917103918103919103920103921103922103923103924103925103926103927103928103929103930103931103932103933103934103935103936103937103938103939103940103941103942103943103944103945103946103947103948103949103950103951103952103953103954103955103956103957103958103959103960103961103962103963103964103965103966103967103968103969103970103971103972103973103974103975103976103977103978103979103980103981103982103983103984103985103986103987103988103989103990103991103992103993103994103995103996103997103998103999104000104001104002104003104004104005104006104007104008104009104010104011104012104013104014104015104016104017104018104019104020104021104022104023104024104025104026104027104028104029104030104031104032104033104034104035104036104037104038104039104040104041104042104043104044104045104046104047104048104049104050104051104052104053104054104055104056104057104058104059104060104061104062104063104064104065104066104067104068104069104070104071104072104073104074104075104076104077104078104079104080104081104082104083104084104085104086104087104088104089104090104091104092104093104094104095104096104097104098104099104100104101104102104103104104104105104106104107104108104109104110104111104112104113104114104115104116104117104118104119104120104121104122104123104124104125104126104127104128104129104130104131104132104133104134104135104136104137104138104139104140104141104142104143104144104145104146104147104148104149104150104151104152104153104154104155104156104157104158104159104160104161104162104163104164104165104166104167104168104169104170104171104172104173104174104175104176104177104178104179104180104181104182104183104184104185104186104187104188104189104190104191104192104193104194104195104196104197104198104199104200104201104202104203104204104205104206104207104208104209104210104211104212104213104214104215104216104217104218104219104220104221104222104223104224104225104226104227104228104229104230104231104232104233104234104235104236104237104238104239104240104241104242104243104244104245104246104247104248104249104250104251104252104253104254104255104256104257104258104259104260104261104262104263104264104265104266104267104268104269104270104271104272104273104274104275104276104277104278104279104280104281104282104283104284104285104286104287104288104289104290104291104292104293104294104295104296104297104298104299104300104301104302104303104304104305104306104307104308104309104310104311104312104313104314104315104316104317104318104319104320104321104322104323104324104325104326104327104328104329104330104331104332104333104334104335104336104337104338104339104340104341104342104343104344104345104346104347104348104349104350104351104352104353104354104355104356104357104358104359104360104361104362104363104364104365104366104367104368104369104370104371104372104373104374104375104376104377104378104379104380104381104382104383104384104385104386104387104388104389104390104391104392104393104394104395104396104397104398104399104400104401104402104403104404104405104406104407104408104409104410104411104412104413104414104415104416104417104418104419104420104421104422104423104424104425104426104427104428104429104430104431104432104433104434104435104436104437104438104439104440104441104442104443104444104445104446104447104448104449104450104451104452104453104454104455104456104457104458104459104460104461104462104463104464104465104466104467104468104469104470104471104472104473104474104475104476104477104478104479104480104481104482104483104484104485104486104487104488104489104490104491104492104493104494104495104496104497104498104499104500104501104502104503104504104505104506104507104508104509104510104511104512104513104514104515104516104517104518104519104520104521104522104523104524104525104526104527104528104529104530104531104532104533104534104535104536104537104538104539104540104541104542104543104544104545104546104547104548104549104550104551104552104553104554104555104556104557104558104559104560104561104562104563104564104565104566104567104568104569104570104571104572104573104574104575104576104577104578104579104580104581104582104583104584104585104586104587104588104589104590104591104592104593104594104595104596104597104598104599104600104601104602104603104604104605104606104607104608104609104610104611104612104613104614104615104616104617104618104619104620104621104622104623104624104625104626104627104628104629104630104631104632104633104634104635104636104637104638104639104640104641104642104643104644104645104646104647104648104649104650104651104652104653104654104655104656104657104658104659104660104661104662104663104664104665104666104667104668104669104670104671104672104673104674104675104676104677104678104679104680104681104682104683104684104685104686104687104688104689104690104691104692104693104694104695104696104697104698104699104700104701104702104703104704104705104706104707104708104709104710104711104712104713104714104715104716104717104718104719104720104721104722104723104724104725104726104727104728104729104730104731104732104733104734104735104736104737104738104739104740104741104742104743104744104745104746104747104748104749104750104751104752104753104754104755104756104757104758104759104760104761104762104763104764104765104766104767104768104769104770104771104772104773104774104775104776104777104778104779104780104781104782104783104784104785104786104787104788104789104790104791104792104793104794104795104796104797104798104799104800104801104802104803104804104805104806104807104808104809104810104811104812104813104814104815104816104817104818104819104820104821104822104823104824104825104826104827104828104829104830104831104832104833104834104835104836104837104838104839104840104841104842104843104844104845104846104847104848104849104850104851104852104853104854104855104856104857104858104859104860104861104862104863104864104865104866104867104868104869104870104871104872104873104874104875104876104877104878104879104880104881104882104883104884104885104886104887104888104889104890104891104892104893104894104895104896104897104898104899104900104901104902104903104904104905104906104907104908104909104910104911104912104913104914104915104916104917104918104919104920104921104922104923104924104925104926104927104928104929104930104931104932104933104934104935104936104937104938104939104940104941104942104943104944104945104946104947104948104949104950104951104952104953104954104955104956104957104958104959104960104961104962104963104964104965104966104967104968104969104970104971104972104973104974104975104976104977104978104979104980104981104982104983104984104985104986104987104988104989104990104991104992104993104994104995104996104997104998104999105000105001105002105003105004105005105006105007105008105009105010105011105012105013105014105015105016105017105018105019105020105021105022105023105024105025105026105027105028105029105030105031105032105033105034105035105036105037105038105039105040105041105042105043105044105045105046105047105048105049105050105051105052105053105054105055105056105057105058105059105060105061105062105063105064105065105066105067105068105069105070105071105072105073105074105075105076105077105078105079105080105081105082105083105084105085105086105087105088105089105090105091105092105093105094105095105096105097105098105099105100105101105102105103105104105105105106105107105108105109105110105111105112105113105114105115105116105117105118105119105120105121105122105123105124105125105126105127105128105129105130105131105132105133105134105135105136105137105138105139105140105141105142105143105144105145105146105147105148105149105150105151105152105153105154105155105156105157105158105159105160105161105162105163105164105165105166105167105168105169105170105171105172105173105174105175105176105177105178105179105180105181105182105183105184105185105186105187105188105189105190105191105192105193105194105195105196105197105198105199105200105201105202105203105204105205105206105207105208105209105210105211105212105213105214105215105216105217105218105219105220105221105222105223105224105225105226105227105228105229105230105231105232105233105234105235105236105237105238105239105240105241105242105243105244105245105246105247105248105249105250105251105252105253105254105255105256105257105258105259105260105261105262105263105264105265105266105267105268105269105270105271105272105273105274105275105276105277105278105279105280105281105282105283105284105285105286105287105288105289105290105291105292105293105294105295105296105297105298105299105300105301105302105303105304105305105306105307105308105309105310105311105312105313105314105315105316105317105318105319105320105321105322105323105324105325105326105327105328105329105330105331105332105333105334105335105336105337105338105339105340105341105342105343105344105345105346105347105348105349105350105351105352105353105354105355105356105357105358105359105360105361105362105363105364105365105366105367105368105369105370105371105372105373105374105375105376105377105378105379105380105381105382105383105384105385105386105387105388105389105390105391105392105393105394105395105396105397105398105399105400105401105402105403105404105405105406105407105408105409105410105411105412105413105414105415105416105417105418105419105420105421105422105423105424105425105426105427105428105429105430105431105432105433105434105435105436105437105438105439105440105441105442105443105444105445105446105447105448105449105450105451105452105453105454105455105456105457105458105459105460105461105462105463105464105465105466105467105468105469105470105471105472105473105474105475105476105477105478105479105480105481105482105483105484105485105486105487105488105489105490105491105492105493105494105495105496105497105498105499105500105501105502105503105504105505105506105507105508105509105510105511105512105513105514105515105516105517105518105519105520105521105522105523105524105525105526105527105528105529105530105531105532105533105534105535105536105537105538105539105540105541105542105543105544105545105546105547105548105549105550105551105552105553105554105555105556105557105558105559105560105561105562105563105564105565105566105567105568105569105570105571105572105573105574105575105576105577105578105579105580105581105582105583105584105585105586105587105588105589105590105591105592105593105594105595105596105597105598105599105600105601105602105603105604105605105606105607105608105609105610105611105612105613105614105615105616105617105618105619105620105621105622105623105624105625105626105627105628105629105630105631105632105633105634105635105636105637105638105639105640105641105642105643105644105645105646105647105648105649105650105651105652105653105654105655105656105657105658105659105660105661105662105663105664105665105666105667105668105669105670105671105672105673105674105675105676105677105678105679105680105681105682105683105684105685105686105687105688105689105690105691105692105693105694105695105696105697105698105699105700105701105702105703105704105705105706105707105708105709105710105711105712105713105714105715105716105717105718105719105720105721105722105723105724105725105726105727105728105729105730105731105732105733105734105735105736105737105738105739105740105741105742105743105744105745105746105747105748105749105750105751105752105753105754105755105756105757105758105759105760105761105762105763105764105765105766105767105768105769105770105771105772105773105774105775105776105777105778105779105780105781105782105783105784105785105786105787105788105789105790105791105792105793105794105795105796105797105798105799105800105801105802105803105804105805105806105807105808105809105810105811105812105813105814105815105816105817105818105819105820105821105822105823105824105825105826105827105828105829105830105831105832105833105834105835105836105837105838105839105840105841105842105843105844105845105846105847105848105849105850105851105852105853105854105855105856105857105858105859105860105861105862105863105864105865105866105867105868105869105870105871105872105873105874105875105876105877105878105879105880105881105882105883105884105885105886105887105888105889105890105891105892105893105894105895105896105897105898105899105900105901105902105903105904105905105906105907105908105909105910105911105912105913105914105915105916105917105918105919105920105921105922105923105924105925105926105927105928105929105930105931105932105933105934105935105936105937105938105939105940105941105942105943105944105945105946105947105948105949105950105951105952105953105954105955105956105957105958105959105960105961105962105963105964105965105966105967105968105969105970105971105972105973105974105975105976105977105978105979105980105981105982105983105984105985105986105987105988105989105990105991105992105993105994105995105996105997105998105999106000106001106002106003106004106005106006106007106008106009106010106011106012106013106014106015106016106017106018106019106020106021106022106023106024106025106026106027106028106029106030106031106032106033106034106035106036106037106038106039106040106041106042106043106044106045106046106047106048106049106050106051106052106053106054106055106056106057106058106059106060106061106062106063106064106065106066106067106068106069106070106071106072106073106074106075106076106077106078106079106080106081106082106083106084106085106086106087106088106089106090106091106092106093106094106095106096106097106098106099106100106101106102106103106104106105106106106107106108106109106110106111106112106113106114106115106116106117106118106119106120106121106122106123106124106125106126106127106128106129106130106131106132106133106134106135106136106137106138106139106140106141106142106143106144106145106146106147106148106149106150106151106152106153106154106155106156106157106158106159106160106161106162106163106164106165106166106167106168106169106170106171106172106173106174106175106176106177106178106179106180106181106182106183106184106185106186106187106188106189106190106191106192106193106194106195106196106197106198106199106200106201106202106203106204106205106206106207106208106209106210106211106212106213106214106215106216106217106218106219106220106221106222106223106224106225106226106227106228106229106230106231106232106233106234106235106236106237106238106239106240106241106242106243106244106245106246106247106248106249106250106251106252106253106254106255106256106257106258106259106260106261106262106263106264106265106266106267106268106269106270106271106272106273106274106275106276106277106278106279106280106281106282106283106284106285106286106287106288106289106290106291106292106293106294106295106296106297106298106299106300106301106302106303106304106305106306106307106308106309106310106311106312106313106314106315106316106317106318106319106320106321106322106323106324106325106326106327106328106329106330106331106332106333106334106335106336106337106338106339106340106341106342106343106344106345106346106347106348106349106350106351106352106353106354106355106356106357106358106359106360106361106362106363106364106365106366106367106368106369106370106371106372106373106374106375106376106377106378106379106380106381106382106383106384106385106386106387106388106389106390106391106392106393106394106395106396106397106398106399106400106401106402106403106404106405106406106407106408106409106410106411106412106413106414106415106416106417106418106419106420106421106422106423106424106425106426106427106428106429106430106431106432106433106434106435106436106437106438106439106440106441106442106443106444106445106446106447106448106449106450106451106452106453106454106455106456106457106458106459106460106461106462106463106464106465106466106467106468106469106470106471106472106473106474106475106476106477106478106479106480106481106482106483106484106485106486106487106488106489106490106491106492106493106494106495106496106497106498106499106500106501106502106503106504106505106506106507106508106509106510106511106512106513106514106515106516106517106518106519106520106521106522106523106524106525106526106527106528106529106530106531106532106533106534106535106536106537106538106539106540106541106542106543106544106545106546106547106548106549106550106551106552106553106554106555106556106557106558106559106560106561106562106563106564106565106566106567106568106569106570106571106572106573106574106575106576106577106578106579106580106581106582106583106584106585106586106587106588106589106590106591106592106593106594106595106596106597106598106599106600106601106602106603106604106605106606106607106608106609106610106611106612106613106614106615106616106617106618106619106620106621106622106623106624106625106626106627106628106629106630106631106632106633106634106635106636106637106638106639106640106641106642106643106644106645106646106647106648106649106650106651106652106653106654106655106656106657106658106659106660106661106662106663106664106665106666106667106668106669106670106671106672106673106674106675106676106677106678106679106680106681106682106683106684106685106686106687106688106689106690106691106692106693106694106695106696106697106698106699106700106701106702106703106704106705106706106707106708106709106710106711106712106713106714106715106716106717106718106719106720106721106722106723106724106725106726106727106728106729106730106731106732106733106734106735106736106737106738106739106740106741106742106743106744106745106746106747106748106749106750106751106752106753106754106755106756106757106758106759106760106761106762106763106764106765106766106767106768106769106770106771106772106773106774106775106776106777106778106779106780106781106782106783106784106785106786106787106788106789106790106791106792106793106794106795106796106797106798106799106800106801106802106803106804106805106806106807106808106809106810106811106812106813106814106815106816106817106818106819106820106821106822106823106824106825106826106827106828106829106830106831106832106833106834106835106836106837106838106839106840106841106842106843106844106845106846106847106848106849106850106851106852106853106854106855106856106857106858106859106860106861106862106863106864106865106866106867106868106869106870106871106872106873106874106875106876106877106878106879106880106881106882106883106884106885106886106887106888106889106890106891106892106893106894106895106896106897106898106899106900106901106902106903106904106905106906106907106908106909106910106911106912106913106914106915106916106917106918106919106920106921106922106923106924106925106926106927106928106929106930106931106932106933106934106935106936106937106938106939106940106941106942106943106944106945106946106947106948106949106950106951106952106953106954106955106956106957106958106959106960106961106962106963106964106965106966106967106968106969106970106971106972106973106974106975106976106977106978106979106980106981106982106983106984106985106986106987106988106989106990106991106992106993106994106995106996106997106998106999107000107001107002107003107004107005107006107007107008107009107010107011107012107013107014107015107016107017107018107019107020107021107022107023107024107025107026107027107028107029107030107031107032107033107034107035107036107037107038107039107040107041107042107043107044107045107046107047107048107049107050107051107052107053107054107055107056107057107058107059107060107061107062107063107064107065107066107067107068107069107070107071107072107073107074107075107076107077107078107079107080107081107082107083107084107085107086107087107088107089107090107091107092107093107094107095107096107097107098107099107100107101107102107103107104107105107106107107107108107109107110107111107112107113107114107115107116107117107118107119107120107121107122107123107124107125107126107127107128107129107130107131107132107133107134107135107136107137107138107139107140107141107142107143107144107145107146107147107148107149107150107151107152107153107154107155107156107157107158107159107160107161107162107163107164107165107166107167107168107169107170107171107172107173107174107175107176107177107178107179107180107181107182107183107184107185107186107187107188107189107190107191107192107193107194107195107196107197107198107199107200107201107202107203107204107205107206107207107208107209107210107211107212107213107214107215107216107217107218107219107220107221107222107223107224107225107226107227107228107229107230107231107232107233107234107235107236107237107238107239107240107241107242107243107244107245107246107247107248107249107250107251107252107253107254107255107256107257107258107259107260107261107262107263107264107265107266107267107268107269107270107271107272107273107274107275107276107277107278107279107280107281107282107283107284107285107286107287107288107289107290107291107292107293107294107295107296107297107298107299107300107301107302107303107304107305107306107307107308107309107310107311107312107313107314107315107316107317107318107319107320107321107322107323107324107325107326107327107328107329107330107331107332107333107334107335107336107337107338107339107340107341107342107343107344107345107346107347107348107349107350107351107352107353107354107355107356107357107358107359107360107361107362107363107364107365107366107367107368107369107370107371107372107373107374107375107376107377107378107379107380107381107382107383107384107385107386107387107388107389107390107391107392107393107394107395107396107397107398107399107400107401107402107403107404107405107406107407107408107409107410107411107412107413107414107415107416107417107418107419107420107421107422107423107424107425107426107427107428107429107430107431107432107433107434107435107436107437107438107439107440107441107442107443107444107445107446107447107448107449107450107451107452107453107454107455107456107457107458107459107460107461107462107463107464107465107466107467107468107469107470107471107472107473107474107475107476107477107478107479107480107481107482107483107484107485107486107487107488107489107490107491107492107493107494107495107496107497107498107499107500107501107502107503107504107505107506107507107508107509107510107511107512107513107514107515107516107517107518107519107520107521107522107523107524107525107526107527107528107529107530107531107532107533107534107535107536107537107538107539107540107541107542107543107544107545107546107547107548107549107550107551107552107553107554107555107556107557107558107559107560107561107562107563107564107565107566107567107568107569107570107571107572107573107574107575107576107577107578107579107580107581107582107583107584107585107586107587107588107589107590107591107592107593107594107595107596107597107598107599107600107601107602107603107604107605107606107607107608107609107610107611107612107613107614107615107616107617107618107619107620107621107622107623107624107625107626107627107628107629107630107631107632107633107634107635107636107637107638107639107640107641107642107643107644107645107646107647107648107649107650107651107652107653107654107655107656107657107658107659107660107661107662107663107664107665107666107667107668107669107670107671107672107673107674107675107676107677107678107679107680107681107682107683107684107685107686107687107688107689107690107691107692107693107694107695107696107697107698107699107700107701107702107703107704107705107706107707107708107709107710107711107712107713107714107715107716107717107718107719107720107721107722107723107724107725107726107727107728107729107730107731107732107733107734107735107736107737107738107739107740107741107742107743107744107745107746107747107748107749107750107751107752107753107754107755107756107757107758107759107760107761107762107763107764107765107766107767107768107769107770107771107772107773107774107775107776107777107778107779107780107781107782107783107784107785107786107787107788107789107790107791107792107793107794107795107796107797107798107799107800107801107802107803107804107805107806107807107808107809107810107811107812107813107814107815107816107817107818107819107820107821107822107823107824107825107826107827107828107829107830107831107832107833107834107835107836107837107838107839107840107841107842107843107844107845107846107847107848107849107850107851107852107853107854107855107856107857107858107859107860107861107862107863107864107865107866107867107868107869107870107871107872107873107874107875107876107877107878107879107880107881107882107883107884107885107886107887107888107889107890107891107892107893107894107895107896107897107898107899107900107901107902107903107904107905107906107907107908107909107910107911107912107913107914107915107916107917107918107919107920107921107922107923107924107925107926107927107928107929107930107931107932107933107934107935107936107937107938107939107940107941107942107943107944107945107946107947107948107949107950107951107952107953107954107955107956107957107958107959107960107961107962107963107964107965107966107967107968107969107970107971107972107973107974107975107976107977107978107979107980107981107982107983107984107985107986107987107988107989107990107991107992107993107994107995107996107997107998107999108000108001108002108003108004108005108006108007108008108009108010108011108012108013108014108015108016108017108018108019108020108021108022108023108024108025108026108027108028108029108030108031108032108033108034108035108036108037108038108039108040108041108042108043108044108045108046108047108048108049108050108051108052108053108054108055108056108057108058108059108060108061108062108063108064108065108066108067108068108069108070108071108072108073108074108075108076108077108078108079108080108081108082108083108084108085108086108087108088108089108090108091108092108093108094108095108096108097108098108099108100108101108102108103108104108105108106108107108108108109108110108111108112108113108114108115108116108117108118108119108120108121108122108123108124108125108126108127108128108129108130108131108132108133108134108135108136108137108138108139108140108141108142108143108144108145108146108147108148108149108150108151108152108153108154108155108156108157108158108159108160108161108162108163108164108165108166108167108168108169108170108171108172108173108174108175108176108177108178108179108180108181108182108183108184108185108186108187108188108189108190108191108192108193108194108195108196108197108198108199108200108201108202108203108204108205108206108207108208108209108210108211108212108213108214108215108216108217108218108219108220108221108222108223108224108225108226108227108228108229108230108231108232108233108234108235108236108237108238108239108240108241108242108243108244108245108246108247108248108249108250108251108252108253108254108255108256108257108258108259108260108261108262108263108264108265108266108267108268108269108270108271108272108273108274108275108276108277108278108279108280108281108282108283108284108285108286108287108288108289108290108291108292108293108294108295108296108297108298108299108300108301108302108303108304108305108306108307108308108309108310108311108312108313108314108315108316108317108318108319108320108321108322108323108324108325108326108327108328108329108330108331108332108333108334108335108336108337108338108339108340108341108342108343108344108345108346108347108348108349108350108351108352108353108354108355108356108357108358108359108360108361108362108363108364108365108366108367108368108369108370108371108372108373108374108375108376108377108378108379108380108381108382108383108384108385108386108387108388108389108390108391108392108393108394108395108396108397108398108399108400108401108402108403108404108405108406108407108408108409108410108411108412108413108414108415108416108417108418108419108420108421108422108423108424108425108426108427108428108429108430108431108432108433108434108435108436108437108438108439108440108441108442108443108444108445108446108447108448108449108450108451108452108453108454108455108456108457108458108459108460108461108462108463108464108465108466108467108468108469108470108471108472108473108474108475108476108477108478108479108480108481108482108483108484108485108486108487108488108489108490108491108492108493108494108495108496108497108498108499108500108501108502108503108504108505108506108507108508108509108510108511108512108513108514108515108516108517108518108519108520108521108522108523108524108525108526108527108528108529108530108531108532108533108534108535108536108537108538108539108540108541108542108543108544108545108546108547108548108549108550108551108552108553108554108555108556108557108558108559108560108561108562108563108564108565108566108567108568108569108570108571108572108573108574108575108576108577108578108579108580108581108582108583108584108585108586108587108588108589108590108591108592108593108594108595108596108597108598108599108600108601108602108603108604108605108606108607108608108609108610108611108612108613108614108615108616108617108618108619108620108621108622108623108624108625108626108627108628108629108630108631108632108633108634108635108636108637108638108639108640108641108642108643108644108645108646108647108648108649108650108651108652108653108654108655108656108657108658108659108660108661108662108663108664108665108666108667108668108669108670108671108672108673108674108675108676108677108678108679108680108681108682108683108684108685108686108687108688108689108690108691108692108693108694108695108696108697108698108699108700108701108702108703108704108705108706108707108708108709108710108711108712108713108714108715108716108717108718108719108720108721108722108723108724108725108726108727108728108729108730108731108732108733108734108735108736108737108738108739108740108741108742108743108744108745108746108747108748108749108750108751108752108753108754108755108756108757108758108759108760108761108762108763108764108765108766108767108768108769108770108771108772108773108774108775108776108777108778108779108780108781108782108783108784108785108786108787108788108789108790108791108792108793108794108795108796108797108798108799108800108801108802108803108804108805108806108807108808108809108810108811108812108813108814108815108816108817108818108819108820108821108822108823108824108825108826108827108828108829108830108831108832108833108834108835108836108837108838108839108840108841108842108843108844108845108846108847108848108849108850108851108852108853108854108855108856108857108858108859108860108861108862108863108864108865108866108867108868108869108870108871108872108873108874108875108876108877108878108879108880108881108882108883108884108885108886108887108888108889108890108891108892108893108894108895108896108897108898108899108900108901108902108903108904108905108906108907108908108909108910108911108912108913108914108915108916108917108918108919108920108921108922108923108924108925108926108927108928108929108930108931108932108933108934108935108936108937108938108939108940108941108942108943108944108945108946108947108948108949108950108951108952108953108954108955108956108957108958108959108960108961108962108963108964108965108966108967108968108969108970108971108972108973108974108975108976108977108978108979108980108981108982108983108984108985108986108987108988108989108990108991108992108993108994108995108996108997108998108999109000109001109002109003109004109005109006109007109008109009109010109011109012109013109014109015109016109017109018109019109020109021109022109023109024109025109026109027109028109029109030109031109032109033109034109035109036109037109038109039109040109041109042109043109044109045109046109047109048109049109050109051109052109053109054109055109056109057109058109059109060109061109062109063109064109065109066109067109068109069109070109071109072109073109074109075109076109077109078109079109080109081109082109083109084109085109086109087109088109089109090109091109092109093109094109095109096109097109098109099109100109101109102109103109104109105109106109107109108109109109110109111109112109113109114109115109116109117109118109119109120109121109122109123109124109125109126109127109128109129109130109131109132109133109134109135109136109137109138109139109140109141109142109143109144109145109146109147109148109149109150109151109152109153109154109155109156109157109158109159109160109161109162109163109164109165109166109167109168109169109170109171109172109173109174109175109176109177109178109179109180109181109182109183109184109185109186109187109188109189109190109191109192109193109194109195109196109197109198109199109200109201109202109203109204109205109206109207109208109209109210109211109212109213109214109215109216109217109218109219109220109221109222109223109224109225109226109227109228109229109230109231109232109233109234109235109236109237109238109239109240109241109242109243109244109245109246109247109248109249109250109251109252109253109254109255109256109257109258109259109260109261109262109263109264109265109266109267109268109269109270109271109272109273109274109275109276109277109278109279109280109281109282109283109284109285109286109287109288109289109290109291109292109293109294109295109296109297109298109299109300109301109302109303109304109305109306109307109308109309109310109311109312109313109314109315109316109317109318109319109320109321109322109323109324109325109326109327109328109329109330109331109332109333109334109335109336109337109338109339109340109341109342109343109344109345109346109347109348109349109350109351109352109353109354109355109356109357109358109359109360109361109362109363109364109365109366109367109368109369109370109371109372109373109374109375109376109377109378109379109380109381109382109383109384109385109386109387109388109389109390109391109392109393109394109395109396109397109398109399109400109401109402109403109404109405109406109407109408109409109410109411109412109413109414109415109416109417109418109419109420109421109422109423109424109425109426109427109428109429109430109431109432109433109434109435109436109437109438109439109440109441109442109443109444109445109446109447109448109449109450109451109452109453109454109455109456109457109458109459109460109461109462109463109464109465109466109467109468109469109470109471109472109473109474109475109476109477109478109479109480109481109482109483109484109485109486109487109488109489109490109491109492109493109494109495109496109497109498109499109500109501109502109503109504109505109506109507109508109509109510109511109512109513109514109515109516109517109518109519109520109521109522109523109524109525109526109527109528109529109530109531109532109533109534109535109536109537109538109539109540109541109542109543109544109545109546109547109548109549109550109551109552109553109554109555109556109557109558109559109560109561109562109563109564109565109566109567109568109569109570109571109572109573109574109575109576109577109578109579109580109581109582109583109584109585109586109587109588109589109590109591109592109593109594109595109596109597109598109599109600109601109602109603109604109605109606109607109608109609109610109611109612109613109614109615109616109617109618109619109620109621109622109623109624109625109626109627109628109629109630109631109632109633109634109635109636109637109638109639109640109641109642109643109644109645109646109647109648109649109650109651109652109653109654109655109656109657109658109659109660109661109662109663109664109665109666109667109668109669109670109671109672109673109674109675109676109677109678109679109680109681109682109683109684109685109686109687109688109689109690109691109692109693109694109695109696109697109698109699109700109701109702109703109704109705109706109707109708109709109710109711109712109713109714109715109716109717109718109719109720109721109722109723109724109725109726109727109728109729109730109731109732109733109734109735109736109737109738109739109740109741109742109743109744109745109746109747109748109749109750109751109752109753109754109755109756109757109758109759109760109761109762109763109764109765109766109767109768109769109770109771109772109773109774109775109776109777109778109779109780109781109782109783109784109785109786109787109788109789109790109791109792109793109794109795109796109797109798109799109800109801109802109803109804109805109806109807109808109809109810109811109812109813109814109815109816109817109818109819109820109821109822109823109824109825109826109827109828109829109830109831109832109833109834109835109836109837109838109839109840109841109842109843109844109845109846109847109848109849109850109851109852109853109854109855109856109857109858109859109860109861109862109863109864109865109866109867109868109869109870109871109872109873109874109875109876109877109878109879109880109881109882109883109884109885109886109887109888109889109890109891109892109893109894109895109896109897109898109899109900109901109902109903109904109905109906109907109908109909109910109911109912109913109914109915109916109917109918109919109920109921109922109923109924109925109926109927109928109929109930109931109932109933109934109935109936109937109938109939109940109941109942109943109944109945109946109947109948109949109950109951109952109953109954109955109956109957109958109959109960109961109962109963109964109965109966109967109968109969109970109971109972109973109974109975109976109977109978109979109980109981109982109983109984109985109986109987109988109989109990109991109992109993109994109995109996109997109998109999110000110001110002110003110004110005110006110007110008110009110010110011110012110013110014110015110016110017110018110019110020110021110022110023110024110025110026110027110028110029110030110031110032110033110034110035110036110037110038110039110040110041110042110043110044110045110046110047110048110049110050110051110052110053110054110055110056110057110058110059110060110061110062110063110064110065110066110067110068110069110070110071110072110073110074110075110076110077110078110079110080110081110082110083110084110085110086110087110088110089110090110091110092110093110094110095110096110097110098110099110100110101110102110103110104110105110106110107110108110109110110110111110112110113110114110115110116110117110118110119110120110121110122110123110124110125110126110127110128110129110130110131110132110133110134110135110136110137110138110139110140110141110142110143110144110145110146110147110148110149110150110151110152110153110154110155110156110157110158110159110160110161110162110163110164110165110166110167110168110169110170110171110172110173110174110175110176110177110178110179110180110181110182110183110184110185110186110187110188110189110190110191110192110193110194110195110196110197110198110199110200110201110202110203110204110205110206110207110208110209110210110211110212110213110214110215110216110217110218110219110220110221110222110223110224110225110226110227110228110229110230110231110232110233110234110235110236110237110238110239110240110241110242110243110244110245110246110247110248110249110250110251110252110253110254110255110256110257110258110259110260110261110262110263110264110265110266110267110268110269110270110271110272110273110274110275110276110277110278110279110280110281110282110283110284110285110286110287110288110289110290110291110292110293110294110295110296110297110298110299110300110301110302110303110304110305110306110307110308110309110310110311110312110313110314110315110316110317110318110319110320110321110322110323110324110325110326110327110328110329110330110331110332110333110334110335110336110337110338110339110340110341110342110343110344110345110346110347110348110349110350110351110352110353110354110355110356110357110358110359110360110361110362110363110364110365110366110367110368110369110370110371110372110373110374110375110376110377110378110379110380110381110382110383110384110385110386110387110388110389110390110391110392110393110394110395110396110397110398110399110400110401110402110403110404110405110406110407110408110409110410110411110412110413110414110415110416110417110418110419110420110421110422110423110424110425110426110427110428110429110430110431110432110433110434110435110436110437110438110439110440110441110442110443110444110445110446110447110448110449110450110451110452110453110454110455110456110457110458110459110460110461110462110463110464110465110466110467110468110469110470110471110472110473110474110475110476110477110478110479110480110481110482110483110484110485110486110487110488110489110490110491110492110493110494110495110496110497110498110499110500110501110502110503110504110505110506110507110508110509110510110511110512110513110514110515110516110517110518110519110520110521110522110523110524110525110526110527110528110529110530110531110532110533110534110535110536110537110538110539110540110541110542110543110544110545110546110547110548110549110550110551110552110553110554110555110556110557110558110559110560110561110562110563110564110565110566110567110568110569110570110571110572110573110574110575110576110577110578110579110580110581110582110583110584110585110586110587110588110589110590110591110592110593110594110595110596110597110598110599110600110601110602110603110604110605110606110607110608110609110610110611110612110613110614110615110616110617110618110619110620110621110622110623110624110625110626110627110628110629110630110631110632110633110634110635110636110637110638110639110640110641110642110643110644110645110646110647110648110649110650110651110652110653110654110655110656110657110658110659110660110661110662110663110664110665110666110667110668110669110670110671110672110673110674110675110676110677110678110679110680110681110682110683110684110685110686110687110688110689110690110691110692110693110694110695110696110697110698110699110700110701110702110703110704110705110706110707110708110709110710110711110712110713110714110715110716110717110718110719110720110721110722110723110724110725110726110727110728110729110730110731110732110733110734110735110736110737110738110739110740110741110742110743110744110745110746110747110748110749110750110751110752110753110754110755110756110757110758110759110760110761110762110763110764110765110766110767110768110769110770110771110772110773110774110775110776110777110778110779110780110781110782110783110784110785110786110787110788110789110790110791110792110793110794110795110796110797110798110799110800110801110802110803110804110805110806110807110808110809110810110811110812110813110814110815110816110817110818110819110820110821110822110823110824110825110826110827110828110829110830110831110832110833110834110835110836110837110838110839110840110841110842110843110844110845110846110847110848110849110850110851110852110853110854110855110856110857110858110859110860110861110862110863110864110865110866110867110868110869110870110871110872110873110874110875110876110877110878110879110880110881110882110883110884110885110886110887110888110889110890110891110892110893110894110895110896110897110898110899110900110901110902110903110904110905110906110907110908110909110910110911110912110913110914110915110916110917110918110919110920110921110922110923110924110925110926110927110928110929110930110931110932110933110934110935110936110937110938110939110940110941110942110943110944110945110946110947110948110949110950110951110952110953110954110955110956110957110958110959110960110961110962110963110964110965110966110967110968110969110970110971110972110973110974110975110976110977110978110979110980110981110982110983110984110985110986110987110988110989110990110991110992110993110994110995110996110997110998110999111000111001111002111003111004111005111006111007111008111009111010111011111012111013111014111015111016111017111018111019111020111021111022111023111024111025111026111027111028111029111030111031111032111033111034111035111036111037111038111039111040111041111042111043111044111045111046111047111048111049111050111051111052111053111054111055111056111057111058111059111060111061111062111063111064111065111066111067111068111069111070111071111072111073111074111075111076111077111078111079111080111081111082111083111084111085111086111087111088111089111090111091111092111093111094111095111096111097111098111099111100111101111102111103111104111105111106111107111108111109111110111111111112111113111114111115111116111117111118111119111120111121111122111123111124111125111126111127111128111129111130111131111132111133111134111135111136111137111138111139111140111141111142111143111144111145111146111147111148111149111150111151111152111153111154111155111156111157111158111159111160111161111162111163111164111165111166111167111168111169111170111171111172111173111174111175111176111177111178111179111180111181111182111183111184111185111186111187111188111189111190111191111192111193111194111195111196111197111198111199111200111201111202111203111204111205111206111207111208111209111210111211111212111213111214111215111216111217111218111219111220111221111222111223111224111225111226111227111228111229111230111231111232111233111234111235111236111237111238111239111240111241111242111243111244111245111246111247111248111249111250111251111252111253111254111255111256111257111258111259111260111261111262111263111264111265111266111267111268111269111270111271111272111273111274111275111276111277111278111279111280111281111282111283111284111285111286111287111288111289111290111291111292111293111294111295111296111297111298111299111300111301111302111303111304111305111306111307111308111309111310111311111312111313111314111315111316111317111318111319111320111321111322111323111324111325111326111327111328111329111330111331111332111333111334111335111336111337111338111339111340111341111342111343111344111345111346111347111348111349111350111351111352111353111354111355111356111357111358111359111360111361111362111363111364111365111366111367111368111369111370111371111372111373111374111375111376111377111378111379111380111381111382111383111384111385111386111387111388111389111390111391111392111393111394111395111396111397111398111399111400111401111402111403111404111405111406111407111408111409111410111411111412111413111414111415111416111417111418111419111420111421111422111423111424111425111426111427111428111429111430111431111432111433111434111435111436111437111438111439111440111441111442111443111444111445111446111447111448111449111450111451111452111453111454111455111456111457111458111459111460111461111462111463111464111465111466111467111468111469111470111471111472111473111474111475111476111477111478111479111480111481111482111483111484111485111486111487111488111489111490111491111492111493111494111495111496111497111498111499111500111501111502111503111504111505111506111507111508111509111510111511111512111513111514111515111516111517111518111519111520111521111522111523111524111525111526111527111528111529111530111531111532111533111534111535111536111537111538111539111540111541111542111543111544111545111546111547111548111549111550111551111552111553111554111555111556111557111558111559111560111561111562111563111564111565111566111567111568111569111570111571111572111573111574111575111576111577111578111579111580111581111582111583111584111585111586111587111588111589111590111591111592111593111594111595111596111597111598111599111600111601111602111603111604111605111606111607111608111609111610111611111612111613111614111615111616111617111618111619111620111621111622111623111624111625111626111627111628111629111630111631111632111633111634111635111636111637111638111639111640111641111642111643111644111645111646111647111648111649111650111651111652111653111654111655111656111657111658111659111660111661111662111663111664111665111666111667111668111669111670111671111672111673111674111675111676111677111678111679111680111681111682111683111684111685111686111687111688111689111690111691111692111693111694111695111696111697111698111699111700111701111702111703111704111705111706111707111708111709111710111711111712111713111714111715111716111717111718111719111720111721111722111723111724111725111726111727111728111729111730111731111732111733111734111735111736111737111738111739111740111741111742111743111744111745111746111747111748111749111750111751111752111753111754111755111756111757111758111759111760111761111762111763111764111765111766111767111768111769111770111771111772111773111774111775111776111777111778111779111780111781111782111783111784111785111786111787111788111789111790111791111792111793111794111795111796111797111798111799111800111801111802111803111804111805111806111807111808111809111810111811111812111813111814111815111816111817111818111819111820111821111822111823111824111825111826111827111828111829111830111831111832111833111834111835111836111837111838111839111840111841111842111843111844111845111846111847111848111849111850111851111852111853111854111855111856111857111858111859111860111861111862111863111864111865111866111867111868111869111870111871111872111873111874111875111876111877111878111879111880111881111882111883111884111885111886111887111888111889111890111891111892111893111894111895111896111897111898111899111900111901111902111903111904111905111906111907111908111909111910111911111912111913111914111915111916111917111918111919111920111921111922111923111924111925111926111927111928111929111930111931111932111933111934111935111936111937111938111939111940111941111942111943111944111945111946111947111948111949111950111951111952111953111954111955111956111957111958111959111960111961111962111963111964111965111966111967111968111969111970111971111972111973111974111975111976111977111978111979111980111981111982111983111984111985111986111987111988111989111990111991111992111993111994111995111996111997111998111999112000112001112002112003112004112005112006112007112008112009112010112011112012112013112014112015112016112017112018112019112020112021112022112023112024112025112026112027112028112029112030112031112032112033112034112035112036112037112038112039112040112041112042112043112044112045112046112047112048112049112050112051112052112053112054112055112056112057112058112059112060112061112062112063112064112065112066112067112068112069112070112071112072112073112074112075112076112077112078112079112080112081112082112083112084112085112086112087112088112089112090112091112092112093112094112095112096112097112098112099112100112101112102112103112104112105112106112107112108112109112110112111112112112113112114112115112116112117112118112119112120112121112122112123112124112125112126112127112128112129112130112131112132112133112134112135112136112137112138112139112140112141112142112143112144112145112146112147112148112149112150112151112152112153112154112155112156112157112158112159112160112161112162112163112164112165112166112167112168112169112170112171112172112173112174112175112176112177112178112179112180112181112182112183112184112185112186112187112188112189112190112191112192112193112194112195112196112197112198112199112200112201112202112203112204112205112206112207112208112209112210112211112212112213112214112215112216112217112218112219112220112221112222112223112224112225112226112227112228112229112230112231112232112233112234112235112236112237112238112239112240112241112242112243112244112245112246112247112248112249112250112251112252112253112254112255112256112257112258112259112260112261112262112263112264112265112266112267112268112269112270112271112272112273112274112275112276112277112278112279112280112281112282112283112284112285112286112287112288112289112290112291112292112293112294112295112296112297112298112299112300112301112302112303112304112305112306112307112308112309112310112311112312112313112314112315112316112317112318112319112320112321112322112323112324112325112326112327112328112329112330112331112332112333112334112335112336112337112338112339112340112341112342112343112344112345112346112347112348112349112350112351112352112353112354112355112356112357112358112359112360112361112362112363112364112365112366112367112368112369112370112371112372112373112374112375112376112377112378112379112380112381112382112383112384112385112386112387112388112389112390112391112392112393112394112395112396112397112398112399112400112401112402112403112404112405112406112407112408112409112410112411112412112413112414112415112416112417112418112419112420112421112422112423112424112425112426112427112428112429112430112431112432112433112434112435112436112437112438112439112440112441112442112443 |
- (global["webpackJsonp"] = global["webpackJsonp"] || []).push([["common/vendor"],[
- /* 0 */,
- /* 1 */
- /*!*********************************************************!*\
- !*** ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js ***!
- \*********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var objectKeys = ['qy', 'env', 'error', 'version', 'lanDebug', 'cloud', 'serviceMarket', 'router', 'worklet', '__webpack_require_UNI_MP_PLUGIN__'];
- var singlePageDisableKey = ['lanDebug', 'router', 'worklet'];
- var target = typeof globalThis !== 'undefined' ? globalThis : function () {
- return this;
- }();
- var key = ['w', 'x'].join('');
- var oldWx = target[key];
- var launchOption = oldWx.getLaunchOptionsSync ? oldWx.getLaunchOptionsSync() : null;
- function isWxKey(key) {
- if (launchOption && launchOption.scene === 1154 && singlePageDisableKey.includes(key)) {
- return false;
- }
- return objectKeys.indexOf(key) > -1 || typeof oldWx[key] === 'function';
- }
- function initWx() {
- var newWx = {};
- for (var _key in oldWx) {
- if (isWxKey(_key)) {
- // TODO wrapper function
- newWx[_key] = oldWx[_key];
- }
- }
- return newWx;
- }
- target[key] = initWx();
- var _default = target[key];
- exports.default = _default;
- /***/ }),
- /* 2 */
- /*!************************************************************!*\
- !*** ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js ***!
- \************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(wx, global) {
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.createApp = createApp;
- exports.createComponent = createComponent;
- exports.createPage = createPage;
- exports.createPlugin = createPlugin;
- exports.createSubpackageApp = createSubpackageApp;
- exports.default = void 0;
- var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 5));
- var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
- var _construct2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/construct */ 15));
- var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ 18));
- var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
- var _uniI18n = __webpack_require__(/*! @dcloudio/uni-i18n */ 22);
- var _vue = _interopRequireDefault(__webpack_require__(/*! vue */ 25));
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
- var realAtob;
- var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
- var b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
- if (typeof atob !== 'function') {
- realAtob = function realAtob(str) {
- str = String(str).replace(/[\t\n\f\r ]+/g, '');
- if (!b64re.test(str)) {
- throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
- }
- // Adding the padding if missing, for semplicity
- str += '=='.slice(2 - (str.length & 3));
- var bitmap;
- var result = '';
- var r1;
- var r2;
- var i = 0;
- for (; i < str.length;) {
- bitmap = b64.indexOf(str.charAt(i++)) << 18 | b64.indexOf(str.charAt(i++)) << 12 | (r1 = b64.indexOf(str.charAt(i++))) << 6 | (r2 = b64.indexOf(str.charAt(i++)));
- result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255) : r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255) : String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255, bitmap & 255);
- }
- return result;
- };
- } else {
- // 注意atob只能在全局对象上调用,例如:`const Base64 = {atob};Base64.atob('xxxx')`是错误的用法
- realAtob = atob;
- }
- function b64DecodeUnicode(str) {
- return decodeURIComponent(realAtob(str).split('').map(function (c) {
- return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
- }).join(''));
- }
- function getCurrentUserInfo() {
- var token = wx.getStorageSync('uni_id_token') || '';
- var tokenArr = token.split('.');
- if (!token || tokenArr.length !== 3) {
- return {
- uid: null,
- role: [],
- permission: [],
- tokenExpired: 0
- };
- }
- var userInfo;
- try {
- userInfo = JSON.parse(b64DecodeUnicode(tokenArr[1]));
- } catch (error) {
- throw new Error('获取当前用户信息出错,详细错误信息为:' + error.message);
- }
- userInfo.tokenExpired = userInfo.exp * 1000;
- delete userInfo.exp;
- delete userInfo.iat;
- return userInfo;
- }
- function uniIdMixin(Vue) {
- Vue.prototype.uniIDHasRole = function (roleId) {
- var _getCurrentUserInfo = getCurrentUserInfo(),
- role = _getCurrentUserInfo.role;
- return role.indexOf(roleId) > -1;
- };
- Vue.prototype.uniIDHasPermission = function (permissionId) {
- var _getCurrentUserInfo2 = getCurrentUserInfo(),
- permission = _getCurrentUserInfo2.permission;
- return this.uniIDHasRole('admin') || permission.indexOf(permissionId) > -1;
- };
- Vue.prototype.uniIDTokenValid = function () {
- var _getCurrentUserInfo3 = getCurrentUserInfo(),
- tokenExpired = _getCurrentUserInfo3.tokenExpired;
- return tokenExpired > Date.now();
- };
- }
- var _toString = Object.prototype.toString;
- var hasOwnProperty = Object.prototype.hasOwnProperty;
- function isFn(fn) {
- return typeof fn === 'function';
- }
- function isStr(str) {
- return typeof str === 'string';
- }
- function isObject(obj) {
- return obj !== null && (0, _typeof2.default)(obj) === 'object';
- }
- function isPlainObject(obj) {
- return _toString.call(obj) === '[object Object]';
- }
- function hasOwn(obj, key) {
- return hasOwnProperty.call(obj, key);
- }
- function noop() {}
- /**
- * Create a cached version of a pure function.
- */
- function cached(fn) {
- var cache = Object.create(null);
- return function cachedFn(str) {
- var hit = cache[str];
- return hit || (cache[str] = fn(str));
- };
- }
- /**
- * Camelize a hyphen-delimited string.
- */
- var camelizeRE = /-(\w)/g;
- var camelize = cached(function (str) {
- return str.replace(camelizeRE, function (_, c) {
- return c ? c.toUpperCase() : '';
- });
- });
- function sortObject(obj) {
- var sortObj = {};
- if (isPlainObject(obj)) {
- Object.keys(obj).sort().forEach(function (key) {
- sortObj[key] = obj[key];
- });
- }
- return !Object.keys(sortObj) ? obj : sortObj;
- }
- var HOOKS = ['invoke', 'success', 'fail', 'complete', 'returnValue'];
- var globalInterceptors = {};
- var scopedInterceptors = {};
- function mergeHook(parentVal, childVal) {
- var res = childVal ? parentVal ? parentVal.concat(childVal) : Array.isArray(childVal) ? childVal : [childVal] : parentVal;
- return res ? dedupeHooks(res) : res;
- }
- function dedupeHooks(hooks) {
- var res = [];
- for (var i = 0; i < hooks.length; i++) {
- if (res.indexOf(hooks[i]) === -1) {
- res.push(hooks[i]);
- }
- }
- return res;
- }
- function removeHook(hooks, hook) {
- var index = hooks.indexOf(hook);
- if (index !== -1) {
- hooks.splice(index, 1);
- }
- }
- function mergeInterceptorHook(interceptor, option) {
- Object.keys(option).forEach(function (hook) {
- if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
- interceptor[hook] = mergeHook(interceptor[hook], option[hook]);
- }
- });
- }
- function removeInterceptorHook(interceptor, option) {
- if (!interceptor || !option) {
- return;
- }
- Object.keys(option).forEach(function (hook) {
- if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
- removeHook(interceptor[hook], option[hook]);
- }
- });
- }
- function addInterceptor(method, option) {
- if (typeof method === 'string' && isPlainObject(option)) {
- mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), option);
- } else if (isPlainObject(method)) {
- mergeInterceptorHook(globalInterceptors, method);
- }
- }
- function removeInterceptor(method, option) {
- if (typeof method === 'string') {
- if (isPlainObject(option)) {
- removeInterceptorHook(scopedInterceptors[method], option);
- } else {
- delete scopedInterceptors[method];
- }
- } else if (isPlainObject(method)) {
- removeInterceptorHook(globalInterceptors, method);
- }
- }
- function wrapperHook(hook, params) {
- return function (data) {
- return hook(data, params) || data;
- };
- }
- function isPromise(obj) {
- return !!obj && ((0, _typeof2.default)(obj) === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
- }
- function queue(hooks, data, params) {
- var promise = false;
- for (var i = 0; i < hooks.length; i++) {
- var hook = hooks[i];
- if (promise) {
- promise = Promise.resolve(wrapperHook(hook, params));
- } else {
- var res = hook(data, params);
- if (isPromise(res)) {
- promise = Promise.resolve(res);
- }
- if (res === false) {
- return {
- then: function then() {}
- };
- }
- }
- }
- return promise || {
- then: function then(callback) {
- return callback(data);
- }
- };
- }
- function wrapperOptions(interceptor) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- ['success', 'fail', 'complete'].forEach(function (name) {
- if (Array.isArray(interceptor[name])) {
- var oldCallback = options[name];
- options[name] = function callbackInterceptor(res) {
- queue(interceptor[name], res, options).then(function (res) {
- /* eslint-disable no-mixed-operators */
- return isFn(oldCallback) && oldCallback(res) || res;
- });
- };
- }
- });
- return options;
- }
- function wrapperReturnValue(method, returnValue) {
- var returnValueHooks = [];
- if (Array.isArray(globalInterceptors.returnValue)) {
- returnValueHooks.push.apply(returnValueHooks, (0, _toConsumableArray2.default)(globalInterceptors.returnValue));
- }
- var interceptor = scopedInterceptors[method];
- if (interceptor && Array.isArray(interceptor.returnValue)) {
- returnValueHooks.push.apply(returnValueHooks, (0, _toConsumableArray2.default)(interceptor.returnValue));
- }
- returnValueHooks.forEach(function (hook) {
- returnValue = hook(returnValue) || returnValue;
- });
- return returnValue;
- }
- function getApiInterceptorHooks(method) {
- var interceptor = Object.create(null);
- Object.keys(globalInterceptors).forEach(function (hook) {
- if (hook !== 'returnValue') {
- interceptor[hook] = globalInterceptors[hook].slice();
- }
- });
- var scopedInterceptor = scopedInterceptors[method];
- if (scopedInterceptor) {
- Object.keys(scopedInterceptor).forEach(function (hook) {
- if (hook !== 'returnValue') {
- interceptor[hook] = (interceptor[hook] || []).concat(scopedInterceptor[hook]);
- }
- });
- }
- return interceptor;
- }
- function invokeApi(method, api, options) {
- for (var _len = arguments.length, params = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
- params[_key - 3] = arguments[_key];
- }
- var interceptor = getApiInterceptorHooks(method);
- if (interceptor && Object.keys(interceptor).length) {
- if (Array.isArray(interceptor.invoke)) {
- var res = queue(interceptor.invoke, options);
- return res.then(function (options) {
- // 重新访问 getApiInterceptorHooks, 允许 invoke 中再次调用 addInterceptor,removeInterceptor
- return api.apply(void 0, [wrapperOptions(getApiInterceptorHooks(method), options)].concat(params));
- });
- } else {
- return api.apply(void 0, [wrapperOptions(interceptor, options)].concat(params));
- }
- }
- return api.apply(void 0, [options].concat(params));
- }
- var promiseInterceptor = {
- returnValue: function returnValue(res) {
- if (!isPromise(res)) {
- return res;
- }
- return new Promise(function (resolve, reject) {
- res.then(function (res) {
- if (!res) {
- resolve(res);
- return;
- }
- if (res[0]) {
- reject(res[0]);
- } else {
- resolve(res[1]);
- }
- });
- });
- }
- };
- var SYNC_API_RE = /^\$|Window$|WindowStyle$|sendHostEvent|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|rpx2px|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getLocale|setLocale|invokePushCallback|getWindowInfo|getDeviceInfo|getAppBaseInfo|getSystemSetting|getAppAuthorizeSetting|initUTS|requireUTS|registerUTS/;
- var CONTEXT_API_RE = /^create|Manager$/;
- // Context例外情况
- var CONTEXT_API_RE_EXC = ['createBLEConnection'];
- // 同步例外情况
- var ASYNC_API = ['createBLEConnection', 'createPushMessage'];
- var CALLBACK_API_RE = /^on|^off/;
- function isContextApi(name) {
- return CONTEXT_API_RE.test(name) && CONTEXT_API_RE_EXC.indexOf(name) === -1;
- }
- function isSyncApi(name) {
- return SYNC_API_RE.test(name) && ASYNC_API.indexOf(name) === -1;
- }
- function isCallbackApi(name) {
- return CALLBACK_API_RE.test(name) && name !== 'onPush';
- }
- function handlePromise(promise) {
- return promise.then(function (data) {
- return [null, data];
- }).catch(function (err) {
- return [err];
- });
- }
- function shouldPromise(name) {
- if (isContextApi(name) || isSyncApi(name) || isCallbackApi(name)) {
- return false;
- }
- return true;
- }
- /* eslint-disable no-extend-native */
- if (!Promise.prototype.finally) {
- Promise.prototype.finally = function (callback) {
- var promise = this.constructor;
- return this.then(function (value) {
- return promise.resolve(callback()).then(function () {
- return value;
- });
- }, function (reason) {
- return promise.resolve(callback()).then(function () {
- throw reason;
- });
- });
- };
- }
- function promisify(name, api) {
- if (!shouldPromise(name) || !isFn(api)) {
- return api;
- }
- return function promiseApi() {
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
- params[_key2 - 1] = arguments[_key2];
- }
- if (isFn(options.success) || isFn(options.fail) || isFn(options.complete)) {
- return wrapperReturnValue(name, invokeApi.apply(void 0, [name, api, options].concat(params)));
- }
- return wrapperReturnValue(name, handlePromise(new Promise(function (resolve, reject) {
- invokeApi.apply(void 0, [name, api, Object.assign({}, options, {
- success: resolve,
- fail: reject
- })].concat(params));
- })));
- };
- }
- var EPS = 1e-4;
- var BASE_DEVICE_WIDTH = 750;
- var isIOS = false;
- var deviceWidth = 0;
- var deviceDPR = 0;
- function checkDeviceWidth() {
- var _Object$assign = Object.assign({}, wx.getWindowInfo(), {
- platform: wx.getDeviceInfo().platform
- }),
- windowWidth = _Object$assign.windowWidth,
- pixelRatio = _Object$assign.pixelRatio,
- platform = _Object$assign.platform; // uni=>wx runtime 编译目标是 uni 对象,内部不允许直接使用 uni
- deviceWidth = windowWidth;
- deviceDPR = pixelRatio;
- isIOS = platform === 'ios';
- }
- function upx2px(number, newDeviceWidth) {
- if (deviceWidth === 0) {
- checkDeviceWidth();
- }
- number = Number(number);
- if (number === 0) {
- return 0;
- }
- var result = number / BASE_DEVICE_WIDTH * (newDeviceWidth || deviceWidth);
- if (result < 0) {
- result = -result;
- }
- result = Math.floor(result + EPS);
- if (result === 0) {
- if (deviceDPR === 1 || !isIOS) {
- result = 1;
- } else {
- result = 0.5;
- }
- }
- return number < 0 ? -result : result;
- }
- var LOCALE_ZH_HANS = 'zh-Hans';
- var LOCALE_ZH_HANT = 'zh-Hant';
- var LOCALE_EN = 'en';
- var LOCALE_FR = 'fr';
- var LOCALE_ES = 'es';
- var messages = {};
- var locale;
- {
- locale = normalizeLocale(wx.getAppBaseInfo().language) || LOCALE_EN;
- }
- function initI18nMessages() {
- if (!isEnableLocale()) {
- return;
- }
- var localeKeys = Object.keys(__uniConfig.locales);
- if (localeKeys.length) {
- localeKeys.forEach(function (locale) {
- var curMessages = messages[locale];
- var userMessages = __uniConfig.locales[locale];
- if (curMessages) {
- Object.assign(curMessages, userMessages);
- } else {
- messages[locale] = userMessages;
- }
- });
- }
- }
- initI18nMessages();
- var i18n = (0, _uniI18n.initVueI18n)(locale, {});
- var t = i18n.t;
- var i18nMixin = i18n.mixin = {
- beforeCreate: function beforeCreate() {
- var _this = this;
- var unwatch = i18n.i18n.watchLocale(function () {
- _this.$forceUpdate();
- });
- this.$once('hook:beforeDestroy', function () {
- unwatch();
- });
- },
- methods: {
- $$t: function $$t(key, values) {
- return t(key, values);
- }
- }
- };
- var setLocale = i18n.setLocale;
- var getLocale = i18n.getLocale;
- function initAppLocale(Vue, appVm, locale) {
- var state = Vue.observable({
- locale: locale || i18n.getLocale()
- });
- var localeWatchers = [];
- appVm.$watchLocale = function (fn) {
- localeWatchers.push(fn);
- };
- Object.defineProperty(appVm, '$locale', {
- get: function get() {
- return state.locale;
- },
- set: function set(v) {
- state.locale = v;
- localeWatchers.forEach(function (watch) {
- return watch(v);
- });
- }
- });
- }
- function isEnableLocale() {
- return typeof __uniConfig !== 'undefined' && __uniConfig.locales && !!Object.keys(__uniConfig.locales).length;
- }
- function include(str, parts) {
- return !!parts.find(function (part) {
- return str.indexOf(part) !== -1;
- });
- }
- function startsWith(str, parts) {
- return parts.find(function (part) {
- return str.indexOf(part) === 0;
- });
- }
- function normalizeLocale(locale, messages) {
- if (!locale) {
- return;
- }
- locale = locale.trim().replace(/_/g, '-');
- if (messages && messages[locale]) {
- return locale;
- }
- locale = locale.toLowerCase();
- if (locale === 'chinese') {
- // 支付宝
- return LOCALE_ZH_HANS;
- }
- if (locale.indexOf('zh') === 0) {
- if (locale.indexOf('-hans') > -1) {
- return LOCALE_ZH_HANS;
- }
- if (locale.indexOf('-hant') > -1) {
- return LOCALE_ZH_HANT;
- }
- if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) {
- return LOCALE_ZH_HANT;
- }
- return LOCALE_ZH_HANS;
- }
- var lang = startsWith(locale, [LOCALE_EN, LOCALE_FR, LOCALE_ES]);
- if (lang) {
- return lang;
- }
- }
- // export function initI18n() {
- // const localeKeys = Object.keys(__uniConfig.locales || {})
- // if (localeKeys.length) {
- // localeKeys.forEach((locale) =>
- // i18n.add(locale, __uniConfig.locales[locale])
- // )
- // }
- // }
- function getLocale$1() {
- // 优先使用 $locale
- if (isFn(getApp)) {
- var app = getApp({
- allowDefault: true
- });
- if (app && app.$vm) {
- return app.$vm.$locale;
- }
- }
- return normalizeLocale(wx.getAppBaseInfo().language) || LOCALE_EN;
- }
- function setLocale$1(locale) {
- var app = isFn(getApp) ? getApp() : false;
- if (!app) {
- return false;
- }
- var oldLocale = app.$vm.$locale;
- if (oldLocale !== locale) {
- app.$vm.$locale = locale;
- onLocaleChangeCallbacks.forEach(function (fn) {
- return fn({
- locale: locale
- });
- });
- return true;
- }
- return false;
- }
- var onLocaleChangeCallbacks = [];
- function onLocaleChange(fn) {
- if (onLocaleChangeCallbacks.indexOf(fn) === -1) {
- onLocaleChangeCallbacks.push(fn);
- }
- }
- if (typeof global !== 'undefined') {
- global.getLocale = getLocale$1;
- }
- var interceptors = {
- promiseInterceptor: promiseInterceptor
- };
- var baseApi = /*#__PURE__*/Object.freeze({
- __proto__: null,
- upx2px: upx2px,
- rpx2px: upx2px,
- getLocale: getLocale$1,
- setLocale: setLocale$1,
- onLocaleChange: onLocaleChange,
- addInterceptor: addInterceptor,
- removeInterceptor: removeInterceptor,
- interceptors: interceptors
- });
- function findExistsPageIndex(url) {
- var pages = getCurrentPages();
- var len = pages.length;
- while (len--) {
- var page = pages[len];
- if (page.$page && page.$page.fullPath === url) {
- return len;
- }
- }
- return -1;
- }
- var redirectTo = {
- name: function name(fromArgs) {
- if (fromArgs.exists === 'back' && fromArgs.delta) {
- return 'navigateBack';
- }
- return 'redirectTo';
- },
- args: function args(fromArgs) {
- if (fromArgs.exists === 'back' && fromArgs.url) {
- var existsPageIndex = findExistsPageIndex(fromArgs.url);
- if (existsPageIndex !== -1) {
- var delta = getCurrentPages().length - 1 - existsPageIndex;
- if (delta > 0) {
- fromArgs.delta = delta;
- }
- }
- }
- }
- };
- var previewImage = {
- args: function args(fromArgs) {
- var currentIndex = parseInt(fromArgs.current);
- if (isNaN(currentIndex)) {
- return;
- }
- var urls = fromArgs.urls;
- if (!Array.isArray(urls)) {
- return;
- }
- var len = urls.length;
- if (!len) {
- return;
- }
- if (currentIndex < 0) {
- currentIndex = 0;
- } else if (currentIndex >= len) {
- currentIndex = len - 1;
- }
- if (currentIndex > 0) {
- fromArgs.current = urls[currentIndex];
- fromArgs.urls = urls.filter(function (item, index) {
- return index < currentIndex ? item !== urls[currentIndex] : true;
- });
- } else {
- fromArgs.current = urls[0];
- }
- return {
- indicator: false,
- loop: false
- };
- }
- };
- var UUID_KEY = '__DC_STAT_UUID';
- var deviceId;
- function useDeviceId(result) {
- deviceId = deviceId || wx.getStorageSync(UUID_KEY);
- if (!deviceId) {
- deviceId = Date.now() + '' + Math.floor(Math.random() * 1e7);
- wx.setStorage({
- key: UUID_KEY,
- data: deviceId
- });
- }
- result.deviceId = deviceId;
- }
- function addSafeAreaInsets(result) {
- if (result.safeArea) {
- var safeArea = result.safeArea;
- result.safeAreaInsets = {
- top: safeArea.top,
- left: safeArea.left,
- right: result.windowWidth - safeArea.right,
- bottom: result.screenHeight - safeArea.bottom
- };
- }
- }
- function populateParameters(result) {
- var _result$brand = result.brand,
- brand = _result$brand === void 0 ? '' : _result$brand,
- _result$model = result.model,
- model = _result$model === void 0 ? '' : _result$model,
- _result$system = result.system,
- system = _result$system === void 0 ? '' : _result$system,
- _result$language = result.language,
- language = _result$language === void 0 ? '' : _result$language,
- theme = result.theme,
- version = result.version,
- platform = result.platform,
- fontSizeSetting = result.fontSizeSetting,
- SDKVersion = result.SDKVersion,
- pixelRatio = result.pixelRatio,
- deviceOrientation = result.deviceOrientation;
- // const isQuickApp = "mp-weixin".indexOf('quickapp-webview') !== -1
- var extraParam = {};
- // osName osVersion
- var osName = '';
- var osVersion = '';
- {
- osName = system.split(' ')[0] || '';
- osVersion = system.split(' ')[1] || '';
- }
- var hostVersion = version;
- // deviceType
- var deviceType = getGetDeviceType(result, model);
- // deviceModel
- var deviceBrand = getDeviceBrand(brand);
- // hostName
- var _hostName = getHostName(result);
- // deviceOrientation
- var _deviceOrientation = deviceOrientation; // 仅 微信 百度 支持
- // devicePixelRatio
- var _devicePixelRatio = pixelRatio;
- // SDKVersion
- var _SDKVersion = SDKVersion;
- // hostLanguage
- var hostLanguage = (language || '').replace(/_/g, '-');
- // wx.getAccountInfoSync
- var parameters = {
- appId: "__UNI__4A158B4",
- appName: "v3-H5",
- appVersion: "1.0.0",
- appVersionCode: "100",
- appLanguage: getAppLanguage(hostLanguage),
- uniCompileVersion: "4.45",
- uniCompilerVersion: "4.45",
- uniRuntimeVersion: "4.45",
- uniPlatform: undefined || "mp-weixin",
- deviceBrand: deviceBrand,
- deviceModel: model,
- deviceType: deviceType,
- devicePixelRatio: _devicePixelRatio,
- deviceOrientation: _deviceOrientation,
- osName: osName.toLocaleLowerCase(),
- osVersion: osVersion,
- hostTheme: theme,
- hostVersion: hostVersion,
- hostLanguage: hostLanguage,
- hostName: _hostName,
- hostSDKVersion: _SDKVersion,
- hostFontSizeSetting: fontSizeSetting,
- windowTop: 0,
- windowBottom: 0,
- // TODO
- osLanguage: undefined,
- osTheme: undefined,
- ua: undefined,
- hostPackageName: undefined,
- browserName: undefined,
- browserVersion: undefined,
- isUniAppX: false
- };
- Object.assign(result, parameters, extraParam);
- }
- function getGetDeviceType(result, model) {
- var deviceType = result.deviceType || 'phone';
- {
- var deviceTypeMaps = {
- ipad: 'pad',
- windows: 'pc',
- mac: 'pc'
- };
- var deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
- var _model = model.toLocaleLowerCase();
- for (var index = 0; index < deviceTypeMapsKeys.length; index++) {
- var _m = deviceTypeMapsKeys[index];
- if (_model.indexOf(_m) !== -1) {
- deviceType = deviceTypeMaps[_m];
- break;
- }
- }
- }
- return deviceType;
- }
- function getDeviceBrand(brand) {
- var deviceBrand = brand;
- if (deviceBrand) {
- deviceBrand = brand.toLocaleLowerCase();
- }
- return deviceBrand;
- }
- function getAppLanguage(defaultLanguage) {
- return getLocale$1 ? getLocale$1() : defaultLanguage;
- }
- function getHostName(result) {
- var _platform = 'WeChat';
- var _hostName = result.hostName || _platform; // mp-jd
- {
- if (result.environment) {
- _hostName = result.environment;
- } else if (result.host && result.host.env) {
- _hostName = result.host.env;
- }
- }
- return _hostName;
- }
- var getSystemInfo = {
- returnValue: function returnValue(result) {
- useDeviceId(result);
- addSafeAreaInsets(result);
- populateParameters(result);
- }
- };
- var showActionSheet = {
- args: function args(fromArgs) {
- if ((0, _typeof2.default)(fromArgs) === 'object') {
- fromArgs.alertText = fromArgs.title;
- }
- }
- };
- var getAppBaseInfo = {
- returnValue: function returnValue(result) {
- var _result = result,
- version = _result.version,
- language = _result.language,
- SDKVersion = _result.SDKVersion,
- theme = _result.theme;
- var _hostName = getHostName(result);
- var hostLanguage = (language || '').replace('_', '-');
- result = sortObject(Object.assign(result, {
- appId: "__UNI__4A158B4",
- appName: "v3-H5",
- appVersion: "1.0.0",
- appVersionCode: "100",
- appLanguage: getAppLanguage(hostLanguage),
- hostVersion: version,
- hostLanguage: hostLanguage,
- hostName: _hostName,
- hostSDKVersion: SDKVersion,
- hostTheme: theme,
- isUniAppX: false,
- uniPlatform: undefined || "mp-weixin",
- uniCompileVersion: "4.45",
- uniCompilerVersion: "4.45",
- uniRuntimeVersion: "4.45"
- }));
- }
- };
- var getDeviceInfo = {
- returnValue: function returnValue(result) {
- var _result2 = result,
- brand = _result2.brand,
- model = _result2.model;
- var deviceType = getGetDeviceType(result, model);
- var deviceBrand = getDeviceBrand(brand);
- useDeviceId(result);
- result = sortObject(Object.assign(result, {
- deviceType: deviceType,
- deviceBrand: deviceBrand,
- deviceModel: model
- }));
- }
- };
- var getWindowInfo = {
- returnValue: function returnValue(result) {
- addSafeAreaInsets(result);
- result = sortObject(Object.assign(result, {
- windowTop: 0,
- windowBottom: 0
- }));
- }
- };
- var getAppAuthorizeSetting = {
- returnValue: function returnValue(result) {
- var locationReducedAccuracy = result.locationReducedAccuracy;
- result.locationAccuracy = 'unsupported';
- if (locationReducedAccuracy === true) {
- result.locationAccuracy = 'reduced';
- } else if (locationReducedAccuracy === false) {
- result.locationAccuracy = 'full';
- }
- }
- };
- // import navigateTo from 'uni-helpers/navigate-to'
- var compressImage = {
- args: function args(fromArgs) {
- // https://developers.weixin.qq.com/community/develop/doc/000c08940c865011298e0a43256800?highLine=compressHeight
- if (fromArgs.compressedHeight && !fromArgs.compressHeight) {
- fromArgs.compressHeight = fromArgs.compressedHeight;
- }
- if (fromArgs.compressedWidth && !fromArgs.compressWidth) {
- fromArgs.compressWidth = fromArgs.compressedWidth;
- }
- }
- };
- var protocols = {
- redirectTo: redirectTo,
- // navigateTo, // 由于在微信开发者工具的页面参数,会显示__id__参数,因此暂时关闭mp-weixin对于navigateTo的AOP
- previewImage: previewImage,
- getSystemInfo: getSystemInfo,
- getSystemInfoSync: getSystemInfo,
- showActionSheet: showActionSheet,
- getAppBaseInfo: getAppBaseInfo,
- getDeviceInfo: getDeviceInfo,
- getWindowInfo: getWindowInfo,
- getAppAuthorizeSetting: getAppAuthorizeSetting,
- compressImage: compressImage
- };
- var todos = ['vibrate', 'preloadPage', 'unPreloadPage', 'loadSubPackage'];
- var canIUses = [];
- var CALLBACKS = ['success', 'fail', 'cancel', 'complete'];
- function processCallback(methodName, method, returnValue) {
- return function (res) {
- return method(processReturnValue(methodName, res, returnValue));
- };
- }
- function processArgs(methodName, fromArgs) {
- var argsOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- var returnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
- var keepFromArgs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
- if (isPlainObject(fromArgs)) {
- // 一般 api 的参数解析
- var toArgs = keepFromArgs === true ? fromArgs : {}; // returnValue 为 false 时,说明是格式化返回值,直接在返回值对象上修改赋值
- if (isFn(argsOption)) {
- argsOption = argsOption(fromArgs, toArgs) || {};
- }
- for (var key in fromArgs) {
- if (hasOwn(argsOption, key)) {
- var keyOption = argsOption[key];
- if (isFn(keyOption)) {
- keyOption = keyOption(fromArgs[key], fromArgs, toArgs);
- }
- if (!keyOption) {
- // 不支持的参数
- console.warn("The '".concat(methodName, "' method of platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support option '").concat(key, "'"));
- } else if (isStr(keyOption)) {
- // 重写参数 key
- toArgs[keyOption] = fromArgs[key];
- } else if (isPlainObject(keyOption)) {
- // {name:newName,value:value}可重新指定参数 key:value
- toArgs[keyOption.name ? keyOption.name : key] = keyOption.value;
- }
- } else if (CALLBACKS.indexOf(key) !== -1) {
- if (isFn(fromArgs[key])) {
- toArgs[key] = processCallback(methodName, fromArgs[key], returnValue);
- }
- } else {
- if (!keepFromArgs) {
- toArgs[key] = fromArgs[key];
- }
- }
- }
- return toArgs;
- } else if (isFn(fromArgs)) {
- fromArgs = processCallback(methodName, fromArgs, returnValue);
- }
- return fromArgs;
- }
- function processReturnValue(methodName, res, returnValue) {
- var keepReturnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
- if (isFn(protocols.returnValue)) {
- // 处理通用 returnValue
- res = protocols.returnValue(methodName, res);
- }
- return processArgs(methodName, res, returnValue, {}, keepReturnValue);
- }
- function wrapper(methodName, method) {
- if (hasOwn(protocols, methodName)) {
- var protocol = protocols[methodName];
- if (!protocol) {
- // 暂不支持的 api
- return function () {
- console.error("Platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support '".concat(methodName, "'."));
- };
- }
- return function (arg1, arg2) {
- // 目前 api 最多两个参数
- var options = protocol;
- if (isFn(protocol)) {
- options = protocol(arg1);
- }
- arg1 = processArgs(methodName, arg1, options.args, options.returnValue);
- var args = [arg1];
- if (typeof arg2 !== 'undefined') {
- args.push(arg2);
- }
- if (isFn(options.name)) {
- methodName = options.name(arg1);
- } else if (isStr(options.name)) {
- methodName = options.name;
- }
- var returnValue = wx[methodName].apply(wx, args);
- if (isSyncApi(methodName)) {
- // 同步 api
- return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName));
- }
- return returnValue;
- };
- }
- return method;
- }
- var todoApis = Object.create(null);
- var TODOS = ['onTabBarMidButtonTap', 'subscribePush', 'unsubscribePush', 'onPush', 'offPush', 'share'];
- function createTodoApi(name) {
- return function todoApi(_ref) {
- var fail = _ref.fail,
- complete = _ref.complete;
- var res = {
- errMsg: "".concat(name, ":fail method '").concat(name, "' not supported")
- };
- isFn(fail) && fail(res);
- isFn(complete) && complete(res);
- };
- }
- TODOS.forEach(function (name) {
- todoApis[name] = createTodoApi(name);
- });
- var providers = {
- oauth: ['weixin'],
- share: ['weixin'],
- payment: ['wxpay'],
- push: ['weixin']
- };
- function getProvider(_ref2) {
- var service = _ref2.service,
- success = _ref2.success,
- fail = _ref2.fail,
- complete = _ref2.complete;
- var res = false;
- if (providers[service]) {
- res = {
- errMsg: 'getProvider:ok',
- service: service,
- provider: providers[service]
- };
- isFn(success) && success(res);
- } else {
- res = {
- errMsg: 'getProvider:fail service not found'
- };
- isFn(fail) && fail(res);
- }
- isFn(complete) && complete(res);
- }
- var extraApi = /*#__PURE__*/Object.freeze({
- __proto__: null,
- getProvider: getProvider
- });
- var getEmitter = function () {
- var Emitter;
- return function getUniEmitter() {
- if (!Emitter) {
- Emitter = new _vue.default();
- }
- return Emitter;
- };
- }();
- function apply(ctx, method, args) {
- return ctx[method].apply(ctx, args);
- }
- function $on() {
- return apply(getEmitter(), '$on', Array.prototype.slice.call(arguments));
- }
- function $off() {
- return apply(getEmitter(), '$off', Array.prototype.slice.call(arguments));
- }
- function $once() {
- return apply(getEmitter(), '$once', Array.prototype.slice.call(arguments));
- }
- function $emit() {
- return apply(getEmitter(), '$emit', Array.prototype.slice.call(arguments));
- }
- var eventApi = /*#__PURE__*/Object.freeze({
- __proto__: null,
- $on: $on,
- $off: $off,
- $once: $once,
- $emit: $emit
- });
- /**
- * 框架内 try-catch
- */
- /**
- * 开发者 try-catch
- */
- function tryCatch(fn) {
- return function () {
- try {
- return fn.apply(fn, arguments);
- } catch (e) {
- // TODO
- console.error(e);
- }
- };
- }
- function getApiCallbacks(params) {
- var apiCallbacks = {};
- for (var name in params) {
- var param = params[name];
- if (isFn(param)) {
- apiCallbacks[name] = tryCatch(param);
- delete params[name];
- }
- }
- return apiCallbacks;
- }
- var cid;
- var cidErrMsg;
- var enabled;
- function normalizePushMessage(message) {
- try {
- return JSON.parse(message);
- } catch (e) {}
- return message;
- }
- function invokePushCallback(args) {
- if (args.type === 'enabled') {
- enabled = true;
- } else if (args.type === 'clientId') {
- cid = args.cid;
- cidErrMsg = args.errMsg;
- invokeGetPushCidCallbacks(cid, args.errMsg);
- } else if (args.type === 'pushMsg') {
- var message = {
- type: 'receive',
- data: normalizePushMessage(args.message)
- };
- for (var i = 0; i < onPushMessageCallbacks.length; i++) {
- var callback = onPushMessageCallbacks[i];
- callback(message);
- // 该消息已被阻止
- if (message.stopped) {
- break;
- }
- }
- } else if (args.type === 'click') {
- onPushMessageCallbacks.forEach(function (callback) {
- callback({
- type: 'click',
- data: normalizePushMessage(args.message)
- });
- });
- }
- }
- var getPushCidCallbacks = [];
- function invokeGetPushCidCallbacks(cid, errMsg) {
- getPushCidCallbacks.forEach(function (callback) {
- callback(cid, errMsg);
- });
- getPushCidCallbacks.length = 0;
- }
- function getPushClientId(args) {
- if (!isPlainObject(args)) {
- args = {};
- }
- var _getApiCallbacks = getApiCallbacks(args),
- success = _getApiCallbacks.success,
- fail = _getApiCallbacks.fail,
- complete = _getApiCallbacks.complete;
- var hasSuccess = isFn(success);
- var hasFail = isFn(fail);
- var hasComplete = isFn(complete);
- Promise.resolve().then(function () {
- if (typeof enabled === 'undefined') {
- enabled = false;
- cid = '';
- cidErrMsg = 'uniPush is not enabled';
- }
- getPushCidCallbacks.push(function (cid, errMsg) {
- var res;
- if (cid) {
- res = {
- errMsg: 'getPushClientId:ok',
- cid: cid
- };
- hasSuccess && success(res);
- } else {
- res = {
- errMsg: 'getPushClientId:fail' + (errMsg ? ' ' + errMsg : '')
- };
- hasFail && fail(res);
- }
- hasComplete && complete(res);
- });
- if (typeof cid !== 'undefined') {
- invokeGetPushCidCallbacks(cid, cidErrMsg);
- }
- });
- }
- var onPushMessageCallbacks = [];
- // 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
- var onPushMessage = function onPushMessage(fn) {
- if (onPushMessageCallbacks.indexOf(fn) === -1) {
- onPushMessageCallbacks.push(fn);
- }
- };
- var offPushMessage = function offPushMessage(fn) {
- if (!fn) {
- onPushMessageCallbacks.length = 0;
- } else {
- var index = onPushMessageCallbacks.indexOf(fn);
- if (index > -1) {
- onPushMessageCallbacks.splice(index, 1);
- }
- }
- };
- var baseInfo = wx.getAppBaseInfo && wx.getAppBaseInfo();
- if (!baseInfo) {
- baseInfo = wx.getSystemInfoSync();
- }
- var host = baseInfo ? baseInfo.host : null;
- var shareVideoMessage = host && host.env === 'SAAASDK' ? wx.miniapp.shareVideoMessage : wx.shareVideoMessage;
- var api = /*#__PURE__*/Object.freeze({
- __proto__: null,
- shareVideoMessage: shareVideoMessage,
- getPushClientId: getPushClientId,
- onPushMessage: onPushMessage,
- offPushMessage: offPushMessage,
- invokePushCallback: invokePushCallback
- });
- var mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__'];
- function findVmByVueId(vm, vuePid) {
- var $children = vm.$children;
- // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200)
- for (var i = $children.length - 1; i >= 0; i--) {
- var childVm = $children[i];
- if (childVm.$scope._$vueId === vuePid) {
- return childVm;
- }
- }
- // 反向递归查找
- var parentVm;
- for (var _i = $children.length - 1; _i >= 0; _i--) {
- parentVm = findVmByVueId($children[_i], vuePid);
- if (parentVm) {
- return parentVm;
- }
- }
- }
- function initBehavior(options) {
- return Behavior(options);
- }
- function isPage() {
- return !!this.route;
- }
- function initRelation(detail) {
- this.triggerEvent('__l', detail);
- }
- function selectAllComponents(mpInstance, selector, $refs) {
- var components = mpInstance.selectAllComponents(selector) || [];
- components.forEach(function (component) {
- var ref = component.dataset.ref;
- $refs[ref] = component.$vm || toSkip(component);
- {
- if (component.dataset.vueGeneric === 'scoped') {
- component.selectAllComponents('.scoped-ref').forEach(function (scopedComponent) {
- selectAllComponents(scopedComponent, selector, $refs);
- });
- }
- }
- });
- }
- function syncRefs(refs, newRefs) {
- var oldKeys = (0, _construct2.default)(Set, (0, _toConsumableArray2.default)(Object.keys(refs)));
- var newKeys = Object.keys(newRefs);
- newKeys.forEach(function (key) {
- var oldValue = refs[key];
- var newValue = newRefs[key];
- if (Array.isArray(oldValue) && Array.isArray(newValue) && oldValue.length === newValue.length && newValue.every(function (value) {
- return oldValue.includes(value);
- })) {
- return;
- }
- refs[key] = newValue;
- oldKeys.delete(key);
- });
- oldKeys.forEach(function (key) {
- delete refs[key];
- });
- return refs;
- }
- function initRefs(vm) {
- var mpInstance = vm.$scope;
- var refs = {};
- Object.defineProperty(vm, '$refs', {
- get: function get() {
- var $refs = {};
- selectAllComponents(mpInstance, '.vue-ref', $refs);
- // TODO 暂不考虑 for 中的 scoped
- var forComponents = mpInstance.selectAllComponents('.vue-ref-in-for') || [];
- forComponents.forEach(function (component) {
- var ref = component.dataset.ref;
- if (!$refs[ref]) {
- $refs[ref] = [];
- }
- $refs[ref].push(component.$vm || toSkip(component));
- });
- return syncRefs(refs, $refs);
- }
- });
- }
- function handleLink(event) {
- var _ref3 = event.detail || event.value,
- vuePid = _ref3.vuePid,
- vueOptions = _ref3.vueOptions; // detail 是微信,value 是百度(dipatch)
- var parentVm;
- if (vuePid) {
- parentVm = findVmByVueId(this.$vm, vuePid);
- }
- if (!parentVm) {
- parentVm = this.$vm;
- }
- vueOptions.parent = parentVm;
- }
- function markMPComponent(component) {
- // 在 Vue 中标记为小程序组件
- var IS_MP = '__v_isMPComponent';
- Object.defineProperty(component, IS_MP, {
- configurable: true,
- enumerable: false,
- value: true
- });
- return component;
- }
- function toSkip(obj) {
- var OB = '__ob__';
- var SKIP = '__v_skip';
- if (isObject(obj) && Object.isExtensible(obj)) {
- // 避免被 @vue/composition-api 观测
- Object.defineProperty(obj, OB, {
- configurable: true,
- enumerable: false,
- value: (0, _defineProperty2.default)({}, SKIP, true)
- });
- }
- return obj;
- }
- var WORKLET_RE = /_(.*)_worklet_factory_/;
- function initWorkletMethods(mpMethods, vueMethods) {
- if (vueMethods) {
- Object.keys(vueMethods).forEach(function (name) {
- var matches = name.match(WORKLET_RE);
- if (matches) {
- var workletName = matches[1];
- mpMethods[name] = vueMethods[name];
- mpMethods[workletName] = vueMethods[workletName];
- }
- });
- }
- }
- var MPPage = Page;
- var MPComponent = Component;
- var customizeRE = /:/g;
- var customize = cached(function (str) {
- return camelize(str.replace(customizeRE, '-'));
- });
- function initTriggerEvent(mpInstance) {
- var oldTriggerEvent = mpInstance.triggerEvent;
- var newTriggerEvent = function newTriggerEvent(event) {
- for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
- args[_key3 - 1] = arguments[_key3];
- }
- // 事件名统一转驼峰格式,仅处理:当前组件为 vue 组件、当前组件为 vue 组件子组件
- if (this.$vm || this.dataset && this.dataset.comType) {
- event = customize(event);
- } else {
- // 针对微信/QQ小程序单独补充驼峰格式事件,以兼容历史项目
- var newEvent = customize(event);
- if (newEvent !== event) {
- oldTriggerEvent.apply(this, [newEvent].concat(args));
- }
- }
- return oldTriggerEvent.apply(this, [event].concat(args));
- };
- try {
- // 京东小程序 triggerEvent 为只读
- mpInstance.triggerEvent = newTriggerEvent;
- } catch (error) {
- mpInstance._triggerEvent = newTriggerEvent;
- }
- }
- function initHook(name, options, isComponent) {
- var oldHook = options[name];
- options[name] = function () {
- markMPComponent(this);
- initTriggerEvent(this);
- if (oldHook) {
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
- args[_key4] = arguments[_key4];
- }
- return oldHook.apply(this, args);
- }
- };
- }
- if (!MPPage.__$wrappered) {
- MPPage.__$wrappered = true;
- Page = function Page() {
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- initHook('onLoad', options);
- return MPPage(options);
- };
- Page.after = MPPage.after;
- Component = function Component() {
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- initHook('created', options);
- return MPComponent(options);
- };
- }
- var PAGE_EVENT_HOOKS = ['onPullDownRefresh', 'onReachBottom', 'onAddToFavorites', 'onShareTimeline', 'onShareAppMessage', 'onPageScroll', 'onResize', 'onTabItemTap'];
- function initMocks(vm, mocks) {
- var mpInstance = vm.$mp[vm.mpType];
- mocks.forEach(function (mock) {
- if (hasOwn(mpInstance, mock)) {
- vm[mock] = mpInstance[mock];
- }
- });
- }
- function hasHook(hook, vueOptions) {
- if (!vueOptions) {
- return true;
- }
- if (_vue.default.options && Array.isArray(_vue.default.options[hook])) {
- return true;
- }
- vueOptions = vueOptions.default || vueOptions;
- if (isFn(vueOptions)) {
- if (isFn(vueOptions.extendOptions[hook])) {
- return true;
- }
- if (vueOptions.super && vueOptions.super.options && Array.isArray(vueOptions.super.options[hook])) {
- return true;
- }
- return false;
- }
- if (isFn(vueOptions[hook]) || Array.isArray(vueOptions[hook])) {
- return true;
- }
- var mixins = vueOptions.mixins;
- if (Array.isArray(mixins)) {
- return !!mixins.find(function (mixin) {
- return hasHook(hook, mixin);
- });
- }
- }
- function initHooks(mpOptions, hooks, vueOptions) {
- hooks.forEach(function (hook) {
- if (hasHook(hook, vueOptions)) {
- mpOptions[hook] = function (args) {
- return this.$vm && this.$vm.__call_hook(hook, args);
- };
- }
- });
- }
- function initUnknownHooks(mpOptions, vueOptions) {
- var excludes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
- findHooks(vueOptions).forEach(function (hook) {
- return initHook$1(mpOptions, hook, excludes);
- });
- }
- function findHooks(vueOptions) {
- var hooks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
- if (vueOptions) {
- Object.keys(vueOptions).forEach(function (name) {
- if (name.indexOf('on') === 0 && isFn(vueOptions[name])) {
- hooks.push(name);
- }
- });
- }
- return hooks;
- }
- function initHook$1(mpOptions, hook, excludes) {
- if (excludes.indexOf(hook) === -1 && !hasOwn(mpOptions, hook)) {
- mpOptions[hook] = function (args) {
- return this.$vm && this.$vm.__call_hook(hook, args);
- };
- }
- }
- function initVueComponent(Vue, vueOptions) {
- vueOptions = vueOptions.default || vueOptions;
- var VueComponent;
- if (isFn(vueOptions)) {
- VueComponent = vueOptions;
- } else {
- VueComponent = Vue.extend(vueOptions);
- }
- vueOptions = VueComponent.options;
- return [VueComponent, vueOptions];
- }
- function initSlots(vm, vueSlots) {
- if (Array.isArray(vueSlots) && vueSlots.length) {
- var $slots = Object.create(null);
- vueSlots.forEach(function (slotName) {
- $slots[slotName] = true;
- });
- vm.$scopedSlots = vm.$slots = $slots;
- }
- }
- function initVueIds(vueIds, mpInstance) {
- vueIds = (vueIds || '').split(',');
- var len = vueIds.length;
- if (len === 1) {
- mpInstance._$vueId = vueIds[0];
- } else if (len === 2) {
- mpInstance._$vueId = vueIds[0];
- mpInstance._$vuePid = vueIds[1];
- }
- }
- function initData(vueOptions, context) {
- var data = vueOptions.data || {};
- var methods = vueOptions.methods || {};
- if (typeof data === 'function') {
- try {
- data = data.call(context); // 支持 Vue.prototype 上挂的数据
- } catch (e) {
- if (Object({"NODE_ENV":"development","VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"v3-H5","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG) {
- console.warn('根据 Vue 的 data 函数初始化小程序 data 失败,请尽量确保 data 函数中不访问 vm 对象,否则可能影响首次数据渲染速度。', data);
- }
- }
- } else {
- try {
- // 对 data 格式化
- data = JSON.parse(JSON.stringify(data));
- } catch (e) {}
- }
- if (!isPlainObject(data)) {
- data = {};
- }
- Object.keys(methods).forEach(function (methodName) {
- if (context.__lifecycle_hooks__.indexOf(methodName) === -1 && !hasOwn(data, methodName)) {
- data[methodName] = methods[methodName];
- }
- });
- return data;
- }
- var PROP_TYPES = [String, Number, Boolean, Object, Array, null];
- function createObserver(name) {
- return function observer(newVal, oldVal) {
- if (this.$vm) {
- this.$vm[name] = newVal; // 为了触发其他非 render watcher
- }
- };
- }
- function initBehaviors(vueOptions, initBehavior) {
- var vueBehaviors = vueOptions.behaviors;
- var vueExtends = vueOptions.extends;
- var vueMixins = vueOptions.mixins;
- var vueProps = vueOptions.props;
- if (!vueProps) {
- vueOptions.props = vueProps = [];
- }
- var behaviors = [];
- if (Array.isArray(vueBehaviors)) {
- vueBehaviors.forEach(function (behavior) {
- behaviors.push(behavior.replace('uni://', "wx".concat("://")));
- if (behavior === 'uni://form-field') {
- if (Array.isArray(vueProps)) {
- vueProps.push('name');
- vueProps.push('value');
- } else {
- vueProps.name = {
- type: String,
- default: ''
- };
- vueProps.value = {
- type: [String, Number, Boolean, Array, Object, Date],
- default: ''
- };
- }
- }
- });
- }
- if (isPlainObject(vueExtends) && vueExtends.props) {
- behaviors.push(initBehavior({
- properties: initProperties(vueExtends.props, true)
- }));
- }
- if (Array.isArray(vueMixins)) {
- vueMixins.forEach(function (vueMixin) {
- if (isPlainObject(vueMixin) && vueMixin.props) {
- behaviors.push(initBehavior({
- properties: initProperties(vueMixin.props, true)
- }));
- }
- });
- }
- return behaviors;
- }
- function parsePropType(key, type, defaultValue, file) {
- // [String]=>String
- if (Array.isArray(type) && type.length === 1) {
- return type[0];
- }
- return type;
- }
- function initProperties(props) {
- var isBehavior = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- var file = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
- var options = arguments.length > 3 ? arguments[3] : undefined;
- var properties = {};
- if (!isBehavior) {
- properties.vueId = {
- type: String,
- value: ''
- };
- {
- if (options.virtualHost) {
- properties.virtualHostStyle = {
- type: null,
- value: ''
- };
- properties.virtualHostClass = {
- type: null,
- value: ''
- };
- }
- }
- // scopedSlotsCompiler auto
- properties.scopedSlotsCompiler = {
- type: String,
- value: ''
- };
- properties.vueSlots = {
- // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
- type: null,
- value: [],
- observer: function observer(newVal, oldVal) {
- var $slots = Object.create(null);
- newVal.forEach(function (slotName) {
- $slots[slotName] = true;
- });
- this.setData({
- $slots: $slots
- });
- }
- };
- }
- if (Array.isArray(props)) {
- // ['title']
- props.forEach(function (key) {
- properties[key] = {
- type: null,
- observer: createObserver(key)
- };
- });
- } else if (isPlainObject(props)) {
- // {title:{type:String,default:''},content:String}
- Object.keys(props).forEach(function (key) {
- var opts = props[key];
- if (isPlainObject(opts)) {
- // title:{type:String,default:''}
- var value = opts.default;
- if (isFn(value)) {
- value = value();
- }
- opts.type = parsePropType(key, opts.type);
- properties[key] = {
- type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null,
- value: value,
- observer: createObserver(key)
- };
- } else {
- // content:String
- var type = parsePropType(key, opts);
- properties[key] = {
- type: PROP_TYPES.indexOf(type) !== -1 ? type : null,
- observer: createObserver(key)
- };
- }
- });
- }
- return properties;
- }
- function wrapper$1(event) {
- // TODO 又得兼容 mpvue 的 mp 对象
- try {
- event.mp = JSON.parse(JSON.stringify(event));
- } catch (e) {}
- event.stopPropagation = noop;
- event.preventDefault = noop;
- event.target = event.target || {};
- if (!hasOwn(event, 'detail')) {
- event.detail = {};
- }
- if (hasOwn(event, 'markerId')) {
- event.detail = (0, _typeof2.default)(event.detail) === 'object' ? event.detail : {};
- event.detail.markerId = event.markerId;
- }
- if (isPlainObject(event.detail)) {
- event.target = Object.assign({}, event.target, event.detail);
- }
- return event;
- }
- function getExtraValue(vm, dataPathsArray) {
- var context = vm;
- dataPathsArray.forEach(function (dataPathArray) {
- var dataPath = dataPathArray[0];
- var value = dataPathArray[2];
- if (dataPath || typeof value !== 'undefined') {
- // ['','',index,'disable']
- var propPath = dataPathArray[1];
- var valuePath = dataPathArray[3];
- var vFor;
- if (Number.isInteger(dataPath)) {
- vFor = dataPath;
- } else if (!dataPath) {
- vFor = context;
- } else if (typeof dataPath === 'string' && dataPath) {
- if (dataPath.indexOf('#s#') === 0) {
- vFor = dataPath.substr(3);
- } else {
- vFor = vm.__get_value(dataPath, context);
- }
- }
- if (Number.isInteger(vFor)) {
- context = value;
- } else if (!propPath) {
- context = vFor[value];
- } else {
- if (Array.isArray(vFor)) {
- context = vFor.find(function (vForItem) {
- return vm.__get_value(propPath, vForItem) === value;
- });
- } else if (isPlainObject(vFor)) {
- context = Object.keys(vFor).find(function (vForKey) {
- return vm.__get_value(propPath, vFor[vForKey]) === value;
- });
- } else {
- console.error('v-for 暂不支持循环数据:', vFor);
- }
- }
- if (valuePath) {
- context = vm.__get_value(valuePath, context);
- }
- }
- });
- return context;
- }
- function processEventExtra(vm, extra, event, __args__) {
- var extraObj = {};
- if (Array.isArray(extra) && extra.length) {
- /**
- *[
- * ['data.items', 'data.id', item.data.id],
- * ['metas', 'id', meta.id]
- *],
- *[
- * ['data.items', 'data.id', item.data.id],
- * ['metas', 'id', meta.id]
- *],
- *'test'
- */
- extra.forEach(function (dataPath, index) {
- if (typeof dataPath === 'string') {
- if (!dataPath) {
- // model,prop.sync
- extraObj['$' + index] = vm;
- } else {
- if (dataPath === '$event') {
- // $event
- extraObj['$' + index] = event;
- } else if (dataPath === 'arguments') {
- extraObj['$' + index] = event.detail ? event.detail.__args__ || __args__ : __args__;
- } else if (dataPath.indexOf('$event.') === 0) {
- // $event.target.value
- extraObj['$' + index] = vm.__get_value(dataPath.replace('$event.', ''), event);
- } else {
- extraObj['$' + index] = vm.__get_value(dataPath);
- }
- }
- } else {
- extraObj['$' + index] = getExtraValue(vm, dataPath);
- }
- });
- }
- return extraObj;
- }
- function getObjByArray(arr) {
- var obj = {};
- for (var i = 1; i < arr.length; i++) {
- var element = arr[i];
- obj[element[0]] = element[1];
- }
- return obj;
- }
- function processEventArgs(vm, event) {
- var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
- var extra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
- var isCustom = arguments.length > 4 ? arguments[4] : undefined;
- var methodName = arguments.length > 5 ? arguments[5] : undefined;
- var isCustomMPEvent = false; // wxcomponent 组件,传递原始 event 对象
- // fixed 用户直接触发 mpInstance.triggerEvent
- var __args__ = isPlainObject(event.detail) ? event.detail.__args__ || [event.detail] : [event.detail];
- if (isCustom) {
- // 自定义事件
- isCustomMPEvent = event.currentTarget && event.currentTarget.dataset && event.currentTarget.dataset.comType === 'wx';
- if (!args.length) {
- // 无参数,直接传入 event 或 detail 数组
- if (isCustomMPEvent) {
- return [event];
- }
- return __args__;
- }
- }
- var extraObj = processEventExtra(vm, extra, event, __args__);
- var ret = [];
- args.forEach(function (arg) {
- if (arg === '$event') {
- if (methodName === '__set_model' && !isCustom) {
- // input v-model value
- ret.push(event.target.value);
- } else {
- if (isCustom && !isCustomMPEvent) {
- ret.push(__args__[0]);
- } else {
- // wxcomponent 组件或内置组件
- ret.push(event);
- }
- }
- } else {
- if (Array.isArray(arg) && arg[0] === 'o') {
- ret.push(getObjByArray(arg));
- } else if (typeof arg === 'string' && hasOwn(extraObj, arg)) {
- ret.push(extraObj[arg]);
- } else {
- ret.push(arg);
- }
- }
- });
- return ret;
- }
- var ONCE = '~';
- var CUSTOM = '^';
- function isMatchEventType(eventType, optType) {
- return eventType === optType || optType === 'regionchange' && (eventType === 'begin' || eventType === 'end');
- }
- function getContextVm(vm) {
- var $parent = vm.$parent;
- // 父组件是 scoped slots 或者其他自定义组件时继续查找
- while ($parent && $parent.$parent && ($parent.$options.generic || $parent.$parent.$options.generic || $parent.$scope._$vuePid)) {
- $parent = $parent.$parent;
- }
- return $parent && $parent.$parent;
- }
- function handleEvent(event) {
- var _this2 = this;
- event = wrapper$1(event);
- // [['tap',[['handle',[1,2,a]],['handle1',[1,2,a]]]]]
- var dataset = (event.currentTarget || event.target).dataset;
- if (!dataset) {
- return console.warn('事件信息不存在');
- }
- var eventOpts = dataset.eventOpts || dataset['event-opts']; // 支付宝 web-view 组件 dataset 非驼峰
- if (!eventOpts) {
- return console.warn('事件信息不存在');
- }
- // [['handle',[1,2,a]],['handle1',[1,2,a]]]
- var eventType = event.type;
- var ret = [];
- eventOpts.forEach(function (eventOpt) {
- var type = eventOpt[0];
- var eventsArray = eventOpt[1];
- var isCustom = type.charAt(0) === CUSTOM;
- type = isCustom ? type.slice(1) : type;
- var isOnce = type.charAt(0) === ONCE;
- type = isOnce ? type.slice(1) : type;
- if (eventsArray && isMatchEventType(eventType, type)) {
- eventsArray.forEach(function (eventArray) {
- var methodName = eventArray[0];
- if (methodName) {
- var handlerCtx = _this2.$vm;
- if (handlerCtx.$options.generic) {
- // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
- handlerCtx = getContextVm(handlerCtx) || handlerCtx;
- }
- if (methodName === '$emit') {
- handlerCtx.$emit.apply(handlerCtx, processEventArgs(_this2.$vm, event, eventArray[1], eventArray[2], isCustom, methodName));
- return;
- }
- var handler = handlerCtx[methodName];
- if (!isFn(handler)) {
- var _type = _this2.$vm.mpType === 'page' ? 'Page' : 'Component';
- var path = _this2.route || _this2.is;
- throw new Error("".concat(_type, " \"").concat(path, "\" does not have a method \"").concat(methodName, "\""));
- }
- if (isOnce) {
- if (handler.once) {
- return;
- }
- handler.once = true;
- }
- var params = processEventArgs(_this2.$vm, event, eventArray[1], eventArray[2], isCustom, methodName);
- params = Array.isArray(params) ? params : [];
- // 参数尾部增加原始事件对象用于复杂表达式内获取额外数据
- if (/=\s*\S+\.eventParams\s*\|\|\s*\S+\[['"]event-params['"]\]/.test(handler.toString())) {
- // eslint-disable-next-line no-sparse-arrays
- params = params.concat([,,,,,,,,,, event]);
- }
- ret.push(handler.apply(handlerCtx, params));
- }
- });
- }
- });
- if (eventType === 'input' && ret.length === 1 && typeof ret[0] !== 'undefined') {
- return ret[0];
- }
- }
- var eventChannels = {};
- function getEventChannel(id) {
- var eventChannel = eventChannels[id];
- delete eventChannels[id];
- return eventChannel;
- }
- var hooks = ['onShow', 'onHide', 'onError', 'onPageNotFound', 'onThemeChange', 'onUnhandledRejection'];
- function initEventChannel() {
- _vue.default.prototype.getOpenerEventChannel = function () {
- // 微信小程序使用自身getOpenerEventChannel
- {
- return this.$scope.getOpenerEventChannel();
- }
- };
- var callHook = _vue.default.prototype.__call_hook;
- _vue.default.prototype.__call_hook = function (hook, args) {
- if (hook === 'onLoad' && args && args.__id__) {
- this.__eventChannel__ = getEventChannel(args.__id__);
- delete args.__id__;
- }
- return callHook.call(this, hook, args);
- };
- }
- function initScopedSlotsParams() {
- var center = {};
- var parents = {};
- function currentId(fn) {
- var vueIds = this.$options.propsData.vueId;
- if (vueIds) {
- var vueId = vueIds.split(',')[0];
- fn(vueId);
- }
- }
- _vue.default.prototype.$hasSSP = function (vueId) {
- var slot = center[vueId];
- if (!slot) {
- parents[vueId] = this;
- this.$on('hook:destroyed', function () {
- delete parents[vueId];
- });
- }
- return slot;
- };
- _vue.default.prototype.$getSSP = function (vueId, name, needAll) {
- var slot = center[vueId];
- if (slot) {
- var params = slot[name] || [];
- if (needAll) {
- return params;
- }
- return params[0];
- }
- };
- _vue.default.prototype.$setSSP = function (name, value) {
- var index = 0;
- currentId.call(this, function (vueId) {
- var slot = center[vueId];
- var params = slot[name] = slot[name] || [];
- params.push(value);
- index = params.length - 1;
- });
- return index;
- };
- _vue.default.prototype.$initSSP = function () {
- currentId.call(this, function (vueId) {
- center[vueId] = {};
- });
- };
- _vue.default.prototype.$callSSP = function () {
- currentId.call(this, function (vueId) {
- if (parents[vueId]) {
- parents[vueId].$forceUpdate();
- }
- });
- };
- _vue.default.mixin({
- destroyed: function destroyed() {
- var propsData = this.$options.propsData;
- var vueId = propsData && propsData.vueId;
- if (vueId) {
- delete center[vueId];
- delete parents[vueId];
- }
- }
- });
- }
- function parseBaseApp(vm, _ref4) {
- var mocks = _ref4.mocks,
- initRefs = _ref4.initRefs;
- initEventChannel();
- {
- initScopedSlotsParams();
- }
- if (vm.$options.store) {
- _vue.default.prototype.$store = vm.$options.store;
- }
- uniIdMixin(_vue.default);
- _vue.default.prototype.mpHost = "mp-weixin";
- _vue.default.mixin({
- beforeCreate: function beforeCreate() {
- if (!this.$options.mpType) {
- return;
- }
- this.mpType = this.$options.mpType;
- this.$mp = (0, _defineProperty2.default)({
- data: {}
- }, this.mpType, this.$options.mpInstance);
- this.$scope = this.$options.mpInstance;
- delete this.$options.mpType;
- delete this.$options.mpInstance;
- if (this.mpType === 'page' && typeof getApp === 'function') {
- // hack vue-i18n
- var app = getApp();
- if (app.$vm && app.$vm.$i18n) {
- this._i18n = app.$vm.$i18n;
- }
- }
- if (this.mpType !== 'app') {
- initRefs(this);
- initMocks(this, mocks);
- }
- }
- });
- var appOptions = {
- onLaunch: function onLaunch(args) {
- if (this.$vm) {
- // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
- return;
- }
- {
- if (wx.canIUse && !wx.canIUse('nextTick')) {
- // 事实 上2.2.3 即可,简单使用 2.3.0 的 nextTick 判断
- console.error('当前微信基础库版本过低,请将 微信开发者工具-详情-项目设置-调试基础库版本 更换为`2.3.0`以上');
- }
- }
- this.$vm = vm;
- this.$vm.$mp = {
- app: this
- };
- this.$vm.$scope = this;
- // vm 上也挂载 globalData
- this.$vm.globalData = this.globalData;
- this.$vm._isMounted = true;
- this.$vm.__call_hook('mounted', args);
- this.$vm.__call_hook('onLaunch', args);
- }
- };
- // 兼容旧版本 globalData
- appOptions.globalData = vm.$options.globalData || {};
- // 将 methods 中的方法挂在 getApp() 中
- var methods = vm.$options.methods;
- if (methods) {
- Object.keys(methods).forEach(function (name) {
- appOptions[name] = methods[name];
- });
- }
- initAppLocale(_vue.default, vm, normalizeLocale(wx.getAppBaseInfo().language) || LOCALE_EN);
- initHooks(appOptions, hooks);
- initUnknownHooks(appOptions, vm.$options);
- return appOptions;
- }
- function parseApp(vm) {
- return parseBaseApp(vm, {
- mocks: mocks,
- initRefs: initRefs
- });
- }
- function createApp(vm) {
- App(parseApp(vm));
- return vm;
- }
- var encodeReserveRE = /[!'()*]/g;
- var encodeReserveReplacer = function encodeReserveReplacer(c) {
- return '%' + c.charCodeAt(0).toString(16);
- };
- var commaRE = /%2C/g;
- // fixed encodeURIComponent which is more conformant to RFC3986:
- // - escapes [!'()*]
- // - preserve commas
- var encode = function encode(str) {
- return encodeURIComponent(str).replace(encodeReserveRE, encodeReserveReplacer).replace(commaRE, ',');
- };
- function stringifyQuery(obj) {
- var encodeStr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : encode;
- var res = obj ? Object.keys(obj).map(function (key) {
- var val = obj[key];
- if (val === undefined) {
- return '';
- }
- if (val === null) {
- return encodeStr(key);
- }
- if (Array.isArray(val)) {
- var result = [];
- val.forEach(function (val2) {
- if (val2 === undefined) {
- return;
- }
- if (val2 === null) {
- result.push(encodeStr(key));
- } else {
- result.push(encodeStr(key) + '=' + encodeStr(val2));
- }
- });
- return result.join('&');
- }
- return encodeStr(key) + '=' + encodeStr(val);
- }).filter(function (x) {
- return x.length > 0;
- }).join('&') : null;
- return res ? "?".concat(res) : '';
- }
- function parseBaseComponent(vueComponentOptions) {
- var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
- isPage = _ref5.isPage,
- initRelation = _ref5.initRelation;
- var needVueOptions = arguments.length > 2 ? arguments[2] : undefined;
- var _initVueComponent = initVueComponent(_vue.default, vueComponentOptions),
- _initVueComponent2 = (0, _slicedToArray2.default)(_initVueComponent, 2),
- VueComponent = _initVueComponent2[0],
- vueOptions = _initVueComponent2[1];
- var options = _objectSpread({
- multipleSlots: true,
- // styleIsolation: 'apply-shared',
- addGlobalClass: true
- }, vueOptions.options || {});
- {
- // 微信 multipleSlots 部分情况有 bug,导致内容顺序错乱 如 u-list,提供覆盖选项
- if (vueOptions['mp-weixin'] && vueOptions['mp-weixin'].options) {
- Object.assign(options, vueOptions['mp-weixin'].options);
- }
- }
- var componentOptions = {
- options: options,
- data: initData(vueOptions, _vue.default.prototype),
- behaviors: initBehaviors(vueOptions, initBehavior),
- properties: initProperties(vueOptions.props, false, vueOptions.__file, options),
- lifetimes: {
- attached: function attached() {
- var properties = this.properties;
- var options = {
- mpType: isPage.call(this) ? 'page' : 'component',
- mpInstance: this,
- propsData: properties
- };
- initVueIds(properties.vueId, this);
- // 处理父子关系
- initRelation.call(this, {
- vuePid: this._$vuePid,
- vueOptions: options
- });
- // 初始化 vue 实例
- this.$vm = new VueComponent(options);
- // 处理$slots,$scopedSlots(暂不支持动态变化$slots)
- initSlots(this.$vm, properties.vueSlots);
- // 触发首次 setData
- this.$vm.$mount();
- },
- ready: function ready() {
- // 当组件 props 默认值为 true,初始化时传入 false 会导致 created,ready 触发, 但 attached 不触发
- // https://developers.weixin.qq.com/community/develop/doc/00066ae2844cc0f8eb883e2a557800
- if (this.$vm) {
- this.$vm._isMounted = true;
- this.$vm.__call_hook('mounted');
- this.$vm.__call_hook('onReady');
- }
- },
- detached: function detached() {
- this.$vm && this.$vm.$destroy();
- }
- },
- pageLifetimes: {
- show: function show(args) {
- this.$vm && this.$vm.__call_hook('onPageShow', args);
- },
- hide: function hide() {
- this.$vm && this.$vm.__call_hook('onPageHide');
- },
- resize: function resize(size) {
- this.$vm && this.$vm.__call_hook('onPageResize', size);
- }
- },
- methods: {
- __l: handleLink,
- __e: handleEvent
- }
- };
- // externalClasses
- if (vueOptions.externalClasses) {
- componentOptions.externalClasses = vueOptions.externalClasses;
- }
- if (Array.isArray(vueOptions.wxsCallMethods)) {
- vueOptions.wxsCallMethods.forEach(function (callMethod) {
- componentOptions.methods[callMethod] = function (args) {
- return this.$vm[callMethod](args);
- };
- });
- }
- if (needVueOptions) {
- return [componentOptions, vueOptions, VueComponent];
- }
- if (isPage) {
- return componentOptions;
- }
- return [componentOptions, VueComponent];
- }
- function parseComponent(vueComponentOptions, needVueOptions) {
- return parseBaseComponent(vueComponentOptions, {
- isPage: isPage,
- initRelation: initRelation
- }, needVueOptions);
- }
- var hooks$1 = ['onShow', 'onHide', 'onUnload'];
- hooks$1.push.apply(hooks$1, PAGE_EVENT_HOOKS);
- function parseBasePage(vuePageOptions) {
- var _parseComponent = parseComponent(vuePageOptions, true),
- _parseComponent2 = (0, _slicedToArray2.default)(_parseComponent, 2),
- pageOptions = _parseComponent2[0],
- vueOptions = _parseComponent2[1];
- initHooks(pageOptions.methods, hooks$1, vueOptions);
- pageOptions.methods.onLoad = function (query) {
- this.options = query;
- var copyQuery = Object.assign({}, query);
- delete copyQuery.__id__;
- this.$page = {
- fullPath: '/' + (this.route || this.is) + stringifyQuery(copyQuery)
- };
- this.$vm.$mp.query = query; // 兼容 mpvue
- this.$vm.__call_hook('onLoad', query);
- };
- {
- initUnknownHooks(pageOptions.methods, vuePageOptions, ['onReady']);
- }
- {
- initWorkletMethods(pageOptions.methods, vueOptions.methods);
- }
- return pageOptions;
- }
- function parsePage(vuePageOptions) {
- return parseBasePage(vuePageOptions);
- }
- function createPage(vuePageOptions) {
- {
- return Component(parsePage(vuePageOptions));
- }
- }
- function createComponent(vueOptions) {
- {
- return Component(parseComponent(vueOptions));
- }
- }
- function createSubpackageApp(vm) {
- var appOptions = parseApp(vm);
- var app = getApp({
- allowDefault: true
- });
- vm.$scope = app;
- var globalData = app.globalData;
- if (globalData) {
- Object.keys(appOptions.globalData).forEach(function (name) {
- if (!hasOwn(globalData, name)) {
- globalData[name] = appOptions.globalData[name];
- }
- });
- }
- Object.keys(appOptions).forEach(function (name) {
- if (!hasOwn(app, name)) {
- app[name] = appOptions[name];
- }
- });
- if (isFn(appOptions.onShow) && wx.onAppShow) {
- wx.onAppShow(function () {
- for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
- args[_key5] = arguments[_key5];
- }
- vm.__call_hook('onShow', args);
- });
- }
- if (isFn(appOptions.onHide) && wx.onAppHide) {
- wx.onAppHide(function () {
- for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
- args[_key6] = arguments[_key6];
- }
- vm.__call_hook('onHide', args);
- });
- }
- if (isFn(appOptions.onLaunch)) {
- var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
- vm.__call_hook('onLaunch', args);
- }
- return vm;
- }
- function createPlugin(vm) {
- var appOptions = parseApp(vm);
- if (isFn(appOptions.onShow) && wx.onAppShow) {
- wx.onAppShow(function () {
- for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
- args[_key7] = arguments[_key7];
- }
- vm.__call_hook('onShow', args);
- });
- }
- if (isFn(appOptions.onHide) && wx.onAppHide) {
- wx.onAppHide(function () {
- for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
- args[_key8] = arguments[_key8];
- }
- vm.__call_hook('onHide', args);
- });
- }
- if (isFn(appOptions.onLaunch)) {
- var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
- vm.__call_hook('onLaunch', args);
- }
- return vm;
- }
- todos.forEach(function (todoApi) {
- protocols[todoApi] = false;
- });
- canIUses.forEach(function (canIUseApi) {
- var apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name : canIUseApi;
- if (!wx.canIUse(apiName)) {
- protocols[canIUseApi] = false;
- }
- });
- var uni = {};
- if (typeof Proxy !== 'undefined' && "mp-weixin" !== 'app-plus') {
- uni = new Proxy({}, {
- get: function get(target, name) {
- if (hasOwn(target, name)) {
- return target[name];
- }
- if (baseApi[name]) {
- return baseApi[name];
- }
- if (api[name]) {
- return promisify(name, api[name]);
- }
- {
- if (extraApi[name]) {
- return promisify(name, extraApi[name]);
- }
- if (todoApis[name]) {
- return promisify(name, todoApis[name]);
- }
- }
- if (eventApi[name]) {
- return eventApi[name];
- }
- return promisify(name, wrapper(name, wx[name]));
- },
- set: function set(target, name, value) {
- target[name] = value;
- return true;
- }
- });
- } else {
- Object.keys(baseApi).forEach(function (name) {
- uni[name] = baseApi[name];
- });
- {
- Object.keys(todoApis).forEach(function (name) {
- uni[name] = promisify(name, todoApis[name]);
- });
- Object.keys(extraApi).forEach(function (name) {
- uni[name] = promisify(name, extraApi[name]);
- });
- }
- Object.keys(eventApi).forEach(function (name) {
- uni[name] = eventApi[name];
- });
- Object.keys(api).forEach(function (name) {
- uni[name] = promisify(name, api[name]);
- });
- Object.keys(wx).forEach(function (name) {
- if (hasOwn(wx, name) || hasOwn(protocols, name)) {
- uni[name] = promisify(name, wrapper(name, wx[name]));
- }
- });
- }
- wx.createApp = createApp;
- wx.createPage = createPage;
- wx.createComponent = createComponent;
- wx.createSubpackageApp = createSubpackageApp;
- wx.createPlugin = createPlugin;
- var uni$1 = uni;
- var _default = uni$1;
- exports.default = _default;
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"], __webpack_require__(/*! ./../../../webpack/buildin/global.js */ 3)))
- /***/ }),
- /* 3 */
- /*!***********************************!*\
- !*** (webpack)/buildin/global.js ***!
- \***********************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- var g;
- // This works in non-strict mode
- g = (function() {
- return this;
- })();
- try {
- // This works if eval is allowed (see CSP)
- g = g || new Function("return this")();
- } catch (e) {
- // This works if the window reference is available
- if (typeof window === "object") g = window;
- }
- // g can still be undefined, but nothing to do about it...
- // We return undefined, instead of nothing here, so it's
- // easier to handle this case. if(!global) { ...}
- module.exports = g;
- /***/ }),
- /* 4 */
- /*!**********************************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/interopRequireDefault.js ***!
- \**********************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : {
- "default": obj
- };
- }
- module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 5 */
- /*!**************************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/slicedToArray.js ***!
- \**************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var arrayWithHoles = __webpack_require__(/*! ./arrayWithHoles.js */ 6);
- var iterableToArrayLimit = __webpack_require__(/*! ./iterableToArrayLimit.js */ 7);
- var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ 8);
- var nonIterableRest = __webpack_require__(/*! ./nonIterableRest.js */ 10);
- function _slicedToArray(arr, i) {
- return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
- }
- module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 6 */
- /*!***************************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/arrayWithHoles.js ***!
- \***************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- function _arrayWithHoles(arr) {
- if (Array.isArray(arr)) return arr;
- }
- module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 7 */
- /*!*********************************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***!
- \*********************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- function _iterableToArrayLimit(r, l) {
- var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
- if (null != t) {
- var e,
- n,
- i,
- u,
- a = [],
- f = !0,
- o = !1;
- try {
- if (i = (t = t.call(r)).next, 0 === l) {
- if (Object(t) !== t) return;
- f = !1;
- } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) {
- ;
- }
- } catch (r) {
- o = !0, n = r;
- } finally {
- try {
- if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
- } finally {
- if (o) throw n;
- }
- }
- return a;
- }
- }
- module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 8 */
- /*!***************************************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***!
- \***************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ 9);
- function _unsupportedIterableToArray(o, minLen) {
- if (!o) return;
- if (typeof o === "string") return arrayLikeToArray(o, minLen);
- var n = Object.prototype.toString.call(o).slice(8, -1);
- if (n === "Object" && o.constructor) n = o.constructor.name;
- if (n === "Map" || n === "Set") return Array.from(o);
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
- }
- module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 9 */
- /*!*****************************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/arrayLikeToArray.js ***!
- \*****************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- function _arrayLikeToArray(arr, len) {
- if (len == null || len > arr.length) len = arr.length;
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
- arr2[i] = arr[i];
- }
- return arr2;
- }
- module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 10 */
- /*!****************************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/nonIterableRest.js ***!
- \****************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- function _nonIterableRest() {
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
- }
- module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 11 */
- /*!***************************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/defineProperty.js ***!
- \***************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ 12);
- function _defineProperty(obj, key, value) {
- key = toPropertyKey(key);
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 12 */
- /*!**************************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/toPropertyKey.js ***!
- \**************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var _typeof = __webpack_require__(/*! ./typeof.js */ 13)["default"];
- var toPrimitive = __webpack_require__(/*! ./toPrimitive.js */ 14);
- function toPropertyKey(t) {
- var i = toPrimitive(t, "string");
- return "symbol" == _typeof(i) ? i : i + "";
- }
- module.exports = toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 13 */
- /*!*******************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/typeof.js ***!
- \*******************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- function _typeof(o) {
- "@babel/helpers - typeof";
- return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
- return typeof o;
- } : function (o) {
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
- }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(o);
- }
- module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 14 */
- /*!************************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/toPrimitive.js ***!
- \************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var _typeof = __webpack_require__(/*! ./typeof.js */ 13)["default"];
- function toPrimitive(t, r) {
- if ("object" != _typeof(t) || !t) return t;
- var e = t[Symbol.toPrimitive];
- if (void 0 !== e) {
- var i = e.call(t, r || "default");
- if ("object" != _typeof(i)) return i;
- throw new TypeError("@@toPrimitive must return a primitive value.");
- }
- return ("string" === r ? String : Number)(t);
- }
- module.exports = toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 15 */
- /*!**********************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/construct.js ***!
- \**********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf.js */ 16);
- var isNativeReflectConstruct = __webpack_require__(/*! ./isNativeReflectConstruct.js */ 17);
- function _construct(t, e, r) {
- if (isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
- var o = [null];
- o.push.apply(o, e);
- var p = new (t.bind.apply(t, o))();
- return r && setPrototypeOf(p, r.prototype), p;
- }
- module.exports = _construct, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 16 */
- /*!***************************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/setPrototypeOf.js ***!
- \***************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- function _setPrototypeOf(o, p) {
- module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
- o.__proto__ = p;
- return o;
- }, module.exports.__esModule = true, module.exports["default"] = module.exports;
- return _setPrototypeOf(o, p);
- }
- module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 17 */
- /*!*************************************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js ***!
- \*************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- function _isNativeReflectConstruct() {
- try {
- var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
- } catch (t) {}
- return (module.exports = _isNativeReflectConstruct = function _isNativeReflectConstruct() {
- return !!t;
- }, module.exports.__esModule = true, module.exports["default"] = module.exports)();
- }
- module.exports = _isNativeReflectConstruct, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 18 */
- /*!******************************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/toConsumableArray.js ***!
- \******************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var arrayWithoutHoles = __webpack_require__(/*! ./arrayWithoutHoles.js */ 19);
- var iterableToArray = __webpack_require__(/*! ./iterableToArray.js */ 20);
- var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ 8);
- var nonIterableSpread = __webpack_require__(/*! ./nonIterableSpread.js */ 21);
- function _toConsumableArray(arr) {
- return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
- }
- module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 19 */
- /*!******************************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js ***!
- \******************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ 9);
- function _arrayWithoutHoles(arr) {
- if (Array.isArray(arr)) return arrayLikeToArray(arr);
- }
- module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 20 */
- /*!****************************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/iterableToArray.js ***!
- \****************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- function _iterableToArray(iter) {
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
- }
- module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 21 */
- /*!******************************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/nonIterableSpread.js ***!
- \******************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- function _nonIterableSpread() {
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
- }
- module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 22 */
- /*!*************************************************************!*\
- !*** ./node_modules/@dcloudio/uni-i18n/dist/uni-i18n.es.js ***!
- \*************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(uni, global) {
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.LOCALE_ZH_HANT = exports.LOCALE_ZH_HANS = exports.LOCALE_FR = exports.LOCALE_ES = exports.LOCALE_EN = exports.I18n = exports.Formatter = void 0;
- exports.compileI18nJsonStr = compileI18nJsonStr;
- exports.hasI18nJson = hasI18nJson;
- exports.initVueI18n = initVueI18n;
- exports.isI18nStr = isI18nStr;
- exports.isString = void 0;
- exports.normalizeLocale = normalizeLocale;
- exports.parseI18nJson = parseI18nJson;
- exports.resolveLocale = resolveLocale;
- var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 5));
- var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23));
- var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ 24));
- var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
- var isObject = function isObject(val) {
- return val !== null && (0, _typeof2.default)(val) === 'object';
- };
- var defaultDelimiters = ['{', '}'];
- var BaseFormatter = /*#__PURE__*/function () {
- function BaseFormatter() {
- (0, _classCallCheck2.default)(this, BaseFormatter);
- this._caches = Object.create(null);
- }
- (0, _createClass2.default)(BaseFormatter, [{
- key: "interpolate",
- value: function interpolate(message, values) {
- var delimiters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultDelimiters;
- if (!values) {
- return [message];
- }
- var tokens = this._caches[message];
- if (!tokens) {
- tokens = parse(message, delimiters);
- this._caches[message] = tokens;
- }
- return compile(tokens, values);
- }
- }]);
- return BaseFormatter;
- }();
- exports.Formatter = BaseFormatter;
- var RE_TOKEN_LIST_VALUE = /^(?:\d)+/;
- var RE_TOKEN_NAMED_VALUE = /^(?:\w)+/;
- function parse(format, _ref) {
- var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
- startDelimiter = _ref2[0],
- endDelimiter = _ref2[1];
- var tokens = [];
- var position = 0;
- var text = '';
- while (position < format.length) {
- var char = format[position++];
- if (char === startDelimiter) {
- if (text) {
- tokens.push({
- type: 'text',
- value: text
- });
- }
- text = '';
- var sub = '';
- char = format[position++];
- while (char !== undefined && char !== endDelimiter) {
- sub += char;
- char = format[position++];
- }
- var isClosed = char === endDelimiter;
- var type = RE_TOKEN_LIST_VALUE.test(sub) ? 'list' : isClosed && RE_TOKEN_NAMED_VALUE.test(sub) ? 'named' : 'unknown';
- tokens.push({
- value: sub,
- type: type
- });
- }
- // else if (char === '%') {
- // // when found rails i18n syntax, skip text capture
- // if (format[position] !== '{') {
- // text += char
- // }
- // }
- else {
- text += char;
- }
- }
- text && tokens.push({
- type: 'text',
- value: text
- });
- return tokens;
- }
- function compile(tokens, values) {
- var compiled = [];
- var index = 0;
- var mode = Array.isArray(values) ? 'list' : isObject(values) ? 'named' : 'unknown';
- if (mode === 'unknown') {
- return compiled;
- }
- while (index < tokens.length) {
- var token = tokens[index];
- switch (token.type) {
- case 'text':
- compiled.push(token.value);
- break;
- case 'list':
- compiled.push(values[parseInt(token.value, 10)]);
- break;
- case 'named':
- if (mode === 'named') {
- compiled.push(values[token.value]);
- } else {
- if (true) {
- console.warn("Type of token '".concat(token.type, "' and format of value '").concat(mode, "' don't match!"));
- }
- }
- break;
- case 'unknown':
- if (true) {
- console.warn("Detect 'unknown' type of token!");
- }
- break;
- }
- index++;
- }
- return compiled;
- }
- var LOCALE_ZH_HANS = 'zh-Hans';
- exports.LOCALE_ZH_HANS = LOCALE_ZH_HANS;
- var LOCALE_ZH_HANT = 'zh-Hant';
- exports.LOCALE_ZH_HANT = LOCALE_ZH_HANT;
- var LOCALE_EN = 'en';
- exports.LOCALE_EN = LOCALE_EN;
- var LOCALE_FR = 'fr';
- exports.LOCALE_FR = LOCALE_FR;
- var LOCALE_ES = 'es';
- exports.LOCALE_ES = LOCALE_ES;
- var hasOwnProperty = Object.prototype.hasOwnProperty;
- var hasOwn = function hasOwn(val, key) {
- return hasOwnProperty.call(val, key);
- };
- var defaultFormatter = new BaseFormatter();
- function include(str, parts) {
- return !!parts.find(function (part) {
- return str.indexOf(part) !== -1;
- });
- }
- function startsWith(str, parts) {
- return parts.find(function (part) {
- return str.indexOf(part) === 0;
- });
- }
- function normalizeLocale(locale, messages) {
- if (!locale) {
- return;
- }
- locale = locale.trim().replace(/_/g, '-');
- if (messages && messages[locale]) {
- return locale;
- }
- locale = locale.toLowerCase();
- if (locale === 'chinese') {
- // 支付宝
- return LOCALE_ZH_HANS;
- }
- if (locale.indexOf('zh') === 0) {
- if (locale.indexOf('-hans') > -1) {
- return LOCALE_ZH_HANS;
- }
- if (locale.indexOf('-hant') > -1) {
- return LOCALE_ZH_HANT;
- }
- if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) {
- return LOCALE_ZH_HANT;
- }
- return LOCALE_ZH_HANS;
- }
- var locales = [LOCALE_EN, LOCALE_FR, LOCALE_ES];
- if (messages && Object.keys(messages).length > 0) {
- locales = Object.keys(messages);
- }
- var lang = startsWith(locale, locales);
- if (lang) {
- return lang;
- }
- }
- var I18n = /*#__PURE__*/function () {
- function I18n(_ref3) {
- var locale = _ref3.locale,
- fallbackLocale = _ref3.fallbackLocale,
- messages = _ref3.messages,
- watcher = _ref3.watcher,
- formater = _ref3.formater;
- (0, _classCallCheck2.default)(this, I18n);
- this.locale = LOCALE_EN;
- this.fallbackLocale = LOCALE_EN;
- this.message = {};
- this.messages = {};
- this.watchers = [];
- if (fallbackLocale) {
- this.fallbackLocale = fallbackLocale;
- }
- this.formater = formater || defaultFormatter;
- this.messages = messages || {};
- this.setLocale(locale || LOCALE_EN);
- if (watcher) {
- this.watchLocale(watcher);
- }
- }
- (0, _createClass2.default)(I18n, [{
- key: "setLocale",
- value: function setLocale(locale) {
- var _this = this;
- var oldLocale = this.locale;
- this.locale = normalizeLocale(locale, this.messages) || this.fallbackLocale;
- if (!this.messages[this.locale]) {
- // 可能初始化时不存在
- this.messages[this.locale] = {};
- }
- this.message = this.messages[this.locale];
- // 仅发生变化时,通知
- if (oldLocale !== this.locale) {
- this.watchers.forEach(function (watcher) {
- watcher(_this.locale, oldLocale);
- });
- }
- }
- }, {
- key: "getLocale",
- value: function getLocale() {
- return this.locale;
- }
- }, {
- key: "watchLocale",
- value: function watchLocale(fn) {
- var _this2 = this;
- var index = this.watchers.push(fn) - 1;
- return function () {
- _this2.watchers.splice(index, 1);
- };
- }
- }, {
- key: "add",
- value: function add(locale, message) {
- var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
- var curMessages = this.messages[locale];
- if (curMessages) {
- if (override) {
- Object.assign(curMessages, message);
- } else {
- Object.keys(message).forEach(function (key) {
- if (!hasOwn(curMessages, key)) {
- curMessages[key] = message[key];
- }
- });
- }
- } else {
- this.messages[locale] = message;
- }
- }
- }, {
- key: "f",
- value: function f(message, values, delimiters) {
- return this.formater.interpolate(message, values, delimiters).join('');
- }
- }, {
- key: "t",
- value: function t(key, locale, values) {
- var message = this.message;
- if (typeof locale === 'string') {
- locale = normalizeLocale(locale, this.messages);
- locale && (message = this.messages[locale]);
- } else {
- values = locale;
- }
- if (!hasOwn(message, key)) {
- console.warn("Cannot translate the value of keypath ".concat(key, ". Use the value of keypath as default."));
- return key;
- }
- return this.formater.interpolate(message[key], values).join('');
- }
- }]);
- return I18n;
- }();
- exports.I18n = I18n;
- function watchAppLocale(appVm, i18n) {
- // 需要保证 watch 的触发在组件渲染之前
- if (appVm.$watchLocale) {
- // vue2
- appVm.$watchLocale(function (newLocale) {
- i18n.setLocale(newLocale);
- });
- } else {
- appVm.$watch(function () {
- return appVm.$locale;
- }, function (newLocale) {
- i18n.setLocale(newLocale);
- });
- }
- }
- function getDefaultLocale() {
- if (typeof uni !== 'undefined' && uni.getLocale) {
- return uni.getLocale();
- }
- // 小程序平台,uni 和 uni-i18n 互相引用,导致访问不到 uni,故在 global 上挂了 getLocale
- if (typeof global !== 'undefined' && global.getLocale) {
- return global.getLocale();
- }
- return LOCALE_EN;
- }
- function initVueI18n(locale) {
- var messages = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var fallbackLocale = arguments.length > 2 ? arguments[2] : undefined;
- var watcher = arguments.length > 3 ? arguments[3] : undefined;
- // 兼容旧版本入参
- if (typeof locale !== 'string') {
- var _ref4 = [messages, locale];
- locale = _ref4[0];
- messages = _ref4[1];
- }
- if (typeof locale !== 'string') {
- // 因为小程序平台,uni-i18n 和 uni 互相引用,导致此时访问 uni 时,为 undefined
- locale = getDefaultLocale();
- }
- if (typeof fallbackLocale !== 'string') {
- fallbackLocale = typeof __uniConfig !== 'undefined' && __uniConfig.fallbackLocale || LOCALE_EN;
- }
- var i18n = new I18n({
- locale: locale,
- fallbackLocale: fallbackLocale,
- messages: messages,
- watcher: watcher
- });
- var _t = function t(key, values) {
- if (typeof getApp !== 'function') {
- // app view
- /* eslint-disable no-func-assign */
- _t = function t(key, values) {
- return i18n.t(key, values);
- };
- } else {
- var isWatchedAppLocale = false;
- _t = function t(key, values) {
- var appVm = getApp().$vm;
- // 可能$vm还不存在,比如在支付宝小程序中,组件定义较早,在props的default里使用了t()函数(如uni-goods-nav),此时app还未初始化
- // options: {
- // type: Array,
- // default () {
- // return [{
- // icon: 'shop',
- // text: t("uni-goods-nav.options.shop"),
- // }, {
- // icon: 'cart',
- // text: t("uni-goods-nav.options.cart")
- // }]
- // }
- // },
- if (appVm) {
- // 触发响应式
- appVm.$locale;
- if (!isWatchedAppLocale) {
- isWatchedAppLocale = true;
- watchAppLocale(appVm, i18n);
- }
- }
- return i18n.t(key, values);
- };
- }
- return _t(key, values);
- };
- return {
- i18n: i18n,
- f: function f(message, values, delimiters) {
- return i18n.f(message, values, delimiters);
- },
- t: function t(key, values) {
- return _t(key, values);
- },
- add: function add(locale, message) {
- var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
- return i18n.add(locale, message, override);
- },
- watch: function watch(fn) {
- return i18n.watchLocale(fn);
- },
- getLocale: function getLocale() {
- return i18n.getLocale();
- },
- setLocale: function setLocale(newLocale) {
- return i18n.setLocale(newLocale);
- }
- };
- }
- var isString = function isString(val) {
- return typeof val === 'string';
- };
- exports.isString = isString;
- var formater;
- function hasI18nJson(jsonObj, delimiters) {
- if (!formater) {
- formater = new BaseFormatter();
- }
- return walkJsonObj(jsonObj, function (jsonObj, key) {
- var value = jsonObj[key];
- if (isString(value)) {
- if (isI18nStr(value, delimiters)) {
- return true;
- }
- } else {
- return hasI18nJson(value, delimiters);
- }
- });
- }
- function parseI18nJson(jsonObj, values, delimiters) {
- if (!formater) {
- formater = new BaseFormatter();
- }
- walkJsonObj(jsonObj, function (jsonObj, key) {
- var value = jsonObj[key];
- if (isString(value)) {
- if (isI18nStr(value, delimiters)) {
- jsonObj[key] = compileStr(value, values, delimiters);
- }
- } else {
- parseI18nJson(value, values, delimiters);
- }
- });
- return jsonObj;
- }
- function compileI18nJsonStr(jsonStr, _ref5) {
- var locale = _ref5.locale,
- locales = _ref5.locales,
- delimiters = _ref5.delimiters;
- if (!isI18nStr(jsonStr, delimiters)) {
- return jsonStr;
- }
- if (!formater) {
- formater = new BaseFormatter();
- }
- var localeValues = [];
- Object.keys(locales).forEach(function (name) {
- if (name !== locale) {
- localeValues.push({
- locale: name,
- values: locales[name]
- });
- }
- });
- localeValues.unshift({
- locale: locale,
- values: locales[locale]
- });
- try {
- return JSON.stringify(compileJsonObj(JSON.parse(jsonStr), localeValues, delimiters), null, 2);
- } catch (e) {}
- return jsonStr;
- }
- function isI18nStr(value, delimiters) {
- return value.indexOf(delimiters[0]) > -1;
- }
- function compileStr(value, values, delimiters) {
- return formater.interpolate(value, values, delimiters).join('');
- }
- function compileValue(jsonObj, key, localeValues, delimiters) {
- var value = jsonObj[key];
- if (isString(value)) {
- // 存在国际化
- if (isI18nStr(value, delimiters)) {
- jsonObj[key] = compileStr(value, localeValues[0].values, delimiters);
- if (localeValues.length > 1) {
- // 格式化国际化语言
- var valueLocales = jsonObj[key + 'Locales'] = {};
- localeValues.forEach(function (localValue) {
- valueLocales[localValue.locale] = compileStr(value, localValue.values, delimiters);
- });
- }
- }
- } else {
- compileJsonObj(value, localeValues, delimiters);
- }
- }
- function compileJsonObj(jsonObj, localeValues, delimiters) {
- walkJsonObj(jsonObj, function (jsonObj, key) {
- compileValue(jsonObj, key, localeValues, delimiters);
- });
- return jsonObj;
- }
- function walkJsonObj(jsonObj, walk) {
- if (Array.isArray(jsonObj)) {
- for (var i = 0; i < jsonObj.length; i++) {
- if (walk(jsonObj, i)) {
- return true;
- }
- }
- } else if (isObject(jsonObj)) {
- for (var key in jsonObj) {
- if (walk(jsonObj, key)) {
- return true;
- }
- }
- }
- return false;
- }
- function resolveLocale(locales) {
- return function (locale) {
- if (!locale) {
- return locale;
- }
- locale = normalizeLocale(locale) || locale;
- return resolveLocaleChain(locale).find(function (locale) {
- return locales.indexOf(locale) > -1;
- });
- };
- }
- function resolveLocaleChain(locale) {
- var chain = [];
- var tokens = locale.split('-');
- while (tokens.length) {
- chain.push(tokens.join('-'));
- tokens.pop();
- }
- return chain;
- }
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"], __webpack_require__(/*! ./../../../webpack/buildin/global.js */ 3)))
- /***/ }),
- /* 23 */
- /*!***************************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/classCallCheck.js ***!
- \***************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
- module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 24 */
- /*!************************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/createClass.js ***!
- \************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ 12);
- function _defineProperties(target, props) {
- for (var i = 0; i < props.length; i++) {
- var descriptor = props[i];
- descriptor.enumerable = descriptor.enumerable || false;
- descriptor.configurable = true;
- if ("value" in descriptor) descriptor.writable = true;
- Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);
- }
- }
- function _createClass(Constructor, protoProps, staticProps) {
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
- if (staticProps) _defineProperties(Constructor, staticProps);
- Object.defineProperty(Constructor, "prototype", {
- writable: false
- });
- return Constructor;
- }
- module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 25 */
- /*!******************************************************************************************!*\
- !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/mp-vue/dist/mp.runtime.esm.js ***!
- \******************************************************************************************/
- /*! exports provided: default */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* WEBPACK VAR INJECTION */(function(global) {/*!
- * Vue.js v2.6.11
- * (c) 2014-2024 Evan You
- * Released under the MIT License.
- */
- /* */
- var emptyObject = Object.freeze({});
- // These helpers produce better VM code in JS engines due to their
- // explicitness and function inlining.
- function isUndef (v) {
- return v === undefined || v === null
- }
- function isDef (v) {
- return v !== undefined && v !== null
- }
- function isTrue (v) {
- return v === true
- }
- function isFalse (v) {
- return v === false
- }
- /**
- * Check if value is primitive.
- */
- function isPrimitive (value) {
- return (
- typeof value === 'string' ||
- typeof value === 'number' ||
- // $flow-disable-line
- typeof value === 'symbol' ||
- typeof value === 'boolean'
- )
- }
- /**
- * Quick object check - this is primarily used to tell
- * Objects from primitive values when we know the value
- * is a JSON-compliant type.
- */
- function isObject (obj) {
- return obj !== null && typeof obj === 'object'
- }
- /**
- * Get the raw type string of a value, e.g., [object Object].
- */
- var _toString = Object.prototype.toString;
- function toRawType (value) {
- return _toString.call(value).slice(8, -1)
- }
- /**
- * Strict object type check. Only returns true
- * for plain JavaScript objects.
- */
- function isPlainObject (obj) {
- return _toString.call(obj) === '[object Object]'
- }
- function isRegExp (v) {
- return _toString.call(v) === '[object RegExp]'
- }
- /**
- * Check if val is a valid array index.
- */
- function isValidArrayIndex (val) {
- var n = parseFloat(String(val));
- return n >= 0 && Math.floor(n) === n && isFinite(val)
- }
- function isPromise (val) {
- return (
- isDef(val) &&
- typeof val.then === 'function' &&
- typeof val.catch === 'function'
- )
- }
- /**
- * Convert a value to a string that is actually rendered.
- */
- function toString (val) {
- return val == null
- ? ''
- : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
- ? JSON.stringify(val, null, 2)
- : String(val)
- }
- /**
- * Convert an input value to a number for persistence.
- * If the conversion fails, return original string.
- */
- function toNumber (val) {
- var n = parseFloat(val);
- return isNaN(n) ? val : n
- }
- /**
- * Make a map and return a function for checking if a key
- * is in that map.
- */
- function makeMap (
- str,
- expectsLowerCase
- ) {
- var map = Object.create(null);
- var list = str.split(',');
- for (var i = 0; i < list.length; i++) {
- map[list[i]] = true;
- }
- return expectsLowerCase
- ? function (val) { return map[val.toLowerCase()]; }
- : function (val) { return map[val]; }
- }
- /**
- * Check if a tag is a built-in tag.
- */
- var isBuiltInTag = makeMap('slot,component', true);
- /**
- * Check if an attribute is a reserved attribute.
- */
- var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
- /**
- * Remove an item from an array.
- */
- function remove (arr, item) {
- if (arr.length) {
- var index = arr.indexOf(item);
- if (index > -1) {
- return arr.splice(index, 1)
- }
- }
- }
- /**
- * Check whether an object has the property.
- */
- var hasOwnProperty = Object.prototype.hasOwnProperty;
- function hasOwn (obj, key) {
- return hasOwnProperty.call(obj, key)
- }
- /**
- * Create a cached version of a pure function.
- */
- function cached (fn) {
- var cache = Object.create(null);
- return (function cachedFn (str) {
- var hit = cache[str];
- return hit || (cache[str] = fn(str))
- })
- }
- /**
- * Camelize a hyphen-delimited string.
- */
- var camelizeRE = /-(\w)/g;
- var camelize = cached(function (str) {
- return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
- });
- /**
- * Capitalize a string.
- */
- var capitalize = cached(function (str) {
- return str.charAt(0).toUpperCase() + str.slice(1)
- });
- /**
- * Hyphenate a camelCase string.
- */
- var hyphenateRE = /\B([A-Z])/g;
- var hyphenate = cached(function (str) {
- return str.replace(hyphenateRE, '-$1').toLowerCase()
- });
- /**
- * Simple bind polyfill for environments that do not support it,
- * e.g., PhantomJS 1.x. Technically, we don't need this anymore
- * since native bind is now performant enough in most browsers.
- * But removing it would mean breaking code that was able to run in
- * PhantomJS 1.x, so this must be kept for backward compatibility.
- */
- /* istanbul ignore next */
- function polyfillBind (fn, ctx) {
- function boundFn (a) {
- var l = arguments.length;
- return l
- ? l > 1
- ? fn.apply(ctx, arguments)
- : fn.call(ctx, a)
- : fn.call(ctx)
- }
- boundFn._length = fn.length;
- return boundFn
- }
- function nativeBind (fn, ctx) {
- return fn.bind(ctx)
- }
- var bind = Function.prototype.bind
- ? nativeBind
- : polyfillBind;
- /**
- * Convert an Array-like object to a real Array.
- */
- function toArray (list, start) {
- start = start || 0;
- var i = list.length - start;
- var ret = new Array(i);
- while (i--) {
- ret[i] = list[i + start];
- }
- return ret
- }
- /**
- * Mix properties into target object.
- */
- function extend (to, _from) {
- for (var key in _from) {
- to[key] = _from[key];
- }
- return to
- }
- /**
- * Merge an Array of Objects into a single Object.
- */
- function toObject (arr) {
- var res = {};
- for (var i = 0; i < arr.length; i++) {
- if (arr[i]) {
- extend(res, arr[i]);
- }
- }
- return res
- }
- /* eslint-disable no-unused-vars */
- /**
- * Perform no operation.
- * Stubbing args to make Flow happy without leaving useless transpiled code
- * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
- */
- function noop (a, b, c) {}
- /**
- * Always return false.
- */
- var no = function (a, b, c) { return false; };
- /* eslint-enable no-unused-vars */
- /**
- * Return the same value.
- */
- var identity = function (_) { return _; };
- /**
- * Check if two values are loosely equal - that is,
- * if they are plain objects, do they have the same shape?
- */
- function looseEqual (a, b) {
- if (a === b) { return true }
- var isObjectA = isObject(a);
- var isObjectB = isObject(b);
- if (isObjectA && isObjectB) {
- try {
- var isArrayA = Array.isArray(a);
- var isArrayB = Array.isArray(b);
- if (isArrayA && isArrayB) {
- return a.length === b.length && a.every(function (e, i) {
- return looseEqual(e, b[i])
- })
- } else if (a instanceof Date && b instanceof Date) {
- return a.getTime() === b.getTime()
- } else if (!isArrayA && !isArrayB) {
- var keysA = Object.keys(a);
- var keysB = Object.keys(b);
- return keysA.length === keysB.length && keysA.every(function (key) {
- return looseEqual(a[key], b[key])
- })
- } else {
- /* istanbul ignore next */
- return false
- }
- } catch (e) {
- /* istanbul ignore next */
- return false
- }
- } else if (!isObjectA && !isObjectB) {
- return String(a) === String(b)
- } else {
- return false
- }
- }
- /**
- * Return the first index at which a loosely equal value can be
- * found in the array (if value is a plain object, the array must
- * contain an object of the same shape), or -1 if it is not present.
- */
- function looseIndexOf (arr, val) {
- for (var i = 0; i < arr.length; i++) {
- if (looseEqual(arr[i], val)) { return i }
- }
- return -1
- }
- /**
- * Ensure a function is called only once.
- */
- function once (fn) {
- var called = false;
- return function () {
- if (!called) {
- called = true;
- fn.apply(this, arguments);
- }
- }
- }
- var ASSET_TYPES = [
- 'component',
- 'directive',
- 'filter'
- ];
- var LIFECYCLE_HOOKS = [
- 'beforeCreate',
- 'created',
- 'beforeMount',
- 'mounted',
- 'beforeUpdate',
- 'updated',
- 'beforeDestroy',
- 'destroyed',
- 'activated',
- 'deactivated',
- 'errorCaptured',
- 'serverPrefetch'
- ];
- /* */
- var config = ({
- /**
- * Option merge strategies (used in core/util/options)
- */
- // $flow-disable-line
- optionMergeStrategies: Object.create(null),
- /**
- * Whether to suppress warnings.
- */
- silent: false,
- /**
- * Show production mode tip message on boot?
- */
- productionTip: "development" !== 'production',
- /**
- * Whether to enable devtools
- */
- devtools: "development" !== 'production',
- /**
- * Whether to record perf
- */
- performance: false,
- /**
- * Error handler for watcher errors
- */
- errorHandler: null,
- /**
- * Warn handler for watcher warns
- */
- warnHandler: null,
- /**
- * Ignore certain custom elements
- */
- ignoredElements: [],
- /**
- * Custom user key aliases for v-on
- */
- // $flow-disable-line
- keyCodes: Object.create(null),
- /**
- * Check if a tag is reserved so that it cannot be registered as a
- * component. This is platform-dependent and may be overwritten.
- */
- isReservedTag: no,
- /**
- * Check if an attribute is reserved so that it cannot be used as a component
- * prop. This is platform-dependent and may be overwritten.
- */
- isReservedAttr: no,
- /**
- * Check if a tag is an unknown element.
- * Platform-dependent.
- */
- isUnknownElement: no,
- /**
- * Get the namespace of an element
- */
- getTagNamespace: noop,
- /**
- * Parse the real tag name for the specific platform.
- */
- parsePlatformTagName: identity,
- /**
- * Check if an attribute must be bound using property, e.g. value
- * Platform-dependent.
- */
- mustUseProp: no,
- /**
- * Perform updates asynchronously. Intended to be used by Vue Test Utils
- * This will significantly reduce performance if set to false.
- */
- async: true,
- /**
- * Exposed for legacy reasons
- */
- _lifecycleHooks: LIFECYCLE_HOOKS
- });
- /* */
- /**
- * unicode letters used for parsing html tags, component names and property paths.
- * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
- * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
- */
- var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
- /**
- * Check if a string starts with $ or _
- */
- function isReserved (str) {
- var c = (str + '').charCodeAt(0);
- return c === 0x24 || c === 0x5F
- }
- /**
- * Define a property.
- */
- function def (obj, key, val, enumerable) {
- Object.defineProperty(obj, key, {
- value: val,
- enumerable: !!enumerable,
- writable: true,
- configurable: true
- });
- }
- /**
- * Parse simple path.
- */
- var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
- function parsePath (path) {
- if (bailRE.test(path)) {
- return
- }
- var segments = path.split('.');
- return function (obj) {
- for (var i = 0; i < segments.length; i++) {
- if (!obj) { return }
- obj = obj[segments[i]];
- }
- return obj
- }
- }
- /* */
- // can we use __proto__?
- var hasProto = '__proto__' in {};
- // Browser environment sniffing
- var inBrowser = typeof window !== 'undefined';
- var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
- var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
- var UA = inBrowser && window.navigator && window.navigator.userAgent.toLowerCase();
- var isIE = UA && /msie|trident/.test(UA);
- var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
- var isEdge = UA && UA.indexOf('edge/') > 0;
- var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
- var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
- var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
- var isPhantomJS = UA && /phantomjs/.test(UA);
- var isFF = UA && UA.match(/firefox\/(\d+)/);
- // Firefox has a "watch" function on Object.prototype...
- var nativeWatch = ({}).watch;
- if (inBrowser) {
- try {
- var opts = {};
- Object.defineProperty(opts, 'passive', ({
- get: function get () {
- }
- })); // https://github.com/facebook/flow/issues/285
- window.addEventListener('test-passive', null, opts);
- } catch (e) {}
- }
- // this needs to be lazy-evaled because vue may be required before
- // vue-server-renderer can set VUE_ENV
- var _isServer;
- var isServerRendering = function () {
- if (_isServer === undefined) {
- /* istanbul ignore if */
- if (!inBrowser && !inWeex && typeof global !== 'undefined') {
- // detect presence of vue-server-renderer and avoid
- // Webpack shimming the process
- _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
- } else {
- _isServer = false;
- }
- }
- return _isServer
- };
- // detect devtools
- var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
- /* istanbul ignore next */
- function isNative (Ctor) {
- return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
- }
- var hasSymbol =
- typeof Symbol !== 'undefined' && isNative(Symbol) &&
- typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
- var _Set;
- /* istanbul ignore if */ // $flow-disable-line
- if (typeof Set !== 'undefined' && isNative(Set)) {
- // use native Set when available.
- _Set = Set;
- } else {
- // a non-standard Set polyfill that only works with primitive keys.
- _Set = /*@__PURE__*/(function () {
- function Set () {
- this.set = Object.create(null);
- }
- Set.prototype.has = function has (key) {
- return this.set[key] === true
- };
- Set.prototype.add = function add (key) {
- this.set[key] = true;
- };
- Set.prototype.clear = function clear () {
- this.set = Object.create(null);
- };
- return Set;
- }());
- }
- /* */
- var warn = noop;
- var tip = noop;
- var generateComponentTrace = (noop); // work around flow check
- var formatComponentName = (noop);
- if (true) {
- var hasConsole = typeof console !== 'undefined';
- var classifyRE = /(?:^|[-_])(\w)/g;
- var classify = function (str) { return str
- .replace(classifyRE, function (c) { return c.toUpperCase(); })
- .replace(/[-_]/g, ''); };
- warn = function (msg, vm) {
- var trace = vm ? generateComponentTrace(vm) : '';
- if (config.warnHandler) {
- config.warnHandler.call(null, msg, vm, trace);
- } else if (hasConsole && (!config.silent)) {
- console.error(("[Vue warn]: " + msg + trace));
- }
- };
- tip = function (msg, vm) {
- if (hasConsole && (!config.silent)) {
- console.warn("[Vue tip]: " + msg + (
- vm ? generateComponentTrace(vm) : ''
- ));
- }
- };
- formatComponentName = function (vm, includeFile) {
- if (vm.$root === vm) {
- if (vm.$options && vm.$options.__file) { // fixed by xxxxxx
- return ('') + vm.$options.__file
- }
- return '<Root>'
- }
- var options = typeof vm === 'function' && vm.cid != null
- ? vm.options
- : vm._isVue
- ? vm.$options || vm.constructor.options
- : vm;
- var name = options.name || options._componentTag;
- var file = options.__file;
- if (!name && file) {
- var match = file.match(/([^/\\]+)\.vue$/);
- name = match && match[1];
- }
- return (
- (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
- (file && includeFile !== false ? (" at " + file) : '')
- )
- };
- var repeat = function (str, n) {
- var res = '';
- while (n) {
- if (n % 2 === 1) { res += str; }
- if (n > 1) { str += str; }
- n >>= 1;
- }
- return res
- };
- generateComponentTrace = function (vm) {
- if (vm._isVue && vm.$parent) {
- var tree = [];
- var currentRecursiveSequence = 0;
- while (vm && vm.$options.name !== 'PageBody') {
- if (tree.length > 0) {
- var last = tree[tree.length - 1];
- if (last.constructor === vm.constructor) {
- currentRecursiveSequence++;
- vm = vm.$parent;
- continue
- } else if (currentRecursiveSequence > 0) {
- tree[tree.length - 1] = [last, currentRecursiveSequence];
- currentRecursiveSequence = 0;
- }
- }
- !vm.$options.isReserved && tree.push(vm);
- vm = vm.$parent;
- }
- return '\n\nfound in\n\n' + tree
- .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
- ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
- : formatComponentName(vm))); })
- .join('\n')
- } else {
- return ("\n\n(found in " + (formatComponentName(vm)) + ")")
- }
- };
- }
- /* */
- var uid = 0;
- /**
- * A dep is an observable that can have multiple
- * directives subscribing to it.
- */
- var Dep = function Dep () {
- this.id = uid++;
- this.subs = [];
- };
- Dep.prototype.addSub = function addSub (sub) {
- this.subs.push(sub);
- };
- Dep.prototype.removeSub = function removeSub (sub) {
- remove(this.subs, sub);
- };
- Dep.prototype.depend = function depend () {
- if (Dep.SharedObject.target) {
- Dep.SharedObject.target.addDep(this);
- }
- };
- Dep.prototype.notify = function notify () {
- // stabilize the subscriber list first
- var subs = this.subs.slice();
- if ( true && !config.async) {
- // subs aren't sorted in scheduler if not running async
- // we need to sort them now to make sure they fire in correct
- // order
- subs.sort(function (a, b) { return a.id - b.id; });
- }
- for (var i = 0, l = subs.length; i < l; i++) {
- subs[i].update();
- }
- };
- // The current target watcher being evaluated.
- // This is globally unique because only one watcher
- // can be evaluated at a time.
- // fixed by xxxxxx (nvue shared vuex)
- /* eslint-disable no-undef */
- Dep.SharedObject = {};
- Dep.SharedObject.target = null;
- Dep.SharedObject.targetStack = [];
- function pushTarget (target) {
- Dep.SharedObject.targetStack.push(target);
- Dep.SharedObject.target = target;
- Dep.target = target;
- }
- function popTarget () {
- Dep.SharedObject.targetStack.pop();
- Dep.SharedObject.target = Dep.SharedObject.targetStack[Dep.SharedObject.targetStack.length - 1];
- Dep.target = Dep.SharedObject.target;
- }
- /* */
- var VNode = function VNode (
- tag,
- data,
- children,
- text,
- elm,
- context,
- componentOptions,
- asyncFactory
- ) {
- this.tag = tag;
- this.data = data;
- this.children = children;
- this.text = text;
- this.elm = elm;
- this.ns = undefined;
- this.context = context;
- this.fnContext = undefined;
- this.fnOptions = undefined;
- this.fnScopeId = undefined;
- this.key = data && data.key;
- this.componentOptions = componentOptions;
- this.componentInstance = undefined;
- this.parent = undefined;
- this.raw = false;
- this.isStatic = false;
- this.isRootInsert = true;
- this.isComment = false;
- this.isCloned = false;
- this.isOnce = false;
- this.asyncFactory = asyncFactory;
- this.asyncMeta = undefined;
- this.isAsyncPlaceholder = false;
- };
- var prototypeAccessors = { child: { configurable: true } };
- // DEPRECATED: alias for componentInstance for backwards compat.
- /* istanbul ignore next */
- prototypeAccessors.child.get = function () {
- return this.componentInstance
- };
- Object.defineProperties( VNode.prototype, prototypeAccessors );
- var createEmptyVNode = function (text) {
- if ( text === void 0 ) text = '';
- var node = new VNode();
- node.text = text;
- node.isComment = true;
- return node
- };
- function createTextVNode (val) {
- return new VNode(undefined, undefined, undefined, String(val))
- }
- // optimized shallow clone
- // used for static nodes and slot nodes because they may be reused across
- // multiple renders, cloning them avoids errors when DOM manipulations rely
- // on their elm reference.
- function cloneVNode (vnode) {
- var cloned = new VNode(
- vnode.tag,
- vnode.data,
- // #7975
- // clone children array to avoid mutating original in case of cloning
- // a child.
- vnode.children && vnode.children.slice(),
- vnode.text,
- vnode.elm,
- vnode.context,
- vnode.componentOptions,
- vnode.asyncFactory
- );
- cloned.ns = vnode.ns;
- cloned.isStatic = vnode.isStatic;
- cloned.key = vnode.key;
- cloned.isComment = vnode.isComment;
- cloned.fnContext = vnode.fnContext;
- cloned.fnOptions = vnode.fnOptions;
- cloned.fnScopeId = vnode.fnScopeId;
- cloned.asyncMeta = vnode.asyncMeta;
- cloned.isCloned = true;
- return cloned
- }
- /*
- * not type checking this file because flow doesn't play well with
- * dynamically accessing methods on Array prototype
- */
- var arrayProto = Array.prototype;
- var arrayMethods = Object.create(arrayProto);
- var methodsToPatch = [
- 'push',
- 'pop',
- 'shift',
- 'unshift',
- 'splice',
- 'sort',
- 'reverse'
- ];
- /**
- * Intercept mutating methods and emit events
- */
- methodsToPatch.forEach(function (method) {
- // cache original method
- var original = arrayProto[method];
- def(arrayMethods, method, function mutator () {
- var args = [], len = arguments.length;
- while ( len-- ) args[ len ] = arguments[ len ];
- var result = original.apply(this, args);
- var ob = this.__ob__;
- var inserted;
- switch (method) {
- case 'push':
- case 'unshift':
- inserted = args;
- break
- case 'splice':
- inserted = args.slice(2);
- break
- }
- if (inserted) { ob.observeArray(inserted); }
- // notify change
- ob.dep.notify();
- return result
- });
- });
- /* */
- var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
- /**
- * In some cases we may want to disable observation inside a component's
- * update computation.
- */
- var shouldObserve = true;
- function toggleObserving (value) {
- shouldObserve = value;
- }
- /**
- * Observer class that is attached to each observed
- * object. Once attached, the observer converts the target
- * object's property keys into getter/setters that
- * collect dependencies and dispatch updates.
- */
- var Observer = function Observer (value) {
- this.value = value;
- this.dep = new Dep();
- this.vmCount = 0;
- def(value, '__ob__', this);
- if (Array.isArray(value)) {
- if (hasProto) {
- {// fixed by xxxxxx 微信小程序使用 plugins 之后,数组方法被直接挂载到了数组对象上,需要执行 copyAugment 逻辑
- if(value.push !== value.__proto__.push){
- copyAugment(value, arrayMethods, arrayKeys);
- } else {
- protoAugment(value, arrayMethods);
- }
- }
- } else {
- copyAugment(value, arrayMethods, arrayKeys);
- }
- this.observeArray(value);
- } else {
- this.walk(value);
- }
- };
- /**
- * Walk through all properties and convert them into
- * getter/setters. This method should only be called when
- * value type is Object.
- */
- Observer.prototype.walk = function walk (obj) {
- var keys = Object.keys(obj);
- for (var i = 0; i < keys.length; i++) {
- defineReactive$$1(obj, keys[i]);
- }
- };
- /**
- * Observe a list of Array items.
- */
- Observer.prototype.observeArray = function observeArray (items) {
- for (var i = 0, l = items.length; i < l; i++) {
- observe(items[i]);
- }
- };
- // helpers
- /**
- * Augment a target Object or Array by intercepting
- * the prototype chain using __proto__
- */
- function protoAugment (target, src) {
- /* eslint-disable no-proto */
- target.__proto__ = src;
- /* eslint-enable no-proto */
- }
- /**
- * Augment a target Object or Array by defining
- * hidden properties.
- */
- /* istanbul ignore next */
- function copyAugment (target, src, keys) {
- for (var i = 0, l = keys.length; i < l; i++) {
- var key = keys[i];
- def(target, key, src[key]);
- }
- }
- /**
- * Attempt to create an observer instance for a value,
- * returns the new observer if successfully observed,
- * or the existing observer if the value already has one.
- */
- function observe (value, asRootData) {
- if (!isObject(value) || value instanceof VNode) {
- return
- }
- var ob;
- if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
- ob = value.__ob__;
- } else if (
- shouldObserve &&
- !isServerRendering() &&
- (Array.isArray(value) || isPlainObject(value)) &&
- Object.isExtensible(value) &&
- !value._isVue &&
- !value.__v_isMPComponent
- ) {
- ob = new Observer(value);
- }
- if (asRootData && ob) {
- ob.vmCount++;
- }
- return ob
- }
- /**
- * Define a reactive property on an Object.
- */
- function defineReactive$$1 (
- obj,
- key,
- val,
- customSetter,
- shallow
- ) {
- var dep = new Dep();
- var property = Object.getOwnPropertyDescriptor(obj, key);
- if (property && property.configurable === false) {
- return
- }
- // cater for pre-defined getter/setters
- var getter = property && property.get;
- var setter = property && property.set;
- if ((!getter || setter) && arguments.length === 2) {
- val = obj[key];
- }
- var childOb = !shallow && observe(val);
- Object.defineProperty(obj, key, {
- enumerable: true,
- configurable: true,
- get: function reactiveGetter () {
- var value = getter ? getter.call(obj) : val;
- if (Dep.SharedObject.target) { // fixed by xxxxxx
- dep.depend();
- if (childOb) {
- childOb.dep.depend();
- if (Array.isArray(value)) {
- dependArray(value);
- }
- }
- }
- return value
- },
- set: function reactiveSetter (newVal) {
- var value = getter ? getter.call(obj) : val;
- /* eslint-disable no-self-compare */
- if (newVal === value || (newVal !== newVal && value !== value)) {
- return
- }
- /* eslint-enable no-self-compare */
- if ( true && customSetter) {
- customSetter();
- }
- // #7981: for accessor properties without setter
- if (getter && !setter) { return }
- if (setter) {
- setter.call(obj, newVal);
- } else {
- val = newVal;
- }
- childOb = !shallow && observe(newVal);
- dep.notify();
- }
- });
- }
- /**
- * Set a property on an object. Adds the new property and
- * triggers change notification if the property doesn't
- * already exist.
- */
- function set (target, key, val) {
- if ( true &&
- (isUndef(target) || isPrimitive(target))
- ) {
- warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
- }
- if (Array.isArray(target) && isValidArrayIndex(key)) {
- target.length = Math.max(target.length, key);
- target.splice(key, 1, val);
- return val
- }
- if (key in target && !(key in Object.prototype)) {
- target[key] = val;
- return val
- }
- var ob = (target).__ob__;
- if (target._isVue || (ob && ob.vmCount)) {
- true && warn(
- 'Avoid adding reactive properties to a Vue instance or its root $data ' +
- 'at runtime - declare it upfront in the data option.'
- );
- return val
- }
- if (!ob) {
- target[key] = val;
- return val
- }
- defineReactive$$1(ob.value, key, val);
- ob.dep.notify();
- return val
- }
- /**
- * Delete a property and trigger change if necessary.
- */
- function del (target, key) {
- if ( true &&
- (isUndef(target) || isPrimitive(target))
- ) {
- warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
- }
- if (Array.isArray(target) && isValidArrayIndex(key)) {
- target.splice(key, 1);
- return
- }
- var ob = (target).__ob__;
- if (target._isVue || (ob && ob.vmCount)) {
- true && warn(
- 'Avoid deleting properties on a Vue instance or its root $data ' +
- '- just set it to null.'
- );
- return
- }
- if (!hasOwn(target, key)) {
- return
- }
- delete target[key];
- if (!ob) {
- return
- }
- ob.dep.notify();
- }
- /**
- * Collect dependencies on array elements when the array is touched, since
- * we cannot intercept array element access like property getters.
- */
- function dependArray (value) {
- for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
- e = value[i];
- e && e.__ob__ && e.__ob__.dep.depend();
- if (Array.isArray(e)) {
- dependArray(e);
- }
- }
- }
- /* */
- /**
- * Option overwriting strategies are functions that handle
- * how to merge a parent option value and a child option
- * value into the final value.
- */
- var strats = config.optionMergeStrategies;
- /**
- * Options with restrictions
- */
- if (true) {
- strats.el = strats.propsData = function (parent, child, vm, key) {
- if (!vm) {
- warn(
- "option \"" + key + "\" can only be used during instance " +
- 'creation with the `new` keyword.'
- );
- }
- return defaultStrat(parent, child)
- };
- }
- /**
- * Helper that recursively merges two data objects together.
- */
- function mergeData (to, from) {
- if (!from) { return to }
- var key, toVal, fromVal;
- var keys = hasSymbol
- ? Reflect.ownKeys(from)
- : Object.keys(from);
- for (var i = 0; i < keys.length; i++) {
- key = keys[i];
- // in case the object is already observed...
- if (key === '__ob__') { continue }
- toVal = to[key];
- fromVal = from[key];
- if (!hasOwn(to, key)) {
- set(to, key, fromVal);
- } else if (
- toVal !== fromVal &&
- isPlainObject(toVal) &&
- isPlainObject(fromVal)
- ) {
- mergeData(toVal, fromVal);
- }
- }
- return to
- }
- /**
- * Data
- */
- function mergeDataOrFn (
- parentVal,
- childVal,
- vm
- ) {
- if (!vm) {
- // in a Vue.extend merge, both should be functions
- if (!childVal) {
- return parentVal
- }
- if (!parentVal) {
- return childVal
- }
- // when parentVal & childVal are both present,
- // we need to return a function that returns the
- // merged result of both functions... no need to
- // check if parentVal is a function here because
- // it has to be a function to pass previous merges.
- return function mergedDataFn () {
- return mergeData(
- typeof childVal === 'function' ? childVal.call(this, this) : childVal,
- typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
- )
- }
- } else {
- return function mergedInstanceDataFn () {
- // instance merge
- var instanceData = typeof childVal === 'function'
- ? childVal.call(vm, vm)
- : childVal;
- var defaultData = typeof parentVal === 'function'
- ? parentVal.call(vm, vm)
- : parentVal;
- if (instanceData) {
- return mergeData(instanceData, defaultData)
- } else {
- return defaultData
- }
- }
- }
- }
- strats.data = function (
- parentVal,
- childVal,
- vm
- ) {
- if (!vm) {
- if (childVal && typeof childVal !== 'function') {
- true && warn(
- 'The "data" option should be a function ' +
- 'that returns a per-instance value in component ' +
- 'definitions.',
- vm
- );
- return parentVal
- }
- return mergeDataOrFn(parentVal, childVal)
- }
- return mergeDataOrFn(parentVal, childVal, vm)
- };
- /**
- * Hooks and props are merged as arrays.
- */
- function mergeHook (
- parentVal,
- childVal
- ) {
- var res = childVal
- ? parentVal
- ? parentVal.concat(childVal)
- : Array.isArray(childVal)
- ? childVal
- : [childVal]
- : parentVal;
- return res
- ? dedupeHooks(res)
- : res
- }
- function dedupeHooks (hooks) {
- var res = [];
- for (var i = 0; i < hooks.length; i++) {
- if (res.indexOf(hooks[i]) === -1) {
- res.push(hooks[i]);
- }
- }
- return res
- }
- LIFECYCLE_HOOKS.forEach(function (hook) {
- strats[hook] = mergeHook;
- });
- /**
- * Assets
- *
- * When a vm is present (instance creation), we need to do
- * a three-way merge between constructor options, instance
- * options and parent options.
- */
- function mergeAssets (
- parentVal,
- childVal,
- vm,
- key
- ) {
- var res = Object.create(parentVal || null);
- if (childVal) {
- true && assertObjectType(key, childVal, vm);
- return extend(res, childVal)
- } else {
- return res
- }
- }
- ASSET_TYPES.forEach(function (type) {
- strats[type + 's'] = mergeAssets;
- });
- /**
- * Watchers.
- *
- * Watchers hashes should not overwrite one
- * another, so we merge them as arrays.
- */
- strats.watch = function (
- parentVal,
- childVal,
- vm,
- key
- ) {
- // work around Firefox's Object.prototype.watch...
- if (parentVal === nativeWatch) { parentVal = undefined; }
- if (childVal === nativeWatch) { childVal = undefined; }
- /* istanbul ignore if */
- if (!childVal) { return Object.create(parentVal || null) }
- if (true) {
- assertObjectType(key, childVal, vm);
- }
- if (!parentVal) { return childVal }
- var ret = {};
- extend(ret, parentVal);
- for (var key$1 in childVal) {
- var parent = ret[key$1];
- var child = childVal[key$1];
- if (parent && !Array.isArray(parent)) {
- parent = [parent];
- }
- ret[key$1] = parent
- ? parent.concat(child)
- : Array.isArray(child) ? child : [child];
- }
- return ret
- };
- /**
- * Other object hashes.
- */
- strats.props =
- strats.methods =
- strats.inject =
- strats.computed = function (
- parentVal,
- childVal,
- vm,
- key
- ) {
- if (childVal && "development" !== 'production') {
- assertObjectType(key, childVal, vm);
- }
- if (!parentVal) { return childVal }
- var ret = Object.create(null);
- extend(ret, parentVal);
- if (childVal) { extend(ret, childVal); }
- return ret
- };
- strats.provide = mergeDataOrFn;
- /**
- * Default strategy.
- */
- var defaultStrat = function (parentVal, childVal) {
- return childVal === undefined
- ? parentVal
- : childVal
- };
- /**
- * Validate component names
- */
- function checkComponents (options) {
- for (var key in options.components) {
- validateComponentName(key);
- }
- }
- function validateComponentName (name) {
- if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
- warn(
- 'Invalid component name: "' + name + '". Component names ' +
- 'should conform to valid custom element name in html5 specification.'
- );
- }
- if (isBuiltInTag(name) || config.isReservedTag(name)) {
- warn(
- 'Do not use built-in or reserved HTML elements as component ' +
- 'id: ' + name
- );
- }
- }
- /**
- * Ensure all props option syntax are normalized into the
- * Object-based format.
- */
- function normalizeProps (options, vm) {
- var props = options.props;
- if (!props) { return }
- var res = {};
- var i, val, name;
- if (Array.isArray(props)) {
- i = props.length;
- while (i--) {
- val = props[i];
- if (typeof val === 'string') {
- name = camelize(val);
- res[name] = { type: null };
- } else if (true) {
- warn('props must be strings when using array syntax.');
- }
- }
- } else if (isPlainObject(props)) {
- for (var key in props) {
- val = props[key];
- name = camelize(key);
- res[name] = isPlainObject(val)
- ? val
- : { type: val };
- }
- } else if (true) {
- warn(
- "Invalid value for option \"props\": expected an Array or an Object, " +
- "but got " + (toRawType(props)) + ".",
- vm
- );
- }
- options.props = res;
- }
- /**
- * Normalize all injections into Object-based format
- */
- function normalizeInject (options, vm) {
- var inject = options.inject;
- if (!inject) { return }
- var normalized = options.inject = {};
- if (Array.isArray(inject)) {
- for (var i = 0; i < inject.length; i++) {
- normalized[inject[i]] = { from: inject[i] };
- }
- } else if (isPlainObject(inject)) {
- for (var key in inject) {
- var val = inject[key];
- normalized[key] = isPlainObject(val)
- ? extend({ from: key }, val)
- : { from: val };
- }
- } else if (true) {
- warn(
- "Invalid value for option \"inject\": expected an Array or an Object, " +
- "but got " + (toRawType(inject)) + ".",
- vm
- );
- }
- }
- /**
- * Normalize raw function directives into object format.
- */
- function normalizeDirectives (options) {
- var dirs = options.directives;
- if (dirs) {
- for (var key in dirs) {
- var def$$1 = dirs[key];
- if (typeof def$$1 === 'function') {
- dirs[key] = { bind: def$$1, update: def$$1 };
- }
- }
- }
- }
- function assertObjectType (name, value, vm) {
- if (!isPlainObject(value)) {
- warn(
- "Invalid value for option \"" + name + "\": expected an Object, " +
- "but got " + (toRawType(value)) + ".",
- vm
- );
- }
- }
- /**
- * Merge two option objects into a new one.
- * Core utility used in both instantiation and inheritance.
- */
- function mergeOptions (
- parent,
- child,
- vm
- ) {
- if (true) {
- checkComponents(child);
- }
- if (typeof child === 'function') {
- child = child.options;
- }
- normalizeProps(child, vm);
- normalizeInject(child, vm);
- normalizeDirectives(child);
- // Apply extends and mixins on the child options,
- // but only if it is a raw options object that isn't
- // the result of another mergeOptions call.
- // Only merged options has the _base property.
- if (!child._base) {
- if (child.extends) {
- parent = mergeOptions(parent, child.extends, vm);
- }
- if (child.mixins) {
- for (var i = 0, l = child.mixins.length; i < l; i++) {
- parent = mergeOptions(parent, child.mixins[i], vm);
- }
- }
- }
- var options = {};
- var key;
- for (key in parent) {
- mergeField(key);
- }
- for (key in child) {
- if (!hasOwn(parent, key)) {
- mergeField(key);
- }
- }
- function mergeField (key) {
- var strat = strats[key] || defaultStrat;
- options[key] = strat(parent[key], child[key], vm, key);
- }
- return options
- }
- /**
- * Resolve an asset.
- * This function is used because child instances need access
- * to assets defined in its ancestor chain.
- */
- function resolveAsset (
- options,
- type,
- id,
- warnMissing
- ) {
- /* istanbul ignore if */
- if (typeof id !== 'string') {
- return
- }
- var assets = options[type];
- // check local registration variations first
- if (hasOwn(assets, id)) { return assets[id] }
- var camelizedId = camelize(id);
- if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
- var PascalCaseId = capitalize(camelizedId);
- if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
- // fallback to prototype chain
- var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
- if ( true && warnMissing && !res) {
- warn(
- 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
- options
- );
- }
- return res
- }
- /* */
- function validateProp (
- key,
- propOptions,
- propsData,
- vm
- ) {
- var prop = propOptions[key];
- var absent = !hasOwn(propsData, key);
- var value = propsData[key];
- // boolean casting
- var booleanIndex = getTypeIndex(Boolean, prop.type);
- if (booleanIndex > -1) {
- if (absent && !hasOwn(prop, 'default')) {
- value = false;
- } else if (value === '' || value === hyphenate(key)) {
- // only cast empty string / same name to boolean if
- // boolean has higher priority
- var stringIndex = getTypeIndex(String, prop.type);
- if (stringIndex < 0 || booleanIndex < stringIndex) {
- value = true;
- }
- }
- }
- // check default value
- if (value === undefined) {
- value = getPropDefaultValue(vm, prop, key);
- // since the default value is a fresh copy,
- // make sure to observe it.
- var prevShouldObserve = shouldObserve;
- toggleObserving(true);
- observe(value);
- toggleObserving(prevShouldObserve);
- }
- if (
- true
- ) {
- assertProp(prop, key, value, vm, absent);
- }
- return value
- }
- /**
- * Get the default value of a prop.
- */
- function getPropDefaultValue (vm, prop, key) {
- // no default, return undefined
- if (!hasOwn(prop, 'default')) {
- return undefined
- }
- var def = prop.default;
- // warn against non-factory defaults for Object & Array
- if ( true && isObject(def)) {
- warn(
- 'Invalid default value for prop "' + key + '": ' +
- 'Props with type Object/Array must use a factory function ' +
- 'to return the default value.',
- vm
- );
- }
- // the raw prop value was also undefined from previous render,
- // return previous default value to avoid unnecessary watcher trigger
- if (vm && vm.$options.propsData &&
- vm.$options.propsData[key] === undefined &&
- vm._props[key] !== undefined
- ) {
- return vm._props[key]
- }
- // call factory function for non-Function types
- // a value is Function if its prototype is function even across different execution context
- return typeof def === 'function' && getType(prop.type) !== 'Function'
- ? def.call(vm)
- : def
- }
- /**
- * Assert whether a prop is valid.
- */
- function assertProp (
- prop,
- name,
- value,
- vm,
- absent
- ) {
- if (prop.required && absent) {
- warn(
- 'Missing required prop: "' + name + '"',
- vm
- );
- return
- }
- if (value == null && !prop.required) {
- return
- }
- var type = prop.type;
- var valid = !type || type === true;
- var expectedTypes = [];
- if (type) {
- if (!Array.isArray(type)) {
- type = [type];
- }
- for (var i = 0; i < type.length && !valid; i++) {
- var assertedType = assertType(value, type[i]);
- expectedTypes.push(assertedType.expectedType || '');
- valid = assertedType.valid;
- }
- }
- if (!valid) {
- warn(
- getInvalidTypeMessage(name, value, expectedTypes),
- vm
- );
- return
- }
- var validator = prop.validator;
- if (validator) {
- if (!validator(value)) {
- warn(
- 'Invalid prop: custom validator check failed for prop "' + name + '".',
- vm
- );
- }
- }
- }
- var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
- function assertType (value, type) {
- var valid;
- var expectedType = getType(type);
- if (simpleCheckRE.test(expectedType)) {
- var t = typeof value;
- valid = t === expectedType.toLowerCase();
- // for primitive wrapper objects
- if (!valid && t === 'object') {
- valid = value instanceof type;
- }
- } else if (expectedType === 'Object') {
- valid = isPlainObject(value);
- } else if (expectedType === 'Array') {
- valid = Array.isArray(value);
- } else {
- valid = value instanceof type;
- }
- return {
- valid: valid,
- expectedType: expectedType
- }
- }
- /**
- * Use function string name to check built-in types,
- * because a simple equality check will fail when running
- * across different vms / iframes.
- */
- function getType (fn) {
- var match = fn && fn.toString().match(/^\s*function (\w+)/);
- return match ? match[1] : ''
- }
- function isSameType (a, b) {
- return getType(a) === getType(b)
- }
- function getTypeIndex (type, expectedTypes) {
- if (!Array.isArray(expectedTypes)) {
- return isSameType(expectedTypes, type) ? 0 : -1
- }
- for (var i = 0, len = expectedTypes.length; i < len; i++) {
- if (isSameType(expectedTypes[i], type)) {
- return i
- }
- }
- return -1
- }
- function getInvalidTypeMessage (name, value, expectedTypes) {
- var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
- " Expected " + (expectedTypes.map(capitalize).join(', '));
- var expectedType = expectedTypes[0];
- var receivedType = toRawType(value);
- var expectedValue = styleValue(value, expectedType);
- var receivedValue = styleValue(value, receivedType);
- // check if we need to specify expected value
- if (expectedTypes.length === 1 &&
- isExplicable(expectedType) &&
- !isBoolean(expectedType, receivedType)) {
- message += " with value " + expectedValue;
- }
- message += ", got " + receivedType + " ";
- // check if we need to specify received value
- if (isExplicable(receivedType)) {
- message += "with value " + receivedValue + ".";
- }
- return message
- }
- function styleValue (value, type) {
- if (type === 'String') {
- return ("\"" + value + "\"")
- } else if (type === 'Number') {
- return ("" + (Number(value)))
- } else {
- return ("" + value)
- }
- }
- function isExplicable (value) {
- var explicitTypes = ['string', 'number', 'boolean'];
- return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
- }
- function isBoolean () {
- var args = [], len = arguments.length;
- while ( len-- ) args[ len ] = arguments[ len ];
- return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
- }
- /* */
- function handleError (err, vm, info) {
- // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
- // See: https://github.com/vuejs/vuex/issues/1505
- pushTarget();
- try {
- if (vm) {
- var cur = vm;
- while ((cur = cur.$parent)) {
- var hooks = cur.$options.errorCaptured;
- if (hooks) {
- for (var i = 0; i < hooks.length; i++) {
- try {
- var capture = hooks[i].call(cur, err, vm, info) === false;
- if (capture) { return }
- } catch (e) {
- globalHandleError(e, cur, 'errorCaptured hook');
- }
- }
- }
- }
- }
- globalHandleError(err, vm, info);
- } finally {
- popTarget();
- }
- }
- function invokeWithErrorHandling (
- handler,
- context,
- args,
- vm,
- info
- ) {
- var res;
- try {
- res = args ? handler.apply(context, args) : handler.call(context);
- if (res && !res._isVue && isPromise(res) && !res._handled) {
- res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
- // issue #9511
- // avoid catch triggering multiple times when nested calls
- res._handled = true;
- }
- } catch (e) {
- handleError(e, vm, info);
- }
- return res
- }
- function globalHandleError (err, vm, info) {
- if (config.errorHandler) {
- try {
- return config.errorHandler.call(null, err, vm, info)
- } catch (e) {
- // if the user intentionally throws the original error in the handler,
- // do not log it twice
- if (e !== err) {
- logError(e, null, 'config.errorHandler');
- }
- }
- }
- logError(err, vm, info);
- }
- function logError (err, vm, info) {
- if (true) {
- warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
- }
- /* istanbul ignore else */
- if ((inBrowser || inWeex) && typeof console !== 'undefined') {
- console.error(err);
- } else {
- throw err
- }
- }
- /* */
- var callbacks = [];
- var pending = false;
- function flushCallbacks () {
- pending = false;
- var copies = callbacks.slice(0);
- callbacks.length = 0;
- for (var i = 0; i < copies.length; i++) {
- copies[i]();
- }
- }
- // Here we have async deferring wrappers using microtasks.
- // In 2.5 we used (macro) tasks (in combination with microtasks).
- // However, it has subtle problems when state is changed right before repaint
- // (e.g. #6813, out-in transitions).
- // Also, using (macro) tasks in event handler would cause some weird behaviors
- // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
- // So we now use microtasks everywhere, again.
- // A major drawback of this tradeoff is that there are some scenarios
- // where microtasks have too high a priority and fire in between supposedly
- // sequential events (e.g. #4521, #6690, which have workarounds)
- // or even between bubbling of the same event (#6566).
- var timerFunc;
- // The nextTick behavior leverages the microtask queue, which can be accessed
- // via either native Promise.then or MutationObserver.
- // MutationObserver has wider support, however it is seriously bugged in
- // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
- // completely stops working after triggering a few times... so, if native
- // Promise is available, we will use it:
- /* istanbul ignore next, $flow-disable-line */
- if (typeof Promise !== 'undefined' && isNative(Promise)) {
- var p = Promise.resolve();
- timerFunc = function () {
- p.then(flushCallbacks);
- // In problematic UIWebViews, Promise.then doesn't completely break, but
- // it can get stuck in a weird state where callbacks are pushed into the
- // microtask queue but the queue isn't being flushed, until the browser
- // needs to do some other work, e.g. handle a timer. Therefore we can
- // "force" the microtask queue to be flushed by adding an empty timer.
- if (isIOS) { setTimeout(noop); }
- };
- } else if (!isIE && typeof MutationObserver !== 'undefined' && (
- isNative(MutationObserver) ||
- // PhantomJS and iOS 7.x
- MutationObserver.toString() === '[object MutationObserverConstructor]'
- )) {
- // Use MutationObserver where native Promise is not available,
- // e.g. PhantomJS, iOS7, Android 4.4
- // (#6466 MutationObserver is unreliable in IE11)
- var counter = 1;
- var observer = new MutationObserver(flushCallbacks);
- var textNode = document.createTextNode(String(counter));
- observer.observe(textNode, {
- characterData: true
- });
- timerFunc = function () {
- counter = (counter + 1) % 2;
- textNode.data = String(counter);
- };
- } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
- // Fallback to setImmediate.
- // Technically it leverages the (macro) task queue,
- // but it is still a better choice than setTimeout.
- timerFunc = function () {
- setImmediate(flushCallbacks);
- };
- } else {
- // Fallback to setTimeout.
- timerFunc = function () {
- setTimeout(flushCallbacks, 0);
- };
- }
- function nextTick (cb, ctx) {
- var _resolve;
- callbacks.push(function () {
- if (cb) {
- try {
- cb.call(ctx);
- } catch (e) {
- handleError(e, ctx, 'nextTick');
- }
- } else if (_resolve) {
- _resolve(ctx);
- }
- });
- if (!pending) {
- pending = true;
- timerFunc();
- }
- // $flow-disable-line
- if (!cb && typeof Promise !== 'undefined') {
- return new Promise(function (resolve) {
- _resolve = resolve;
- })
- }
- }
- /* */
- /* not type checking this file because flow doesn't play well with Proxy */
- var initProxy;
- if (true) {
- var allowedGlobals = makeMap(
- 'Infinity,undefined,NaN,isFinite,isNaN,' +
- 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
- 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
- 'require' // for Webpack/Browserify
- );
- var warnNonPresent = function (target, key) {
- warn(
- "Property or method \"" + key + "\" is not defined on the instance but " +
- 'referenced during render. Make sure that this property is reactive, ' +
- 'either in the data option, or for class-based components, by ' +
- 'initializing the property. ' +
- 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
- target
- );
- };
- var warnReservedPrefix = function (target, key) {
- warn(
- "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
- 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
- 'prevent conflicts with Vue internals. ' +
- 'See: https://vuejs.org/v2/api/#data',
- target
- );
- };
- var hasProxy =
- typeof Proxy !== 'undefined' && isNative(Proxy);
- if (hasProxy) {
- var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
- config.keyCodes = new Proxy(config.keyCodes, {
- set: function set (target, key, value) {
- if (isBuiltInModifier(key)) {
- warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
- return false
- } else {
- target[key] = value;
- return true
- }
- }
- });
- }
- var hasHandler = {
- has: function has (target, key) {
- var has = key in target;
- var isAllowed = allowedGlobals(key) ||
- (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
- if (!has && !isAllowed) {
- if (key in target.$data) { warnReservedPrefix(target, key); }
- else { warnNonPresent(target, key); }
- }
- return has || !isAllowed
- }
- };
- var getHandler = {
- get: function get (target, key) {
- if (typeof key === 'string' && !(key in target)) {
- if (key in target.$data) { warnReservedPrefix(target, key); }
- else { warnNonPresent(target, key); }
- }
- return target[key]
- }
- };
- initProxy = function initProxy (vm) {
- if (hasProxy) {
- // determine which proxy handler to use
- var options = vm.$options;
- var handlers = options.render && options.render._withStripped
- ? getHandler
- : hasHandler;
- vm._renderProxy = new Proxy(vm, handlers);
- } else {
- vm._renderProxy = vm;
- }
- };
- }
- /* */
- var seenObjects = new _Set();
- /**
- * Recursively traverse an object to evoke all converted
- * getters, so that every nested property inside the object
- * is collected as a "deep" dependency.
- */
- function traverse (val) {
- _traverse(val, seenObjects);
- seenObjects.clear();
- }
- function _traverse (val, seen) {
- var i, keys;
- var isA = Array.isArray(val);
- if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
- return
- }
- if (val.__ob__) {
- var depId = val.__ob__.dep.id;
- if (seen.has(depId)) {
- return
- }
- seen.add(depId);
- }
- if (isA) {
- i = val.length;
- while (i--) { _traverse(val[i], seen); }
- } else {
- keys = Object.keys(val);
- i = keys.length;
- while (i--) { _traverse(val[keys[i]], seen); }
- }
- }
- var mark;
- var measure;
- if (true) {
- var perf = inBrowser && window.performance;
- /* istanbul ignore if */
- if (
- perf &&
- perf.mark &&
- perf.measure &&
- perf.clearMarks &&
- perf.clearMeasures
- ) {
- mark = function (tag) { return perf.mark(tag); };
- measure = function (name, startTag, endTag) {
- perf.measure(name, startTag, endTag);
- perf.clearMarks(startTag);
- perf.clearMarks(endTag);
- // perf.clearMeasures(name)
- };
- }
- }
- /* */
- var normalizeEvent = cached(function (name) {
- var passive = name.charAt(0) === '&';
- name = passive ? name.slice(1) : name;
- var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
- name = once$$1 ? name.slice(1) : name;
- var capture = name.charAt(0) === '!';
- name = capture ? name.slice(1) : name;
- return {
- name: name,
- once: once$$1,
- capture: capture,
- passive: passive
- }
- });
- function createFnInvoker (fns, vm) {
- function invoker () {
- var arguments$1 = arguments;
- var fns = invoker.fns;
- if (Array.isArray(fns)) {
- var cloned = fns.slice();
- for (var i = 0; i < cloned.length; i++) {
- invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
- }
- } else {
- // return handler return value for single handlers
- return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
- }
- }
- invoker.fns = fns;
- return invoker
- }
- function updateListeners (
- on,
- oldOn,
- add,
- remove$$1,
- createOnceHandler,
- vm
- ) {
- var name, def$$1, cur, old, event;
- for (name in on) {
- def$$1 = cur = on[name];
- old = oldOn[name];
- event = normalizeEvent(name);
- if (isUndef(cur)) {
- true && warn(
- "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
- vm
- );
- } else if (isUndef(old)) {
- if (isUndef(cur.fns)) {
- cur = on[name] = createFnInvoker(cur, vm);
- }
- if (isTrue(event.once)) {
- cur = on[name] = createOnceHandler(event.name, cur, event.capture);
- }
- add(event.name, cur, event.capture, event.passive, event.params);
- } else if (cur !== old) {
- old.fns = cur;
- on[name] = old;
- }
- }
- for (name in oldOn) {
- if (isUndef(on[name])) {
- event = normalizeEvent(name);
- remove$$1(event.name, oldOn[name], event.capture);
- }
- }
- }
- /* */
- /* */
- // fixed by xxxxxx (mp properties)
- function extractPropertiesFromVNodeData(data, Ctor, res, context) {
- var propOptions = Ctor.options.mpOptions && Ctor.options.mpOptions.properties;
- if (isUndef(propOptions)) {
- return res
- }
- var externalClasses = Ctor.options.mpOptions.externalClasses || [];
- var attrs = data.attrs;
- var props = data.props;
- if (isDef(attrs) || isDef(props)) {
- for (var key in propOptions) {
- var altKey = hyphenate(key);
- var result = checkProp(res, props, key, altKey, true) ||
- checkProp(res, attrs, key, altKey, false);
- // externalClass
- if (
- result &&
- res[key] &&
- externalClasses.indexOf(altKey) !== -1 &&
- context[camelize(res[key])]
- ) {
- // 赋值 externalClass 真正的值(模板里 externalClass 的值可能是字符串)
- res[key] = context[camelize(res[key])];
- }
- }
- }
- return res
- }
- function extractPropsFromVNodeData (
- data,
- Ctor,
- tag,
- context// fixed by xxxxxx
- ) {
- // we are only extracting raw values here.
- // validation and default values are handled in the child
- // component itself.
- var propOptions = Ctor.options.props;
- if (isUndef(propOptions)) {
- // fixed by xxxxxx
- return extractPropertiesFromVNodeData(data, Ctor, {}, context)
- }
- var res = {};
- var attrs = data.attrs;
- var props = data.props;
- if (isDef(attrs) || isDef(props)) {
- for (var key in propOptions) {
- var altKey = hyphenate(key);
- if (true) {
- var keyInLowerCase = key.toLowerCase();
- if (
- key !== keyInLowerCase &&
- attrs && hasOwn(attrs, keyInLowerCase)
- ) {
- tip(
- "Prop \"" + keyInLowerCase + "\" is passed to component " +
- (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
- " \"" + key + "\". " +
- "Note that HTML attributes are case-insensitive and camelCased " +
- "props need to use their kebab-case equivalents when using in-DOM " +
- "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
- );
- }
- }
- checkProp(res, props, key, altKey, true) ||
- checkProp(res, attrs, key, altKey, false);
- }
- }
- // fixed by xxxxxx
- return extractPropertiesFromVNodeData(data, Ctor, res, context)
- }
- function checkProp (
- res,
- hash,
- key,
- altKey,
- preserve
- ) {
- if (isDef(hash)) {
- if (hasOwn(hash, key)) {
- res[key] = hash[key];
- if (!preserve) {
- delete hash[key];
- }
- return true
- } else if (hasOwn(hash, altKey)) {
- res[key] = hash[altKey];
- if (!preserve) {
- delete hash[altKey];
- }
- return true
- }
- }
- return false
- }
- /* */
- // The template compiler attempts to minimize the need for normalization by
- // statically analyzing the template at compile time.
- //
- // For plain HTML markup, normalization can be completely skipped because the
- // generated render function is guaranteed to return Array<VNode>. There are
- // two cases where extra normalization is needed:
- // 1. When the children contains components - because a functional component
- // may return an Array instead of a single root. In this case, just a simple
- // normalization is needed - if any child is an Array, we flatten the whole
- // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
- // because functional components already normalize their own children.
- function simpleNormalizeChildren (children) {
- for (var i = 0; i < children.length; i++) {
- if (Array.isArray(children[i])) {
- return Array.prototype.concat.apply([], children)
- }
- }
- return children
- }
- // 2. When the children contains constructs that always generated nested Arrays,
- // e.g. <template>, <slot>, v-for, or when the children is provided by user
- // with hand-written render functions / JSX. In such cases a full normalization
- // is needed to cater to all possible types of children values.
- function normalizeChildren (children) {
- return isPrimitive(children)
- ? [createTextVNode(children)]
- : Array.isArray(children)
- ? normalizeArrayChildren(children)
- : undefined
- }
- function isTextNode (node) {
- return isDef(node) && isDef(node.text) && isFalse(node.isComment)
- }
- function normalizeArrayChildren (children, nestedIndex) {
- var res = [];
- var i, c, lastIndex, last;
- for (i = 0; i < children.length; i++) {
- c = children[i];
- if (isUndef(c) || typeof c === 'boolean') { continue }
- lastIndex = res.length - 1;
- last = res[lastIndex];
- // nested
- if (Array.isArray(c)) {
- if (c.length > 0) {
- c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
- // merge adjacent text nodes
- if (isTextNode(c[0]) && isTextNode(last)) {
- res[lastIndex] = createTextVNode(last.text + (c[0]).text);
- c.shift();
- }
- res.push.apply(res, c);
- }
- } else if (isPrimitive(c)) {
- if (isTextNode(last)) {
- // merge adjacent text nodes
- // this is necessary for SSR hydration because text nodes are
- // essentially merged when rendered to HTML strings
- res[lastIndex] = createTextVNode(last.text + c);
- } else if (c !== '') {
- // convert primitive to vnode
- res.push(createTextVNode(c));
- }
- } else {
- if (isTextNode(c) && isTextNode(last)) {
- // merge adjacent text nodes
- res[lastIndex] = createTextVNode(last.text + c.text);
- } else {
- // default key for nested array children (likely generated by v-for)
- if (isTrue(children._isVList) &&
- isDef(c.tag) &&
- isUndef(c.key) &&
- isDef(nestedIndex)) {
- c.key = "__vlist" + nestedIndex + "_" + i + "__";
- }
- res.push(c);
- }
- }
- }
- return res
- }
- /* */
- function initProvide (vm) {
- var provide = vm.$options.provide;
- if (provide) {
- vm._provided = typeof provide === 'function'
- ? provide.call(vm)
- : provide;
- }
- }
- function initInjections (vm) {
- var result = resolveInject(vm.$options.inject, vm);
- if (result) {
- toggleObserving(false);
- Object.keys(result).forEach(function (key) {
- /* istanbul ignore else */
- if (true) {
- defineReactive$$1(vm, key, result[key], function () {
- warn(
- "Avoid mutating an injected value directly since the changes will be " +
- "overwritten whenever the provided component re-renders. " +
- "injection being mutated: \"" + key + "\"",
- vm
- );
- });
- } else {}
- });
- toggleObserving(true);
- }
- }
- function resolveInject (inject, vm) {
- if (inject) {
- // inject is :any because flow is not smart enough to figure out cached
- var result = Object.create(null);
- var keys = hasSymbol
- ? Reflect.ownKeys(inject)
- : Object.keys(inject);
- for (var i = 0; i < keys.length; i++) {
- var key = keys[i];
- // #6574 in case the inject object is observed...
- if (key === '__ob__') { continue }
- var provideKey = inject[key].from;
- var source = vm;
- while (source) {
- if (source._provided && hasOwn(source._provided, provideKey)) {
- result[key] = source._provided[provideKey];
- break
- }
- source = source.$parent;
- }
- if (!source) {
- if ('default' in inject[key]) {
- var provideDefault = inject[key].default;
- result[key] = typeof provideDefault === 'function'
- ? provideDefault.call(vm)
- : provideDefault;
- } else if (true) {
- warn(("Injection \"" + key + "\" not found"), vm);
- }
- }
- }
- return result
- }
- }
- /* */
- /**
- * Runtime helper for resolving raw children VNodes into a slot object.
- */
- function resolveSlots (
- children,
- context
- ) {
- if (!children || !children.length) {
- return {}
- }
- var slots = {};
- for (var i = 0, l = children.length; i < l; i++) {
- var child = children[i];
- var data = child.data;
- // remove slot attribute if the node is resolved as a Vue slot node
- if (data && data.attrs && data.attrs.slot) {
- delete data.attrs.slot;
- }
- // named slots should only be respected if the vnode was rendered in the
- // same context.
- if ((child.context === context || child.fnContext === context) &&
- data && data.slot != null
- ) {
- var name = data.slot;
- var slot = (slots[name] || (slots[name] = []));
- if (child.tag === 'template') {
- slot.push.apply(slot, child.children || []);
- } else {
- slot.push(child);
- }
- } else {
- // fixed by xxxxxx 临时 hack 掉 uni-app 中的异步 name slot page
- if(child.asyncMeta && child.asyncMeta.data && child.asyncMeta.data.slot === 'page'){
- (slots['page'] || (slots['page'] = [])).push(child);
- }else{
- (slots.default || (slots.default = [])).push(child);
- }
- }
- }
- // ignore slots that contains only whitespace
- for (var name$1 in slots) {
- if (slots[name$1].every(isWhitespace)) {
- delete slots[name$1];
- }
- }
- return slots
- }
- function isWhitespace (node) {
- return (node.isComment && !node.asyncFactory) || node.text === ' '
- }
- /* */
- function normalizeScopedSlots (
- slots,
- normalSlots,
- prevSlots
- ) {
- var res;
- var hasNormalSlots = Object.keys(normalSlots).length > 0;
- var isStable = slots ? !!slots.$stable : !hasNormalSlots;
- var key = slots && slots.$key;
- if (!slots) {
- res = {};
- } else if (slots._normalized) {
- // fast path 1: child component re-render only, parent did not change
- return slots._normalized
- } else if (
- isStable &&
- prevSlots &&
- prevSlots !== emptyObject &&
- key === prevSlots.$key &&
- !hasNormalSlots &&
- !prevSlots.$hasNormal
- ) {
- // fast path 2: stable scoped slots w/ no normal slots to proxy,
- // only need to normalize once
- return prevSlots
- } else {
- res = {};
- for (var key$1 in slots) {
- if (slots[key$1] && key$1[0] !== '$') {
- res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
- }
- }
- }
- // expose normal slots on scopedSlots
- for (var key$2 in normalSlots) {
- if (!(key$2 in res)) {
- res[key$2] = proxyNormalSlot(normalSlots, key$2);
- }
- }
- // avoriaz seems to mock a non-extensible $scopedSlots object
- // and when that is passed down this would cause an error
- if (slots && Object.isExtensible(slots)) {
- (slots)._normalized = res;
- }
- def(res, '$stable', isStable);
- def(res, '$key', key);
- def(res, '$hasNormal', hasNormalSlots);
- return res
- }
- function normalizeScopedSlot(normalSlots, key, fn) {
- var normalized = function () {
- var res = arguments.length ? fn.apply(null, arguments) : fn({});
- res = res && typeof res === 'object' && !Array.isArray(res)
- ? [res] // single vnode
- : normalizeChildren(res);
- return res && (
- res.length === 0 ||
- (res.length === 1 && res[0].isComment) // #9658
- ) ? undefined
- : res
- };
- // this is a slot using the new v-slot syntax without scope. although it is
- // compiled as a scoped slot, render fn users would expect it to be present
- // on this.$slots because the usage is semantically a normal slot.
- if (fn.proxy) {
- Object.defineProperty(normalSlots, key, {
- get: normalized,
- enumerable: true,
- configurable: true
- });
- }
- return normalized
- }
- function proxyNormalSlot(slots, key) {
- return function () { return slots[key]; }
- }
- /* */
- /**
- * Runtime helper for rendering v-for lists.
- */
- function renderList (
- val,
- render
- ) {
- var ret, i, l, keys, key;
- if (Array.isArray(val) || typeof val === 'string') {
- ret = new Array(val.length);
- for (i = 0, l = val.length; i < l; i++) {
- ret[i] = render(val[i], i, i, i); // fixed by xxxxxx
- }
- } else if (typeof val === 'number') {
- ret = new Array(val);
- for (i = 0; i < val; i++) {
- ret[i] = render(i + 1, i, i, i); // fixed by xxxxxx
- }
- } else if (isObject(val)) {
- if (hasSymbol && val[Symbol.iterator]) {
- ret = [];
- var iterator = val[Symbol.iterator]();
- var result = iterator.next();
- while (!result.done) {
- ret.push(render(result.value, ret.length, i, i++)); // fixed by xxxxxx
- result = iterator.next();
- }
- } else {
- keys = Object.keys(val);
- ret = new Array(keys.length);
- for (i = 0, l = keys.length; i < l; i++) {
- key = keys[i];
- ret[i] = render(val[key], key, i, i); // fixed by xxxxxx
- }
- }
- }
- if (!isDef(ret)) {
- ret = [];
- }
- (ret)._isVList = true;
- return ret
- }
- /* */
- /**
- * Runtime helper for rendering <slot>
- */
- function renderSlot (
- name,
- fallback,
- props,
- bindObject
- ) {
- var scopedSlotFn = this.$scopedSlots[name];
- var nodes;
- if (scopedSlotFn) { // scoped slot
- props = props || {};
- if (bindObject) {
- if ( true && !isObject(bindObject)) {
- warn(
- 'slot v-bind without argument expects an Object',
- this
- );
- }
- props = extend(extend({}, bindObject), props);
- }
- // fixed by xxxxxx app-plus scopedSlot
- nodes = scopedSlotFn(props, this, props._i) || fallback;
- } else {
- nodes = this.$slots[name] || fallback;
- }
- var target = props && props.slot;
- if (target) {
- return this.$createElement('template', { slot: target }, nodes)
- } else {
- return nodes
- }
- }
- /* */
- /**
- * Runtime helper for resolving filters
- */
- function resolveFilter (id) {
- return resolveAsset(this.$options, 'filters', id, true) || identity
- }
- /* */
- function isKeyNotMatch (expect, actual) {
- if (Array.isArray(expect)) {
- return expect.indexOf(actual) === -1
- } else {
- return expect !== actual
- }
- }
- /**
- * Runtime helper for checking keyCodes from config.
- * exposed as Vue.prototype._k
- * passing in eventKeyName as last argument separately for backwards compat
- */
- function checkKeyCodes (
- eventKeyCode,
- key,
- builtInKeyCode,
- eventKeyName,
- builtInKeyName
- ) {
- var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
- if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
- return isKeyNotMatch(builtInKeyName, eventKeyName)
- } else if (mappedKeyCode) {
- return isKeyNotMatch(mappedKeyCode, eventKeyCode)
- } else if (eventKeyName) {
- return hyphenate(eventKeyName) !== key
- }
- }
- /* */
- /**
- * Runtime helper for merging v-bind="object" into a VNode's data.
- */
- function bindObjectProps (
- data,
- tag,
- value,
- asProp,
- isSync
- ) {
- if (value) {
- if (!isObject(value)) {
- true && warn(
- 'v-bind without argument expects an Object or Array value',
- this
- );
- } else {
- if (Array.isArray(value)) {
- value = toObject(value);
- }
- var hash;
- var loop = function ( key ) {
- if (
- key === 'class' ||
- key === 'style' ||
- isReservedAttribute(key)
- ) {
- hash = data;
- } else {
- var type = data.attrs && data.attrs.type;
- hash = asProp || config.mustUseProp(tag, type, key)
- ? data.domProps || (data.domProps = {})
- : data.attrs || (data.attrs = {});
- }
- var camelizedKey = camelize(key);
- var hyphenatedKey = hyphenate(key);
- if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
- hash[key] = value[key];
- if (isSync) {
- var on = data.on || (data.on = {});
- on[("update:" + key)] = function ($event) {
- value[key] = $event;
- };
- }
- }
- };
- for (var key in value) loop( key );
- }
- }
- return data
- }
- /* */
- /**
- * Runtime helper for rendering static trees.
- */
- function renderStatic (
- index,
- isInFor
- ) {
- var cached = this._staticTrees || (this._staticTrees = []);
- var tree = cached[index];
- // if has already-rendered static tree and not inside v-for,
- // we can reuse the same tree.
- if (tree && !isInFor) {
- return tree
- }
- // otherwise, render a fresh tree.
- tree = cached[index] = this.$options.staticRenderFns[index].call(
- this._renderProxy,
- null,
- this // for render fns generated for functional component templates
- );
- markStatic(tree, ("__static__" + index), false);
- return tree
- }
- /**
- * Runtime helper for v-once.
- * Effectively it means marking the node as static with a unique key.
- */
- function markOnce (
- tree,
- index,
- key
- ) {
- markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
- return tree
- }
- function markStatic (
- tree,
- key,
- isOnce
- ) {
- if (Array.isArray(tree)) {
- for (var i = 0; i < tree.length; i++) {
- if (tree[i] && typeof tree[i] !== 'string') {
- markStaticNode(tree[i], (key + "_" + i), isOnce);
- }
- }
- } else {
- markStaticNode(tree, key, isOnce);
- }
- }
- function markStaticNode (node, key, isOnce) {
- node.isStatic = true;
- node.key = key;
- node.isOnce = isOnce;
- }
- /* */
- function bindObjectListeners (data, value) {
- if (value) {
- if (!isPlainObject(value)) {
- true && warn(
- 'v-on without argument expects an Object value',
- this
- );
- } else {
- var on = data.on = data.on ? extend({}, data.on) : {};
- for (var key in value) {
- var existing = on[key];
- var ours = value[key];
- on[key] = existing ? [].concat(existing, ours) : ours;
- }
- }
- }
- return data
- }
- /* */
- function resolveScopedSlots (
- fns, // see flow/vnode
- res,
- // the following are added in 2.6
- hasDynamicKeys,
- contentHashKey
- ) {
- res = res || { $stable: !hasDynamicKeys };
- for (var i = 0; i < fns.length; i++) {
- var slot = fns[i];
- if (Array.isArray(slot)) {
- resolveScopedSlots(slot, res, hasDynamicKeys);
- } else if (slot) {
- // marker for reverse proxying v-slot without scope on this.$slots
- if (slot.proxy) {
- slot.fn.proxy = true;
- }
- res[slot.key] = slot.fn;
- }
- }
- if (contentHashKey) {
- (res).$key = contentHashKey;
- }
- return res
- }
- /* */
- function bindDynamicKeys (baseObj, values) {
- for (var i = 0; i < values.length; i += 2) {
- var key = values[i];
- if (typeof key === 'string' && key) {
- baseObj[values[i]] = values[i + 1];
- } else if ( true && key !== '' && key !== null) {
- // null is a special value for explicitly removing a binding
- warn(
- ("Invalid value for dynamic directive argument (expected string or null): " + key),
- this
- );
- }
- }
- return baseObj
- }
- // helper to dynamically append modifier runtime markers to event names.
- // ensure only append when value is already string, otherwise it will be cast
- // to string and cause the type check to miss.
- function prependModifier (value, symbol) {
- return typeof value === 'string' ? symbol + value : value
- }
- /* */
- function installRenderHelpers (target) {
- target._o = markOnce;
- target._n = toNumber;
- target._s = toString;
- target._l = renderList;
- target._t = renderSlot;
- target._q = looseEqual;
- target._i = looseIndexOf;
- target._m = renderStatic;
- target._f = resolveFilter;
- target._k = checkKeyCodes;
- target._b = bindObjectProps;
- target._v = createTextVNode;
- target._e = createEmptyVNode;
- target._u = resolveScopedSlots;
- target._g = bindObjectListeners;
- target._d = bindDynamicKeys;
- target._p = prependModifier;
- }
- /* */
- function FunctionalRenderContext (
- data,
- props,
- children,
- parent,
- Ctor
- ) {
- var this$1 = this;
- var options = Ctor.options;
- // ensure the createElement function in functional components
- // gets a unique context - this is necessary for correct named slot check
- var contextVm;
- if (hasOwn(parent, '_uid')) {
- contextVm = Object.create(parent);
- // $flow-disable-line
- contextVm._original = parent;
- } else {
- // the context vm passed in is a functional context as well.
- // in this case we want to make sure we are able to get a hold to the
- // real context instance.
- contextVm = parent;
- // $flow-disable-line
- parent = parent._original;
- }
- var isCompiled = isTrue(options._compiled);
- var needNormalization = !isCompiled;
- this.data = data;
- this.props = props;
- this.children = children;
- this.parent = parent;
- this.listeners = data.on || emptyObject;
- this.injections = resolveInject(options.inject, parent);
- this.slots = function () {
- if (!this$1.$slots) {
- normalizeScopedSlots(
- data.scopedSlots,
- this$1.$slots = resolveSlots(children, parent)
- );
- }
- return this$1.$slots
- };
- Object.defineProperty(this, 'scopedSlots', ({
- enumerable: true,
- get: function get () {
- return normalizeScopedSlots(data.scopedSlots, this.slots())
- }
- }));
- // support for compiled functional template
- if (isCompiled) {
- // exposing $options for renderStatic()
- this.$options = options;
- // pre-resolve slots for renderSlot()
- this.$slots = this.slots();
- this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
- }
- if (options._scopeId) {
- this._c = function (a, b, c, d) {
- var vnode = createElement(contextVm, a, b, c, d, needNormalization);
- if (vnode && !Array.isArray(vnode)) {
- vnode.fnScopeId = options._scopeId;
- vnode.fnContext = parent;
- }
- return vnode
- };
- } else {
- this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
- }
- }
- installRenderHelpers(FunctionalRenderContext.prototype);
- function createFunctionalComponent (
- Ctor,
- propsData,
- data,
- contextVm,
- children
- ) {
- var options = Ctor.options;
- var props = {};
- var propOptions = options.props;
- if (isDef(propOptions)) {
- for (var key in propOptions) {
- props[key] = validateProp(key, propOptions, propsData || emptyObject);
- }
- } else {
- if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
- if (isDef(data.props)) { mergeProps(props, data.props); }
- }
- var renderContext = new FunctionalRenderContext(
- data,
- props,
- children,
- contextVm,
- Ctor
- );
- var vnode = options.render.call(null, renderContext._c, renderContext);
- if (vnode instanceof VNode) {
- return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
- } else if (Array.isArray(vnode)) {
- var vnodes = normalizeChildren(vnode) || [];
- var res = new Array(vnodes.length);
- for (var i = 0; i < vnodes.length; i++) {
- res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
- }
- return res
- }
- }
- function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
- // #7817 clone node before setting fnContext, otherwise if the node is reused
- // (e.g. it was from a cached normal slot) the fnContext causes named slots
- // that should not be matched to match.
- var clone = cloneVNode(vnode);
- clone.fnContext = contextVm;
- clone.fnOptions = options;
- if (true) {
- (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
- }
- if (data.slot) {
- (clone.data || (clone.data = {})).slot = data.slot;
- }
- return clone
- }
- function mergeProps (to, from) {
- for (var key in from) {
- to[camelize(key)] = from[key];
- }
- }
- /* */
- /* */
- /* */
- /* */
- // inline hooks to be invoked on component VNodes during patch
- var componentVNodeHooks = {
- init: function init (vnode, hydrating) {
- if (
- vnode.componentInstance &&
- !vnode.componentInstance._isDestroyed &&
- vnode.data.keepAlive
- ) {
- // kept-alive components, treat as a patch
- var mountedNode = vnode; // work around flow
- componentVNodeHooks.prepatch(mountedNode, mountedNode);
- } else {
- var child = vnode.componentInstance = createComponentInstanceForVnode(
- vnode,
- activeInstance
- );
- child.$mount(hydrating ? vnode.elm : undefined, hydrating);
- }
- },
- prepatch: function prepatch (oldVnode, vnode) {
- var options = vnode.componentOptions;
- var child = vnode.componentInstance = oldVnode.componentInstance;
- updateChildComponent(
- child,
- options.propsData, // updated props
- options.listeners, // updated listeners
- vnode, // new parent vnode
- options.children // new children
- );
- },
- insert: function insert (vnode) {
- var context = vnode.context;
- var componentInstance = vnode.componentInstance;
- if (!componentInstance._isMounted) {
- callHook(componentInstance, 'onServiceCreated');
- callHook(componentInstance, 'onServiceAttached');
- componentInstance._isMounted = true;
- callHook(componentInstance, 'mounted');
- }
- if (vnode.data.keepAlive) {
- if (context._isMounted) {
- // vue-router#1212
- // During updates, a kept-alive component's child components may
- // change, so directly walking the tree here may call activated hooks
- // on incorrect children. Instead we push them into a queue which will
- // be processed after the whole patch process ended.
- queueActivatedComponent(componentInstance);
- } else {
- activateChildComponent(componentInstance, true /* direct */);
- }
- }
- },
- destroy: function destroy (vnode) {
- var componentInstance = vnode.componentInstance;
- if (!componentInstance._isDestroyed) {
- if (!vnode.data.keepAlive) {
- componentInstance.$destroy();
- } else {
- deactivateChildComponent(componentInstance, true /* direct */);
- }
- }
- }
- };
- var hooksToMerge = Object.keys(componentVNodeHooks);
- function createComponent (
- Ctor,
- data,
- context,
- children,
- tag
- ) {
- if (isUndef(Ctor)) {
- return
- }
- var baseCtor = context.$options._base;
- // plain options object: turn it into a constructor
- if (isObject(Ctor)) {
- Ctor = baseCtor.extend(Ctor);
- }
- // if at this stage it's not a constructor or an async component factory,
- // reject.
- if (typeof Ctor !== 'function') {
- if (true) {
- warn(("Invalid Component definition: " + (String(Ctor))), context);
- }
- return
- }
- // async component
- var asyncFactory;
- if (isUndef(Ctor.cid)) {
- asyncFactory = Ctor;
- Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
- if (Ctor === undefined) {
- // return a placeholder node for async component, which is rendered
- // as a comment node but preserves all the raw information for the node.
- // the information will be used for async server-rendering and hydration.
- return createAsyncPlaceholder(
- asyncFactory,
- data,
- context,
- children,
- tag
- )
- }
- }
- data = data || {};
- // resolve constructor options in case global mixins are applied after
- // component constructor creation
- resolveConstructorOptions(Ctor);
- // transform component v-model data into props & events
- if (isDef(data.model)) {
- transformModel(Ctor.options, data);
- }
- // extract props
- var propsData = extractPropsFromVNodeData(data, Ctor, tag, context); // fixed by xxxxxx
- // functional component
- if (isTrue(Ctor.options.functional)) {
- return createFunctionalComponent(Ctor, propsData, data, context, children)
- }
- // extract listeners, since these needs to be treated as
- // child component listeners instead of DOM listeners
- var listeners = data.on;
- // replace with listeners with .native modifier
- // so it gets processed during parent component patch.
- data.on = data.nativeOn;
- if (isTrue(Ctor.options.abstract)) {
- // abstract components do not keep anything
- // other than props & listeners & slot
- // work around flow
- var slot = data.slot;
- data = {};
- if (slot) {
- data.slot = slot;
- }
- }
- // install component management hooks onto the placeholder node
- installComponentHooks(data);
- // return a placeholder vnode
- var name = Ctor.options.name || tag;
- var vnode = new VNode(
- ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
- data, undefined, undefined, undefined, context,
- { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
- asyncFactory
- );
- return vnode
- }
- function createComponentInstanceForVnode (
- vnode, // we know it's MountedComponentVNode but flow doesn't
- parent // activeInstance in lifecycle state
- ) {
- var options = {
- _isComponent: true,
- _parentVnode: vnode,
- parent: parent
- };
- // check inline-template render functions
- var inlineTemplate = vnode.data.inlineTemplate;
- if (isDef(inlineTemplate)) {
- options.render = inlineTemplate.render;
- options.staticRenderFns = inlineTemplate.staticRenderFns;
- }
- return new vnode.componentOptions.Ctor(options)
- }
- function installComponentHooks (data) {
- var hooks = data.hook || (data.hook = {});
- for (var i = 0; i < hooksToMerge.length; i++) {
- var key = hooksToMerge[i];
- var existing = hooks[key];
- var toMerge = componentVNodeHooks[key];
- if (existing !== toMerge && !(existing && existing._merged)) {
- hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
- }
- }
- }
- function mergeHook$1 (f1, f2) {
- var merged = function (a, b) {
- // flow complains about extra args which is why we use any
- f1(a, b);
- f2(a, b);
- };
- merged._merged = true;
- return merged
- }
- // transform component v-model info (value and callback) into
- // prop and event handler respectively.
- function transformModel (options, data) {
- var prop = (options.model && options.model.prop) || 'value';
- var event = (options.model && options.model.event) || 'input'
- ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
- var on = data.on || (data.on = {});
- var existing = on[event];
- var callback = data.model.callback;
- if (isDef(existing)) {
- if (
- Array.isArray(existing)
- ? existing.indexOf(callback) === -1
- : existing !== callback
- ) {
- on[event] = [callback].concat(existing);
- }
- } else {
- on[event] = callback;
- }
- }
- /* */
- var SIMPLE_NORMALIZE = 1;
- var ALWAYS_NORMALIZE = 2;
- // wrapper function for providing a more flexible interface
- // without getting yelled at by flow
- function createElement (
- context,
- tag,
- data,
- children,
- normalizationType,
- alwaysNormalize
- ) {
- if (Array.isArray(data) || isPrimitive(data)) {
- normalizationType = children;
- children = data;
- data = undefined;
- }
- if (isTrue(alwaysNormalize)) {
- normalizationType = ALWAYS_NORMALIZE;
- }
- return _createElement(context, tag, data, children, normalizationType)
- }
- function _createElement (
- context,
- tag,
- data,
- children,
- normalizationType
- ) {
- if (isDef(data) && isDef((data).__ob__)) {
- true && warn(
- "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
- 'Always create fresh vnode data objects in each render!',
- context
- );
- return createEmptyVNode()
- }
- // object syntax in v-bind
- if (isDef(data) && isDef(data.is)) {
- tag = data.is;
- }
- if (!tag) {
- // in case of component :is set to falsy value
- return createEmptyVNode()
- }
- // warn against non-primitive key
- if ( true &&
- isDef(data) && isDef(data.key) && !isPrimitive(data.key)
- ) {
- {
- warn(
- 'Avoid using non-primitive value as key, ' +
- 'use string/number value instead.',
- context
- );
- }
- }
- // support single function children as default scoped slot
- if (Array.isArray(children) &&
- typeof children[0] === 'function'
- ) {
- data = data || {};
- data.scopedSlots = { default: children[0] };
- children.length = 0;
- }
- if (normalizationType === ALWAYS_NORMALIZE) {
- children = normalizeChildren(children);
- } else if (normalizationType === SIMPLE_NORMALIZE) {
- children = simpleNormalizeChildren(children);
- }
- var vnode, ns;
- if (typeof tag === 'string') {
- var Ctor;
- ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
- if (config.isReservedTag(tag)) {
- // platform built-in elements
- if ( true && isDef(data) && isDef(data.nativeOn)) {
- warn(
- ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
- context
- );
- }
- vnode = new VNode(
- config.parsePlatformTagName(tag), data, children,
- undefined, undefined, context
- );
- } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
- // component
- vnode = createComponent(Ctor, data, context, children, tag);
- } else {
- // unknown or unlisted namespaced elements
- // check at runtime because it may get assigned a namespace when its
- // parent normalizes children
- vnode = new VNode(
- tag, data, children,
- undefined, undefined, context
- );
- }
- } else {
- // direct component options / constructor
- vnode = createComponent(tag, data, context, children);
- }
- if (Array.isArray(vnode)) {
- return vnode
- } else if (isDef(vnode)) {
- if (isDef(ns)) { applyNS(vnode, ns); }
- if (isDef(data)) { registerDeepBindings(data); }
- return vnode
- } else {
- return createEmptyVNode()
- }
- }
- function applyNS (vnode, ns, force) {
- vnode.ns = ns;
- if (vnode.tag === 'foreignObject') {
- // use default namespace inside foreignObject
- ns = undefined;
- force = true;
- }
- if (isDef(vnode.children)) {
- for (var i = 0, l = vnode.children.length; i < l; i++) {
- var child = vnode.children[i];
- if (isDef(child.tag) && (
- isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
- applyNS(child, ns, force);
- }
- }
- }
- }
- // ref #5318
- // necessary to ensure parent re-render when deep bindings like :style and
- // :class are used on slot nodes
- function registerDeepBindings (data) {
- if (isObject(data.style)) {
- traverse(data.style);
- }
- if (isObject(data.class)) {
- traverse(data.class);
- }
- }
- /* */
- function initRender (vm) {
- vm._vnode = null; // the root of the child tree
- vm._staticTrees = null; // v-once cached trees
- var options = vm.$options;
- var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
- var renderContext = parentVnode && parentVnode.context;
- vm.$slots = resolveSlots(options._renderChildren, renderContext);
- vm.$scopedSlots = emptyObject;
- // bind the createElement fn to this instance
- // so that we get proper render context inside it.
- // args order: tag, data, children, normalizationType, alwaysNormalize
- // internal version is used by render functions compiled from templates
- vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
- // normalization is always applied for the public version, used in
- // user-written render functions.
- vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
- // $attrs & $listeners are exposed for easier HOC creation.
- // they need to be reactive so that HOCs using them are always updated
- var parentData = parentVnode && parentVnode.data;
- /* istanbul ignore else */
- if (true) {
- defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
- !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
- }, true);
- defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
- !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
- }, true);
- } else {}
- }
- var currentRenderingInstance = null;
- function renderMixin (Vue) {
- // install runtime convenience helpers
- installRenderHelpers(Vue.prototype);
- Vue.prototype.$nextTick = function (fn) {
- return nextTick(fn, this)
- };
- Vue.prototype._render = function () {
- var vm = this;
- var ref = vm.$options;
- var render = ref.render;
- var _parentVnode = ref._parentVnode;
- if (_parentVnode) {
- vm.$scopedSlots = normalizeScopedSlots(
- _parentVnode.data.scopedSlots,
- vm.$slots,
- vm.$scopedSlots
- );
- }
- // set parent vnode. this allows render functions to have access
- // to the data on the placeholder node.
- vm.$vnode = _parentVnode;
- // render self
- var vnode;
- try {
- // There's no need to maintain a stack because all render fns are called
- // separately from one another. Nested component's render fns are called
- // when parent component is patched.
- currentRenderingInstance = vm;
- vnode = render.call(vm._renderProxy, vm.$createElement);
- } catch (e) {
- handleError(e, vm, "render");
- // return error render result,
- // or previous vnode to prevent render error causing blank component
- /* istanbul ignore else */
- if ( true && vm.$options.renderError) {
- try {
- vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
- } catch (e) {
- handleError(e, vm, "renderError");
- vnode = vm._vnode;
- }
- } else {
- vnode = vm._vnode;
- }
- } finally {
- currentRenderingInstance = null;
- }
- // if the returned array contains only a single node, allow it
- if (Array.isArray(vnode) && vnode.length === 1) {
- vnode = vnode[0];
- }
- // return empty vnode in case the render function errored out
- if (!(vnode instanceof VNode)) {
- if ( true && Array.isArray(vnode)) {
- warn(
- 'Multiple root nodes returned from render function. Render function ' +
- 'should return a single root node.',
- vm
- );
- }
- vnode = createEmptyVNode();
- }
- // set parent
- vnode.parent = _parentVnode;
- return vnode
- };
- }
- /* */
- function ensureCtor (comp, base) {
- if (
- comp.__esModule ||
- (hasSymbol && comp[Symbol.toStringTag] === 'Module')
- ) {
- comp = comp.default;
- }
- return isObject(comp)
- ? base.extend(comp)
- : comp
- }
- function createAsyncPlaceholder (
- factory,
- data,
- context,
- children,
- tag
- ) {
- var node = createEmptyVNode();
- node.asyncFactory = factory;
- node.asyncMeta = { data: data, context: context, children: children, tag: tag };
- return node
- }
- function resolveAsyncComponent (
- factory,
- baseCtor
- ) {
- if (isTrue(factory.error) && isDef(factory.errorComp)) {
- return factory.errorComp
- }
- if (isDef(factory.resolved)) {
- return factory.resolved
- }
- var owner = currentRenderingInstance;
- if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
- // already pending
- factory.owners.push(owner);
- }
- if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
- return factory.loadingComp
- }
- if (owner && !isDef(factory.owners)) {
- var owners = factory.owners = [owner];
- var sync = true;
- var timerLoading = null;
- var timerTimeout = null
- ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
- var forceRender = function (renderCompleted) {
- for (var i = 0, l = owners.length; i < l; i++) {
- (owners[i]).$forceUpdate();
- }
- if (renderCompleted) {
- owners.length = 0;
- if (timerLoading !== null) {
- clearTimeout(timerLoading);
- timerLoading = null;
- }
- if (timerTimeout !== null) {
- clearTimeout(timerTimeout);
- timerTimeout = null;
- }
- }
- };
- var resolve = once(function (res) {
- // cache resolved
- factory.resolved = ensureCtor(res, baseCtor);
- // invoke callbacks only if this is not a synchronous resolve
- // (async resolves are shimmed as synchronous during SSR)
- if (!sync) {
- forceRender(true);
- } else {
- owners.length = 0;
- }
- });
- var reject = once(function (reason) {
- true && warn(
- "Failed to resolve async component: " + (String(factory)) +
- (reason ? ("\nReason: " + reason) : '')
- );
- if (isDef(factory.errorComp)) {
- factory.error = true;
- forceRender(true);
- }
- });
- var res = factory(resolve, reject);
- if (isObject(res)) {
- if (isPromise(res)) {
- // () => Promise
- if (isUndef(factory.resolved)) {
- res.then(resolve, reject);
- }
- } else if (isPromise(res.component)) {
- res.component.then(resolve, reject);
- if (isDef(res.error)) {
- factory.errorComp = ensureCtor(res.error, baseCtor);
- }
- if (isDef(res.loading)) {
- factory.loadingComp = ensureCtor(res.loading, baseCtor);
- if (res.delay === 0) {
- factory.loading = true;
- } else {
- timerLoading = setTimeout(function () {
- timerLoading = null;
- if (isUndef(factory.resolved) && isUndef(factory.error)) {
- factory.loading = true;
- forceRender(false);
- }
- }, res.delay || 200);
- }
- }
- if (isDef(res.timeout)) {
- timerTimeout = setTimeout(function () {
- timerTimeout = null;
- if (isUndef(factory.resolved)) {
- reject(
- true
- ? ("timeout (" + (res.timeout) + "ms)")
- : undefined
- );
- }
- }, res.timeout);
- }
- }
- }
- sync = false;
- // return in case resolved synchronously
- return factory.loading
- ? factory.loadingComp
- : factory.resolved
- }
- }
- /* */
- function isAsyncPlaceholder (node) {
- return node.isComment && node.asyncFactory
- }
- /* */
- function getFirstComponentChild (children) {
- if (Array.isArray(children)) {
- for (var i = 0; i < children.length; i++) {
- var c = children[i];
- if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
- return c
- }
- }
- }
- }
- /* */
- /* */
- function initEvents (vm) {
- vm._events = Object.create(null);
- vm._hasHookEvent = false;
- // init parent attached events
- var listeners = vm.$options._parentListeners;
- if (listeners) {
- updateComponentListeners(vm, listeners);
- }
- }
- var target;
- function add (event, fn) {
- target.$on(event, fn);
- }
- function remove$1 (event, fn) {
- target.$off(event, fn);
- }
- function createOnceHandler (event, fn) {
- var _target = target;
- return function onceHandler () {
- var res = fn.apply(null, arguments);
- if (res !== null) {
- _target.$off(event, onceHandler);
- }
- }
- }
- function updateComponentListeners (
- vm,
- listeners,
- oldListeners
- ) {
- target = vm;
- updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
- target = undefined;
- }
- function eventsMixin (Vue) {
- var hookRE = /^hook:/;
- Vue.prototype.$on = function (event, fn) {
- var vm = this;
- if (Array.isArray(event)) {
- for (var i = 0, l = event.length; i < l; i++) {
- vm.$on(event[i], fn);
- }
- } else {
- (vm._events[event] || (vm._events[event] = [])).push(fn);
- // optimize hook:event cost by using a boolean flag marked at registration
- // instead of a hash lookup
- if (hookRE.test(event)) {
- vm._hasHookEvent = true;
- }
- }
- return vm
- };
- Vue.prototype.$once = function (event, fn) {
- var vm = this;
- function on () {
- vm.$off(event, on);
- fn.apply(vm, arguments);
- }
- on.fn = fn;
- vm.$on(event, on);
- return vm
- };
- Vue.prototype.$off = function (event, fn) {
- var vm = this;
- // all
- if (!arguments.length) {
- vm._events = Object.create(null);
- return vm
- }
- // array of events
- if (Array.isArray(event)) {
- for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
- vm.$off(event[i$1], fn);
- }
- return vm
- }
- // specific event
- var cbs = vm._events[event];
- if (!cbs) {
- return vm
- }
- if (!fn) {
- vm._events[event] = null;
- return vm
- }
- // specific handler
- var cb;
- var i = cbs.length;
- while (i--) {
- cb = cbs[i];
- if (cb === fn || cb.fn === fn) {
- cbs.splice(i, 1);
- break
- }
- }
- return vm
- };
- Vue.prototype.$emit = function (event) {
- var vm = this;
- if (true) {
- var lowerCaseEvent = event.toLowerCase();
- if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
- tip(
- "Event \"" + lowerCaseEvent + "\" is emitted in component " +
- (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
- "Note that HTML attributes are case-insensitive and you cannot use " +
- "v-on to listen to camelCase events when using in-DOM templates. " +
- "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
- );
- }
- }
- var cbs = vm._events[event];
- if (cbs) {
- cbs = cbs.length > 1 ? toArray(cbs) : cbs;
- var args = toArray(arguments, 1);
- var info = "event handler for \"" + event + "\"";
- for (var i = 0, l = cbs.length; i < l; i++) {
- invokeWithErrorHandling(cbs[i], vm, args, vm, info);
- }
- }
- return vm
- };
- }
- /* */
- var activeInstance = null;
- var isUpdatingChildComponent = false;
- function setActiveInstance(vm) {
- var prevActiveInstance = activeInstance;
- activeInstance = vm;
- return function () {
- activeInstance = prevActiveInstance;
- }
- }
- function initLifecycle (vm) {
- var options = vm.$options;
- // locate first non-abstract parent
- var parent = options.parent;
- if (parent && !options.abstract) {
- while (parent.$options.abstract && parent.$parent) {
- parent = parent.$parent;
- }
- parent.$children.push(vm);
- }
- vm.$parent = parent;
- vm.$root = parent ? parent.$root : vm;
- vm.$children = [];
- vm.$refs = {};
- vm._watcher = null;
- vm._inactive = null;
- vm._directInactive = false;
- vm._isMounted = false;
- vm._isDestroyed = false;
- vm._isBeingDestroyed = false;
- }
- function lifecycleMixin (Vue) {
- Vue.prototype._update = function (vnode, hydrating) {
- var vm = this;
- var prevEl = vm.$el;
- var prevVnode = vm._vnode;
- var restoreActiveInstance = setActiveInstance(vm);
- vm._vnode = vnode;
- // Vue.prototype.__patch__ is injected in entry points
- // based on the rendering backend used.
- if (!prevVnode) {
- // initial render
- vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
- } else {
- // updates
- vm.$el = vm.__patch__(prevVnode, vnode);
- }
- restoreActiveInstance();
- // update __vue__ reference
- if (prevEl) {
- prevEl.__vue__ = null;
- }
- if (vm.$el) {
- vm.$el.__vue__ = vm;
- }
- // if parent is an HOC, update its $el as well
- if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
- vm.$parent.$el = vm.$el;
- }
- // updated hook is called by the scheduler to ensure that children are
- // updated in a parent's updated hook.
- };
- Vue.prototype.$forceUpdate = function () {
- var vm = this;
- if (vm._watcher) {
- vm._watcher.update();
- }
- };
- Vue.prototype.$destroy = function () {
- var vm = this;
- if (vm._isBeingDestroyed) {
- return
- }
- callHook(vm, 'beforeDestroy');
- vm._isBeingDestroyed = true;
- // remove self from parent
- var parent = vm.$parent;
- if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
- remove(parent.$children, vm);
- }
- // teardown watchers
- if (vm._watcher) {
- vm._watcher.teardown();
- }
- var i = vm._watchers.length;
- while (i--) {
- vm._watchers[i].teardown();
- }
- // remove reference from data ob
- // frozen object may not have observer.
- if (vm._data.__ob__) {
- vm._data.__ob__.vmCount--;
- }
- // call the last hook...
- vm._isDestroyed = true;
- // invoke destroy hooks on current rendered tree
- vm.__patch__(vm._vnode, null);
- // fire destroyed hook
- callHook(vm, 'destroyed');
- // turn off all instance listeners.
- vm.$off();
- // remove __vue__ reference
- if (vm.$el) {
- vm.$el.__vue__ = null;
- }
- // release circular reference (#6759)
- if (vm.$vnode) {
- vm.$vnode.parent = null;
- }
- };
- }
- function updateChildComponent (
- vm,
- propsData,
- listeners,
- parentVnode,
- renderChildren
- ) {
- if (true) {
- isUpdatingChildComponent = true;
- }
- // determine whether component has slot children
- // we need to do this before overwriting $options._renderChildren.
- // check if there are dynamic scopedSlots (hand-written or compiled but with
- // dynamic slot names). Static scoped slots compiled from template has the
- // "$stable" marker.
- var newScopedSlots = parentVnode.data.scopedSlots;
- var oldScopedSlots = vm.$scopedSlots;
- var hasDynamicScopedSlot = !!(
- (newScopedSlots && !newScopedSlots.$stable) ||
- (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
- (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
- );
- // Any static slot children from the parent may have changed during parent's
- // update. Dynamic scoped slots may also have changed. In such cases, a forced
- // update is necessary to ensure correctness.
- var needsForceUpdate = !!(
- renderChildren || // has new static slots
- vm.$options._renderChildren || // has old static slots
- hasDynamicScopedSlot
- );
- vm.$options._parentVnode = parentVnode;
- vm.$vnode = parentVnode; // update vm's placeholder node without re-render
- if (vm._vnode) { // update child tree's parent
- vm._vnode.parent = parentVnode;
- }
- vm.$options._renderChildren = renderChildren;
- // update $attrs and $listeners hash
- // these are also reactive so they may trigger child update if the child
- // used them during render
- vm.$attrs = parentVnode.data.attrs || emptyObject;
- vm.$listeners = listeners || emptyObject;
- // update props
- if (propsData && vm.$options.props) {
- toggleObserving(false);
- var props = vm._props;
- var propKeys = vm.$options._propKeys || [];
- for (var i = 0; i < propKeys.length; i++) {
- var key = propKeys[i];
- var propOptions = vm.$options.props; // wtf flow?
- props[key] = validateProp(key, propOptions, propsData, vm);
- }
- toggleObserving(true);
- // keep a copy of raw propsData
- vm.$options.propsData = propsData;
- }
-
- // fixed by xxxxxx update properties(mp runtime)
- vm._$updateProperties && vm._$updateProperties(vm);
-
- // update listeners
- listeners = listeners || emptyObject;
- var oldListeners = vm.$options._parentListeners;
- vm.$options._parentListeners = listeners;
- updateComponentListeners(vm, listeners, oldListeners);
- // resolve slots + force update if has children
- if (needsForceUpdate) {
- vm.$slots = resolveSlots(renderChildren, parentVnode.context);
- vm.$forceUpdate();
- }
- if (true) {
- isUpdatingChildComponent = false;
- }
- }
- function isInInactiveTree (vm) {
- while (vm && (vm = vm.$parent)) {
- if (vm._inactive) { return true }
- }
- return false
- }
- function activateChildComponent (vm, direct) {
- if (direct) {
- vm._directInactive = false;
- if (isInInactiveTree(vm)) {
- return
- }
- } else if (vm._directInactive) {
- return
- }
- if (vm._inactive || vm._inactive === null) {
- vm._inactive = false;
- for (var i = 0; i < vm.$children.length; i++) {
- activateChildComponent(vm.$children[i]);
- }
- callHook(vm, 'activated');
- }
- }
- function deactivateChildComponent (vm, direct) {
- if (direct) {
- vm._directInactive = true;
- if (isInInactiveTree(vm)) {
- return
- }
- }
- if (!vm._inactive) {
- vm._inactive = true;
- for (var i = 0; i < vm.$children.length; i++) {
- deactivateChildComponent(vm.$children[i]);
- }
- callHook(vm, 'deactivated');
- }
- }
- function callHook (vm, hook) {
- // #7573 disable dep collection when invoking lifecycle hooks
- pushTarget();
- var handlers = vm.$options[hook];
- var info = hook + " hook";
- if (handlers) {
- for (var i = 0, j = handlers.length; i < j; i++) {
- invokeWithErrorHandling(handlers[i], vm, null, vm, info);
- }
- }
- if (vm._hasHookEvent) {
- vm.$emit('hook:' + hook);
- }
- popTarget();
- }
- /* */
- var MAX_UPDATE_COUNT = 100;
- var queue = [];
- var activatedChildren = [];
- var has = {};
- var circular = {};
- var waiting = false;
- var flushing = false;
- var index = 0;
- /**
- * Reset the scheduler's state.
- */
- function resetSchedulerState () {
- index = queue.length = activatedChildren.length = 0;
- has = {};
- if (true) {
- circular = {};
- }
- waiting = flushing = false;
- }
- // Async edge case #6566 requires saving the timestamp when event listeners are
- // attached. However, calling performance.now() has a perf overhead especially
- // if the page has thousands of event listeners. Instead, we take a timestamp
- // every time the scheduler flushes and use that for all event listeners
- // attached during that flush.
- var currentFlushTimestamp = 0;
- // Async edge case fix requires storing an event listener's attach timestamp.
- var getNow = Date.now;
- // Determine what event timestamp the browser is using. Annoyingly, the
- // timestamp can either be hi-res (relative to page load) or low-res
- // (relative to UNIX epoch), so in order to compare time we have to use the
- // same timestamp type when saving the flush timestamp.
- // All IE versions use low-res event timestamps, and have problematic clock
- // implementations (#9632)
- if (inBrowser && !isIE) {
- var performance = window.performance;
- if (
- performance &&
- typeof performance.now === 'function' &&
- getNow() > document.createEvent('Event').timeStamp
- ) {
- // if the event timestamp, although evaluated AFTER the Date.now(), is
- // smaller than it, it means the event is using a hi-res timestamp,
- // and we need to use the hi-res version for event listener timestamps as
- // well.
- getNow = function () { return performance.now(); };
- }
- }
- /**
- * Flush both queues and run the watchers.
- */
- function flushSchedulerQueue () {
- currentFlushTimestamp = getNow();
- flushing = true;
- var watcher, id;
- // Sort queue before flush.
- // This ensures that:
- // 1. Components are updated from parent to child. (because parent is always
- // created before the child)
- // 2. A component's user watchers are run before its render watcher (because
- // user watchers are created before the render watcher)
- // 3. If a component is destroyed during a parent component's watcher run,
- // its watchers can be skipped.
- queue.sort(function (a, b) { return a.id - b.id; });
- // do not cache length because more watchers might be pushed
- // as we run existing watchers
- for (index = 0; index < queue.length; index++) {
- watcher = queue[index];
- if (watcher.before) {
- watcher.before();
- }
- id = watcher.id;
- has[id] = null;
- watcher.run();
- // in dev build, check and stop circular updates.
- if ( true && has[id] != null) {
- circular[id] = (circular[id] || 0) + 1;
- if (circular[id] > MAX_UPDATE_COUNT) {
- warn(
- 'You may have an infinite update loop ' + (
- watcher.user
- ? ("in watcher with expression \"" + (watcher.expression) + "\"")
- : "in a component render function."
- ),
- watcher.vm
- );
- break
- }
- }
- }
- // keep copies of post queues before resetting state
- var activatedQueue = activatedChildren.slice();
- var updatedQueue = queue.slice();
- resetSchedulerState();
- // call component updated and activated hooks
- callActivatedHooks(activatedQueue);
- callUpdatedHooks(updatedQueue);
- // devtool hook
- /* istanbul ignore if */
- if (devtools && config.devtools) {
- devtools.emit('flush');
- }
- }
- function callUpdatedHooks (queue) {
- var i = queue.length;
- while (i--) {
- var watcher = queue[i];
- var vm = watcher.vm;
- if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
- callHook(vm, 'updated');
- }
- }
- }
- /**
- * Queue a kept-alive component that was activated during patch.
- * The queue will be processed after the entire tree has been patched.
- */
- function queueActivatedComponent (vm) {
- // setting _inactive to false here so that a render function can
- // rely on checking whether it's in an inactive tree (e.g. router-view)
- vm._inactive = false;
- activatedChildren.push(vm);
- }
- function callActivatedHooks (queue) {
- for (var i = 0; i < queue.length; i++) {
- queue[i]._inactive = true;
- activateChildComponent(queue[i], true /* true */);
- }
- }
- /**
- * Push a watcher into the watcher queue.
- * Jobs with duplicate IDs will be skipped unless it's
- * pushed when the queue is being flushed.
- */
- function queueWatcher (watcher) {
- var id = watcher.id;
- if (has[id] == null) {
- has[id] = true;
- if (!flushing) {
- queue.push(watcher);
- } else {
- // if already flushing, splice the watcher based on its id
- // if already past its id, it will be run next immediately.
- var i = queue.length - 1;
- while (i > index && queue[i].id > watcher.id) {
- i--;
- }
- queue.splice(i + 1, 0, watcher);
- }
- // queue the flush
- if (!waiting) {
- waiting = true;
- if ( true && !config.async) {
- flushSchedulerQueue();
- return
- }
- nextTick(flushSchedulerQueue);
- }
- }
- }
- /* */
- var uid$2 = 0;
- /**
- * A watcher parses an expression, collects dependencies,
- * and fires callback when the expression value changes.
- * This is used for both the $watch() api and directives.
- */
- var Watcher = function Watcher (
- vm,
- expOrFn,
- cb,
- options,
- isRenderWatcher
- ) {
- this.vm = vm;
- if (isRenderWatcher) {
- vm._watcher = this;
- }
- vm._watchers.push(this);
- // options
- if (options) {
- this.deep = !!options.deep;
- this.user = !!options.user;
- this.lazy = !!options.lazy;
- this.sync = !!options.sync;
- this.before = options.before;
- } else {
- this.deep = this.user = this.lazy = this.sync = false;
- }
- this.cb = cb;
- this.id = ++uid$2; // uid for batching
- this.active = true;
- this.dirty = this.lazy; // for lazy watchers
- this.deps = [];
- this.newDeps = [];
- this.depIds = new _Set();
- this.newDepIds = new _Set();
- this.expression = true
- ? expOrFn.toString()
- : undefined;
- // parse expression for getter
- if (typeof expOrFn === 'function') {
- this.getter = expOrFn;
- } else {
- this.getter = parsePath(expOrFn);
- if (!this.getter) {
- this.getter = noop;
- true && warn(
- "Failed watching path: \"" + expOrFn + "\" " +
- 'Watcher only accepts simple dot-delimited paths. ' +
- 'For full control, use a function instead.',
- vm
- );
- }
- }
- this.value = this.lazy
- ? undefined
- : this.get();
- };
- /**
- * Evaluate the getter, and re-collect dependencies.
- */
- Watcher.prototype.get = function get () {
- pushTarget(this);
- var value;
- var vm = this.vm;
- try {
- value = this.getter.call(vm, vm);
- } catch (e) {
- if (this.user) {
- handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
- } else {
- throw e
- }
- } finally {
- // "touch" every property so they are all tracked as
- // dependencies for deep watching
- if (this.deep) {
- traverse(value);
- }
- popTarget();
- this.cleanupDeps();
- }
- return value
- };
- /**
- * Add a dependency to this directive.
- */
- Watcher.prototype.addDep = function addDep (dep) {
- var id = dep.id;
- if (!this.newDepIds.has(id)) {
- this.newDepIds.add(id);
- this.newDeps.push(dep);
- if (!this.depIds.has(id)) {
- dep.addSub(this);
- }
- }
- };
- /**
- * Clean up for dependency collection.
- */
- Watcher.prototype.cleanupDeps = function cleanupDeps () {
- var i = this.deps.length;
- while (i--) {
- var dep = this.deps[i];
- if (!this.newDepIds.has(dep.id)) {
- dep.removeSub(this);
- }
- }
- var tmp = this.depIds;
- this.depIds = this.newDepIds;
- this.newDepIds = tmp;
- this.newDepIds.clear();
- tmp = this.deps;
- this.deps = this.newDeps;
- this.newDeps = tmp;
- this.newDeps.length = 0;
- };
- /**
- * Subscriber interface.
- * Will be called when a dependency changes.
- */
- Watcher.prototype.update = function update () {
- /* istanbul ignore else */
- if (this.lazy) {
- this.dirty = true;
- } else if (this.sync) {
- this.run();
- } else {
- queueWatcher(this);
- }
- };
- /**
- * Scheduler job interface.
- * Will be called by the scheduler.
- */
- Watcher.prototype.run = function run () {
- if (this.active) {
- var value = this.get();
- if (
- value !== this.value ||
- // Deep watchers and watchers on Object/Arrays should fire even
- // when the value is the same, because the value may
- // have mutated.
- isObject(value) ||
- this.deep
- ) {
- // set new value
- var oldValue = this.value;
- this.value = value;
- if (this.user) {
- try {
- this.cb.call(this.vm, value, oldValue);
- } catch (e) {
- handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
- }
- } else {
- this.cb.call(this.vm, value, oldValue);
- }
- }
- }
- };
- /**
- * Evaluate the value of the watcher.
- * This only gets called for lazy watchers.
- */
- Watcher.prototype.evaluate = function evaluate () {
- this.value = this.get();
- this.dirty = false;
- };
- /**
- * Depend on all deps collected by this watcher.
- */
- Watcher.prototype.depend = function depend () {
- var i = this.deps.length;
- while (i--) {
- this.deps[i].depend();
- }
- };
- /**
- * Remove self from all dependencies' subscriber list.
- */
- Watcher.prototype.teardown = function teardown () {
- if (this.active) {
- // remove self from vm's watcher list
- // this is a somewhat expensive operation so we skip it
- // if the vm is being destroyed.
- if (!this.vm._isBeingDestroyed) {
- remove(this.vm._watchers, this);
- }
- var i = this.deps.length;
- while (i--) {
- this.deps[i].removeSub(this);
- }
- this.active = false;
- }
- };
- /* */
- var sharedPropertyDefinition = {
- enumerable: true,
- configurable: true,
- get: noop,
- set: noop
- };
- function proxy (target, sourceKey, key) {
- sharedPropertyDefinition.get = function proxyGetter () {
- return this[sourceKey][key]
- };
- sharedPropertyDefinition.set = function proxySetter (val) {
- this[sourceKey][key] = val;
- };
- Object.defineProperty(target, key, sharedPropertyDefinition);
- }
- function initState (vm) {
- vm._watchers = [];
- var opts = vm.$options;
- if (opts.props) { initProps(vm, opts.props); }
- if (opts.methods) { initMethods(vm, opts.methods); }
- if (opts.data) {
- initData(vm);
- } else {
- observe(vm._data = {}, true /* asRootData */);
- }
- if (opts.computed) { initComputed(vm, opts.computed); }
- if (opts.watch && opts.watch !== nativeWatch) {
- initWatch(vm, opts.watch);
- }
- }
- function initProps (vm, propsOptions) {
- var propsData = vm.$options.propsData || {};
- var props = vm._props = {};
- // cache prop keys so that future props updates can iterate using Array
- // instead of dynamic object key enumeration.
- var keys = vm.$options._propKeys = [];
- var isRoot = !vm.$parent;
- // root instance props should be converted
- if (!isRoot) {
- toggleObserving(false);
- }
- var loop = function ( key ) {
- keys.push(key);
- var value = validateProp(key, propsOptions, propsData, vm);
- /* istanbul ignore else */
- if (true) {
- var hyphenatedKey = hyphenate(key);
- if (isReservedAttribute(hyphenatedKey) ||
- config.isReservedAttr(hyphenatedKey)) {
- warn(
- ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
- vm
- );
- }
- defineReactive$$1(props, key, value, function () {
- if (!isRoot && !isUpdatingChildComponent) {
- {
- if(vm.mpHost === 'mp-baidu' || vm.mpHost === 'mp-kuaishou' || vm.mpHost === 'mp-xhs'){//百度、快手、小红书 observer 在 setData callback 之后触发,直接忽略该 warn
- return
- }
- //fixed by xxxxxx __next_tick_pending,uni://form-field 时不告警
- if(
- key === 'value' &&
- Array.isArray(vm.$options.behaviors) &&
- vm.$options.behaviors.indexOf('uni://form-field') !== -1
- ){
- return
- }
- if(vm._getFormData){
- return
- }
- var $parent = vm.$parent;
- while($parent){
- if($parent.__next_tick_pending){
- return
- }
- $parent = $parent.$parent;
- }
- }
- warn(
- "Avoid mutating a prop directly since the value will be " +
- "overwritten whenever the parent component re-renders. " +
- "Instead, use a data or computed property based on the prop's " +
- "value. Prop being mutated: \"" + key + "\"",
- vm
- );
- }
- });
- } else {}
- // static props are already proxied on the component's prototype
- // during Vue.extend(). We only need to proxy props defined at
- // instantiation here.
- if (!(key in vm)) {
- proxy(vm, "_props", key);
- }
- };
- for (var key in propsOptions) loop( key );
- toggleObserving(true);
- }
- function initData (vm) {
- var data = vm.$options.data;
- data = vm._data = typeof data === 'function'
- ? getData(data, vm)
- : data || {};
- if (!isPlainObject(data)) {
- data = {};
- true && warn(
- 'data functions should return an object:\n' +
- 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
- vm
- );
- }
- // proxy data on instance
- var keys = Object.keys(data);
- var props = vm.$options.props;
- var methods = vm.$options.methods;
- var i = keys.length;
- while (i--) {
- var key = keys[i];
- if (true) {
- if (methods && hasOwn(methods, key)) {
- warn(
- ("Method \"" + key + "\" has already been defined as a data property."),
- vm
- );
- }
- }
- if (props && hasOwn(props, key)) {
- true && warn(
- "The data property \"" + key + "\" is already declared as a prop. " +
- "Use prop default value instead.",
- vm
- );
- } else if (!isReserved(key)) {
- proxy(vm, "_data", key);
- }
- }
- // observe data
- observe(data, true /* asRootData */);
- }
- function getData (data, vm) {
- // #7573 disable dep collection when invoking data getters
- pushTarget();
- try {
- return data.call(vm, vm)
- } catch (e) {
- handleError(e, vm, "data()");
- return {}
- } finally {
- popTarget();
- }
- }
- var computedWatcherOptions = { lazy: true };
- function initComputed (vm, computed) {
- // $flow-disable-line
- var watchers = vm._computedWatchers = Object.create(null);
- // computed properties are just getters during SSR
- var isSSR = isServerRendering();
- for (var key in computed) {
- var userDef = computed[key];
- var getter = typeof userDef === 'function' ? userDef : userDef.get;
- if ( true && getter == null) {
- warn(
- ("Getter is missing for computed property \"" + key + "\"."),
- vm
- );
- }
- if (!isSSR) {
- // create internal watcher for the computed property.
- watchers[key] = new Watcher(
- vm,
- getter || noop,
- noop,
- computedWatcherOptions
- );
- }
- // component-defined computed properties are already defined on the
- // component prototype. We only need to define computed properties defined
- // at instantiation here.
- if (!(key in vm)) {
- defineComputed(vm, key, userDef);
- } else if (true) {
- if (key in vm.$data) {
- warn(("The computed property \"" + key + "\" is already defined in data."), vm);
- } else if (vm.$options.props && key in vm.$options.props) {
- warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
- }
- }
- }
- }
- function defineComputed (
- target,
- key,
- userDef
- ) {
- var shouldCache = !isServerRendering();
- if (typeof userDef === 'function') {
- sharedPropertyDefinition.get = shouldCache
- ? createComputedGetter(key)
- : createGetterInvoker(userDef);
- sharedPropertyDefinition.set = noop;
- } else {
- sharedPropertyDefinition.get = userDef.get
- ? shouldCache && userDef.cache !== false
- ? createComputedGetter(key)
- : createGetterInvoker(userDef.get)
- : noop;
- sharedPropertyDefinition.set = userDef.set || noop;
- }
- if ( true &&
- sharedPropertyDefinition.set === noop) {
- sharedPropertyDefinition.set = function () {
- warn(
- ("Computed property \"" + key + "\" was assigned to but it has no setter."),
- this
- );
- };
- }
- Object.defineProperty(target, key, sharedPropertyDefinition);
- }
- function createComputedGetter (key) {
- return function computedGetter () {
- var watcher = this._computedWatchers && this._computedWatchers[key];
- if (watcher) {
- if (watcher.dirty) {
- watcher.evaluate();
- }
- if (Dep.SharedObject.target) {// fixed by xxxxxx
- watcher.depend();
- }
- return watcher.value
- }
- }
- }
- function createGetterInvoker(fn) {
- return function computedGetter () {
- return fn.call(this, this)
- }
- }
- function initMethods (vm, methods) {
- var props = vm.$options.props;
- for (var key in methods) {
- if (true) {
- if (typeof methods[key] !== 'function') {
- warn(
- "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
- "Did you reference the function correctly?",
- vm
- );
- }
- if (props && hasOwn(props, key)) {
- warn(
- ("Method \"" + key + "\" has already been defined as a prop."),
- vm
- );
- }
- if ((key in vm) && isReserved(key)) {
- warn(
- "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
- "Avoid defining component methods that start with _ or $."
- );
- }
- }
- vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
- }
- }
- function initWatch (vm, watch) {
- for (var key in watch) {
- var handler = watch[key];
- if (Array.isArray(handler)) {
- for (var i = 0; i < handler.length; i++) {
- createWatcher(vm, key, handler[i]);
- }
- } else {
- createWatcher(vm, key, handler);
- }
- }
- }
- function createWatcher (
- vm,
- expOrFn,
- handler,
- options
- ) {
- if (isPlainObject(handler)) {
- options = handler;
- handler = handler.handler;
- }
- if (typeof handler === 'string') {
- handler = vm[handler];
- }
- return vm.$watch(expOrFn, handler, options)
- }
- function stateMixin (Vue) {
- // flow somehow has problems with directly declared definition object
- // when using Object.defineProperty, so we have to procedurally build up
- // the object here.
- var dataDef = {};
- dataDef.get = function () { return this._data };
- var propsDef = {};
- propsDef.get = function () { return this._props };
- if (true) {
- dataDef.set = function () {
- warn(
- 'Avoid replacing instance root $data. ' +
- 'Use nested data properties instead.',
- this
- );
- };
- propsDef.set = function () {
- warn("$props is readonly.", this);
- };
- }
- Object.defineProperty(Vue.prototype, '$data', dataDef);
- Object.defineProperty(Vue.prototype, '$props', propsDef);
- Vue.prototype.$set = set;
- Vue.prototype.$delete = del;
- Vue.prototype.$watch = function (
- expOrFn,
- cb,
- options
- ) {
- var vm = this;
- if (isPlainObject(cb)) {
- return createWatcher(vm, expOrFn, cb, options)
- }
- options = options || {};
- options.user = true;
- var watcher = new Watcher(vm, expOrFn, cb, options);
- if (options.immediate) {
- try {
- cb.call(vm, watcher.value);
- } catch (error) {
- handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
- }
- }
- return function unwatchFn () {
- watcher.teardown();
- }
- };
- }
- /* */
- var uid$3 = 0;
- function initMixin (Vue) {
- Vue.prototype._init = function (options) {
- var vm = this;
- // a uid
- vm._uid = uid$3++;
- var startTag, endTag;
- /* istanbul ignore if */
- if ( true && config.performance && mark) {
- startTag = "vue-perf-start:" + (vm._uid);
- endTag = "vue-perf-end:" + (vm._uid);
- mark(startTag);
- }
- // a flag to avoid this being observed
- vm._isVue = true;
- // merge options
- if (options && options._isComponent) {
- // optimize internal component instantiation
- // since dynamic options merging is pretty slow, and none of the
- // internal component options needs special treatment.
- initInternalComponent(vm, options);
- } else {
- vm.$options = mergeOptions(
- resolveConstructorOptions(vm.constructor),
- options || {},
- vm
- );
- }
- /* istanbul ignore else */
- if (true) {
- initProxy(vm);
- } else {}
- // expose real self
- vm._self = vm;
- initLifecycle(vm);
- initEvents(vm);
- initRender(vm);
- callHook(vm, 'beforeCreate');
- !vm._$fallback && initInjections(vm); // resolve injections before data/props
- initState(vm);
- !vm._$fallback && initProvide(vm); // resolve provide after data/props
- !vm._$fallback && callHook(vm, 'created');
- /* istanbul ignore if */
- if ( true && config.performance && mark) {
- vm._name = formatComponentName(vm, false);
- mark(endTag);
- measure(("vue " + (vm._name) + " init"), startTag, endTag);
- }
- if (vm.$options.el) {
- vm.$mount(vm.$options.el);
- }
- };
- }
- function initInternalComponent (vm, options) {
- var opts = vm.$options = Object.create(vm.constructor.options);
- // doing this because it's faster than dynamic enumeration.
- var parentVnode = options._parentVnode;
- opts.parent = options.parent;
- opts._parentVnode = parentVnode;
- var vnodeComponentOptions = parentVnode.componentOptions;
- opts.propsData = vnodeComponentOptions.propsData;
- opts._parentListeners = vnodeComponentOptions.listeners;
- opts._renderChildren = vnodeComponentOptions.children;
- opts._componentTag = vnodeComponentOptions.tag;
- if (options.render) {
- opts.render = options.render;
- opts.staticRenderFns = options.staticRenderFns;
- }
- }
- function resolveConstructorOptions (Ctor) {
- var options = Ctor.options;
- if (Ctor.super) {
- var superOptions = resolveConstructorOptions(Ctor.super);
- var cachedSuperOptions = Ctor.superOptions;
- if (superOptions !== cachedSuperOptions) {
- // super option changed,
- // need to resolve new options.
- Ctor.superOptions = superOptions;
- // check if there are any late-modified/attached options (#4976)
- var modifiedOptions = resolveModifiedOptions(Ctor);
- // update base extend options
- if (modifiedOptions) {
- extend(Ctor.extendOptions, modifiedOptions);
- }
- options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
- if (options.name) {
- options.components[options.name] = Ctor;
- }
- }
- }
- return options
- }
- function resolveModifiedOptions (Ctor) {
- var modified;
- var latest = Ctor.options;
- var sealed = Ctor.sealedOptions;
- for (var key in latest) {
- if (latest[key] !== sealed[key]) {
- if (!modified) { modified = {}; }
- modified[key] = latest[key];
- }
- }
- return modified
- }
- function Vue (options) {
- if ( true &&
- !(this instanceof Vue)
- ) {
- warn('Vue is a constructor and should be called with the `new` keyword');
- }
- this._init(options);
- }
- initMixin(Vue);
- stateMixin(Vue);
- eventsMixin(Vue);
- lifecycleMixin(Vue);
- renderMixin(Vue);
- /* */
- function initUse (Vue) {
- Vue.use = function (plugin) {
- var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
- if (installedPlugins.indexOf(plugin) > -1) {
- return this
- }
- // additional parameters
- var args = toArray(arguments, 1);
- args.unshift(this);
- if (typeof plugin.install === 'function') {
- plugin.install.apply(plugin, args);
- } else if (typeof plugin === 'function') {
- plugin.apply(null, args);
- }
- installedPlugins.push(plugin);
- return this
- };
- }
- /* */
- function initMixin$1 (Vue) {
- Vue.mixin = function (mixin) {
- this.options = mergeOptions(this.options, mixin);
- return this
- };
- }
- /* */
- function initExtend (Vue) {
- /**
- * Each instance constructor, including Vue, has a unique
- * cid. This enables us to create wrapped "child
- * constructors" for prototypal inheritance and cache them.
- */
- Vue.cid = 0;
- var cid = 1;
- /**
- * Class inheritance
- */
- Vue.extend = function (extendOptions) {
- extendOptions = extendOptions || {};
- var Super = this;
- var SuperId = Super.cid;
- var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
- if (cachedCtors[SuperId]) {
- return cachedCtors[SuperId]
- }
- var name = extendOptions.name || Super.options.name;
- if ( true && name) {
- validateComponentName(name);
- }
- var Sub = function VueComponent (options) {
- this._init(options);
- };
- Sub.prototype = Object.create(Super.prototype);
- Sub.prototype.constructor = Sub;
- Sub.cid = cid++;
- Sub.options = mergeOptions(
- Super.options,
- extendOptions
- );
- Sub['super'] = Super;
- // For props and computed properties, we define the proxy getters on
- // the Vue instances at extension time, on the extended prototype. This
- // avoids Object.defineProperty calls for each instance created.
- if (Sub.options.props) {
- initProps$1(Sub);
- }
- if (Sub.options.computed) {
- initComputed$1(Sub);
- }
- // allow further extension/mixin/plugin usage
- Sub.extend = Super.extend;
- Sub.mixin = Super.mixin;
- Sub.use = Super.use;
- // create asset registers, so extended classes
- // can have their private assets too.
- ASSET_TYPES.forEach(function (type) {
- Sub[type] = Super[type];
- });
- // enable recursive self-lookup
- if (name) {
- Sub.options.components[name] = Sub;
- }
- // keep a reference to the super options at extension time.
- // later at instantiation we can check if Super's options have
- // been updated.
- Sub.superOptions = Super.options;
- Sub.extendOptions = extendOptions;
- Sub.sealedOptions = extend({}, Sub.options);
- // cache constructor
- cachedCtors[SuperId] = Sub;
- return Sub
- };
- }
- function initProps$1 (Comp) {
- var props = Comp.options.props;
- for (var key in props) {
- proxy(Comp.prototype, "_props", key);
- }
- }
- function initComputed$1 (Comp) {
- var computed = Comp.options.computed;
- for (var key in computed) {
- defineComputed(Comp.prototype, key, computed[key]);
- }
- }
- /* */
- function initAssetRegisters (Vue) {
- /**
- * Create asset registration methods.
- */
- ASSET_TYPES.forEach(function (type) {
- Vue[type] = function (
- id,
- definition
- ) {
- if (!definition) {
- return this.options[type + 's'][id]
- } else {
- /* istanbul ignore if */
- if ( true && type === 'component') {
- validateComponentName(id);
- }
- if (type === 'component' && isPlainObject(definition)) {
- definition.name = definition.name || id;
- definition = this.options._base.extend(definition);
- }
- if (type === 'directive' && typeof definition === 'function') {
- definition = { bind: definition, update: definition };
- }
- this.options[type + 's'][id] = definition;
- return definition
- }
- };
- });
- }
- /* */
- function getComponentName (opts) {
- return opts && (opts.Ctor.options.name || opts.tag)
- }
- function matches (pattern, name) {
- if (Array.isArray(pattern)) {
- return pattern.indexOf(name) > -1
- } else if (typeof pattern === 'string') {
- return pattern.split(',').indexOf(name) > -1
- } else if (isRegExp(pattern)) {
- return pattern.test(name)
- }
- /* istanbul ignore next */
- return false
- }
- function pruneCache (keepAliveInstance, filter) {
- var cache = keepAliveInstance.cache;
- var keys = keepAliveInstance.keys;
- var _vnode = keepAliveInstance._vnode;
- for (var key in cache) {
- var cachedNode = cache[key];
- if (cachedNode) {
- var name = getComponentName(cachedNode.componentOptions);
- if (name && !filter(name)) {
- pruneCacheEntry(cache, key, keys, _vnode);
- }
- }
- }
- }
- function pruneCacheEntry (
- cache,
- key,
- keys,
- current
- ) {
- var cached$$1 = cache[key];
- if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
- cached$$1.componentInstance.$destroy();
- }
- cache[key] = null;
- remove(keys, key);
- }
- var patternTypes = [String, RegExp, Array];
- var KeepAlive = {
- name: 'keep-alive',
- abstract: true,
- props: {
- include: patternTypes,
- exclude: patternTypes,
- max: [String, Number]
- },
- created: function created () {
- this.cache = Object.create(null);
- this.keys = [];
- },
- destroyed: function destroyed () {
- for (var key in this.cache) {
- pruneCacheEntry(this.cache, key, this.keys);
- }
- },
- mounted: function mounted () {
- var this$1 = this;
- this.$watch('include', function (val) {
- pruneCache(this$1, function (name) { return matches(val, name); });
- });
- this.$watch('exclude', function (val) {
- pruneCache(this$1, function (name) { return !matches(val, name); });
- });
- },
- render: function render () {
- var slot = this.$slots.default;
- var vnode = getFirstComponentChild(slot);
- var componentOptions = vnode && vnode.componentOptions;
- if (componentOptions) {
- // check pattern
- var name = getComponentName(componentOptions);
- var ref = this;
- var include = ref.include;
- var exclude = ref.exclude;
- if (
- // not included
- (include && (!name || !matches(include, name))) ||
- // excluded
- (exclude && name && matches(exclude, name))
- ) {
- return vnode
- }
- var ref$1 = this;
- var cache = ref$1.cache;
- var keys = ref$1.keys;
- var key = vnode.key == null
- // same constructor may get registered as different local components
- // so cid alone is not enough (#3269)
- ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
- : vnode.key;
- if (cache[key]) {
- vnode.componentInstance = cache[key].componentInstance;
- // make current key freshest
- remove(keys, key);
- keys.push(key);
- } else {
- cache[key] = vnode;
- keys.push(key);
- // prune oldest entry
- if (this.max && keys.length > parseInt(this.max)) {
- pruneCacheEntry(cache, keys[0], keys, this._vnode);
- }
- }
- vnode.data.keepAlive = true;
- }
- return vnode || (slot && slot[0])
- }
- };
- var builtInComponents = {
- KeepAlive: KeepAlive
- };
- /* */
- function initGlobalAPI (Vue) {
- // config
- var configDef = {};
- configDef.get = function () { return config; };
- if (true) {
- configDef.set = function () {
- warn(
- 'Do not replace the Vue.config object, set individual fields instead.'
- );
- };
- }
- Object.defineProperty(Vue, 'config', configDef);
- // exposed util methods.
- // NOTE: these are not considered part of the public API - avoid relying on
- // them unless you are aware of the risk.
- Vue.util = {
- warn: warn,
- extend: extend,
- mergeOptions: mergeOptions,
- defineReactive: defineReactive$$1
- };
- Vue.set = set;
- Vue.delete = del;
- Vue.nextTick = nextTick;
- // 2.6 explicit observable API
- Vue.observable = function (obj) {
- observe(obj);
- return obj
- };
- Vue.options = Object.create(null);
- ASSET_TYPES.forEach(function (type) {
- Vue.options[type + 's'] = Object.create(null);
- });
- // this is used to identify the "base" constructor to extend all plain-object
- // components with in Weex's multi-instance scenarios.
- Vue.options._base = Vue;
- extend(Vue.options.components, builtInComponents);
- initUse(Vue);
- initMixin$1(Vue);
- initExtend(Vue);
- initAssetRegisters(Vue);
- }
- initGlobalAPI(Vue);
- Object.defineProperty(Vue.prototype, '$isServer', {
- get: isServerRendering
- });
- Object.defineProperty(Vue.prototype, '$ssrContext', {
- get: function get () {
- /* istanbul ignore next */
- return this.$vnode && this.$vnode.ssrContext
- }
- });
- // expose FunctionalRenderContext for ssr runtime helper installation
- Object.defineProperty(Vue, 'FunctionalRenderContext', {
- value: FunctionalRenderContext
- });
- Vue.version = '2.6.11';
- /**
- * https://raw.githubusercontent.com/Tencent/westore/master/packages/westore/utils/diff.js
- */
- var ARRAYTYPE = '[object Array]';
- var OBJECTTYPE = '[object Object]';
- var NULLTYPE = '[object Null]';
- var UNDEFINEDTYPE = '[object Undefined]';
- // const FUNCTIONTYPE = '[object Function]'
- function diff(current, pre) {
- var result = {};
- syncKeys(current, pre);
- _diff(current, pre, '', result);
- return result
- }
- function syncKeys(current, pre) {
- if (current === pre) { return }
- var rootCurrentType = type(current);
- var rootPreType = type(pre);
- if (rootCurrentType == OBJECTTYPE && rootPreType == OBJECTTYPE) {
- if(Object.keys(current).length >= Object.keys(pre).length){
- for (var key in pre) {
- var currentValue = current[key];
- if (currentValue === undefined) {
- current[key] = null;
- } else {
- syncKeys(currentValue, pre[key]);
- }
- }
- }
- } else if (rootCurrentType == ARRAYTYPE && rootPreType == ARRAYTYPE) {
- if (current.length >= pre.length) {
- pre.forEach(function (item, index) {
- syncKeys(current[index], item);
- });
- }
- }
- }
- function nullOrUndefined(currentType, preType) {
- if(
- (currentType === NULLTYPE || currentType === UNDEFINEDTYPE) &&
- (preType === NULLTYPE || preType === UNDEFINEDTYPE)
- ) {
- return false
- }
- return true
- }
- function _diff(current, pre, path, result) {
- if (current === pre) { return }
- var rootCurrentType = type(current);
- var rootPreType = type(pre);
- if (rootCurrentType == OBJECTTYPE) {
- if (rootPreType != OBJECTTYPE || Object.keys(current).length < Object.keys(pre).length) {
- setResult(result, path, current);
- } else {
- var loop = function ( key ) {
- var currentValue = current[key];
- var preValue = pre[key];
- var currentType = type(currentValue);
- var preType = type(preValue);
- if (currentType != ARRAYTYPE && currentType != OBJECTTYPE) {
- if (currentValue !== pre[key] && nullOrUndefined(currentType, preType)) {
- setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
- }
- } else if (currentType == ARRAYTYPE) {
- if (preType != ARRAYTYPE) {
- setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
- } else {
- if (currentValue.length < preValue.length) {
- setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
- } else {
- currentValue.forEach(function (item, index) {
- _diff(item, preValue[index], (path == '' ? '' : path + ".") + key + '[' + index + ']', result);
- });
- }
- }
- } else if (currentType == OBJECTTYPE) {
- if (preType != OBJECTTYPE || Object.keys(currentValue).length < Object.keys(preValue).length) {
- setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
- } else {
- for (var subKey in currentValue) {
- _diff(currentValue[subKey], preValue[subKey], (path == '' ? '' : path + ".") + key + '.' + subKey, result);
- }
- }
- }
- };
- for (var key in current) loop( key );
- }
- } else if (rootCurrentType == ARRAYTYPE) {
- if (rootPreType != ARRAYTYPE) {
- setResult(result, path, current);
- } else {
- if (current.length < pre.length) {
- setResult(result, path, current);
- } else {
- current.forEach(function (item, index) {
- _diff(item, pre[index], path + '[' + index + ']', result);
- });
- }
- }
- } else {
- setResult(result, path, current);
- }
- }
- function setResult(result, k, v) {
- // if (type(v) != FUNCTIONTYPE) {
- result[k] = v;
- // }
- }
- function type(obj) {
- return Object.prototype.toString.call(obj)
- }
- /* */
- function flushCallbacks$1(vm) {
- if (vm.__next_tick_callbacks && vm.__next_tick_callbacks.length) {
- if (Object({"NODE_ENV":"development","VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"v3-H5","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG) {
- var mpInstance = vm.$scope;
- console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
- ']:flushCallbacks[' + vm.__next_tick_callbacks.length + ']');
- }
- var copies = vm.__next_tick_callbacks.slice(0);
- vm.__next_tick_callbacks.length = 0;
- for (var i = 0; i < copies.length; i++) {
- copies[i]();
- }
- }
- }
- function hasRenderWatcher(vm) {
- return queue.find(function (watcher) { return vm._watcher === watcher; })
- }
- function nextTick$1(vm, cb) {
- //1.nextTick 之前 已 setData 且 setData 还未回调完成
- //2.nextTick 之前存在 render watcher
- if (!vm.__next_tick_pending && !hasRenderWatcher(vm)) {
- if(Object({"NODE_ENV":"development","VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"v3-H5","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG){
- var mpInstance = vm.$scope;
- console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
- ']:nextVueTick');
- }
- return nextTick(cb, vm)
- }else{
- if(Object({"NODE_ENV":"development","VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"v3-H5","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG){
- var mpInstance$1 = vm.$scope;
- console.log('[' + (+new Date) + '][' + (mpInstance$1.is || mpInstance$1.route) + '][' + vm._uid +
- ']:nextMPTick');
- }
- }
- var _resolve;
- if (!vm.__next_tick_callbacks) {
- vm.__next_tick_callbacks = [];
- }
- vm.__next_tick_callbacks.push(function () {
- if (cb) {
- try {
- cb.call(vm);
- } catch (e) {
- handleError(e, vm, 'nextTick');
- }
- } else if (_resolve) {
- _resolve(vm);
- }
- });
- // $flow-disable-line
- if (!cb && typeof Promise !== 'undefined') {
- return new Promise(function (resolve) {
- _resolve = resolve;
- })
- }
- }
- /* */
- function clearInstance(key, value) {
- // 简易去除 Vue 和小程序组件实例
- if (value) {
- if (value._isVue || value.__v_isMPComponent) {
- return {}
- }
- }
- return value
- }
- function cloneWithData(vm) {
- // 确保当前 vm 所有数据被同步
- var ret = Object.create(null);
- var dataKeys = [].concat(
- Object.keys(vm._data || {}),
- Object.keys(vm._computedWatchers || {}));
- dataKeys.reduce(function(ret, key) {
- ret[key] = vm[key];
- return ret
- }, ret);
- // vue-composition-api
- var compositionApiState = vm.__composition_api_state__ || vm.__secret_vfa_state__;
- var rawBindings = compositionApiState && compositionApiState.rawBindings;
- if (rawBindings) {
- Object.keys(rawBindings).forEach(function (key) {
- ret[key] = vm[key];
- });
- }
- //TODO 需要把无用数据处理掉,比如 list=>l0 则 list 需要移除,否则多传输一份数据
- Object.assign(ret, vm.$mp.data || {});
- if (
- Array.isArray(vm.$options.behaviors) &&
- vm.$options.behaviors.indexOf('uni://form-field') !== -1
- ) { //form-field
- ret['name'] = vm.name;
- ret['value'] = vm.value;
- }
- return JSON.parse(JSON.stringify(ret, clearInstance))
- }
- var patch = function(oldVnode, vnode) {
- var this$1 = this;
- if (vnode === null) { //destroy
- return
- }
- if (this.mpType === 'page' || this.mpType === 'component') {
- var mpInstance = this.$scope;
- var data = Object.create(null);
- try {
- data = cloneWithData(this);
- } catch (err) {
- console.error(err);
- }
- data.__webviewId__ = mpInstance.data.__webviewId__;
- var mpData = Object.create(null);
- Object.keys(data).forEach(function (key) { //仅同步 data 中有的数据
- mpData[key] = mpInstance.data[key];
- });
- var diffData = this.$shouldDiffData === false ? data : diff(data, mpData);
- if (Object.keys(diffData).length) {
- if (Object({"NODE_ENV":"development","VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"v3-H5","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG) {
- console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + this._uid +
- ']差量更新',
- JSON.stringify(diffData));
- }
- this.__next_tick_pending = true;
- mpInstance.setData(diffData, function () {
- this$1.__next_tick_pending = false;
- flushCallbacks$1(this$1);
- });
- } else {
- flushCallbacks$1(this);
- }
- }
- };
- /* */
- function createEmptyRender() {
- }
- function mountComponent$1(
- vm,
- el,
- hydrating
- ) {
- if (!vm.mpType) {//main.js 中的 new Vue
- return vm
- }
- if (vm.mpType === 'app') {
- vm.$options.render = createEmptyRender;
- }
- if (!vm.$options.render) {
- vm.$options.render = createEmptyRender;
- if (true) {
- /* istanbul ignore if */
- if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
- vm.$options.el || el) {
- warn(
- 'You are using the runtime-only build of Vue where the template ' +
- 'compiler is not available. Either pre-compile the templates into ' +
- 'render functions, or use the compiler-included build.',
- vm
- );
- } else {
- warn(
- 'Failed to mount component: template or render function not defined.',
- vm
- );
- }
- }
- }
-
- !vm._$fallback && callHook(vm, 'beforeMount');
- var updateComponent = function () {
- vm._update(vm._render(), hydrating);
- };
- // we set this to vm._watcher inside the watcher's constructor
- // since the watcher's initial patch may call $forceUpdate (e.g. inside child
- // component's mounted hook), which relies on vm._watcher being already defined
- new Watcher(vm, updateComponent, noop, {
- before: function before() {
- if (vm._isMounted && !vm._isDestroyed) {
- callHook(vm, 'beforeUpdate');
- }
- }
- }, true /* isRenderWatcher */);
- hydrating = false;
- return vm
- }
- /* */
- function renderClass (
- staticClass,
- dynamicClass
- ) {
- if (isDef(staticClass) || isDef(dynamicClass)) {
- return concat(staticClass, stringifyClass(dynamicClass))
- }
- /* istanbul ignore next */
- return ''
- }
- function concat (a, b) {
- return a ? b ? (a + ' ' + b) : a : (b || '')
- }
- function stringifyClass (value) {
- if (Array.isArray(value)) {
- return stringifyArray(value)
- }
- if (isObject(value)) {
- return stringifyObject(value)
- }
- if (typeof value === 'string') {
- return value
- }
- /* istanbul ignore next */
- return ''
- }
- function stringifyArray (value) {
- var res = '';
- var stringified;
- for (var i = 0, l = value.length; i < l; i++) {
- if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
- if (res) { res += ' '; }
- res += stringified;
- }
- }
- return res
- }
- function stringifyObject (value) {
- var res = '';
- for (var key in value) {
- if (value[key]) {
- if (res) { res += ' '; }
- res += key;
- }
- }
- return res
- }
- /* */
- var parseStyleText = cached(function (cssText) {
- var res = {};
- var listDelimiter = /;(?![^(]*\))/g;
- var propertyDelimiter = /:(.+)/;
- cssText.split(listDelimiter).forEach(function (item) {
- if (item) {
- var tmp = item.split(propertyDelimiter);
- tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
- }
- });
- return res
- });
- // normalize possible array / string values into Object
- function normalizeStyleBinding (bindingStyle) {
- if (Array.isArray(bindingStyle)) {
- return toObject(bindingStyle)
- }
- if (typeof bindingStyle === 'string') {
- return parseStyleText(bindingStyle)
- }
- return bindingStyle
- }
- /* */
- var MP_METHODS = ['createSelectorQuery', 'createIntersectionObserver', 'selectAllComponents', 'selectComponent'];
- function getTarget(obj, path) {
- var parts = path.split('.');
- var key = parts[0];
- if (key.indexOf('__$n') === 0) { //number index
- key = parseInt(key.replace('__$n', ''));
- }
- if (parts.length === 1) {
- return obj[key]
- }
- return getTarget(obj[key], parts.slice(1).join('.'))
- }
- function internalMixin(Vue) {
- Vue.config.errorHandler = function(err, vm, info) {
- Vue.util.warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
- console.error(err);
- /* eslint-disable no-undef */
- var app = typeof getApp === 'function' && getApp();
- if (app && app.onError) {
- app.onError(err);
- }
- };
- var oldEmit = Vue.prototype.$emit;
- Vue.prototype.$emit = function(event) {
- if (this.$scope && event) {
- var triggerEvent = this.$scope['_triggerEvent'] || this.$scope['triggerEvent'];
- if (triggerEvent) {
- try {
- triggerEvent.call(this.$scope, event, {
- __args__: toArray(arguments, 1)
- });
- } catch (error) {
- }
- }
- }
- return oldEmit.apply(this, arguments)
- };
- Vue.prototype.$nextTick = function(fn) {
- return nextTick$1(this, fn)
- };
- MP_METHODS.forEach(function (method) {
- Vue.prototype[method] = function(args) {
- if (this.$scope && this.$scope[method]) {
- return this.$scope[method](args)
- }
- // mp-alipay
- if (typeof my === 'undefined') {
- return
- }
- if (method === 'createSelectorQuery') {
- /* eslint-disable no-undef */
- return my.createSelectorQuery(args)
- } else if (method === 'createIntersectionObserver') {
- /* eslint-disable no-undef */
- return my.createIntersectionObserver(args)
- }
- // TODO mp-alipay 暂不支持 selectAllComponents,selectComponent
- };
- });
- Vue.prototype.__init_provide = initProvide;
- Vue.prototype.__init_injections = initInjections;
- Vue.prototype.__call_hook = function(hook, args) {
- var vm = this;
- // #7573 disable dep collection when invoking lifecycle hooks
- pushTarget();
- var handlers = vm.$options[hook];
- var info = hook + " hook";
- var ret;
- if (handlers) {
- for (var i = 0, j = handlers.length; i < j; i++) {
- ret = invokeWithErrorHandling(handlers[i], vm, args ? [args] : null, vm, info);
- }
- }
- if (vm._hasHookEvent) {
- vm.$emit('hook:' + hook, args);
- }
- popTarget();
- return ret
- };
- Vue.prototype.__set_model = function(target, key, value, modifiers) {
- if (Array.isArray(modifiers)) {
- if (modifiers.indexOf('trim') !== -1) {
- value = value.trim();
- }
- if (modifiers.indexOf('number') !== -1) {
- value = this._n(value);
- }
- }
- if (!target) {
- target = this;
- }
- // 解决动态属性添加
- Vue.set(target, key, value);
- };
- Vue.prototype.__set_sync = function(target, key, value) {
- if (!target) {
- target = this;
- }
- // 解决动态属性添加
- Vue.set(target, key, value);
- };
- Vue.prototype.__get_orig = function(item) {
- if (isPlainObject(item)) {
- return item['$orig'] || item
- }
- return item
- };
- Vue.prototype.__get_value = function(dataPath, target) {
- return getTarget(target || this, dataPath)
- };
- Vue.prototype.__get_class = function(dynamicClass, staticClass) {
- return renderClass(staticClass, dynamicClass)
- };
- Vue.prototype.__get_style = function(dynamicStyle, staticStyle) {
- if (!dynamicStyle && !staticStyle) {
- return ''
- }
- var dynamicStyleObj = normalizeStyleBinding(dynamicStyle);
- var styleObj = staticStyle ? extend(staticStyle, dynamicStyleObj) : dynamicStyleObj;
- return Object.keys(styleObj).map(function (name) { return ((hyphenate(name)) + ":" + (styleObj[name])); }).join(';')
- };
- Vue.prototype.__map = function(val, iteratee) {
- //TODO 暂不考虑 string
- var ret, i, l, keys, key;
- if (Array.isArray(val)) {
- ret = new Array(val.length);
- for (i = 0, l = val.length; i < l; i++) {
- ret[i] = iteratee(val[i], i);
- }
- return ret
- } else if (isObject(val)) {
- keys = Object.keys(val);
- ret = Object.create(null);
- for (i = 0, l = keys.length; i < l; i++) {
- key = keys[i];
- ret[key] = iteratee(val[key], key, i);
- }
- return ret
- } else if (typeof val === 'number') {
- ret = new Array(val);
- for (i = 0, l = val; i < l; i++) {
- // 第一个参数暂时仍和小程序一致
- ret[i] = iteratee(i, i);
- }
- return ret
- }
- return []
- };
- }
- /* */
- var LIFECYCLE_HOOKS$1 = [
- //App
- 'onLaunch',
- 'onShow',
- 'onHide',
- 'onUniNViewMessage',
- 'onPageNotFound',
- 'onThemeChange',
- 'onError',
- 'onUnhandledRejection',
- //Page
- 'onInit',
- 'onLoad',
- // 'onShow',
- 'onReady',
- // 'onHide',
- 'onUnload',
- 'onPullDownRefresh',
- 'onReachBottom',
- 'onTabItemTap',
- 'onAddToFavorites',
- 'onShareTimeline',
- 'onShareAppMessage',
- 'onResize',
- 'onPageScroll',
- 'onNavigationBarButtonTap',
- 'onBackPress',
- 'onNavigationBarSearchInputChanged',
- 'onNavigationBarSearchInputConfirmed',
- 'onNavigationBarSearchInputClicked',
- 'onUploadDouyinVideo',
- 'onNFCReadMessage',
- //Component
- // 'onReady', // 兼容旧版本,应该移除该事件
- 'onPageShow',
- 'onPageHide',
- 'onPageResize'
- ];
- function lifecycleMixin$1(Vue) {
- //fixed vue-class-component
- var oldExtend = Vue.extend;
- Vue.extend = function(extendOptions) {
- extendOptions = extendOptions || {};
- var methods = extendOptions.methods;
- if (methods) {
- Object.keys(methods).forEach(function (methodName) {
- if (LIFECYCLE_HOOKS$1.indexOf(methodName)!==-1) {
- extendOptions[methodName] = methods[methodName];
- delete methods[methodName];
- }
- });
- }
- return oldExtend.call(this, extendOptions)
- };
- var strategies = Vue.config.optionMergeStrategies;
- var mergeHook = strategies.created;
- LIFECYCLE_HOOKS$1.forEach(function (hook) {
- strategies[hook] = mergeHook;
- });
- Vue.prototype.__lifecycle_hooks__ = LIFECYCLE_HOOKS$1;
- }
- /* */
- // install platform patch function
- Vue.prototype.__patch__ = patch;
- // public mount method
- Vue.prototype.$mount = function(
- el ,
- hydrating
- ) {
- return mountComponent$1(this, el, hydrating)
- };
- lifecycleMixin$1(Vue);
- internalMixin(Vue);
- /* */
- /* harmony default export */ __webpack_exports__["default"] = (Vue);
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../webpack/buildin/global.js */ 3)))
- /***/ }),
- /* 26 */
- /*!**************************************!*\
- !*** E:/git/2021项目/v3-H5/pages.json ***!
- \**************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- /***/ }),
- /* 27 */,
- /* 28 */,
- /* 29 */,
- /* 30 */,
- /* 31 */,
- /* 32 */
- /*!**********************************************************************************************************!*\
- !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js ***!
- \**********************************************************************************************************/
- /*! exports provided: default */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
- /* globals __VUE_SSR_CONTEXT__ */
- // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
- // This module is a runtime utility for cleaner component module output and will
- // be included in the final webpack user bundle.
- function normalizeComponent (
- scriptExports,
- render,
- staticRenderFns,
- functionalTemplate,
- injectStyles,
- scopeId,
- moduleIdentifier, /* server only */
- shadowMode, /* vue-cli only */
- components, // fixed by xxxxxx auto components
- renderjs // fixed by xxxxxx renderjs
- ) {
- // Vue.extend constructor export interop
- var options = typeof scriptExports === 'function'
- ? scriptExports.options
- : scriptExports
- // fixed by xxxxxx auto components
- if (components) {
- if (!options.components) {
- options.components = {}
- }
- var hasOwn = Object.prototype.hasOwnProperty
- for (var name in components) {
- if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {
- options.components[name] = components[name]
- }
- }
- }
- // fixed by xxxxxx renderjs
- if (renderjs) {
- if(typeof renderjs.beforeCreate === 'function'){
- renderjs.beforeCreate = [renderjs.beforeCreate]
- }
- (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {
- this[renderjs.__module] = this
- });
- (options.mixins || (options.mixins = [])).push(renderjs)
- }
- // render functions
- if (render) {
- options.render = render
- options.staticRenderFns = staticRenderFns
- options._compiled = true
- }
- // functional template
- if (functionalTemplate) {
- options.functional = true
- }
- // scopedId
- if (scopeId) {
- options._scopeId = 'data-v-' + scopeId
- }
- var hook
- if (moduleIdentifier) { // server build
- hook = function (context) {
- // 2.3 injection
- context =
- context || // cached call
- (this.$vnode && this.$vnode.ssrContext) || // stateful
- (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
- // 2.2 with runInNewContext: true
- if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
- context = __VUE_SSR_CONTEXT__
- }
- // inject component styles
- if (injectStyles) {
- injectStyles.call(this, context)
- }
- // register component module identifier for async chunk inferrence
- if (context && context._registeredComponents) {
- context._registeredComponents.add(moduleIdentifier)
- }
- }
- // used by ssr in case component is cached and beforeCreate
- // never gets called
- options._ssrRegister = hook
- } else if (injectStyles) {
- hook = shadowMode
- ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
- : injectStyles
- }
- if (hook) {
- if (options.functional) {
- // for template-only hot-reload because in that case the render fn doesn't
- // go through the normalizer
- options._injectStyles = hook
- // register for functioal component in vue file
- var originalRender = options.render
- options.render = function renderWithStyleInjection (h, context) {
- hook.call(context)
- return originalRender(h, context)
- }
- } else {
- // inject component registration as beforeCreate hook
- var existing = options.beforeCreate
- options.beforeCreate = existing
- ? [].concat(existing, hook)
- : [hook]
- }
- }
- return {
- exports: scriptExports,
- options: options
- }
- }
- /***/ }),
- /* 33 */
- /*!*************************************************!*\
- !*** E:/git/2021项目/v3-H5/api/request/config.js ***!
- \*************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.config = void 0;
- var config = {
- /************************************ 后台服务地址 ************************************/
- // base_url: 'http://192.168.1.43/api', //43服务器
- // base_url: 'http://192.168.1.8/api',//1.8服务器
- // base_url: 'http://192.168.1.88/labSystem',//1.88服务器
- // base_url: 'http://192.168.1.9:8080',//柴
- // base_url: 'http://192.168.1.24:8080',//林总
- // base_url: 'http://192.168.1.7:8080',//刘波
- // base_url: 'http://192.168.1.17:8080',//小飞
- // base_url: 'http://192.168.1.43/api',//小飞
- // base_url: 'http://192.168.1.20:8080',//志伟
- // base_url: 'http://192.168.1.39:8080',//高升
- // base_url: 'http://192.168.1.29:8080',//何成
- // base_url: 'https://demo.zjznai.com/xzgd/',
- // base_url: 'https://lab.zjznai.com/labNhSystem/',//43服务器高升测试
- // base_url: 'https://lab.zjznai.com/labTest/',//1.8外网
- // base_url: 'https://lab.zjznai.com/labapp/',//43服务器线上
- base_url: 'https://lab.zjznai.com/appTest/',
- //88服务器线上
- // base_url: 'https://lab.zjznai.com/labSystem/', //矿大地址
- // base_url: 'https://lab.zjznai.com/jdlabSystem/', //交大地址
- // base_url: 'https://lab.zjznai.com/jndxlabSystem/', //暨大地址
- // base_url: 'https://lab.zjznai.com/api/', //暨大化材
- // base_url: 'https://lab.zjznai.com/kdwclabSystem/', //矿大文昌地址
- //base_url: 'https://znyj.zjznai.suda.edu.cn/labSystem/', //苏大临时地址
- // base_url: 'https://labcontrol.nwafu.edu.cn/api/', //西北农林
- // base_url: 'http://172.16.0.65/api/', //西北农林
- //base_url: 'https://lab.zjznai.com/labapp/', //43测试
- // base_url: 'https://metersphere.zjznai.com/labSystem/', //中国海关
- /************************************ 图片服务地址 ************************************/
- //(imagesUrl.styl 文件内还需要配置一次css相关地址注意是否与imagesUrl.styl一致)
- imagesUrl: 'https://zj-wechat.oss-cn-beijing.aliyuncs.com/xcx_images/xcx_v3/',
- /************************************ 扫一扫 ************************************/
- //1.MSDS说明书 2.安全制度 3.危险源详情 地址配置
- saoCodeTypeUrl: 'http://192.168.1.88/labSystem/admin/#/codeHtml?',
- /************************************ 校级管理员身份ID ************************************/
- schoolId: '1815293314666532865',
- /************************************ 院级管理员身份ID ************************************/
- collegeId: '1815336278075838465',
- /************************************ 版本标识-用于区别各学校差异化代码 ************************************/
- VERSION_DIFFERENCE_FIELD: 'xiBeiNongLinDaXue',
- /************************************ H5统一认证地址-用于H5版本统一认证 ************************************/
- UNIFIED_CERTIFICATION_URL: 'https://labcontrol.nwafu.edu.cn/api/auth/cas/logout/applet'
- };
- exports.config = config;
- /***/ }),
- /* 34 */
- /*!****************************************************!*\
- !*** E:/git/2021项目/v3-H5/uni.promisify.adaptor.js ***!
- \****************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- /* WEBPACK VAR INJECTION */(function(uni) {var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ 13);
- uni.addInterceptor({
- returnValue: function returnValue(res) {
- if (!(!!res && (_typeof(res) === "object" || typeof res === "function") && typeof res.then === "function")) {
- return res;
- }
- return new Promise(function (resolve, reject) {
- res.then(function (res) {
- if (!res) return resolve(res);
- return res[0] ? reject(res[0]) : resolve(res[1]);
- });
- });
- }
- });
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
- /***/ }),
- /* 35 */
- /*!*********************************************!*\
- !*** E:/git/2021项目/v3-H5/devTools/index.js ***!
- \*********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(uni) {
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _drawView = _interopRequireDefault(__webpack_require__(/*! ./core/libs/drawView */ 36));
- var _logReport = _interopRequireDefault(__webpack_require__(/*! ./core/libs/logReport */ 37));
- var _errorReport = _interopRequireDefault(__webpack_require__(/*! ./core/libs/errorReport */ 41));
- var _devOptions = _interopRequireDefault(__webpack_require__(/*! ./core/libs/devOptions */ 39));
- var _createH5Bubble = _interopRequireDefault(__webpack_require__(/*! ./core/libs/createH5Bubble */ 42));
- var _vueMixin = _interopRequireDefault(__webpack_require__(/*! ./core/proxy/vueMixin */ 43));
- var _index = _interopRequireDefault(__webpack_require__(/*! ./core/proxy/index */ 47));
- var _pageLinkList = _interopRequireDefault(__webpack_require__(/*! ./core/libs/pageLinkList */ 44));
- /**
- * @type {Vue}
- */
- var that;
- var devTools = {
- options: null,
- /**
- * 挂载安装APP页面
- */
- install: function install(vm, options) {
- try {
- that = vm;
- var _this = this;
- if (vm && vm.config && vm.config.globalProperties) {
- vm.config.globalProperties.$logReport = _logReport.default;
- } else {
- vm.prototype.$logReport = _logReport.default;
- }
- //! 初始化配置项
- _devOptions.default.setOptions(options);
- options = _devOptions.default.getOptions();
- _this.options = options;
- if (!options || !options.status) {
- return console.log("%c devTools 调试工具未运行!", 'padding: 4px;background-color: red;color: #fff;font-size: 15px;');
- }
- //! 挂载dev工具
- if (vm && vm.config && vm.config.globalProperties) {
- vm.config.globalProperties.$devTools = devTools;
- } else {
- vm.prototype.$devTools = devTools;
- }
- if (options.error.status) {
- //! 挂载vue报错
- vm.config.errorHandler = function (err, vm, trace) {
- (0, _errorReport.default)(err, trace, "ve");
- };
- //! 挂载vue警告
- vm.config.warnHandler = function (err, vm, trace) {
- (0, _errorReport.default)(err, trace, "vw");
- };
- }
- //!混入生命周期监听器
- vm.mixin(_vueMixin.default);
- //!绘制环境变量小标签
- //!调试工具全局拦截器挂载
- (0, _index.default)(options);
- //! 注册dev弹窗打开事件
- uni.$on("devTools_showDialog", function () {
- _this.show();
- });
- //! 注册dev弹窗关闭事件
- uni.$on("devTools_closeDialog", function (options) {
- _this.hide(options);
- });
- //! 挂载uni对象
- uni.$dev = {
- show: function show() {
- _this.show();
- },
- hide: function hide() {
- _this.hide();
- },
- errorReport: _errorReport.default,
- logReport: _logReport.default
- };
- //! 注册jsRunner执行事件
- uni.$on("devTools_jsRunner", function (code) {
- var result = undefined;
- try {
- var fun = ("ev" + "__混淆__" + "al").replace("__混淆__", "");
- result = globalThis[fun](code);
- // result = eval(code);
- } catch (error) {
- if (error && error.message) {
- result = error.message;
- }
- }
- uni.$emit("devTools_jsRunnerCallback", result);
- });
- // ! 页面路由列表
- _pageLinkList.default.install();
- } catch (error) {
- console.log("devTools install error", error);
- }
- },
- /**
- * 打开调试弹窗
- */
- show: function show() {
- var pages = getCurrentPages();
- //! 已经打开了调试工具,不要重复显示
- if (pages[pages.length - 1].route == this.options.devRoute) {
- return false;
- }
- uni.navigateTo({
- url: this.options.route,
- animationType: 'none',
- animationDuration: 0
- });
- },
- /**
- * 隐藏调试弹窗
- */
- hide: function hide(options) {
- uni.navigateBack();
- if (options && options.navigateToUrl) {
- var t = 600;
- t = 200;
- setTimeout(function () {
- uni.navigateTo({
- url: options.navigateToUrl
- });
- }, t);
- }
- },
- errorReport: _errorReport.default,
- logReport: _logReport.default
- };
- var _default = devTools;
- exports.default = _default;
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
- /***/ }),
- /* 36 */
- /*!**********************************************************!*\
- !*** E:/git/2021项目/v3-H5/devTools/core/libs/drawView.js ***!
- \**********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(uni) {
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- /**
- * 绘制调试工具
- */
- /**
- * 入口文件
- */
- function init(options, devTools) {
- var sysInfo = uni.getSystemInfoSync();
- var tagConfig = uni.getStorageSync("devTools_tagConfig");
- if (!tagConfig) {
- tagConfig = {};
- }
- tagConfig = Object.assign({
- show: options.bubble.status,
- x: sysInfo.screenWidth - 90,
- y: sysInfo.screenHeight - 90
- }, tagConfig);
- tagConfig.show = options.bubble.status;
- // 拖动范围限制
- var dragLimit = {
- min: {
- x: 0,
- y: 0
- },
- max: {
- x: sysInfo.screenWidth - 70,
- y: sysInfo.screenHeight - 24
- }
- };
- var view = new plus.nativeObj.View('debugTag', {
- top: tagConfig.y + 'px',
- left: tagConfig.x + 'px',
- height: '24px',
- width: '70px',
- backgroundColor: options.bubble.bgColor
- });
- view.drawText(options.bubble.text, {}, {
- size: '12px',
- color: options.bubble.color,
- weight: 'bold'
- });
- if (tagConfig.show) {
- view.show();
- }
- var isTouch = false;
- var touchStart = {
- l: 0,
- t: 0,
- x: 0,
- y: 0,
- time: 0,
- hasMove: false
- };
- view.addEventListener("touchstart", function (e) {
- isTouch = true;
- touchStart.l = e.clientX;
- touchStart.t = e.clientY;
- touchStart.time = new Date().getTime();
- touchStart.hasMove = false;
- });
- view.addEventListener("touchmove", function (e) {
- if (!isTouch) return;
- if (!touchStart.hasMove) {
- touchStart.hasMove = true;
- }
- var x = e.screenX - touchStart.l;
- var y = e.screenY - touchStart.t;
- x = Math.min(Math.max(x, dragLimit.min.x), dragLimit.max.x);
- y = Math.min(Math.max(y, dragLimit.min.y), dragLimit.max.y);
- view.setStyle({
- top: y + 'px',
- left: x + 'px'
- });
- touchStart.x = x;
- touchStart.y = y;
- });
- view.addEventListener("touchend", function (e) {
- isTouch = false;
- if (!touchStart.hasMove || touchStart.time > new Date().getTime() - 300) {
- // 单击事件
- var pages = getCurrentPages();
- var route = options.route.substring(1, options.route.length - 2);
- if (pages[pages.length - 1].route == route) {
- // 已经处于debug页面,不响应点击事件
- return;
- }
- devTools.show();
- } else {
- //拖拽结束事件
- tagConfig.x = touchStart.x;
- tagConfig.y = touchStart.y;
- uni.setStorageSync("devTools_tagConfig", tagConfig);
- }
- });
- uni.setStorageSync("devTools_tagConfig", tagConfig);
- }
- var _default = init;
- exports.default = _default;
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
- /***/ }),
- /* 37 */
- /*!***********************************************************!*\
- !*** E:/git/2021项目/v3-H5/devTools/core/libs/logReport.js ***!
- \***********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
- var _devCache = _interopRequireDefault(__webpack_require__(/*! ./devCache */ 38));
- var _devOptions = _interopRequireDefault(__webpack_require__(/*! ./devOptions */ 39));
- var _jsonCompress = _interopRequireDefault(__webpack_require__(/*! ./jsonCompress */ 40));
- /**
- * ! 运行日志提交工具
- */
- /**
- * 日志上报
- */
- function logReport(msg) {
- try {
- if (!msg) return false;
- var options = _devOptions.default.getOptions();
- if (!options.status) {
- console.error("日志上报失败!dev工具未启用 msg:" + msg);
- return;
- }
- if (!options.logs.status) {
- console.error("日志上报失败!dev logs未启用 msg:" + msg);
- return;
- }
- try {
- var pages = getCurrentPages();
- if (pages[pages.length - 1].route == options.devRoute) {
- // 不记录调试工具报出的日志
- return false;
- }
- } catch (error) {}
- if ((0, _typeof2.default)(msg) == "object") {
- try {
- msg = JSON.stringify(msg);
- } catch (error) {
- msg = "logReport:error";
- }
- }
- var log = {
- t: new Date().getTime(),
- m: ""
- };
- var logSize = _jsonCompress.default.calculateStringByteSize(log);
- msg = String(msg);
- msg = _jsonCompress.default.compressObject(msg, options.logs.cache.rowSize - logSize);
- log.m = msg;
- var logs = _devCache.default.get("logReport");
- if (!logs) logs = [];
- logs.unshift(log);
- logs = _jsonCompress.default.compressArray(logs, "end", options.logs.cache.size);
- _devCache.default.set("logReport", logs);
- } catch (error) {
- console.log("logReport error", error);
- }
- }
- var _default = logReport;
- exports.default = _default;
- /***/ }),
- /* 38 */
- /*!**********************************************************!*\
- !*** E:/git/2021项目/v3-H5/devTools/core/libs/devCache.js ***!
- \**********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(uni) {
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _devOptions = _interopRequireDefault(__webpack_require__(/*! ./devOptions */ 39));
- /**
- * dev工具缓存管理
- */
- var _default = {
- /**
- * 存储的键开始名称
- */
- cacheKey: "devTools_v3_",
- options: null,
- /**
- * 临时缓存对象
- */
- tempCache: {
- errorReport: [],
- logReport: [],
- console: [],
- request: [],
- uniBus: []
- },
- /**
- * 临时数据存放
- */
- tempData: {},
- /**
- * 向缓存内写入数据
- */
- set: function set(key, value) {
- try {
- if (['errorReport', 'logReport', 'console', 'request', 'uniBus'].indexOf(key) != -1) {
- var setting = this.getLongListSetting(key);
- if (!setting.status) return;
- if (!setting.cache.status) {
- // !不使用缓存
- this.tempCache[key] = value;
- return;
- }
- }
- key = "".concat(this.cacheKey).concat(key);
- this.tempData[key] = value;
- } catch (error) {
- console.log("devCache.set error", error);
- }
- },
- /**
- * 同步读取缓存数据
- */
- get: function get(key) {
- try {
- if (['errorReport', 'logReport', 'console', 'request', 'uniBus'].indexOf(key) != -1) {
- var setting = this.getLongListSetting(key);
- if (!setting.status) return [];
- if (!setting.cache.status) {
- // !不使用缓存
- return this.tempCache[key];
- }
- }
- key = "".concat(this.cacheKey).concat(key);
- if (this.tempData.hasOwnProperty(key)) {
- return this.tempData[key];
- } else {
- var value = uni.getStorageSync(key);
- this.tempData[key] = value;
- return value;
- }
- } catch (error) {
- console.log("devCache.get error", error);
- return "";
- }
- },
- getLongListSetting: function getLongListSetting(key) {
- var optionsKey = {
- errorReport: 'error',
- logReport: 'logs',
- console: 'console',
- request: 'network',
- uniBus: 'uniBus'
- };
- if (this.options) return this.options[optionsKey[key]];
- this.options = _devOptions.default.getOptions();
- return this.options[optionsKey[key]];
- },
- /**
- * 同步本地缓存
- */
- syncLocalCache: function syncLocalCache() {
- var that = this;
- setTimeout(function () {
- try {
- var waitSetKeys = Object.keys(that.tempData);
- var _loop = function _loop(i) {
- var key = waitSetKeys[i];
- uni.setStorage({
- key: key,
- data: that.tempData[key],
- success: function success() {
- // console.log("set " + key + " success,length=" + that.tempData[key].length);
- delete that.tempData[key];
- }
- });
- };
- for (var i = 0; i < waitSetKeys.length; i++) {
- _loop(i);
- }
- } catch (error) {
- console.log("devCache error: ", error);
- }
- setTimeout(function () {
- that.syncLocalCache();
- }, 500);
- }, Math.round(Math.random() * 3 * 1000) + 2000);
- }
- };
- exports.default = _default;
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
- /***/ }),
- /* 39 */
- /*!************************************************************!*\
- !*** E:/git/2021项目/v3-H5/devTools/core/libs/devOptions.js ***!
- \************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ 18));
- var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
- var _devCache = _interopRequireDefault(__webpack_require__(/*! ./devCache */ 38));
- /**
- * 设置各端大小 kb
- */
- var defSize = function defSize(h5, app, mp) {
- var r = 0;
- r = mp;
- return Math.ceil(r * 1024);
- };
- /**
- * 获取配置
- */
- var _default = {
- /**
- * 配置缓存key
- */
- cacheKey: "options_v8",
- /**
- * 默认配置项
- */
- defaultOptions: {
- version: 3.81,
- status: false,
- //调试工具总开关
- route: "/devTools/page/index",
- // 调试页面的路由,不建议更改
- bubble: {
- //调试弹窗气泡设置
- status: false,
- // 气泡标签是否显示,生产环境建议关闭
- text: "调试工具",
- // 气泡上展示的文字
- color: "#ffffff",
- // 气泡文字颜色
- bgColor: "rgba(250, 53, 52,0.7)" // 气泡背景颜色
- },
- console: {
- status: true,
- // 开关
- isOutput: true,
- //打印的日志是否对外输出到浏览器调试界面,建议在生产环境时开启
- cache: {
- status: true,
- //是否启用console缓存
- size: defSize(512, 1024 * 2, 512),
- rowSize: defSize(5.12, 20, 10)
- }
- },
- error: {
- status: true,
- cache: {
- status: true,
- size: defSize(512, 1024 * 2, 512),
- rowSize: defSize(5.12, 20, 10)
- }
- },
- network: {
- status: true,
- cache: {
- status: true,
- size: defSize(512, 1024 * 2, 512),
- rowSize: defSize(5.12, 20, 10)
- }
- },
- logs: {
- status: true,
- cache: {
- status: true,
- size: defSize(512, 1024 * 2, 512),
- rowSize: defSize(0.4, 0.4, 0.4)
- }
- },
- // 页面统计开关
- pageStatistics: {
- status: true,
- // 统计状态开关
- size: defSize(200, 1024 * 2, 512),
- dayOnlineRowMax: 60 // 日活跃时间的保存条数
- },
- // uni event bus 监听设置
- uniBus: {
- status: true,
- cache: {
- status: true,
- size: defSize(512, 1024 * 2, 512),
- rowSize: defSize(5.12, 20, 10),
- countMaxSize: defSize(512, 1024 * 2, 512) // bus统计上限 kb
- }
- }
- },
- /**
- * 获取配置信息
- */
- getOptions: function getOptions() {
- try {
- var options = _devCache.default.get(this.cacheKey);
- if (!options) {
- return {
- status: false //默认关闭调试工具
- };
- }
- var r = String(options.route);
- // ! 增加 devRoute 参数
- options.devRoute = r.substring(1, r.length);
- return options;
- } catch (error) {
- console.log("devOptions.getOptions error: ", error);
- return {
- status: false //默认关闭调试工具
- };
- }
- },
- /**
- * 保存配置项
- */
- setOptions: function setOptions(options) {
- try {
- if (!options) {
- options = this.defaultOptions;
- }
- if (options.status) {
- if (!options.route || typeof options.route != "string" || options.route.indexOf("/") != 0) {
- return this.outputError("devTools \u8C03\u8BD5\u5DE5\u5177\u914D\u7F6E\u51FA\u9519: [route] \u53C2\u6570\u914D\u7F6E\u9519\u8BEF\uFF01");
- }
- }
- var data = deepMerge(this.defaultOptions, options);
- _devCache.default.set(this.cacheKey, data);
- } catch (error) {
- console.log("devOptions.setOptions error: ", error);
- }
- },
- /**
- * 弹出错误信息
- */
- outputError: function outputError(msg) {
- console.log('%c' + msg, "\n padding: 4px;\n background-color: red;\n color: #fff;\n font-size: 15px;\n ");
- }
- };
- /**
- * 深度合并对象
- */
- exports.default = _default;
- function deepMerge(target) {
- try {
- for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- sources[_key - 1] = arguments[_key];
- }
- if (!sources.length) return target; // 如果没有源对象则直接返回目标对象
- var source = sources[0];
- for (var key in source) {
- if (source.hasOwnProperty(key)) {
- if ((0, _typeof2.default)(source[key]) === 'object' && (0, _typeof2.default)(target[key]) !== undefined) {
- target[key] = deepMerge({}, target[key], source[key]); // 若属性值为对象类型且目标对象已存在该属性,则递归调用deepMerge函数进行合并
- } else {
- target[key] = source[key]; // 否则将源对象的属性赋值到目标对象上
- }
- }
- }
- return deepMerge.apply(void 0, [target].concat((0, _toConsumableArray2.default)(sources.slice(1)))); // 处理完第一个源对象后再次调用deepMerge函数处理其他源对象
- } catch (error) {
- console.log("deepMerge error", error);
- return {};
- }
- }
- /***/ }),
- /* 40 */
- /*!**************************************************************!*\
- !*** E:/git/2021项目/v3-H5/devTools/core/libs/jsonCompress.js ***!
- \**************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 5));
- var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
- /**
- * json压缩工具
- */
- var _default = {
- /**
- * 压缩js对象成json字符串,并控制json字节大小,多余部分裁剪
- */
- compressObject: function compressObject() {
- var _this = this;
- var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- var maxSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1024 * 10.24;
- try {
- if (obj === undefined || obj === null) return obj;
- if (typeof obj == "string") {
- return this.truncateStrBySize(obj, maxSize);
- }
- if (typeof obj == "number") {
- return obj;
- }
- var t = new Date().getTime();
- var type = (0, _typeof2.default)(obj);
- if (type === 'symbol') {
- obj = "Symbol->" + obj.toString();
- } else if (type === 'bigint') {
- obj = "bigint->" + obj.toString();
- } else if (typeof Error != "undefined" && obj instanceof Error) {
- obj = "Error->".concat(obj.name, "\n").concat(obj.message, "\n").concat(obj.stack);
- } else if (typeof Date != "undefined" && obj instanceof Date) {
- obj = "Date->" + obj.toISOString();
- } else if (typeof obj == "function") {
- obj = "Function->" + obj.toString();
- } else if (typeof RegExp != "undefined" && obj instanceof RegExp) {
- obj = "RegExp->" + obj.toString();
- } else if (typeof Map != "undefined" && obj instanceof Map) {
- obj = "Map->(".concat(obj.size, ") { ").concat(Array.from(obj.entries()).map(function (_ref) {
- var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
- key = _ref2[0],
- value = _ref2[1];
- return "".concat(convertToString(key), " => ").concat(convertToString(value));
- }).join(', '), " }");
- } else if (typeof Set != "undefined" && obj instanceof Set) {
- obj = "Set->(".concat(obj.size, ") { ").concat(Array.from(obj.values()).map(function (value) {
- return convertToString(value);
- }).join(', '), " }");
- } else if (typeof Blob != "undefined" && obj instanceof Blob) {
- obj = "Blob->{ size: ".concat(obj.size, ", type: ").concat(obj.type, " }");
- } else if (typeof File != "undefined" && obj instanceof File) {
- obj = "File->{ name: \"".concat(obj.name, "\", size: ").concat(obj.size, ", type: ").concat(obj.type, ", lastModified: ").concat(new Date(obj.lastModified).toISOString(), " }");
- } else if (typeof URL != "undefined" && obj instanceof URL) {
- obj = "URL->{ href: \"".concat(obj.href, "\", protocol: \"").concat(obj.protocol, "\", host: \"").concat(obj.host, "\", pathname: \"").concat(obj.pathname, "\", search: \"").concat(obj.search, "\", hash: \"").concat(obj.hash, "\" }");
- } else if (typeof FormData != "undefined" && obj instanceof FormData) {
- var entries = [];
- obj.forEach(function (key, item) {
- entries.push(key);
- });
- obj = "FormData->{ ".concat(entries.join(', '), " }");
- } else if (typeof Location != "undefined" && obj instanceof Location) {
- obj = "Location->{ href: \"".concat(obj.href, "\", protocol: \"").concat(obj.protocol, "\", host: \"").concat(obj.host, "\", pathname: \"").concat(obj.pathname, "\", search: \"").concat(obj.search, "\", hash: \"").concat(obj.hash, "\" }");
- } else if (typeof Document != "undefined" && obj instanceof Document) {
- obj = "Document->{ title: \"".concat(obj.title, "\", URL: \"").concat(obj.URL, "\" }");
- } else if (typeof Window !== "undefined" && obj instanceof Window) {
- obj = "Window->{ location: ".concat(this.compressObject(obj.location), ", document: ").concat(this.compressObject(obj.document), " }");
- } else if (typeof Element != "undefined" && obj instanceof Element) {
- obj = "Element->{ tagName: \"".concat(obj.tagName, "\", id: \"").concat(obj.id, "\", class: \"").concat(obj.className, "\" }");
- } else if (typeof HTMLCanvasElement != "undefined" && obj instanceof HTMLCanvasElement) {
- obj = "Canvas->{ width: ".concat(obj.width, ", height: ").concat(obj.height, " }");
- } else if (typeof HTMLAudioElement != "undefined" && obj instanceof HTMLAudioElement) {
- obj = "Audio->{ src: \"".concat(obj.src, "\", duration: ").concat(obj.duration, " }");
- } else if (typeof HTMLVideoElement != "undefined" && obj instanceof HTMLVideoElement) {
- obj = "Video->{ src: \"".concat(obj.src, "\", width: ").concat(obj.videoWidth, ", height: ").concat(obj.videoHeight, ", duration: ").concat(obj.duration, " }");
- } else if (typeof Storage != "undefined" && obj instanceof Storage) {
- obj = "Storage->{ length: ".concat(obj.length, " }");
- } else if (typeof Worker != "undefined" && typeof ServiceWorker != "undefined" && typeof SharedWorker != "undefined" && (obj instanceof Worker || obj instanceof ServiceWorker || obj instanceof SharedWorker)) {
- obj = "Worker->".concat(obj.constructor.name, " { scriptURL: \"").concat(obj.scriptURL, "\" }");
- } else if (typeof WebSocket != "undefined" && obj instanceof WebSocket) {
- obj = "WebSocket->{ url: \"".concat(obj.url, "\", readyState: ").concat(obj.readyState, " }");
- } else if (typeof XMLHttpRequest != "undefined" && obj instanceof XMLHttpRequest) {
- obj = "XMLHttpRequest->{ readyState: ".concat(obj.readyState, ", status: ").concat(obj.status, " }");
- } else if (typeof EventSource != "undefined" && obj instanceof EventSource) {
- obj = "EventSource->{ url: \"".concat(obj.url, "\", readyState: ").concat(obj.readyState, " }");
- } else if (typeof MediaStream != "undefined" && obj instanceof MediaStream) {
- obj = "MediaStream->{ id: \"".concat(obj.id, "\", active: ").concat(obj.active, " }");
- } else if (typeof RTCPeerConnection != "undefined" && obj instanceof RTCPeerConnection) {
- obj = "RTCPeerConnection->{ connectionState: \"".concat(obj.connectionState, "\" }");
- } else if (typeof AudioContext != "undefined" && obj instanceof AudioContext) {
- obj = "AudioContext->{ state: \"".concat(obj.state, "\" }");
- } else if (typeof Element != "undefined" && obj instanceof Element) {
- obj = "Element->{ tagName: \"".concat(obj.tagName, "\", id: \"").concat(obj.id, "\", class: \"").concat(obj.className, "\" }");
- } else if (typeof HTMLCanvasElement != "undefined" && obj instanceof HTMLCanvasElement) {
- obj = "Canvas->{ width: ".concat(obj.width, ", height: ").concat(obj.height, " }");
- } else if (typeof HTMLAudioElement != "undefined" && obj instanceof HTMLAudioElement) {
- obj = "Audio->{ src: \"".concat(obj.src, "\", duration: ").concat(obj.duration, " }");
- } else if (typeof HTMLVideoElement != "undefined" && obj instanceof HTMLVideoElement) {
- obj = "Video->{ src: \"".concat(obj.src, "\", width: ").concat(obj.videoWidth, ", height: ").concat(obj.videoHeight, ", duration: ").concat(obj.duration, " }");
- } else if (typeof Geolocation != "undefined" && obj instanceof Geolocation) {
- obj = "Geolocation->{ }";
- } else if (typeof Performance != "undefined" && obj instanceof Performance) {
- obj = "Performance->{ now: ".concat(obj.now(), " }");
- } else if (typeof Event != "undefined" && obj instanceof Event) {
- obj = "Event->{ type: \"".concat(obj.type, "\", target: \"").concat(obj.target, "\" }");
- }
- if (typeof obj == "string") {
- return this.truncateStrBySize(obj, maxSize);
- }
- if ((0, _typeof2.default)(obj) != "object") {
- return obj;
- }
- if (maxSize < 2) return {};
- var addEndOut = false;
- if (maxSize > 50) {
- var objSize = this.calculateStringByteSize(obj);
- if (objSize > maxSize) {
- maxSize = maxSize - 50;
- addEndOut = true;
- }
- }
- var sizeCount = 2;
- var str = this.safeJsonStringify(obj, function (key, value) {
- var keySize = _this.calculateStringByteSize(key);
- if ((0, _typeof2.default)(value) == "object") {
- if (sizeCount + keySize + 6 > maxSize) {
- return;
- }
- sizeCount = sizeCount + keySize + 6;
- return value;
- }
- var valueSize = _this.calculateStringByteSize(value);
- var rowSize = keySize + valueSize + 6;
- if (rowSize + sizeCount > maxSize) return;
- sizeCount = sizeCount + rowSize;
- return value;
- });
- var outPut = JSON.parse(str);
- if (addEndOut) {
- if (Array.isArray(outPut)) {
- outPut.push('(已截断其余部分)');
- } else if ((0, _typeof2.default)(outPut) == "object") {
- outPut["*注意"] = "(已截断其余部分)";
- }
- }
- // console.log("compressObject use time: " + (new Date().getTime() - t));
- return outPut;
- } catch (error) {
- console.log("compressObject error", error);
- return "";
- }
- },
- /**
- * 压缩数组不超过特定大小
- * @param {any[]} [arr=[]] 需要处理的数组
- * @param {string} [delType='start'] 数组超出后删除的开始位置
- * @param {number} [maxSize=1024 * 972] 数组最大字节数
- */
- compressArray: function compressArray() {
- var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
- var delType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "start";
- var maxSize = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1024 * 972;
- var t = new Date().getTime();
- try {
- if (!arr || arr.length == 0 || !arr[0]) return [];
- var i = 0;
- while (true) {
- i = i + 1;
- if (i > 999999) return arr;
- if (!arr || arr.length == 0) {
- return [];
- }
- if (this.calculateStringByteSize(arr) <= maxSize) {
- // consoleLog("compressArray t=>" + (new Date().getTime() - t) + " i=>" + i)
- return arr;
- }
- if (delType == "start") {
- arr.splice(0, 1);
- } else {
- arr.splice(arr.length - 1, 1);
- }
- }
- } catch (error) {
- console.log("compressArray error", error);
- return [];
- }
- },
- /**
- * 计算对象或字符串占用的字节大小,传入对象将自动转json
- */
- calculateStringByteSize: function calculateStringByteSize(str) {
- try {
- var type = (0, _typeof2.default)(str);
- if (type == "bigint" || type == "number" || type == "boolean") {
- return str.toString().length;
- } else if (type == "function") {
- str = str.toString().length;
- } else if (str === null || str === undefined) {
- return 0;
- } else {
- try {
- str = this.safeJsonStringify(str);
- if (str && str.hasOwnProperty) {
- return str.length;
- } else {
- return 1024 * 20;
- }
- } catch (error) {
- console.log("calculateStringByteSize error", error);
- return 1024 * 20;
- }
- }
- var size = 0;
- for (var i = 0; i < str.length; i++) {
- var charCode = str.charCodeAt(i);
- if (charCode < 0x0080) {
- size += 1;
- } else if (charCode < 0x0800) {
- size += 2;
- } else if (charCode >= 0xD800 && charCode <= 0xDFFF) {
- size += 4;
- i++;
- } else {
- size += 3;
- }
- }
- return size;
- } catch (error) {
- console.log("calculateStringByteSize error", error);
- return 1024 * 1024;
- }
- },
- /**
- * 安全的js对象转字符串
- */
- safeJsonStringify: function safeJsonStringify(obj, handleValue) {
- if (!obj) return "{}";
- try {
- if (handleValue) {
- return JSON.stringify(obj, function (key, value) {
- return handleValue(key, value);
- });
- } else {
- return JSON.stringify(obj, function (key, value) {
- return value;
- });
- }
- } catch (error) {
- // 尝试解析json失败,可能是变量循环引用的问题,继续尝试增加WeakSet解析
- }
- try {
- var seen = new WeakSet();
- var jsonStr = JSON.stringify(obj, function (key, value) {
- if ((0, _typeof2.default)(value) == "object") {
- try {
- if (value instanceof File) {
- value = "js:File";
- }
- if (value && value.constructor && value.constructor.name && typeof value.constructor.name == "string") {
- var className = value.constructor.name;
- if (className == "VueComponent") {
- return "js:Object:VueComponent";
- }
- }
- } catch (error) {}
- }
- if (typeof value == "function") {
- try {
- value = value.toString();
- } catch (error) {
- value = "js:function";
- }
- }
- if ((0, _typeof2.default)(value) === "object" && value !== null) {
- // 处理循环引用问题
- if (seen.has(value)) {
- return;
- }
- seen.add(value);
- }
- if (handleValue && typeof handleValue == "function") {
- try {
- return handleValue(key, value);
- } catch (error) {
- console.log("handleValue error", error);
- }
- return;
- }
- return value;
- });
- seen = null;
- return jsonStr;
- } catch (error) {
- return "{}";
- }
- },
- /**
- * 根据限制的字节大小截取字符串
- */
- truncateStrBySize: function truncateStrBySize() {
- var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
- var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 20 * 1024;
- try {
- if (size < 1) return "";
- if (this.calculateStringByteSize(str) <= size) return str;
- var endStr = "";
- if (size > 30) {
- endStr = "(已截断多余部分)";
- size = size - 30;
- }
- var low = 0,
- high = str.length,
- mid;
- while (low < high) {
- mid = Math.floor((low + high) / 2);
- var currentSize = this.calculateStringByteSize(str.substring(0, mid));
- if (currentSize > size) {
- // 如果大于限制值,减小高边界
- high = mid;
- } else {
- // 如果小于或等于限制值,增加低边界
- low = mid + 1;
- }
- }
- // 返回截断的字符串,注意low-1是因为low是最后一次检查超出大小时的位置
- return str.substring(0, low - 1) + endStr;
- } catch (error) {
- console.log("truncateStrBySize error", error);
- return "";
- }
- }
- };
- exports.default = _default;
- /***/ }),
- /* 41 */
- /*!*************************************************************!*\
- !*** E:/git/2021项目/v3-H5/devTools/core/libs/errorReport.js ***!
- \*************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _devCache = _interopRequireDefault(__webpack_require__(/*! ./devCache */ 38));
- var _devOptions = _interopRequireDefault(__webpack_require__(/*! ./devOptions */ 39));
- var _jsonCompress = _interopRequireDefault(__webpack_require__(/*! ./jsonCompress */ 40));
- /**
- * ! vue报错捕获
- */
- /**
- * * vue错误日志上报
- * @param {'ve'|'vw'|'oe'|'n'} type 错误类型
- */
- function errorReport(msg, trace) {
- var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "n";
- try {
- if (!msg) return false;
- if (msg instanceof Error) {
- msg = msg.message;
- }
- var options = _devOptions.default.getOptions();
- if (!options.error.status) return;
- var page = "未知";
- try {
- var pages = getCurrentPages();
- var item = pages[pages.length - 1];
- if (item && item.route) {
- page = item.route;
- }
- } catch (error) {}
- var logs = _devCache.default.get("errorReport");
- if (!logs) logs = [];
- if (logs.length >= options.error.cache.rowMax) {
- logs = logs.splice(0, options.error.cache.rowMax);
- }
- msg = String(msg);
- msg = _jsonCompress.default.compressObject(msg, options.error.cache.rowSize / 2);
- trace = String(trace);
- trace = _jsonCompress.default.compressObject(trace, options.error.cache.rowSize / 2);
- logs.unshift({
- t: new Date().getTime(),
- m: msg,
- tr: trace,
- p: page,
- type: type
- });
- console.error("__ignoreReport__", msg, trace);
- logs = _jsonCompress.default.compressArray(logs, "end", options.error.cache.size);
- _devCache.default.set("errorReport", logs);
- } catch (error) {
- console.log("errorReport error: ", error);
- }
- }
- var _default = errorReport;
- exports.default = _default;
- /***/ }),
- /* 42 */
- /*!****************************************************************!*\
- !*** E:/git/2021项目/v3-H5/devTools/core/libs/createH5Bubble.js ***!
- \****************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- /**
- *! 创建h5页面上拖动的气泡标签
- */
- function createH5Bubble(options, devTools) {
- var tagConfig = localStorage.getItem("devTools_tagConfig");
- if (!tagConfig) {
- tagConfig = {};
- } else {
- tagConfig = JSON.parse(tagConfig);
- }
- tagConfig = Object.assign({
- show: options.bubble.status,
- x: window.innerWidth - 90,
- y: window.innerHeight - 90
- }, tagConfig);
- tagConfig.show = options.bubble.status;
- // 拖动范围限制
- var dragLimit = {
- min: {
- x: 0,
- y: 0
- },
- max: {
- x: window.innerWidth - 70,
- y: window.innerHeight - 24
- }
- };
- tagConfig.x = Math.min(Math.max(tagConfig.x, dragLimit.min.x), dragLimit.max.x);
- tagConfig.y = Math.min(Math.max(tagConfig.y, dragLimit.min.y), dragLimit.max.y);
- var tag = document.createElement("div");
- tag.style = "\n box-sizing: border-box;\n position: fixed;\n z-index: 9999999;\n left: ".concat(tagConfig.x, "px;\n top: ").concat(tagConfig.y, "px;\n width: 70px;\n height: 24px;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 4px;\n border-radius: 6px;\n background-color: ").concat(options.bubble.bgColor, ";\n color: ").concat(options.bubble.color, ";\n font-size: 10px;\n cursor: grab;\n box-shadow: 0px 0px 6px ").concat(options.bubble.bgColor, ";\n backdrop-filter: blur(1px);\n ");
- tag.innerHTML = options.bubble.text;
- tag.setAttribute("id", "debugTag");
- if (tagConfig.show) {
- document.body.appendChild(tag);
- }
- /**
- * 标签单击事件
- */
- function tagClick() {
- var pages = getCurrentPages();
- var route = options.route.substring(1, options.route.length - 2);
- if (pages[pages.length - 1].route == route) {
- // 已经处于debug页面,不响应点击事件
- return;
- }
- devTools.show();
- }
- var isTouch = false;
- var touchStartPoint = {
- clientX: 0,
- clientY: 0,
- tagX: tagConfig.x,
- tagY: tagConfig.y,
- hasMove: false
- };
- function touchStart(e) {
- if (isTouch) return;
- if (e.preventDefault) {
- e.preventDefault();
- }
- var clientX = e.clientX ? e.clientX : e.targetTouches[0].clientX;
- var clientY = e.clientX ? e.clientY : e.targetTouches[0].clientY;
- touchStartPoint.clientX = clientX;
- touchStartPoint.clientY = clientY;
- touchStartPoint.tagX = tagConfig.x;
- touchStartPoint.tagY = tagConfig.y;
- touchStartPoint.hasMove = false;
- isTouch = true;
- }
- function touchMove(e) {
- if (!isTouch) return;
- if (e.preventDefault) {
- e.preventDefault();
- }
- var clientX = e.clientX ? e.clientX : e.targetTouches[0].clientX;
- var clientY = e.clientX ? e.clientY : e.targetTouches[0].clientY;
- touchStartPoint.hasMove = true;
- var offsetX = touchStartPoint.clientX - clientX;
- var offsetY = touchStartPoint.clientY - clientY;
- var tx = touchStartPoint.tagX - offsetX;
- var ty = touchStartPoint.tagY - offsetY;
- tx = Math.min(Math.max(tx, dragLimit.min.x), dragLimit.max.x);
- ty = Math.min(Math.max(ty, dragLimit.min.y), dragLimit.max.y);
- tag.style.left = "".concat(tx, "px");
- tag.style.top = "".concat(ty, "px");
- tagConfig.x = tx;
- tagConfig.y = ty;
- }
- function touchEnd(e) {
- if (!isTouch) return;
- if (e.preventDefault) {
- e.preventDefault();
- }
- isTouch = false;
- localStorage.setItem("devTools_tagConfig", JSON.stringify(tagConfig));
- if (!touchStartPoint.hasMove) {
- tagClick();
- }
- }
- tag.addEventListener("touchstart", touchStart);
- tag.addEventListener("touchmove", touchMove);
- tag.addEventListener("touchend", touchEnd);
- tag.addEventListener("mousedown", touchStart);
- document.addEventListener("mousemove", touchMove);
- document.addEventListener("mouseup", touchEnd);
- localStorage.setItem("devTools_tagConfig", JSON.stringify(tagConfig));
- }
- var _default = createH5Bubble;
- exports.default = _default;
- /***/ }),
- /* 43 */
- /*!***********************************************************!*\
- !*** E:/git/2021项目/v3-H5/devTools/core/proxy/vueMixin.js ***!
- \***********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(uni) {
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _devOptions = _interopRequireDefault(__webpack_require__(/*! ../libs/devOptions */ 39));
- var _logReport = _interopRequireDefault(__webpack_require__(/*! ../libs/logReport */ 37));
- var _pageLinkList = _interopRequireDefault(__webpack_require__(/*! ../libs/pageLinkList */ 44));
- var _pageStatistics = _interopRequireDefault(__webpack_require__(/*! ../libs/pageStatistics */ 45));
- /**
- * ! Vue页面混入,监听生命周期
- */
- var _default = {
- data: function data() {
- return {
- /**
- * 挂载dev页面对象
- */
- devTools_pageData: {
- route: '',
- // 页面路径
- isOnShow: false,
- // 是否处于展示状态
- activeTime: 0 //活跃时间
- }
- };
- },
- /**
- * *页面载入事件
- */
- onLoad: function onLoad(pageInitParams) {
- var that = this;
- // ! 注入 Eruda
- var isInjectEruda = uni.getStorageSync("devTools_isInjectEruda") == "yes";
- if (isInjectEruda) {
- var ErudaCode = "\n if(!window.isInjectEruda){\n window.isInjectEruda = true;\n var script = document.createElement('script');\n script.src=\"https://cdn.jsdelivr.net/npm/eruda\";\n document.body.append(script);\n script.onload = function () {\n eruda.init();\n }\n }\n ";
- var fun = 'e' + ['v'][0] + 'a' + ['l'][0];
- try {} catch (error) {
- console.log("devTools mixin onLoad injectEruda error ", error);
- }
- }
- // ! 注入 vConsole
- var isInjectVConsole = uni.getStorageSync("devTools_isInjectVConsole") == "yes";
- if (isInjectVConsole) {
- var vConsoleCode = "\n if(!window.isInjectVConsole){\n window.isInjectVConsole = true;\n var script = document.createElement('script');\n script.src=\"https://cdn.jsdelivr.net/npm/vconsole@latest/dist/vconsole.min.js\";\n document.body.append(script);\n script.onload = function () {\n let vConsoleObj = new window.VConsole();\n }\n }\n ";
- var _fun = 'e' + ['v'][0] + 'a' + ['l'][0];
- try {} catch (error) {
- console.log("devTools mixin onLoad injectVConsole error ", error);
- }
- }
- try {
- var pages = getCurrentPages();
- var pageItem = pages && pages.length > 0 ? pages[pages.length - 1] : null;
- if (pageItem) {
- var devSetting = _devOptions.default.getOptions();
- if (pageItem.route == devSetting.devRoute) {
- that.devTools_pageData = false;
- } else {
- that.devTools_pageData.route = pageItem.route;
- (0, _logReport.default)("onLoad>".concat(pageItem.route, ">") + (pageInitParams ? JSON.stringify(pageInitParams) : ''));
- setInterval(function () {
- if (that.devTools_pageData && that.devTools_pageData.isOnShow) {
- that.devTools_pageData.activeTime = that.devTools_pageData.activeTime + 1;
- }
- }, 1000);
- }
- }
- _pageLinkList.default.pushPageRouteMap(pages);
- } catch (error) {
- console.log("devTools mixin onLoad error ", error);
- }
- },
- /**
- * *页面展示事件
- */
- onShow: function onShow() {
- try {
- var that = this;
- if (that.devTools_pageData) {
- that.devTools_pageData.isOnShow = true;
- that.devTools_pageData.activeTime = 0;
- }
- } catch (error) {
- console.log("devTools mixin onShow error ", error);
- }
- },
- /**
- * *页面隐藏事件
- */
- onHide: function onHide() {
- try {
- var that = this;
- if (that.devTools_pageData) {
- that.devTools_pageData.isOnShow = false;
- (0, _pageStatistics.default)(that.devTools_pageData.route, that.devTools_pageData.activeTime);
- that.devTools_pageData.activeTime = 0;
- }
- } catch (error) {
- console.log("devTools mixin onHide error ", error);
- }
- },
- /**
- * * 页面卸载事件
- */
- onUnload: function onUnload() {
- try {
- var that = this;
- (0, _logReport.default)("onUnload>".concat(that.devTools_pageData.route));
- that.devTools_pageData = null;
- } catch (error) {
- console.log("devTools mixin onUnload error ", error);
- }
- }
- };
- exports.default = _default;
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
- /***/ }),
- /* 44 */
- /*!**************************************************************!*\
- !*** E:/git/2021项目/v3-H5/devTools/core/libs/pageLinkList.js ***!
- \**************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
- var _devCache = _interopRequireDefault(__webpack_require__(/*! ./devCache */ 38));
- var _default = {
- pageRouteMap: [],
- pageRouteKeyMap: {},
- /**
- * 安装路径分析插件
- */
- install: function install() {
- var allRoutes = this.getAllRoutes();
- var pageRouteKeyMap = _devCache.default.get("pageRouteKeyMap");
- if (!pageRouteKeyMap || (0, _typeof2.default)(pageRouteKeyMap) != "object") {
- pageRouteKeyMap = {};
- }
- var lastNo = 0;
- Object.keys(pageRouteKeyMap).forEach(function (key) {
- var item = Number(pageRouteKeyMap[key]);
- if (item > lastNo) {
- lastNo = item;
- }
- });
- allRoutes.forEach(function (item) {
- if (!pageRouteKeyMap[item.path]) {
- pageRouteKeyMap[item.path] = lastNo + 1;
- lastNo = lastNo + 1;
- }
- });
- _devCache.default.set("pageRouteKeyMap", pageRouteKeyMap);
- this.pageRouteKeyMap = pageRouteKeyMap;
- var pageRouteMap = _devCache.default.get("pageRouteMap");
- if (!pageRouteMap || (0, _typeof2.default)(pageRouteMap) != "object") {
- pageRouteMap = {};
- }
- Object.keys(pageRouteMap).forEach(function (key) {
- try {
- var n = Number(pageRouteMap[key]);
- if (!Number.isInteger(n) || n < 0) {
- pageRouteMap[key] = 1;
- }
- } catch (error) {}
- });
- this.pageRouteMap = pageRouteMap;
- this.saveData();
- },
- /**
- * 获取APP注册的所有路由
- * @returns {{path: string}[]} 返回路由列表
- */
- getAllRoutes: function getAllRoutes() {
- var pages = [];
- try {
- var wxPages = __wxConfig.pages;
- wxPages.map(function (item) {
- pages.push({
- path: "/" + item
- });
- });
- } catch (error) {
- pages = [];
- }
- return pages;
- },
- /**
- * 写入路由列表
- */
- pushPageRouteMap: function pushPageRouteMap() {
- var _this = this;
- var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
- if (!list || list.length == 0) {
- list = getCurrentPages();
- }
- var key = "";
- list.forEach(function (item) {
- var path = item.route.indexOf("/") == 0 ? item.route : "/" + item.route;
- var keyItem = _this.pageRouteKeyMap[path];
- if (!keyItem) {
- keyItem = path;
- }
- if (key == "") {
- key = keyItem + "";
- } else {
- key = key + "," + keyItem;
- }
- });
- if (this.pageRouteMap[key]) {
- this.pageRouteMap[key] = this.pageRouteMap[key] + 1;
- } else {
- this.pageRouteMap[key] = 1;
- }
- },
- /**
- * 保存路由缓存
- */
- saveData: function saveData() {
- var that = this;
- setTimeout(function () {
- _devCache.default.set("pageRouteMap", that.pageRouteMap);
- setTimeout(function () {
- that.saveData();
- }, 500);
- }, Math.round(Math.random() * 3 * 1000) + 2000);
- }
- };
- exports.default = _default;
- /***/ }),
- /* 45 */
- /*!****************************************************************!*\
- !*** E:/git/2021项目/v3-H5/devTools/core/libs/pageStatistics.js ***!
- \****************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _devCache = _interopRequireDefault(__webpack_require__(/*! ./devCache */ 38));
- var _devOptions = _interopRequireDefault(__webpack_require__(/*! ./devOptions */ 39));
- var _jsonCompress = _interopRequireDefault(__webpack_require__(/*! ./jsonCompress */ 40));
- var _timeFormat = __webpack_require__(/*! ./timeFormat */ 46);
- /**
- * !页面统计:访问次数、停留时长
- */
- /**
- * 页面注销时提交
- */
- function pageStatisticsReport(route, activeTime) {
- try {
- if (!route) return false;
- var options = _devOptions.default.getOptions();
- if (!options.pageStatistics.status) return; //! 配置文件关闭页面统计
- var logs = _devCache.default.get("pageCount");
- if (!logs) logs = [];
- var pageIndex = logs.findIndex(function (x) {
- return x.route == route;
- });
- if (pageIndex == -1) {
- logs.push({
- route: route,
- activeTimeCount: activeTime
- });
- } else {
- logs[pageIndex].activeTimeCount = activeTime + logs[pageIndex].activeTimeCount;
- }
- logs = _jsonCompress.default.compressArray(logs, "end", options.pageStatistics.size);
- _devCache.default.set("pageCount", logs);
- var now = new Date().getTime();
- var date = (0, _timeFormat.timeFormat)(now, "yyyy-mm-dd");
- var dayOnline = _devCache.default.get("dayOnline");
- if (!dayOnline) dayOnline = [];
- var i = dayOnline.findIndex(function (x) {
- return x.date == date;
- });
- if (i == -1) {
- dayOnline.unshift({
- date: date,
- activeTimeCount: activeTime,
- page: [{
- r: route,
- t: activeTime
- }]
- });
- } else {
- dayOnline[i].activeTimeCount = dayOnline[i].activeTimeCount + activeTime;
- var pi = dayOnline[i].page.findIndex(function (x) {
- return x.r == route;
- });
- if (pi == -1) {
- dayOnline[i].page.push({
- r: route,
- t: activeTime
- });
- } else {
- dayOnline[i].page[pi].t = dayOnline[i].page[pi].t + activeTime;
- }
- }
- if (dayOnline.length > options.pageStatistics.dayOnlineRowMax) {
- dayOnline = dayOnline.splice(0, options.pageStatistics.dayOnlineRowMax);
- }
- dayOnline = _jsonCompress.default.compressArray(dayOnline, "end", options.pageStatistics.size);
- _devCache.default.set("dayOnline", dayOnline);
- } catch (error) {
- console.log("pageStatistics error", error);
- }
- }
- var _default = pageStatisticsReport;
- exports.default = _default;
- /***/ }),
- /* 46 */
- /*!************************************************************!*\
- !*** E:/git/2021项目/v3-H5/devTools/core/libs/timeFormat.js ***!
- \************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.timeFormat = timeFormat;
- exports.timeFromNow = timeFromNow;
- // padStart 的 polyfill,因为某些机型或情况,还无法支持es7的padStart,比如电脑版的微信小程序
- // 所以这里做一个兼容polyfill的兼容处理
- try {
- if (!String.prototype.padStart) {
- // 为了方便表示这里 fillString 用了ES6 的默认参数,不影响理解
- String.prototype.padStart = function (maxLength) {
- var fillString = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ' ';
- if (Object.prototype.toString.call(fillString) !== "[object String]") throw new TypeError('fillString must be String');
- var str = this;
- // 返回 String(str) 这里是为了使返回的值是字符串字面量,在控制台中更符合直觉
- if (str.length >= maxLength) return String(str);
- var fillLength = maxLength - str.length,
- times = Math.ceil(fillLength / fillString.length);
- while (times >>= 1) {
- fillString += fillString;
- if (times === 1) {
- fillString += fillString;
- }
- }
- return fillString.slice(0, fillLength) + str;
- };
- }
- } catch (error) {
- console.log("timeFormat fillString error", error);
- }
- // 其他更多是格式化有如下:
- // yyyy:mm:dd|yyyy:mm|yyyy年mm月dd日|yyyy年mm月dd日 hh时MM分等,可自定义组合
- function timeFormat() {
- var dateTime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
- var fmt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'yyyy-mm-dd hh:MM:ss';
- try {
- // 如果为null,则格式化当前时间
- if (!dateTime) dateTime = Number(new Date());
- // 如果dateTime长度为10或者13,则为秒和毫秒的时间戳,如果超过13位,则为其他的时间格式
- if (dateTime.toString().length == 10) dateTime *= 1000;
- var date = new Date(dateTime);
- var ret;
- var opt = {
- "y+": date.getFullYear().toString(),
- // 年
- "m+": (date.getMonth() + 1).toString(),
- // 月
- "d+": date.getDate().toString(),
- // 日
- "h+": date.getHours().toString(),
- // 时
- "M+": date.getMinutes().toString(),
- // 分
- "s+": date.getSeconds().toString() // 秒
- // 有其他格式化字符需求可以继续添加,必须转化成字符串
- };
- for (var k in opt) {
- ret = new RegExp("(" + k + ")").exec(fmt);
- if (ret) {
- fmt = fmt.replace(ret[1], ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, "0"));
- }
- ;
- }
- ;
- return fmt;
- } catch (error) {
- console.log("timeFormat error", error);
- return "unknown error";
- }
- }
- function timeFromNow(timestamp) {
- try {
- var now = new Date().getTime();
- var diff = timestamp - now;
- // 确定是过去还是未来
- var suffix = diff > 0 ? "后" : "前";
- diff = Math.abs(diff);
- // 计算时间差异
- var seconds = Math.floor(diff / 1000);
- var minutes = Math.floor(seconds / 60);
- var hours = Math.floor(minutes / 60);
- var days = Math.floor(hours / 24);
- var months = Math.floor(days / 30);
- var years = Math.floor(days / 365);
- // 根据时间差异返回相应的字符串
- if (seconds < 60) {
- return "".concat(seconds, "\u79D2").concat(suffix);
- } else if (minutes < 60) {
- return "".concat(minutes, "\u5206\u949F").concat(suffix);
- } else if (hours < 24) {
- return "".concat(hours, "\u5C0F\u65F6").concat(suffix);
- } else if (days < 30) {
- return "".concat(days, "\u5929").concat(suffix);
- } else if (months < 12) {
- return "".concat(months, "\u4E2A\u6708").concat(suffix);
- } else {
- return "".concat(years, "\u5E74").concat(suffix);
- }
- } catch (error) {
- console.log("timeFromNow error", error);
- }
- }
- /***/ }),
- /* 47 */
- /*!********************************************************!*\
- !*** E:/git/2021项目/v3-H5/devTools/core/proxy/index.js ***!
- \********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = devToolsProxyInstall;
- var _devCache = _interopRequireDefault(__webpack_require__(/*! ../libs/devCache */ 38));
- var _console = _interopRequireDefault(__webpack_require__(/*! ./console */ 48));
- var _request = _interopRequireDefault(__webpack_require__(/*! ./request */ 49));
- var _storage = _interopRequireDefault(__webpack_require__(/*! ./storage */ 53));
- var _uniBus = _interopRequireDefault(__webpack_require__(/*! ./uniBus */ 54));
- var _uniListen = _interopRequireDefault(__webpack_require__(/*! ./uniListen */ 55));
- /**
- * dev调试工具初始化
- */
- function devToolsProxyInstall(options) {
- try {
- if (options.network && options.network.status) {
- _request.default.install();
- }
- if (options.console && options.console.status) {
- _console.default.install();
- }
- if (options.logs && options.logs.status) {
- _uniListen.default.install();
- }
- _storage.default.install();
- if (options.uniBus && options.uniBus.status) {
- _uniBus.default.install();
- }
- _devCache.default.syncLocalCache();
- } catch (error) {
- _console.default.log("devToolsProxyInstall error", error);
- }
- }
- /***/ }),
- /* 48 */
- /*!**********************************************************!*\
- !*** E:/git/2021项目/v3-H5/devTools/core/proxy/console.js ***!
- \**********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(uni) {
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ 18));
- var _devCache = _interopRequireDefault(__webpack_require__(/*! ../libs/devCache */ 38));
- var _devOptions = _interopRequireDefault(__webpack_require__(/*! ../libs/devOptions */ 39));
- var _jsonCompress = _interopRequireDefault(__webpack_require__(/*! ../libs/jsonCompress */ 40));
- var _default = {
- logList: [],
- options: null,
- /**
- * 挂载打印拦截器
- */
- install: function install() {
- var that = this;
- this.options = _devOptions.default.getOptions();
- if (!this.options.console.status) return;
- this.logList = _devCache.default.get("console");
- if (!this.logList) this.logList = [];
- this.syncReqData(); //同步缓存
- if (uni.__log__) {
- // ! VUE3在app端时有这个特殊的方法
- that.mountUniConsole();
- } else {
- that.mountJsConsole();
- }
- //! 删除指定记录
- uni.$on("devTools_delConsoleItem", function (item) {
- var i = that.logList.findIndex(function (x) {
- var t = JSON.stringify(x.list);
- return t == JSON.stringify(item.list) && x.time == item.time && x.page == item.page && x.type == item.type;
- });
- if (i != -1) {
- that.logList.splice(i, 1);
- }
- that.saveData();
- });
- //! 清空console日志
- uni.$on("devTools_delConsoleAll", function () {
- that.logList = [];
- that.saveData();
- });
- },
- /**
- * 同步请求信息到缓存数据中
- */
- syncReqData: function syncReqData() {
- var that = this;
- setTimeout(function () {
- try {
- that.saveData();
- } catch (error) {
- console.log("console.syncReqData error", error);
- }
- that.syncReqData();
- }, 3000);
- },
- /**
- * 同步数据到缓存
- */
- saveData: function saveData() {
- var that = this;
- that.logList = _jsonCompress.default.compressArray(that.logList, 'end', that.options.console.cache.size);
- _devCache.default.set("console", that.logList);
- },
- /**
- * 挂载监听js自带的console函数
- */
- mountJsConsole: function mountJsConsole() {
- var that = this;
- try {
- var _error = function _error() {
- try {
- var args = Array.prototype.slice.call(arguments);
- if (args[0] && typeof args[0] == "string" && (args[0] == "__ignoreReport__" //! 忽略错误日志上报
- || args[0].indexOf("__ignoreReport__") == 0)) {
- var _args = [];
- if (args.length > 1) {
- for (var _i2 = 0; _i2 < args.length; _i2++) {
- if (_i2 != 0) {
- _args.push(args[_i2]);
- }
- }
- } else {
- _args[0] = args[0];
- _args[0] = _args[0].replace("__ignoreReport__", "");
- }
- if (that.options.console.isOutput) {
- _e.apply(void 0, _args);
- }
- return;
- }
- replaceConsole("error", args);
- } catch (error) {
- _e("监听console.error出错", error);
- }
- };
- /**
- * 替换系统打印函数
- */
- var replaceConsole = function replaceConsole(type, args) {
- try {
- var data = [];
- if (args && args.length > 0) {
- var argList = args;
- var oneSize = that.options.console.cache.rowSize / argList.length;
- for (var _i3 = 0; _i3 < argList.length; _i3++) {
- var row = _jsonCompress.default.compressObject(argList[_i3], oneSize);
- data.push(row);
- }
- } else {
- data = [];
- }
- var page = "未知";
- try {
- var pages = getCurrentPages();
- var item = pages[pages.length - 1];
- if (item && item.route) {
- page = item.route;
- }
- } catch (error) {}
- that.logList.unshift({
- list: data,
- time: new Date().getTime(),
- page: page,
- type: type
- });
- if (that.options.console.isOutput) {
- if (type == "error") {
- _e.apply(void 0, (0, _toConsumableArray2.default)(args));
- } else if (type == "warn") {
- _w.apply(void 0, (0, _toConsumableArray2.default)(args));
- } else if (type == "info") {
- _i.apply(void 0, (0, _toConsumableArray2.default)(args));
- } else {
- _l.apply(void 0, (0, _toConsumableArray2.default)(args));
- }
- }
- } catch (error) {
- if (that.options.console.isOutput) {
- _e("监听console出错", error);
- }
- }
- };
- var _l = console.log;
- try {
- globalThis.consoleLog = function () {
- var _console;
- (_console = console).log.apply(_console, arguments);
- };
- } catch (error) {}
- try {
- window.consoleLog = function () {
- var _console2;
- (_console2 = console).log.apply(_console2, arguments);
- };
- } catch (error) {}
- console.log = function () {
- replaceConsole("log", arguments);
- };
- var _e = console.error;
- console.error = _error;
- var _w = console.warn;
- console.warn = function () {
- replaceConsole("warn", arguments);
- };
- var _i = console.info;
- console.info = function () {
- replaceConsole("info", arguments);
- };
- } catch (error) {
- console.log("console.install error", error);
- }
- },
- /**
- * 挂载监听uni自带的打印函数
- */
- mountUniConsole: function mountUniConsole() {
- var that = this;
- try {
- /**
- * 替换系统打印函数
- */
- var replaceConsole = function replaceConsole(type, args) {
- try {
- var data = [];
- if (args && args.length > 0) {
- var argList = args;
- var oneSize = that.options.console.cache.rowSize / argList.length;
- for (var _i6 = 0; _i6 < argList.length; _i6++) {
- var row = _jsonCompress.default.compressObject(argList[_i6], oneSize);
- data.push(row);
- }
- } else {
- data = [];
- }
- var page = "未知";
- try {
- var pages = getCurrentPages();
- var item = pages[pages.length - 1];
- if (item && item.route) {
- page = item.route;
- }
- } catch (error) {}
- that.logList.unshift({
- list: data,
- time: new Date().getTime(),
- page: page,
- type: type
- });
- if (that.options.console.isOutput) {
- if (type == "error") {
- e.apply(void 0, (0, _toConsumableArray2.default)(args));
- } else if (type == "warn") {
- w.apply(void 0, (0, _toConsumableArray2.default)(args));
- } else if (type == "info") {
- i.apply(void 0, (0, _toConsumableArray2.default)(args));
- } else {
- l.apply(void 0, (0, _toConsumableArray2.default)(args));
- }
- }
- } catch (error) {
- if (that.options.console.isOutput) {
- e("监听console出错", error);
- }
- }
- };
- var uniSysConsole = uni.__log__;
- try {
- globalThis.consoleLog = function () {
- var _uni;
- (_uni = uni).__log__.apply(_uni, ["log", "未知来源"].concat(Array.prototype.slice.call(arguments)));
- };
- } catch (error) {}
- try {
- window.consoleLog = function () {
- var _uni2;
- (_uni2 = uni).__log__.apply(_uni2, ["log", "未知来源"].concat(Array.prototype.slice.call(arguments)));
- };
- } catch (error) {}
- uni.__log__ = function (type, line) {
- try {
- for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
- args[_key - 2] = arguments[_key];
- }
- // 处理特殊情况 "__ignoreReport__" 忽略错误日志上报
- if (type == "error") {
- if (args[0] && typeof args[0] == "string" && (args[0] == "__ignoreReport__" //! 忽略错误日志上报
- || args[0].indexOf("__ignoreReport__") == 0)) {
- var _args = [];
- if (args.length > 1) {
- for (var _i4 = 0; _i4 < args.length; _i4++) {
- if (_i4 != 0) {
- _args.push(args[_i4]);
- }
- }
- } else {
- _args[0] = args[0];
- _args[0] = _args[0].replace("__ignoreReport__", "");
- }
- if (that.options.console.isOutput) {
- uniSysConsole.apply(void 0, [type, line].concat(_args));
- }
- return;
- }
- }
- var data = [];
- if (args && args.length > 0) {
- var argList = args;
- var oneSize = that.options.console.cache.rowSize / argList.length;
- for (var _i5 = 0; _i5 < argList.length; _i5++) {
- var row = _jsonCompress.default.compressObject(argList[_i5], oneSize);
- data.push(row);
- }
- } else {
- data = [];
- }
- var page = "未知";
- try {
- var pages = getCurrentPages();
- var item = pages[pages.length - 1];
- if (item && item.route) {
- page = item.route;
- }
- } catch (error) {}
- data.push(line);
- that.logList.unshift({
- list: data,
- time: new Date().getTime(),
- page: page,
- type: type
- });
- if (that.options.console.isOutput) {
- uniSysConsole.apply(void 0, [type, line].concat((0, _toConsumableArray2.default)(data)));
- }
- } catch (error) {
- if (that.options.console.isOutput) {
- uniSysConsole("error", "监听console出错", error);
- }
- }
- };
- } catch (error) {
- console.log("console.install error", error);
- }
- }
- };
- exports.default = _default;
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
- /***/ }),
- /* 49 */
- /*!**********************************************************!*\
- !*** E:/git/2021项目/v3-H5/devTools/core/proxy/request.js ***!
- \**********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(uni) {
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ 50));
- var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
- var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 52));
- var _devCache = _interopRequireDefault(__webpack_require__(/*! ../libs/devCache */ 38));
- var _devOptions = _interopRequireDefault(__webpack_require__(/*! ../libs/devOptions */ 39));
- var _jsonCompress = _interopRequireDefault(__webpack_require__(/*! ../libs/jsonCompress */ 40));
- var _default = {
- /**
- * 请求日志示例
- */
- ajaxLogData: {
- id: 0,
- //请求id
- type: 0,
- // 0发起请求中 1请求成功 2请求失败
- sendTime: 0,
- //发送请求的时间
- responseTime: 0,
- //响应时间
- useTime: 0,
- //请求总耗时
- url: "",
- //请求地址
- header: "",
- //请求头
- method: "get",
- //请求方式
- data: "",
- //请求参数
- responseBody: "",
- //响应主体
- responseHeader: "",
- //响应头
- responseStatus: "",
- //响应编码
- responseMsg: "" //响应报错信息
- },
- options: null,
- /**
- * 请求的数据列表
- */
- ajaxData: [],
- /**
- * 挂载请求拦截器
- */
- install: function install() {
- var _this = this;
- var that = this;
- try {
- this.options = _devOptions.default.getOptions();
- if (!this.options.network.status) return;
- this.ajaxData = _devCache.default.get("request");
- if (!this.ajaxData) this.ajaxData = [];
- this.syncReqData(); //同步缓存
- uni.addInterceptor('request', {
- /**
- * 入参
- */
- invoke: function invoke(args) {
- try {
- args._id_ = new Date().getTime() + '_' + Number(Math.random().toString().replace("0.", ""));
- var copyData = JSON.parse(JSON.stringify(that.ajaxLogData));
- copyData.id = args._id_;
- copyData.sendTime = new Date().getTime();
- copyData.url = that.dataCopy(args.url);
- copyData.header = that.dataCopy(args.header);
- if (!args.method) {
- copyData.method = "get";
- } else {
- copyData.method = that.dataCopy(args.method);
- }
- var cSize = _jsonCompress.default.calculateStringByteSize(copyData);
- if (cSize > that.options.network.cache.rowSize) {
- copyData = _jsonCompress.default.compressObject(copyData, that.options.network.cache.rowSize);
- } else {
- var data = _jsonCompress.default.compressObject(args.data, that.options.network.cache.rowSize - cSize);
- try {
- data = JSON.parse(data);
- } catch (error) {}
- copyData.data = data;
- }
- that.ajaxData.unshift(copyData);
- } catch (error) {
- console.error("request拦截器invoke出错", error);
- }
- },
- success: function success(response, request) {
- return new Promise( /*#__PURE__*/function () {
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(yes, err) {
- var speedLimit, delayDuration, sleepParam, sleepTime, resTimeout, isFail, targetPro, randPro, item, size, data, json;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- //! 延迟请求返回,模拟弱网环境
- speedLimit = uni.getStorageSync("devtools_uniResLimitType");
- if (!speedLimit) {
- _context.next = 9;
- break;
- }
- delayDuration = {
- "2g": [30, 60],
- "3g-": [10, 30],
- "3g": [3, 10],
- "4g": [0.5, 3]
- };
- sleepParam = delayDuration[speedLimit];
- if (!sleepParam) {
- _context.next = 9;
- break;
- }
- sleepTime = rNum(sleepParam[0], sleepParam[1]);
- _context.next = 8;
- return sleep(sleepTime * 1000);
- case 8:
- response.errMsg = response.errMsg + " | [devtools\u6A21\u62DF\u5F31\u7F51\u5EF6\u8FDF:".concat(sleepTime, "s]");
- case 9:
- // ! 随机响应失败概率
- resTimeout = uni.getStorageSync("devtools_uniResTimeout");
- isFail = false;
- if (resTimeout && resTimeout > 1) {
- targetPro = Number(resTimeout);
- randPro = rNum(0, 100);
- if (randPro < targetPro) {
- // 命中失败
- response.statusCode = rNum(400, 600); //生成随机400 ~ 600之间的状态码
- response.errMsg = response.errMsg + " | [devtools\u968F\u673A\u8D85\u65F6\u62A5\u9519\uFF0C\u5F53\u524D\u547D\u4E2D\u7684\u6982\u7387\u9636\u5C42\u4E3A:".concat(targetPro, "%\uFF0C\u751F\u6210\u7684\u968F\u673A\u6570\u4E3A\uFF1A").concat(randPro, "]");
- response.data = "[devTools]模拟请求失败结果!";
- isFail = true;
- }
- }
- // ! 记录响应内容
- _context.prev = 12;
- item = that.ajaxData.find(function (x) {
- return x.id == request._id_;
- });
- if (item) {
- _context.next = 16;
- break;
- }
- return _context.abrupt("return");
- case 16:
- item.responseBodySize = _jsonCompress.default.calculateStringByteSize(response.data);
- item.responseMsg = response.errMsg;
- item.responseStatus = response.statusCode;
- item.responseHeader = response.header;
- item.type = 1;
- item.responseTime = new Date().getTime();
- item.useTime = ((item.responseTime - item.sendTime) / 1000).toFixed(3);
- size = _jsonCompress.default.calculateStringByteSize(item);
- if (size > that.options.network.cache.rowSize) {
- item.responseBody = "[内容太长已截断多余部分]";
- data = _jsonCompress.default.compressObject(item, that.options.network.cache.rowSize);
- that.ajaxData[that.ajaxData.findIndex(function (x) {
- return x.id == request._id_;
- })] = data;
- } else {
- json = response.data;
- try {
- json = JSON.parse(JSON.stringify(json));
- } catch (error) {}
- item.responseBody = _jsonCompress.default.compressObject(json, that.options.network.cache.rowSize - size);
- }
- _context.next = 30;
- break;
- case 27:
- _context.prev = 27;
- _context.t0 = _context["catch"](12);
- console.error("request拦截器success出错", _context.t0);
- case 30:
- if (isFail) {
- err(response.data);
- } else {
- yes(response);
- }
- case 31:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, null, [[12, 27]]);
- }));
- return function (_x, _x2) {
- return _ref.apply(this, arguments);
- };
- }());
- },
- fail: function fail(err, request) {
- try {
- var item = that.ajaxData.find(function (x) {
- return x.id == request._id_;
- });
- if (!item) return;
- item.type = 2;
- item.responseTime = new Date().getTime();
- item.useTime = ((item.responseTime - item.sendTime) / 1000).toFixed(3);
- item.responseMsg = err.errMsg;
- } catch (error) {
- console.error("request拦截器fail出错", error);
- }
- },
- complete: function complete(res) {}
- });
- // ! 删除指定请求记录
- uni.$on("devTools_delNetworkItemById", function (id) {
- var i = _this.ajaxData.findIndex(function (x) {
- return x.id == id;
- });
- if (i != -1) {
- _this.ajaxData.splice(i, 1);
- }
- _this.saveData();
- });
- // ! 清空请求记录
- uni.$on("devTools_delNetworkAll", function () {
- _this.ajaxData = [];
- _this.saveData();
- });
- } catch (error) {
- console.log("request.install error", error);
- }
- },
- /**
- * 同步请求信息到缓存数据中
- */
- syncReqData: function syncReqData() {
- var that = this;
- setTimeout(function () {
- try {
- that.saveData();
- } catch (error) {
- console.log("request.syncReqData", error);
- }
- that.syncReqData();
- }, 4000);
- },
- /**
- * 保存数据到缓存中
- */
- saveData: function saveData() {
- var that = this;
- that.ajaxData = _jsonCompress.default.compressArray(that.ajaxData, that.options.network.cache.size);
- _devCache.default.set("request", that.ajaxData);
- },
- /**
- * 复制对象
- */
- dataCopy: function dataCopy(data) {
- try {
- if ((0, _typeof2.default)(data) == "object") {
- return JSON.parse(JSON.stringify([data]))[0];
- } else {
- return data;
- }
- } catch (error) {
- console.log("request.dataCopy", error);
- return "";
- }
- }
- };
- /**
- * 随机生成n~m的数,支持两位小数
- */
- exports.default = _default;
- function rNum(n, m) {
- return Number((Math.random() * (m - n) + n).toFixed(2));
- }
- /**
- * 休眠指定时长
- */
- function sleep(t) {
- return new Promise(function (y) {
- setTimeout(y, t);
- });
- }
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
- /***/ }),
- /* 50 */
- /*!************************************************************************************************!*\
- !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/@babel/runtime/regenerator/index.js ***!
- \************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- // TODO(Babel 8): Remove this file.
- var runtime = __webpack_require__(/*! @babel/runtime/helpers/regeneratorRuntime */ 51)();
- module.exports = runtime;
- /***/ }),
- /* 51 */
- /*!*******************************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/regeneratorRuntime.js ***!
- \*******************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var _typeof = __webpack_require__(/*! ./typeof.js */ 13)["default"];
- function _regeneratorRuntime() {
- "use strict";
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
- module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
- return e;
- }, module.exports.__esModule = true, module.exports["default"] = module.exports;
- var t,
- e = {},
- r = Object.prototype,
- n = r.hasOwnProperty,
- o = Object.defineProperty || function (t, e, r) {
- t[e] = r.value;
- },
- i = "function" == typeof Symbol ? Symbol : {},
- a = i.iterator || "@@iterator",
- c = i.asyncIterator || "@@asyncIterator",
- u = i.toStringTag || "@@toStringTag";
- function define(t, e, r) {
- return Object.defineProperty(t, e, {
- value: r,
- enumerable: !0,
- configurable: !0,
- writable: !0
- }), t[e];
- }
- try {
- define({}, "");
- } catch (t) {
- define = function define(t, e, r) {
- return t[e] = r;
- };
- }
- function wrap(t, e, r, n) {
- var i = e && e.prototype instanceof Generator ? e : Generator,
- a = Object.create(i.prototype),
- c = new Context(n || []);
- return o(a, "_invoke", {
- value: makeInvokeMethod(t, r, c)
- }), a;
- }
- function tryCatch(t, e, r) {
- try {
- return {
- type: "normal",
- arg: t.call(e, r)
- };
- } catch (t) {
- return {
- type: "throw",
- arg: t
- };
- }
- }
- e.wrap = wrap;
- var h = "suspendedStart",
- l = "suspendedYield",
- f = "executing",
- s = "completed",
- y = {};
- function Generator() {}
- function GeneratorFunction() {}
- function GeneratorFunctionPrototype() {}
- var p = {};
- define(p, a, function () {
- return this;
- });
- var d = Object.getPrototypeOf,
- v = d && d(d(values([])));
- v && v !== r && n.call(v, a) && (p = v);
- var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
- function defineIteratorMethods(t) {
- ["next", "throw", "return"].forEach(function (e) {
- define(t, e, function (t) {
- return this._invoke(e, t);
- });
- });
- }
- function AsyncIterator(t, e) {
- function invoke(r, o, i, a) {
- var c = tryCatch(t[r], t, o);
- if ("throw" !== c.type) {
- var u = c.arg,
- h = u.value;
- return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
- invoke("next", t, i, a);
- }, function (t) {
- invoke("throw", t, i, a);
- }) : e.resolve(h).then(function (t) {
- u.value = t, i(u);
- }, function (t) {
- return invoke("throw", t, i, a);
- });
- }
- a(c.arg);
- }
- var r;
- o(this, "_invoke", {
- value: function value(t, n) {
- function callInvokeWithMethodAndArg() {
- return new e(function (e, r) {
- invoke(t, n, e, r);
- });
- }
- return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
- }
- });
- }
- function makeInvokeMethod(e, r, n) {
- var o = h;
- return function (i, a) {
- if (o === f) throw Error("Generator is already running");
- if (o === s) {
- if ("throw" === i) throw a;
- return {
- value: t,
- done: !0
- };
- }
- for (n.method = i, n.arg = a;;) {
- var c = n.delegate;
- if (c) {
- var u = maybeInvokeDelegate(c, n);
- if (u) {
- if (u === y) continue;
- return u;
- }
- }
- if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
- if (o === h) throw o = s, n.arg;
- n.dispatchException(n.arg);
- } else "return" === n.method && n.abrupt("return", n.arg);
- o = f;
- var p = tryCatch(e, r, n);
- if ("normal" === p.type) {
- if (o = n.done ? s : l, p.arg === y) continue;
- return {
- value: p.arg,
- done: n.done
- };
- }
- "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
- }
- };
- }
- function maybeInvokeDelegate(e, r) {
- var n = r.method,
- o = e.iterator[n];
- if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
- var i = tryCatch(o, e.iterator, r.arg);
- if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
- var a = i.arg;
- return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
- }
- function pushTryEntry(t) {
- var e = {
- tryLoc: t[0]
- };
- 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
- }
- function resetTryEntry(t) {
- var e = t.completion || {};
- e.type = "normal", delete e.arg, t.completion = e;
- }
- function Context(t) {
- this.tryEntries = [{
- tryLoc: "root"
- }], t.forEach(pushTryEntry, this), this.reset(!0);
- }
- function values(e) {
- if (e || "" === e) {
- var r = e[a];
- if (r) return r.call(e);
- if ("function" == typeof e.next) return e;
- if (!isNaN(e.length)) {
- var o = -1,
- i = function next() {
- for (; ++o < e.length;) {
- if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
- }
- return next.value = t, next.done = !0, next;
- };
- return i.next = i;
- }
- }
- throw new TypeError(_typeof(e) + " is not iterable");
- }
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
- value: GeneratorFunctionPrototype,
- configurable: !0
- }), o(GeneratorFunctionPrototype, "constructor", {
- value: GeneratorFunction,
- configurable: !0
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
- var e = "function" == typeof t && t.constructor;
- return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
- }, e.mark = function (t) {
- return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
- }, e.awrap = function (t) {
- return {
- __await: t
- };
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
- return this;
- }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
- void 0 === i && (i = Promise);
- var a = new AsyncIterator(wrap(t, r, n, o), i);
- return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
- return t.done ? t.value : a.next();
- });
- }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
- return this;
- }), define(g, "toString", function () {
- return "[object Generator]";
- }), e.keys = function (t) {
- var e = Object(t),
- r = [];
- for (var n in e) {
- r.push(n);
- }
- return r.reverse(), function next() {
- for (; r.length;) {
- var t = r.pop();
- if (t in e) return next.value = t, next.done = !1, next;
- }
- return next.done = !0, next;
- };
- }, e.values = values, Context.prototype = {
- constructor: Context,
- reset: function reset(e) {
- if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) {
- "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
- }
- },
- stop: function stop() {
- this.done = !0;
- var t = this.tryEntries[0].completion;
- if ("throw" === t.type) throw t.arg;
- return this.rval;
- },
- dispatchException: function dispatchException(e) {
- if (this.done) throw e;
- var r = this;
- function handle(n, o) {
- return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
- }
- for (var o = this.tryEntries.length - 1; o >= 0; --o) {
- var i = this.tryEntries[o],
- a = i.completion;
- if ("root" === i.tryLoc) return handle("end");
- if (i.tryLoc <= this.prev) {
- var c = n.call(i, "catchLoc"),
- u = n.call(i, "finallyLoc");
- if (c && u) {
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
- } else if (c) {
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
- } else {
- if (!u) throw Error("try statement without catch or finally");
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
- }
- }
- }
- },
- abrupt: function abrupt(t, e) {
- for (var r = this.tryEntries.length - 1; r >= 0; --r) {
- var o = this.tryEntries[r];
- if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
- var i = o;
- break;
- }
- }
- i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
- var a = i ? i.completion : {};
- return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
- },
- complete: function complete(t, e) {
- if ("throw" === t.type) throw t.arg;
- return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
- },
- finish: function finish(t) {
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
- var r = this.tryEntries[e];
- if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
- }
- },
- "catch": function _catch(t) {
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
- var r = this.tryEntries[e];
- if (r.tryLoc === t) {
- var n = r.completion;
- if ("throw" === n.type) {
- var o = n.arg;
- resetTryEntry(r);
- }
- return o;
- }
- }
- throw Error("illegal catch attempt");
- },
- delegateYield: function delegateYield(e, r, n) {
- return this.delegate = {
- iterator: values(e),
- resultName: r,
- nextLoc: n
- }, "next" === this.method && (this.arg = t), y;
- }
- }, e;
- }
- module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 52 */
- /*!*****************************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/asyncToGenerator.js ***!
- \*****************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
- try {
- var info = gen[key](arg);
- var value = info.value;
- } catch (error) {
- reject(error);
- return;
- }
- if (info.done) {
- resolve(value);
- } else {
- Promise.resolve(value).then(_next, _throw);
- }
- }
- function _asyncToGenerator(fn) {
- return function () {
- var self = this,
- args = arguments;
- return new Promise(function (resolve, reject) {
- var gen = fn.apply(self, args);
- function _next(value) {
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
- }
- function _throw(err) {
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
- }
- _next(undefined);
- });
- };
- }
- module.exports = _asyncToGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 53 */
- /*!**********************************************************!*\
- !*** E:/git/2021项目/v3-H5/devTools/core/proxy/storage.js ***!
- \**********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(uni) {
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _devCache = _interopRequireDefault(__webpack_require__(/*! ../libs/devCache */ 38));
- var _default = {
- /**
- * 挂载缓存监听
- */
- install: function install() {
- try {
- var setStorage = function setStorage() {
- try {
- if (arguments[0] && arguments[0].key && arguments[0].key.indexOf("devTools_") != 0) {
- that.addCacheKey(arguments[0].key);
- }
- } catch (error) {}
- return _setStorage.apply(void 0, arguments);
- };
- var setStorageSync = function setStorageSync() {
- try {
- if (arguments[0] && arguments[0].indexOf("devTools_") != 0) {
- that.addCacheKey(arguments[0]);
- }
- } catch (error) {}
- return _setStorageSync.apply(void 0, arguments);
- };
- var removeStorage = function removeStorage() {
- try {
- if (arguments[0] && arguments[0].key && arguments[0].key.indexOf("devTools_") != 0) {
- that.delCacheKey(arguments[0].key);
- }
- } catch (error) {}
- return _removeStorage.apply(void 0, arguments);
- };
- var removeStorageSync = function removeStorageSync() {
- try {
- if (arguments[0] && arguments[0].indexOf("devTools_") != 0) {
- that.delCacheKey(arguments[0]);
- }
- } catch (error) {}
- return _removeStorageSync.apply(void 0, arguments);
- };
- var that = this;
- var _setStorage = uni.setStorage;
- uni.setStorage = setStorage;
- var _setStorageSync = uni.setStorageSync;
- uni.setStorageSync = setStorageSync;
- var _removeStorage = uni.removeStorage;
- uni.removeStorage = removeStorage;
- var _removeStorageSync = uni.removeStorageSync;
- uni.removeStorageSync = removeStorageSync;
- } catch (error) {
- console.log("devTools storage.install error", error);
- }
- },
- /**
- * 添加缓存key
- */
- addCacheKey: function addCacheKey(key) {
- try {
- if (key && typeof key == "string") {
- var storageList = _devCache.default.get("storage");
- if (!storageList) storageList = [];
- if (storageList.indexOf(key) == -1) {
- storageList.push(key);
- _devCache.default.set("storage", storageList);
- }
- }
- } catch (error) {
- console.log("devTools storage.addCacheKey error", error);
- }
- },
- /**
- * 删除指定缓存key
- */
- delCacheKey: function delCacheKey(key) {
- try {
- if (key && typeof key == "string") {
- var storageList = _devCache.default.get("storage");
- if (!storageList) storageList = [];
- var index = storageList.indexOf(key);
- if (index > -1) {
- storageList.splice(index, 1);
- _devCache.default.set("storage", storageList);
- }
- }
- } catch (error) {
- console.log("devTools storage.delCacheKey error", error);
- }
- }
- };
- exports.default = _default;
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
- /***/ }),
- /* 54 */
- /*!*********************************************************!*\
- !*** E:/git/2021项目/v3-H5/devTools/core/proxy/uniBus.js ***!
- \*********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(uni) {
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _devCache = _interopRequireDefault(__webpack_require__(/*! ../libs/devCache */ 38));
- var _devOptions = _interopRequireDefault(__webpack_require__(/*! ../libs/devOptions */ 39));
- var _jsonCompress = _interopRequireDefault(__webpack_require__(/*! ../libs/jsonCompress */ 40));
- var _default = {
- logList: [],
- busCount: [],
- options: null,
- /**
- * 挂载打印拦截器
- */
- install: function install() {
- try {
- /**
- * 统计总次数
- */
- var addCount = function addCount(name) {
- var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "on";
- var i = that.busCount.findIndex(function (x) {
- return x.e == name;
- });
- if (i == -1) {
- var item = {
- e: name,
- on: 0,
- off: 0,
- emit: 0,
- once: 0
- };
- item[type] = item[type] + 1;
- that.busCount.push(item);
- } else {
- that.busCount[i][type] = that.busCount[i][type] + 1;
- }
- }; // ! 清空全部记录
- var that = this;
- this.options = _devOptions.default.getOptions();
- if (!this.options.uniBus.status) return;
- this.logList = _devCache.default.get("uniBus");
- if (!this.logList) this.logList = [];
- this.busCount = _devCache.default.get("busCount");
- if (!this.busCount) this.busCount = [];
- this.syncReqData(); //同步缓存
- var now = function now() {
- return new Date().getTime();
- };
- var _on = uni.$on;
- uni.$on = function () {
- try {
- var n = arguments[0];
- if (n && typeof n == "string" && n.length < 200 && n.indexOf("devTools_") == -1) {
- that.logList.unshift({
- t: now(),
- e: _jsonCompress.default.compressObject("on>".concat(n), that.options.uniBus.cache.rowMax)
- });
- addCount(n, "on");
- }
- } catch (error) {
- console.error("uni.$on出错", error);
- }
- _on.apply(void 0, arguments);
- };
- var _once = uni.$once;
- uni.$once = function () {
- try {
- var n = arguments[0];
- if (n && typeof n == "string" && n.length < 200 && n.indexOf("devTools_") == -1) {
- that.logList.unshift({
- t: now(),
- e: _jsonCompress.default.compressObject("once>".concat(n), that.options.uniBus.cache.rowMax)
- });
- addCount(n, "once");
- }
- } catch (error) {
- console.error("uni.$once出错", error);
- }
- _once.apply(void 0, arguments);
- };
- var _emit = uni.$emit;
- uni.$emit = function () {
- try {
- var n = arguments[0];
- var p = arguments[1];
- if (n && typeof n == "string" && n.length < 200 && n.indexOf("devTools_") == -1) {
- that.logList.unshift({
- t: now(),
- e: _jsonCompress.default.compressObject("emit>".concat(n) + (p ? '>' + JSON.stringify(p) : ''), that.options.uniBus.cache.rowMax)
- });
- addCount(n, "emit");
- }
- } catch (error) {
- console.error("uni.$emit出错", error);
- }
- _emit.apply(void 0, arguments);
- };
- var _off = uni.$off;
- uni.$off = function () {
- try {
- var n = arguments[0];
- if (n && typeof n == "string" && n.length < 200 && n.indexOf("devTools_") == -1) {
- that.logList.unshift({
- t: now(),
- e: _jsonCompress.default.compressObject("off>".concat(n) + arguments[0], that.options.uniBus.cache.rowMax)
- });
- addCount(n, "off");
- }
- } catch (error) {
- console.error("uni.$off出错", error);
- }
- _off.apply(void 0, arguments);
- };
- uni.$on("devTools_delUniBusAll", function () {
- that.logList = [];
- that.busCount = [];
- });
- } catch (error) {
- console.log("devTools uniBus.install error", error);
- }
- },
- /**
- * 同步请求信息到缓存数据中
- */
- syncReqData: function syncReqData() {
- var that = this;
- setTimeout(function () {
- try {
- that.logList = _jsonCompress.default.compressArray(that.logList, "end", that.options.uniBus.cache.rowMax);
- _devCache.default.set("uniBus", that.logList);
- that.busCount = _jsonCompress.default.compressArray(that.busCount, "end", that.options.uniBus.cache.countMaxSize);
- _devCache.default.set("busCount", that.busCount);
- } catch (error) {
- console.log("devTools uniBus.syncReqData error", error);
- }
- that.syncReqData();
- }, 5000);
- }
- };
- exports.default = _default;
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
- /***/ }),
- /* 55 */
- /*!************************************************************!*\
- !*** E:/git/2021项目/v3-H5/devTools/core/proxy/uniListen.js ***!
- \************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(uni) {
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _logReport = _interopRequireDefault(__webpack_require__(/*! ../libs/logReport */ 37));
- var _default = {
- /**
- * 挂载uni大部分api监听器
- */
- install: function install() {
- try {
- this.addDefUniApiListen();
- this.onNetworkStatusChange();
- this.scanCodeListen();
- this.onLocaleChange();
- } catch (error) {
- console.log("uniListen error", error);
- }
- },
- /**
- * 批量挂载api调用日志
- */
- addDefUniApiListen: function addDefUniApiListen() {
- /**
- * 需要挂载监听的api列表
- */
- var diyListenApi = {
- downloadFile: function downloadFile(args) {
- (0, _logReport.default)("downloadFile>" + (args && args.url ? args.url : ''));
- },
- connectSocket: function connectSocket(args) {
- (0, _logReport.default)("connectSocket>" + args.url);
- },
- makePhoneCall: function makePhoneCall(args) {
- (0, _logReport.default)("makePhoneCall>" + args.phoneNumber);
- },
- addPhoneContact: function addPhoneContact(args) {
- (0, _logReport.default)("addPhoneContact>" + args.name);
- },
- showToast: function showToast(args) {
- (0, _logReport.default)("showToast>" + args.title);
- },
- showModal: function showModal(args) {
- (0, _logReport.default)("showModal>" + args.title + '>' + args.content);
- },
- setLocale: function setLocale(args) {
- (0, _logReport.default)("setLocale>" + args);
- },
- saveFile: function saveFile(args) {
- (0, _logReport.default)("saveFile>" + args.tempFilePath);
- },
- login: function login(args) {
- (0, _logReport.default)("login>" + JSON.stringify(args));
- },
- share: function share(args) {
- (0, _logReport.default)("share>" + JSON.stringify(args));
- },
- shareWithSystem: function shareWithSystem(args) {
- (0, _logReport.default)("shareWithSystem>" + JSON.stringify(args));
- },
- requestPayment: function requestPayment(args) {
- (0, _logReport.default)("requestPayment>" + JSON.stringify(args));
- },
- authorize: function authorize(args) {
- (0, _logReport.default)("requestPayment>" + args.scope);
- },
- navigateToMiniProgram: function navigateToMiniProgram(args) {
- (0, _logReport.default)("navigateToMiniProgram>" + args.appId + '>' + args.path);
- },
- openDocument: function openDocument(args) {
- (0, _logReport.default)("openDocument>" + args.filePath);
- }
- };
- /**
- * 需要监听打印日志的api名称列表
- */
- var waitListenApiNames = ["uploadFile", "closeSocket", "getLocation", "chooseLocation", "openLocation", "chooseImage", "previewImage", "saveImageToPhotosAlbum", "chooseFile", "chooseVideo", "chooseMedia", "saveVideoToPhotosAlbum", "openVideoEditor", "openAppAuthorizeSetting", "startAccelerometer", "startCompass", "startGyroscope", "setScreenBrightness", "vibrate", "vibrateLong", "vibrateShort", "openBluetoothAdapter", "startBeaconDiscovery", "startSoterAuthentication", "hideKeyboard", "showActionSheet", "startPullDownRefresh", "showShareMenu", "startFacialRecognitionVerify", "openSetting", "chooseAddress", "chooseInvoiceTitle", "openEmbeddedMiniProgram"];
- var _loop = function _loop(key) {
- uni.addInterceptor(key, {
- invoke: function invoke(_args) {
- try {
- diyListenApi[key](_args);
- } catch (error) {
- console.error("addInterceptor=>" + key, error);
- }
- }
- });
- };
- for (var key in diyListenApi) {
- _loop(key);
- }
- waitListenApiNames.map(function (key) {
- uni.addInterceptor(key, {
- invoke: function invoke(args) {
- try {
- (0, _logReport.default)(key);
- } catch (error) {
- console.error("addInterceptor>" + key, error);
- }
- }
- });
- });
- },
- /**
- * 添加网络状态监听
- */
- onNetworkStatusChange: function onNetworkStatusChange() {
- uni.onNetworkStatusChange(function (res) {
- try {
- (0, _logReport.default)("onNetworkStatusChange>isConnected:" + (res.isConnected ? 'true' : 'false') + '>networkType:' + res.networkType);
- } catch (error) {
- console.log("onNetworkStatusChange", error);
- }
- });
- },
- /**
- * 添加系统主题切换监听
- */
- onThemeChange: function onThemeChange() {
- uni.onThemeChange(function (res) {
- try {
- (0, _logReport.default)("onThemeChange>" + res.theme);
- } catch (error) {
- console.log("onThemeChange", error);
- }
- });
- },
- /**
- * 监听扫码结果
- */
- scanCodeListen: function scanCodeListen() {
- uni.addInterceptor('scanCode', {
- success: function success(res) {
- try {
- (0, _logReport.default)("scanCodeSuccess>" + JSON.stringify({
- scanType: res.scanType,
- result: res.result
- }));
- } catch (error) {
- console.log("scanCode", error);
- }
- }
- });
- },
- /**
- * 监听系统语言切换
- */
- onLocaleChange: function onLocaleChange() {
- uni.onLocaleChange(function (locale) {
- try {
- (0, _logReport.default)("onLocaleChange>" + locale);
- } catch (error) {
- console.log("onLocaleChange", error);
- }
- });
- }
- };
- exports.default = _default;
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
- /***/ }),
- /* 56 */
- /*!**********************************************!*\
- !*** E:/git/2021项目/v3-H5/devTools/config.js ***!
- \**********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var config = {
- status: true,
- //调试工具总开关
- route: "/devTools/page/index",
- // 调试页面的路由,不建议更改
- bubble: {
- //调试弹窗气泡设置
- status: true,
- // 气泡标签是否显示,生产环境建议关闭
- text: "DevTools",
- // 气泡上展示的文字
- color: "#ffffff",
- // 气泡文字颜色
- bgColor: "rgba(250, 53, 52,0.7)" // 气泡背景颜色
- },
- // 注意: 以下配置不建议更改
- pageStatistics: {
- // 页面统计开关
- status: true,
- // 统计状态开关
- size: 1024 * 100,
- // 缓存上限,单位byte
- dayOnlineRowMax: 30 // 活跃数据缓存天数
- },
- console: {
- //console日志配置
- status: true,
- //功能总开关
- isOutput: true,
- //打印的日志是否对外输出到浏览器调试界面,建议在生产环境时关闭
- cache: {
- status: true,
- //是否启用本地缓存
- size: 512 * 1024,
- //缓存上限,单位byte
- rowSize: 1024 * 4 //单条记录缓存上限,单位byte
- }
- },
- uniBus: {
- // uni event bus 监听设置
- status: true,
- cache: {
- status: true,
- size: 1024 * 512,
- // bus调用日志上限 byte
- rowSize: 1024 * 10,
- countMaxSize: 1024 * 10 // bus统计上限 byte
- }
- },
- error: {
- //报错拦截配置
- status: true,
- cache: {
- status: true,
- size: 512 * 1024,
- rowSize: 1024 * 4
- }
- },
- network: {
- //请求拦截配置
- status: true,
- cache: {
- status: true,
- size: 512 * 1024,
- rowSize: 1024 * 4
- }
- },
- logs: {
- //运行日志
- status: true,
- cache: {
- status: true,
- size: 512 * 1024,
- rowSize: 1024 * 4
- }
- }
- };
- var _default = config;
- exports.default = _default;
- /***/ }),
- /* 57 */,
- /* 58 */,
- /* 59 */,
- /* 60 */,
- /* 61 */,
- /* 62 */,
- /* 63 */
- /*!**********************************************!*\
- !*** E:/git/2021项目/v3-H5/pages/api/index.js ***!
- \**********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.examPointsRecordGetMyPointsLogInfo = exports.creditAppletGetMyPointsLogInfo = exports.configInfo = exports.chemicalAppletSelectStockInfo = exports.chemicalAppletGetStockDetail = exports.chemicalAppletGetCabinetByChemical = exports.chemicalAppletCabinetDetail = exports.chemicalAioVerifyScanLogin = exports.chemicalAioVerifyAppletLogin = exports.chemicalAioIdentityScanLogin = exports.authGetAppletUser = void 0;
- exports.getConfigByType = getConfigByType;
- exports.systemUserProfile = exports.systemUserPersonalData = exports.systemUserDropList = exports.systemSubjectCheckIsAdminOrSafeUser = exports.systemNoticeGetNoticeType = exports.systemNoticeGetNoticeList = exports.systemNoticeGetNoticeDetail = exports.systemNoticeGetNoticeCount = exports.systemMineUserEdit = exports.systemDeptDropList = exports.systemAppletRolePermission = exports.systemAppletLayoutSelect = exports.studentinfoFacemy = exports.securityDataStatisticsGetUserIdentity = exports.securityCheckPlanPlantList = exports.securityCheckDangerNotHazardOneCollect = exports.securityCheckDangerHazardOneCollect = exports.reportAppletReportBsEquipStatusList = exports.reportAppletReportBsEquipDangerList = exports.reportAppletReportBsEquipDangerCheckList = exports.reportAppletReportBsEquipAppointTopList = exports.reportAppletReportApiResourceRateResourceList = exports.reportAppletReportApiResourceRateAnalysisList = exports.reportAppletReportApiEquipRankTopList = exports.reportAppletReportApiEquipOverdueList = exports.reportAppletReportApiEquipOverdueGetLifePageList = exports.reportAppletReportApiEquipLifeList = exports.reportAppletReportApiEquipLifeGetReportBsEquipLifeList = exports.reportAppletReportApiDeviceStatGetDeviceStat = exports.reportAppletReportApiCageRateList = exports.reportAppletReportApiCageRateCageRateList = exports.reportAppStatisticsWarningHandle = exports.reportAppStatisticsPersonDeviceSafety = exports.reportAppStatisticsLabStateStatistics = exports.reportAppStatisticsLabNumberPeople = exports.reportAppStatisticsHazardTotalSort = exports.reportAppStatisticsDangerSort = exports.reportAppStatisticsCountStatistics = exports.reportAppStatisticsChemicalStockSort = exports.outSubjectPhoto = exports.logout = exports.login = exports.laboratorySubPassOutIsotopeSubSign = exports.laboratoryPlanCloseRiskPlan = exports.laboratoryClassTypeGetList = exports.laboratoryClassLevelGetList = exports.laboratoryBigViewSelectTriggerInfo = exports.laboratoryBigViewGetFloorByBigView = exports.laboratoryAppletSubList = exports.laboratoryAppletGetSubDetailInfo = exports.laboratoryAppletCheckPassOrNo = exports.laboratoryAppletCheckApplyPending = exports.laboratoryAppBoardScanCodeVerification = exports.iotAppSpeakerPlayVoice = exports.iotAppSpeakerFindHorn = exports.gradingControl = exports.getLogoInfo = void 0;
- var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
- var _request = __webpack_require__(/*! @/api/request/request.js */ 64);
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
- //登录
- var login = function login(data) {
- return (0, _request.apiResquest)({
- url: "/auth/appletLogin",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //退出登录
- exports.login = login;
- var logout = function logout(data) {
- return (0, _request.apiResquest)({
- url: "/auth/logout",
- method: 'GET',
- data: data
- });
- };
- //查询公共配置
- exports.logout = logout;
- var configInfo = function configInfo(data) {
- return (0, _request.apiResquest)({
- url: "/auth/configInfo",
- method: 'GET',
- data: data
- });
- };
- //获取公共配置的图片
- exports.configInfo = configInfo;
- var getLogoInfo = function getLogoInfo(data) {
- return (0, _request.apiResquest)({
- url: "/system/config/info/getConfigByType",
- method: 'GET',
- data: data
- });
- };
- //化学品登录-扫码验证
- exports.getLogoInfo = getLogoInfo;
- var chemicalAioIdentityScanLogin = function chemicalAioIdentityScanLogin(data) {
- return (0, _request.apiResquest)({
- url: "/chemical/aio/identity/scanLogin",
- method: 'GET',
- data: data
- });
- };
- //实验室-列表
- exports.chemicalAioIdentityScanLogin = chemicalAioIdentityScanLogin;
- var laboratoryAppletSubList = function laboratoryAppletSubList(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/applet/subList",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //实验室-详情
- exports.laboratoryAppletSubList = laboratoryAppletSubList;
- var laboratoryAppletGetSubDetailInfo = function laboratoryAppletGetSubDetailInfo(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/applet/getSubDetailInfo",
- method: 'GET',
- data: data
- });
- };
- //实验室-查询喇叭列表
- exports.laboratoryAppletGetSubDetailInfo = laboratoryAppletGetSubDetailInfo;
- var iotAppSpeakerFindHorn = function iotAppSpeakerFindHorn(data) {
- return (0, _request.apiResquest)({
- url: "/iot/app/speaker/findHorn",
- method: 'GET',
- data: data
- });
- };
- //实验室-喇叭播放
- exports.iotAppSpeakerFindHorn = iotAppSpeakerFindHorn;
- var iotAppSpeakerPlayVoice = function iotAppSpeakerPlayVoice(data) {
- return (0, _request.apiResquest)({
- url: "/iot/app/speaker/playVoice",
- method: 'GET',
- data: data
- });
- };
- //扫码-查询化学品详情
- exports.iotAppSpeakerPlayVoice = iotAppSpeakerPlayVoice;
- var chemicalAppletCabinetDetail = function chemicalAppletCabinetDetail(data) {
- return (0, _request.apiResquest)({
- url: "/chemical/applet/cabinetDetail",
- method: 'GET',
- data: data
- });
- };
- //查询化学品目录清单
- exports.chemicalAppletCabinetDetail = chemicalAppletCabinetDetail;
- var chemicalAppletGetCabinetByChemical = function chemicalAppletGetCabinetByChemical(data) {
- return (0, _request.apiResquest)({
- url: "/chemical/applet/getCabinetByChemical",
- method: 'GET',
- data: data
- });
- };
- //扫码-查询化学品信息
- exports.chemicalAppletGetCabinetByChemical = chemicalAppletGetCabinetByChemical;
- var chemicalAppletGetStockDetail = function chemicalAppletGetStockDetail(data) {
- return (0, _request.apiResquest)({
- url: "/chemical/applet/getStockDetail",
- method: 'GET',
- data: data
- });
- };
- //个人中心-获取个人信息
- exports.chemicalAppletGetStockDetail = chemicalAppletGetStockDetail;
- var systemUserProfile = function systemUserProfile(data) {
- return (0, _request.apiResquest)({
- url: "/system/user/profile",
- method: 'GET',
- data: data
- });
- };
- //用户修改头像接口
- exports.systemUserProfile = systemUserProfile;
- var systemMineUserEdit = function systemMineUserEdit(data) {
- return (0, _request.apiResquest)({
- url: "/system/mine/user/edit",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- /*查询用户列表-下拉列表
- * userName : '', 名称
- * userType: '', 0.系统 1.老师 2.学生
- */
- exports.systemMineUserEdit = systemMineUserEdit;
- var systemUserDropList = function systemUserDropList(data) {
- return (0, _request.apiResquest)({
- url: "/system/user/dropList",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- /* 分类获取公共配置
- * category 1.系统参数 2.公共配置
- * configType 1.基础配置 2.管控一体机 3.化学品终端 4.小程序配置 5.开发配置 6.首页配置
- */
- exports.systemUserDropList = systemUserDropList;
- function getConfigByType(data) {
- return (0, _request.apiResquest)({
- url: '/system/config/info/getConfigByType',
- method: 'post',
- data: _objectSpread({}, data)
- });
- }
- //查询人员身份标识
- var securityDataStatisticsGetUserIdentity = function securityDataStatisticsGetUserIdentity(data) {
- return (0, _request.apiResquest)({
- url: "/security/dataStatistics/getUserIdentity",
- method: 'GET',
- data: data
- });
- };
- //查询小程序布局配置
- exports.securityDataStatisticsGetUserIdentity = securityDataStatisticsGetUserIdentity;
- var systemAppletLayoutSelect = function systemAppletLayoutSelect(data) {
- return (0, _request.apiResquest)({
- url: '/system/applet/layout/select',
- method: 'GET',
- data: data
- });
- };
- //查询权限字段
- exports.systemAppletLayoutSelect = systemAppletLayoutSelect;
- var systemAppletRolePermission = function systemAppletRolePermission(data) {
- return (0, _request.apiResquest)({
- url: '/system/applet/role/permission',
- method: 'GET',
- data: data
- });
- };
- /* 数据看板 */
- //人数统计
- exports.systemAppletRolePermission = systemAppletRolePermission;
- var reportAppStatisticsCountStatistics = function reportAppStatisticsCountStatistics(data) {
- return (0, _request.apiResquest)({
- url: '/report/app/statistics/countStatistics',
- method: 'GET',
- data: data
- });
- };
- //实验室使用、空闲、异常数量
- exports.reportAppStatisticsCountStatistics = reportAppStatisticsCountStatistics;
- var reportAppStatisticsLabStateStatistics = function reportAppStatisticsLabStateStatistics(data) {
- return (0, _request.apiResquest)({
- url: '/report/app/statistics/labStateStatistics',
- method: 'GET',
- data: data
- });
- };
- //实验室-图表
- exports.reportAppStatisticsLabStateStatistics = reportAppStatisticsLabStateStatistics;
- var reportAppStatisticsLabNumberPeople = function reportAppStatisticsLabNumberPeople(data) {
- return (0, _request.apiResquest)({
- url: '/report/app/statistics/labNumberPeople',
- method: 'GET',
- data: data
- });
- };
- //学院人员设备列表
- exports.reportAppStatisticsLabNumberPeople = reportAppStatisticsLabNumberPeople;
- var reportAppStatisticsPersonDeviceSafety = function reportAppStatisticsPersonDeviceSafety(data) {
- return (0, _request.apiResquest)({
- url: '/report/app/statistics/personDeviceSafety',
- method: 'GET',
- data: data
- });
- };
- //危险源
- exports.reportAppStatisticsPersonDeviceSafety = reportAppStatisticsPersonDeviceSafety;
- var reportAppStatisticsHazardTotalSort = function reportAppStatisticsHazardTotalSort(data) {
- return (0, _request.apiResquest)({
- url: '/report/app/statistics/hazardTotalSort',
- method: 'GET',
- data: data
- });
- };
- //危化品
- exports.reportAppStatisticsHazardTotalSort = reportAppStatisticsHazardTotalSort;
- var reportAppStatisticsChemicalStockSort = function reportAppStatisticsChemicalStockSort(data) {
- return (0, _request.apiResquest)({
- url: '/report/app/statistics/chemicalStockSort',
- method: 'GET',
- data: data
- });
- };
- //安全隐患-查询计划标题
- exports.reportAppStatisticsChemicalStockSort = reportAppStatisticsChemicalStockSort;
- var securityCheckPlanPlantList = function securityCheckPlanPlantList(data) {
- return (0, _request.apiResquest)({
- url: "/security/checkPlan/plantList",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //安全隐患-安全隐患排行
- exports.securityCheckPlanPlantList = securityCheckPlanPlantList;
- var reportAppStatisticsDangerSort = function reportAppStatisticsDangerSort(data) {
- return (0, _request.apiResquest)({
- url: '/report/app/statistics/dangerSort',
- method: 'GET',
- data: data
- });
- };
- //安全隐患-一级指标
- exports.reportAppStatisticsDangerSort = reportAppStatisticsDangerSort;
- var securityCheckDangerHazardOneCollect = function securityCheckDangerHazardOneCollect(data) {
- return (0, _request.apiResquest)({
- url: '/security/checkDanger/hazardOneCollect',
- method: 'GET',
- data: data
- });
- };
- //安全隐患-暂无法整改
- exports.securityCheckDangerHazardOneCollect = securityCheckDangerHazardOneCollect;
- var securityCheckDangerNotHazardOneCollect = function securityCheckDangerNotHazardOneCollect(data) {
- return (0, _request.apiResquest)({
- url: '/security/checkDanger/notHazardOneCollect',
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //安全隐患-预警处置
- exports.securityCheckDangerNotHazardOneCollect = securityCheckDangerNotHazardOneCollect;
- var reportAppStatisticsWarningHandle = function reportAppStatisticsWarningHandle(data) {
- return (0, _request.apiResquest)({
- url: '/report/app/statistics/warningHandle',
- method: 'GET',
- data: data
- });
- };
- //设备管控-top
- exports.reportAppStatisticsWarningHandle = reportAppStatisticsWarningHandle;
- var reportAppletReportApiDeviceStatGetDeviceStat = function reportAppletReportApiDeviceStatGetDeviceStat(data) {
- return (0, _request.apiResquest)({
- url: '/report/applet/reportApiDeviceStat/getDeviceStat',
- method: 'GET',
- data: data
- });
- };
- //设备管控-安全检查指标
- exports.reportAppletReportApiDeviceStatGetDeviceStat = reportAppletReportApiDeviceStatGetDeviceStat;
- var reportAppletReportBsEquipDangerCheckList = function reportAppletReportBsEquipDangerCheckList(data) {
- return (0, _request.apiResquest)({
- url: "/report/applet/reportBsEquipDanger/checkList",
- method: 'GET',
- data: data
- });
- };
- //设备管控-特种设备与常规冷热设备安全隐患统计
- exports.reportAppletReportBsEquipDangerCheckList = reportAppletReportBsEquipDangerCheckList;
- var reportAppletReportBsEquipDangerList = function reportAppletReportBsEquipDangerList(data) {
- return (0, _request.apiResquest)({
- url: "/report/applet/reportBsEquipDanger/list",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //设备管控-超期服役设备-统计
- exports.reportAppletReportBsEquipDangerList = reportAppletReportBsEquipDangerList;
- var reportAppletReportApiEquipOverdueList = function reportAppletReportApiEquipOverdueList(data) {
- return (0, _request.apiResquest)({
- url: "/report/applet/reportApiEquipOverdue/list",
- method: 'GET',
- data: data
- });
- };
- //设备管控-设备使用寿命-统计
- exports.reportAppletReportApiEquipOverdueList = reportAppletReportApiEquipOverdueList;
- var reportAppletReportApiEquipLifeList = function reportAppletReportApiEquipLifeList(data) {
- return (0, _request.apiResquest)({
- url: "/report/applet/reportApiEquipLife/list",
- method: 'GET',
- data: data
- });
- };
- //设备管控-超期服役设备-列表
- exports.reportAppletReportApiEquipLifeList = reportAppletReportApiEquipLifeList;
- var reportAppletReportApiEquipOverdueGetLifePageList = function reportAppletReportApiEquipOverdueGetLifePageList(data) {
- return (0, _request.apiResquest)({
- url: "/report/applet/reportApiEquipOverdue/getLifePageList",
- method: 'GET',
- data: data
- });
- };
- //设备管控-设备使用寿命-列表
- exports.reportAppletReportApiEquipOverdueGetLifePageList = reportAppletReportApiEquipOverdueGetLifePageList;
- var reportAppletReportApiEquipLifeGetReportBsEquipLifeList = function reportAppletReportApiEquipLifeGetReportBsEquipLifeList(data) {
- return (0, _request.apiResquest)({
- url: "/report/applet/reportApiEquipLife/getReportBsEquipLifeList",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //大仪预约-使用使用排行TOP10
- exports.reportAppletReportApiEquipLifeGetReportBsEquipLifeList = reportAppletReportApiEquipLifeGetReportBsEquipLifeList;
- var reportAppletReportApiEquipRankTopList = function reportAppletReportApiEquipRankTopList(data) {
- return (0, _request.apiResquest)({
- url: "/report/applet/reportApiEquipRank/topList",
- method: 'GET',
- data: data
- });
- };
- //大仪预约-大仪预约排行
- exports.reportAppletReportApiEquipRankTopList = reportAppletReportApiEquipRankTopList;
- var reportAppletReportBsEquipAppointTopList = function reportAppletReportBsEquipAppointTopList(data) {
- return (0, _request.apiResquest)({
- url: "/report/applet/reportBsEquipAppoint/topList",
- method: 'GET',
- data: data
- });
- };
- //大仪预约-设备总数
- exports.reportAppletReportBsEquipAppointTopList = reportAppletReportBsEquipAppointTopList;
- var reportAppletReportBsEquipStatusList = function reportAppletReportBsEquipStatusList(data) {
- return (0, _request.apiResquest)({
- url: "/report/applet/reportBsEquipStatus/list",
- method: 'GET',
- data: data
- });
- };
- //笼位预约概况
- exports.reportAppletReportBsEquipStatusList = reportAppletReportBsEquipStatusList;
- var reportAppletReportApiCageRateList = function reportAppletReportApiCageRateList(data) {
- return (0, _request.apiResquest)({
- url: "/report/applet/reportApiCageRate/list",
- method: 'GET',
- data: data
- });
- };
- //笼位预约-实验室A-B楼
- exports.reportAppletReportApiCageRateList = reportAppletReportApiCageRateList;
- var reportAppletReportApiCageRateCageRateList = function reportAppletReportApiCageRateCageRateList(data) {
- return (0, _request.apiResquest)({
- url: "/report/applet/reportApiCageRate/cageRateList",
- method: 'GET',
- data: data
- });
- };
- //资源预约情况
- exports.reportAppletReportApiCageRateCageRateList = reportAppletReportApiCageRateCageRateList;
- var reportAppletReportApiResourceRateResourceList = function reportAppletReportApiResourceRateResourceList(data) {
- return (0, _request.apiResquest)({
- url: "/report/applet/reportApiResourceRate/resourceList",
- method: 'GET',
- data: data
- });
- };
- //资源室隐患统计
- exports.reportAppletReportApiResourceRateResourceList = reportAppletReportApiResourceRateResourceList;
- var reportAppletReportApiResourceRateAnalysisList = function reportAppletReportApiResourceRateAnalysisList(data) {
- return (0, _request.apiResquest)({
- url: "/report/applet/reportApiResourceRate/analysisList",
- method: 'GET',
- data: data
- });
- };
- /************************扫码相关************************/
- //化学品终端-扫码登录
- exports.reportAppletReportApiResourceRateAnalysisList = reportAppletReportApiResourceRateAnalysisList;
- var chemicalAioVerifyScanLogin = function chemicalAioVerifyScanLogin(data) {
- return (0, _request.apiResquest)({
- url: "/chemical/aio/verify/scanLogin",
- method: 'GET',
- data: data
- });
- };
- //化学品终端-双人认证
- exports.chemicalAioVerifyScanLogin = chemicalAioVerifyScanLogin;
- var chemicalAioVerifyAppletLogin = function chemicalAioVerifyAppletLogin(data) {
- return (0, _request.apiResquest)({
- url: "/chemical/aio/verify/appletLogin",
- method: 'GET',
- data: data
- });
- };
- //电子信息牌二维码-小程序扫码验证
- exports.chemicalAioVerifyAppletLogin = chemicalAioVerifyAppletLogin;
- var laboratoryAppBoardScanCodeVerification = function laboratoryAppBoardScanCodeVerification(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/app/board/scanCodeVerification",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- /************************消息相关************************/
- //消息-未读消息数量
- exports.laboratoryAppBoardScanCodeVerification = laboratoryAppBoardScanCodeVerification;
- var systemNoticeGetNoticeCount = function systemNoticeGetNoticeCount(id, data) {
- return (0, _request.apiResquest)({
- url: "/system/notice/getNoticeCount",
- method: 'GET',
- data: data
- });
- };
- //消息-列表
- exports.systemNoticeGetNoticeCount = systemNoticeGetNoticeCount;
- var systemNoticeGetNoticeList = function systemNoticeGetNoticeList(data) {
- return (0, _request.apiResquest)({
- url: "/system/notice/getNoticeList",
- method: 'GET',
- data: data
- });
- };
- //消息-详情
- exports.systemNoticeGetNoticeList = systemNoticeGetNoticeList;
- var systemNoticeGetNoticeDetail = function systemNoticeGetNoticeDetail(data) {
- return (0, _request.apiResquest)({
- url: "/system/notice/getNoticeDetail",
- method: 'GET',
- data: data
- });
- };
- //消息-获取系统消息类型
- exports.systemNoticeGetNoticeDetail = systemNoticeGetNoticeDetail;
- var systemNoticeGetNoticeType = function systemNoticeGetNoticeType(data) {
- return (0, _request.apiResquest)({
- url: "/system/notice/getNoticeType",
- method: 'GET',
- data: data
- });
- };
- //查询人脸信息与认证状态
- exports.systemNoticeGetNoticeType = systemNoticeGetNoticeType;
- var studentinfoFacemy = function studentinfoFacemy(data) {
- return (0, _request.apiResquest)({
- url: "/base/app/lab/api/studentinfo/my",
- method: 'GET'
- });
- };
- /************************未调试************************/
- //获取离开检查配置
- exports.studentinfoFacemy = studentinfoFacemy;
- var outSubjectPhoto = function outSubjectPhoto(id, data) {
- return (0, _request.apiResquestForm)({
- url: "/base/app/lab/api/outSubjectPhoto",
- method: 'GET',
- data: data
- });
- };
- //分级管控未完成工作列表
- exports.outSubjectPhoto = outSubjectPhoto;
- var gradingControl = function gradingControl(data) {
- return (0, _request.apiResquest)({
- url: "/base/app/lab/manage/havingList",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //积分信息
- exports.gradingControl = gradingControl;
- var examPointsRecordGetMyPointsLogInfo = function examPointsRecordGetMyPointsLogInfo(data) {
- return (0, _request.apiResquest)({
- url: "/exam/points/record/getMyPointsLogInfo",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //积分信息(新-对接学习考试后的)
- exports.examPointsRecordGetMyPointsLogInfo = examPointsRecordGetMyPointsLogInfo;
- var creditAppletGetMyPointsLogInfo = function creditAppletGetMyPointsLogInfo(data) {
- return (0, _request.apiResquest)({
- url: "/credit/applet/getMyPointsLogInfo",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //实验室-列表-获取学院列表下拉列表
- exports.creditAppletGetMyPointsLogInfo = creditAppletGetMyPointsLogInfo;
- var systemDeptDropList = function systemDeptDropList(data) {
- return (0, _request.apiResquest)({
- url: "/system/dept/dropList",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //实验室-列表-获取分类下拉列表
- exports.systemDeptDropList = systemDeptDropList;
- var laboratoryClassTypeGetList = function laboratoryClassTypeGetList(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/typeConfig/getList",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //实验室-列表-获取分级
- exports.laboratoryClassTypeGetList = laboratoryClassTypeGetList;
- var laboratoryClassLevelGetList = function laboratoryClassLevelGetList(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/levelConfig/getLevelTitleList",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //查询用户信息-(初始密码/手机号/导师/身份)
- exports.laboratoryClassLevelGetList = laboratoryClassLevelGetList;
- var systemUserPersonalData = function systemUserPersonalData(data) {
- return (0, _request.apiResquest)({
- url: "/system/user/personalData",
- method: 'get'
- });
- };
- //根据 token 获取用户信息
- exports.systemUserPersonalData = systemUserPersonalData;
- var authGetAppletUser = function authGetAppletUser(data) {
- return (0, _request.apiResquest)({
- url: "/auth/getAppletUser",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //查询是否是同位素实验并且有签退
- exports.authGetAppletUser = authGetAppletUser;
- var laboratorySubPassOutIsotopeSubSign = function laboratorySubPassOutIsotopeSubSign(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/subPassOut/isotopeSubSign",
- method: 'GET',
- data: data
- });
- };
- //扫码查询-化学品基本信息
- exports.laboratorySubPassOutIsotopeSubSign = laboratorySubPassOutIsotopeSubSign;
- var chemicalAppletSelectStockInfo = function chemicalAppletSelectStockInfo(data) {
- return (0, _request.apiResquest)({
- url: "/chemical/applet/selectStockInfo",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //查询当前用户下的预案触发数据
- exports.chemicalAppletSelectStockInfo = chemicalAppletSelectStockInfo;
- var laboratoryBigViewSelectTriggerInfo = function laboratoryBigViewSelectTriggerInfo(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/bigView/selectTriggerInfo",
- method: 'GET',
- data: data
- });
- };
- //应急处置-结束预案
- exports.laboratoryBigViewSelectTriggerInfo = laboratoryBigViewSelectTriggerInfo;
- var laboratoryPlanCloseRiskPlan = function laboratoryPlanCloseRiskPlan(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/plan/closeRiskPlan",
- method: 'GET',
- data: data
- });
- };
- //-应急处置-楼层布局数据
- exports.laboratoryPlanCloseRiskPlan = laboratoryPlanCloseRiskPlan;
- var laboratoryBigViewGetFloorByBigView = function laboratoryBigViewGetFloorByBigView(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/bigView/getFloorByBigView",
- method: 'GET',
- data: data
- });
- };
- //查询是否是管理员/安全员
- exports.laboratoryBigViewGetFloorByBigView = laboratoryBigViewGetFloorByBigView;
- var systemSubjectCheckIsAdminOrSafeUser = function systemSubjectCheckIsAdminOrSafeUser(data) {
- return (0, _request.apiResquest)({
- url: "/system/subject/checkIsAdminOrSafeUser",
- method: 'GET',
- data: data
- });
- };
- //查询安全准入是否有-待审核
- exports.systemSubjectCheckIsAdminOrSafeUser = systemSubjectCheckIsAdminOrSafeUser;
- var laboratoryAppletCheckApplyPending = function laboratoryAppletCheckApplyPending(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/applet/checkApplyPending",
- method: 'GET',
- data: data
- });
- };
- //查询申请列表是否有未查看-通过/驳回
- exports.laboratoryAppletCheckApplyPending = laboratoryAppletCheckApplyPending;
- var laboratoryAppletCheckPassOrNo = function laboratoryAppletCheckPassOrNo(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/applet/checkPassOrNo",
- method: 'GET',
- data: data
- });
- };
- exports.laboratoryAppletCheckPassOrNo = laboratoryAppletCheckPassOrNo;
- /***/ }),
- /* 64 */
- /*!**************************************************!*\
- !*** E:/git/2021项目/v3-H5/api/request/request.js ***!
- \**************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(uni) {
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.apiResquestTimer = exports.apiResquestOutside = exports.apiResquestJsonList = exports.apiResquestFormVideo = exports.apiResquestForm = exports.apiResquest = void 0;
- exports.loginTimeout = loginTimeout;
- var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
- var _config = __webpack_require__(/*! ./config.js */ 33);
- var _util = __webpack_require__(/*! ./util.js */ 65);
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
- var apiResquest = function apiResquest(prams) {
- return new Promise(function (resolve, reject) {
- var url = _config.config.base_url + prams.url;
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- // get请求映射params参数
- if (prams.method === 'GET' && prams.data) {
- url = url + '?' + (0, _util.tansParams)(prams.data);
- url = url.slice(0, -1);
- prams.data = {};
- }
- return uni.request({
- timeout: 10000,
- url: url,
- data: _objectSpread({}, prams.data),
- method: prams.method,
- header: {
- 'content-type': 'application/json;charset=utf-8',
- 'Authorization': uni.getStorageSync('token')
- },
- success: function success(res) {
- // 成功
- uni.hideLoading();
- if (res.statusCode == 200) {
- if (res.data.code == 200) {
- resolve(res);
- } else if (res.data.code == 401) {
- loginTimeout();
- } else {
- uni.showToast({
- mask: true,
- icon: "none",
- position: "center",
- title: res.data.message,
- duration: 2000
- });
- resolve(res);
- }
- } else if (res.statusCode == 401) {
- loginTimeout();
- } else {
- uni.showToast({
- mask: true,
- icon: "none",
- position: "center",
- title: '连接异常,请联系管理员.',
- duration: 2000
- });
- resolve(res);
- }
- },
- fail: function fail(err) {
- // 失败
- uni.hideLoading();
- uni.showToast({
- mask: true,
- icon: "none",
- position: "center",
- title: '出错啦~请联系管理员!',
- duration: 2000
- });
- },
- complete: function complete() {
- // 完成
- }
- });
- });
- };
- exports.apiResquest = apiResquest;
- var apiResquestOutside = function apiResquestOutside(prams) {
- return new Promise(function (resolve, reject) {
- var url = prams.url;
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- // get请求映射params参数
- if (prams.method === 'GET' && prams.data) {
- url = url + '?' + (0, _util.tansParams)(prams.data);
- url = url.slice(0, -1);
- prams.data = {};
- }
- return uni.request({
- timeout: 10000,
- url: url,
- data: _objectSpread({}, prams.data),
- method: prams.method,
- header: {
- 'content-type': 'application/json;charset=utf-8',
- 'Authorization': uni.getStorageSync('token')
- },
- success: function success(res) {
- // 成功
- uni.hideLoading();
- if (res.statusCode == 200) {
- if (res.data.code == 200) {
- resolve(res);
- } else if (res.data.code == 401) {
- loginTimeout();
- } else {
- uni.showToast({
- mask: true,
- icon: "none",
- position: "center",
- title: res.data.message,
- duration: 2000
- });
- resolve(res);
- }
- } else if (res.statusCode == 401) {
- loginTimeout();
- } else {
- uni.showToast({
- mask: true,
- icon: "none",
- position: "center",
- title: '连接异常,请联系管理员.',
- duration: 2000
- });
- resolve(res);
- }
- },
- fail: function fail(err) {
- // 失败
- uni.hideLoading();
- uni.showToast({
- mask: true,
- icon: "none",
- position: "center",
- title: '出错啦~请联系管理员!',
- duration: 2000
- });
- },
- complete: function complete() {
- // 完成
- }
- });
- });
- };
- exports.apiResquestOutside = apiResquestOutside;
- var apiResquestForm = function apiResquestForm(prams) {
- return new Promise(function (resolve, reject) {
- var url = _config.config.base_url + prams.url;
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- // get请求映射params参数
- if (prams.method === 'GET' && prams.data) {
- url = url + '?' + (0, _util.tansParams)(prams.data);
- url = url.slice(0, -1);
- prams.data = {};
- }
- return uni.request({
- timeout: 10000,
- url: url,
- data: _objectSpread({}, prams.data),
- method: prams.method,
- header: {
- 'content-type': 'application/x-www-form-urlencoded',
- 'Authorization': uni.getStorageSync('token')
- },
- success: function success(res) {
- // 成功
- uni.hideLoading();
- if (res.statusCode == 200) {
- if (res.data.code == 200) {
- resolve(res);
- } else if (res.data.code == 401) {
- loginTimeout();
- } else {
- uni.showToast({
- mask: true,
- icon: "none",
- position: "center",
- title: res.data.message,
- duration: 2000
- });
- resolve(res);
- }
- } else if (res.statusCode == 401) {
- loginTimeout();
- } else {
- uni.showToast({
- mask: true,
- icon: "none",
- position: "center",
- title: '连接异常,请联系管理员.',
- duration: 2000
- });
- resolve(res);
- }
- },
- fail: function fail(err) {
- // 失败
- uni.hideLoading();
- uni.showToast({
- mask: true,
- icon: "none",
- position: "center",
- title: '出错啦~请联系管理员!',
- duration: 2000
- });
- },
- complete: function complete() {
- // 完成
- }
- });
- });
- };
- exports.apiResquestForm = apiResquestForm;
- var apiResquestJsonList = function apiResquestJsonList(prams) {
- return new Promise(function (resolve, reject) {
- var url = _config.config.base_url + prams.url;
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- // get请求映射params参数
- if (prams.method === 'GET' && prams.data) {
- url = url + '?' + (0, _util.tansParams)(prams.data);
- url = url.slice(0, -1);
- prams.data = {};
- }
- return uni.request({
- timeout: 10000,
- url: url,
- data: prams.data,
- method: prams.method,
- header: {
- 'content-type': 'application/json',
- 'Authorization': uni.getStorageSync('token')
- },
- success: function success(res) {
- // 成功
- uni.hideLoading();
- if (res.statusCode == 200) {
- if (res.data.code == 200) {
- resolve(res);
- } else if (res.data.code == 401) {
- loginTimeout();
- } else {
- uni.showToast({
- mask: true,
- icon: "none",
- position: "center",
- title: res.data.message,
- duration: 2000
- });
- resolve(res);
- }
- } else if (res.statusCode == 401) {
- loginTimeout();
- } else {
- uni.showToast({
- mask: true,
- icon: "none",
- position: "center",
- title: '连接异常,请联系管理员.',
- duration: 2000
- });
- resolve(res);
- }
- },
- fail: function fail(err) {
- // 失败
- uni.hideLoading();
- uni.showToast({
- mask: true,
- icon: "none",
- position: "center",
- title: '出错啦~请联系管理员!',
- duration: 2000
- });
- },
- complete: function complete() {
- // 完成
- }
- });
- });
- };
- exports.apiResquestJsonList = apiResquestJsonList;
- var apiResquestFormVideo = function apiResquestFormVideo(prams) {
- return new Promise(function (resolve, reject) {
- var url = uni.getStorageSync('cameraExtranetAgent') + prams.url;
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- // get请求映射params参数
- if (prams.method === 'GET' && prams.data) {
- url = url + '?' + (0, _util.tansParams)(prams.data);
- url = url.slice(0, -1);
- prams.data = {};
- }
- return uni.request({
- timeout: 10000,
- url: url,
- data: _objectSpread({}, prams.data),
- method: prams.method,
- header: {
- 'content-type': 'application/x-www-form-urlencoded',
- 'Authorization': uni.getStorageSync('token')
- },
- success: function success(res) {
- // 成功
- uni.hideLoading();
- if (res.statusCode == 200) {
- if (res.data.code == 200) {
- resolve(res);
- } else if (res.data.code == 401) {
- loginTimeout();
- } else {
- uni.showToast({
- mask: true,
- icon: "none",
- position: "center",
- title: res.data.message,
- duration: 2000
- });
- resolve(res);
- }
- } else if (res.statusCode == 401) {
- loginTimeout();
- } else {
- uni.showToast({
- mask: true,
- icon: "none",
- position: "center",
- title: '连接异常,请联系管理员.',
- duration: 2000
- });
- resolve(res);
- }
- },
- fail: function fail(err) {
- // 失败
- uni.hideLoading();
- uni.showToast({
- mask: true,
- icon: "none",
- position: "center",
- title: '出错啦~请联系管理员!',
- duration: 2000
- });
- },
- complete: function complete() {
- // 完成
- }
- });
- });
- };
- exports.apiResquestFormVideo = apiResquestFormVideo;
- var apiResquestTimer = function apiResquestTimer(prams) {
- return new Promise(function (resolve, reject) {
- var url = _config.config.base_url + prams.url;
- // get请求映射params参数
- if (prams.method === 'GET' && prams.data) {
- url = url + '?' + (0, _util.tansParams)(prams.data);
- url = url.slice(0, -1);
- prams.data = {};
- }
- return uni.request({
- timeout: 10000,
- url: url,
- data: _objectSpread({}, prams.data),
- method: prams.method,
- header: {
- 'content-type': 'application/json;charset=utf-8',
- 'Authorization': uni.getStorageSync('token')
- },
- success: function success(res) {
- // 成功
- uni.hideLoading();
- if (res.statusCode == 200) {
- if (res.data.code == 200) {
- resolve(res);
- } else if (res.data.code == 401) {
- loginTimeout();
- } else {
- uni.showToast({
- mask: true,
- icon: "none",
- position: "center",
- title: res.data.message,
- duration: 2000
- });
- resolve(res);
- }
- } else if (res.statusCode == 401) {
- loginTimeout();
- } else {
- uni.showToast({
- mask: true,
- icon: "none",
- position: "center",
- title: '连接异常,请联系管理员.',
- duration: 2000
- });
- resolve(res);
- }
- },
- fail: function fail(err) {
- // 失败
- uni.hideLoading();
- uni.showToast({
- mask: true,
- icon: "none",
- position: "center",
- title: '出错啦~请联系管理员!',
- duration: 2000
- });
- },
- complete: function complete() {
- // 完成
- }
- });
- });
- };
- //登录超时-退出至登录页面
- exports.apiResquestTimer = apiResquestTimer;
- function loginTimeout(params) {
- uni.showToast({
- mask: true,
- icon: "none",
- position: "center",
- title: "登录超时,请重新登录~",
- duration: 2000
- });
- uni.removeStorageSync('token');
- uni.removeStorageSync('userId');
- uni.removeStorageSync('userType');
- setTimeout(function () {
- uni.redirectTo({
- url: '/pages/views/login/login'
- });
- }, 2000);
- }
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
- /***/ }),
- /* 65 */
- /*!***********************************************!*\
- !*** E:/git/2021项目/v3-H5/api/request/util.js ***!
- \***********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.tansParams = tansParams;
- var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
- function tansParams(params) {
- var result = '';
- for (var _i = 0, _Object$keys = Object.keys(params); _i < _Object$keys.length; _i++) {
- var propName = _Object$keys[_i];
- var value = params[propName];
- var part = encodeURIComponent(propName) + "=";
- if (value !== null && typeof value !== "undefined") {
- if ((0, _typeof2.default)(value) === 'object') {
- for (var _i2 = 0, _Object$keys2 = Object.keys(value); _i2 < _Object$keys2.length; _i2++) {
- var key = _Object$keys2[_i2];
- if (value[key] !== null && typeof value[key] !== 'undefined') {
- var _params = propName + '[' + key + ']';
- var subPart = encodeURIComponent(_params) + "=";
- result += subPart + encodeURIComponent(value[key]) + "&";
- }
- }
- } else {
- result += part + encodeURIComponent(value) + "&";
- }
- }
- }
- return result;
- }
- /***/ }),
- /* 66 */,
- /* 67 */,
- /* 68 */,
- /* 69 */,
- /* 70 */,
- /* 71 */,
- /* 72 */,
- /* 73 */,
- /* 74 */
- /*!*********************************************!*\
- !*** E:/git/2021项目/v3-H5/utils/mqtt.min.js ***!
- \*********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- /* WEBPACK VAR INJECTION */(function(global, wx) {var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;var require;var require;var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ 13);
- (function (f) {
- if (( false ? undefined : _typeof(exports)) === "object" && typeof module !== "undefined") {
- module.exports = f();
- } else if (true) {
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (f),
- __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
- (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- } else { var g; }
- })(function () {
- var define, module, exports;
- return function () {
- function r(e, n, t) {
- function o(i, f) {
- if (!n[i]) {
- if (!e[i]) {
- var c = "function" == typeof require && require;
- if (!f && c) return require(i, !0);
- if (u) return u(i, !0);
- var a = new Error("Cannot find module '" + i + "'");
- throw a.code = "MODULE_NOT_FOUND", a;
- }
- var p = n[i] = {
- exports: {}
- };
- e[i][0].call(p.exports, function (r) {
- var n = e[i][1][r];
- return o(n || r);
- }, p, p.exports, r, e, n, t);
- }
- return n[i].exports;
- }
- for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) {
- o(t[i]);
- }
- return o;
- }
- return r;
- }()({
- 1: [function (require, module, exports) {
- (function (process, global) {
- "use strict";
- var events = require("events");
- var Store = require("./store");
- var mqttPacket = require("mqtt-packet");
- var Writable = require("readable-stream").Writable;
- var inherits = require("inherits");
- var reInterval = require("reinterval");
- var validations = require("./validations");
- var xtend = require("xtend");
- var setImmediate = global.setImmediate || function (callback) {
- process.nextTick(callback);
- };
- var defaultConnectOptions = {
- keepalive: 60,
- reschedulePings: true,
- protocolId: "MQTT",
- protocolVersion: 4,
- reconnectPeriod: 1e3,
- connectTimeout: 30 * 1e3,
- clean: true,
- resubscribe: true
- };
- var errors = {
- 0: "",
- 1: "Unacceptable protocol version",
- 2: "Identifier rejected",
- 3: "Server unavailable",
- 4: "Bad username or password",
- 5: "Not authorized",
- 16: "No matching subscribers",
- 17: "No subscription existed",
- 128: "Unspecified error",
- 129: "Malformed Packet",
- 130: "Protocol Error",
- 131: "Implementation specific error",
- 132: "Unsupported Protocol Version",
- 133: "Client Identifier not valid",
- 134: "Bad User Name or Password",
- 135: "Not authorized",
- 136: "Server unavailable",
- 137: "Server busy",
- 138: "Banned",
- 139: "Server shutting down",
- 140: "Bad authentication method",
- 141: "Keep Alive timeout",
- 142: "Session taken over",
- 143: "Topic Filter invalid",
- 144: "Topic Name invalid",
- 145: "Packet identifier in use",
- 146: "Packet Identifier not found",
- 147: "Receive Maximum exceeded",
- 148: "Topic Alias invalid",
- 149: "Packet too large",
- 150: "Message rate too high",
- 151: "Quota exceeded",
- 152: "Administrative action",
- 153: "Payload format invalid",
- 154: "Retain not supported",
- 155: "QoS not supported",
- 156: "Use another server",
- 157: "Server moved",
- 158: "Shared Subscriptions not supported",
- 159: "Connection rate exceeded",
- 160: "Maximum connect time",
- 161: "Subscription Identifiers not supported",
- 162: "Wildcard Subscriptions not supported"
- };
- function defaultId() {
- return "mqttjs_" + Math.random().toString(16).substr(2, 8);
- }
- function sendPacket(client, packet, cb) {
- client.emit("packetsend", packet);
- var result = mqttPacket.writeToStream(packet, client.stream, client.options);
- if (!result && cb) {
- client.stream.once("drain", cb);
- } else if (cb) {
- cb();
- }
- }
- function flush(queue) {
- if (queue) {
- Object.keys(queue).forEach(function (messageId) {
- if (typeof queue[messageId].cb === "function") {
- queue[messageId].cb(new Error("Connection closed"));
- delete queue[messageId];
- }
- });
- }
- }
- function flushVolatile(queue) {
- if (queue) {
- Object.keys(queue).forEach(function (messageId) {
- if (queue[messageId].volatile && typeof queue[messageId].cb === "function") {
- queue[messageId].cb(new Error("Connection closed"));
- delete queue[messageId];
- }
- });
- }
- }
- function storeAndSend(client, packet, cb, cbStorePut) {
- client.outgoingStore.put(packet, function storedPacket(err) {
- if (err) {
- return cb && cb(err);
- }
- cbStorePut();
- sendPacket(client, packet, cb);
- });
- }
- function nop() {}
- function MqttClient(streamBuilder, options) {
- var k;
- var that = this;
- if (!(this instanceof MqttClient)) {
- return new MqttClient(streamBuilder, options);
- }
- this.options = options || {};
- for (k in defaultConnectOptions) {
- if (typeof this.options[k] === "undefined") {
- this.options[k] = defaultConnectOptions[k];
- } else {
- this.options[k] = options[k];
- }
- }
- this.options.clientId = typeof options.clientId === "string" ? options.clientId : defaultId();
- this.options.customHandleAcks = options.protocolVersion === 5 && options.customHandleAcks ? options.customHandleAcks : function () {
- arguments[3](0);
- };
- this.streamBuilder = streamBuilder;
- this.outgoingStore = options.outgoingStore || new Store();
- this.incomingStore = options.incomingStore || new Store();
- this.queueQoSZero = options.queueQoSZero === undefined ? true : options.queueQoSZero;
- this._resubscribeTopics = {};
- this.messageIdToTopic = {};
- this.pingTimer = null;
- this.connected = false;
- this.disconnecting = false;
- this.queue = [];
- this.connackTimer = null;
- this.reconnectTimer = null;
- this._storeProcessing = false;
- this._packetIdsDuringStoreProcessing = {};
- this.nextId = Math.max(1, Math.floor(Math.random() * 65535));
- this.outgoing = {};
- this._firstConnection = true;
- this.on("close", function () {
- this.connected = false;
- clearTimeout(this.connackTimer);
- });
- this.on("connect", function () {
- var queue = this.queue;
- function deliver() {
- var entry = queue.shift();
- var packet = null;
- if (!entry) {
- return;
- }
- packet = entry.packet;
- that._sendPacket(packet, function (err) {
- if (entry.cb) {
- entry.cb(err);
- }
- deliver();
- });
- }
- deliver();
- });
- this.on("close", function () {
- if (that.pingTimer !== null) {
- that.pingTimer.clear();
- that.pingTimer = null;
- }
- });
- this.on("close", this._setupReconnect);
- events.EventEmitter.call(this);
- this._setupStream();
- }
- inherits(MqttClient, events.EventEmitter);
- MqttClient.prototype._setupStream = function () {
- var connectPacket;
- var that = this;
- var writable = new Writable();
- var parser = mqttPacket.parser(this.options);
- var completeParse = null;
- var packets = [];
- this._clearReconnect();
- this.stream = this.streamBuilder(this);
- parser.on("packet", function (packet) {
- packets.push(packet);
- });
- function nextTickWork() {
- if (packets.length) {
- process.nextTick(work);
- } else {
- var done = completeParse;
- completeParse = null;
- done();
- }
- }
- function work() {
- var packet = packets.shift();
- if (packet) {
- that._handlePacket(packet, nextTickWork);
- } else {
- var done = completeParse;
- completeParse = null;
- if (done) done();
- }
- }
- writable._write = function (buf, enc, done) {
- completeParse = done;
- parser.parse(buf);
- work();
- };
- this.stream.pipe(writable);
- this.stream.on("error", nop);
- this.stream.on("close", function () {
- flushVolatile(that.outgoing);
- that.emit("close");
- });
- connectPacket = Object.create(this.options);
- connectPacket.cmd = "connect";
- sendPacket(this, connectPacket);
- parser.on("error", this.emit.bind(this, "error"));
- if (this.options.properties) {
- if (!this.options.properties.authenticationMethod && this.options.properties.authenticationData) {
- this.emit("error", new Error("Packet has no Authentication Method"));
- return this;
- }
- if (this.options.properties.authenticationMethod && this.options.authPacket && _typeof(this.options.authPacket) === "object") {
- var authPacket = xtend({
- cmd: "auth",
- reasonCode: 0
- }, this.options.authPacket);
- sendPacket(this, authPacket);
- }
- }
- this.stream.setMaxListeners(1e3);
- clearTimeout(this.connackTimer);
- this.connackTimer = setTimeout(function () {
- that._cleanUp(true);
- }, this.options.connectTimeout);
- };
- MqttClient.prototype._handlePacket = function (packet, done) {
- var options = this.options;
- if (options.protocolVersion === 5 && options.properties && options.properties.maximumPacketSize && options.properties.maximumPacketSize < packet.length) {
- this.emit("error", new Error("exceeding packets size " + packet.cmd));
- this.end({
- reasonCode: 149,
- properties: {
- reasonString: "Maximum packet size was exceeded"
- }
- });
- return this;
- }
- this.emit("packetreceive", packet);
- switch (packet.cmd) {
- case "publish":
- this._handlePublish(packet, done);
- break;
- case "puback":
- case "pubrec":
- case "pubcomp":
- case "suback":
- case "unsuback":
- this._handleAck(packet);
- done();
- break;
- case "pubrel":
- this._handlePubrel(packet, done);
- break;
- case "connack":
- this._handleConnack(packet);
- done();
- break;
- case "pingresp":
- this._handlePingresp(packet);
- done();
- break;
- case "disconnect":
- this._handleDisconnect(packet);
- done();
- break;
- default:
- break;
- }
- };
- MqttClient.prototype._checkDisconnecting = function (callback) {
- if (this.disconnecting) {
- if (callback) {
- callback(new Error("client disconnecting"));
- } else {
- this.emit("error", new Error("client disconnecting"));
- }
- }
- return this.disconnecting;
- };
- MqttClient.prototype.publish = function (topic, message, opts, callback) {
- var packet;
- var options = this.options;
- if (typeof opts === "function") {
- callback = opts;
- opts = null;
- }
- var defaultOpts = {
- qos: 0,
- retain: false,
- dup: false
- };
- opts = xtend(defaultOpts, opts);
- if (this._checkDisconnecting(callback)) {
- return this;
- }
- packet = {
- cmd: "publish",
- topic: topic,
- payload: message,
- qos: opts.qos,
- retain: opts.retain,
- messageId: this._nextId(),
- dup: opts.dup
- };
- if (options.protocolVersion === 5) {
- packet.properties = opts.properties;
- if (!options.properties && packet.properties && packet.properties.topicAlias || opts.properties && options.properties && (opts.properties.topicAlias && options.properties.topicAliasMaximum && opts.properties.topicAlias > options.properties.topicAliasMaximum || !options.properties.topicAliasMaximum && opts.properties.topicAlias)) {
- delete packet.properties.topicAlias;
- }
- }
- switch (opts.qos) {
- case 1:
- case 2:
- this.outgoing[packet.messageId] = {
- volatile: false,
- cb: callback || nop
- };
- if (this._storeProcessing) {
- this._packetIdsDuringStoreProcessing[packet.messageId] = false;
- this._storePacket(packet, undefined, opts.cbStorePut);
- } else {
- this._sendPacket(packet, undefined, opts.cbStorePut);
- }
- break;
- default:
- if (this._storeProcessing) {
- this._storePacket(packet, callback, opts.cbStorePut);
- } else {
- this._sendPacket(packet, callback, opts.cbStorePut);
- }
- break;
- }
- return this;
- };
- MqttClient.prototype.subscribe = function () {
- var packet;
- var args = new Array(arguments.length);
- for (var i = 0; i < arguments.length; i++) {
- args[i] = arguments[i];
- }
- var subs = [];
- var obj = args.shift();
- var resubscribe = obj.resubscribe;
- var callback = args.pop() || nop;
- var opts = args.pop();
- var invalidTopic;
- var that = this;
- var version = this.options.protocolVersion;
- delete obj.resubscribe;
- if (typeof obj === "string") {
- obj = [obj];
- }
- if (typeof callback !== "function") {
- opts = callback;
- callback = nop;
- }
- invalidTopic = validations.validateTopics(obj);
- if (invalidTopic !== null) {
- setImmediate(callback, new Error("Invalid topic " + invalidTopic));
- return this;
- }
- if (this._checkDisconnecting(callback)) {
- return this;
- }
- var defaultOpts = {
- qos: 0
- };
- if (version === 5) {
- defaultOpts.nl = false;
- defaultOpts.rap = false;
- defaultOpts.rh = 0;
- }
- opts = xtend(defaultOpts, opts);
- if (Array.isArray(obj)) {
- obj.forEach(function (topic) {
- if (!that._resubscribeTopics.hasOwnProperty(topic) || that._resubscribeTopics[topic].qos < opts.qos || resubscribe) {
- var currentOpts = {
- topic: topic,
- qos: opts.qos
- };
- if (version === 5) {
- currentOpts.nl = opts.nl;
- currentOpts.rap = opts.rap;
- currentOpts.rh = opts.rh;
- currentOpts.properties = opts.properties;
- }
- subs.push(currentOpts);
- }
- });
- } else {
- Object.keys(obj).forEach(function (k) {
- if (!that._resubscribeTopics.hasOwnProperty(k) || that._resubscribeTopics[k].qos < obj[k].qos || resubscribe) {
- var currentOpts = {
- topic: k,
- qos: obj[k].qos
- };
- if (version === 5) {
- currentOpts.nl = obj[k].nl;
- currentOpts.rap = obj[k].rap;
- currentOpts.rh = obj[k].rh;
- currentOpts.properties = opts.properties;
- }
- subs.push(currentOpts);
- }
- });
- }
- packet = {
- cmd: "subscribe",
- subscriptions: subs,
- qos: 1,
- retain: false,
- dup: false,
- messageId: this._nextId()
- };
- if (opts.properties) {
- packet.properties = opts.properties;
- }
- if (!subs.length) {
- callback(null, []);
- return;
- }
- if (this.options.resubscribe) {
- var topics = [];
- subs.forEach(function (sub) {
- if (that.options.reconnectPeriod > 0) {
- var topic = {
- qos: sub.qos
- };
- if (version === 5) {
- topic.nl = sub.nl || false;
- topic.rap = sub.rap || false;
- topic.rh = sub.rh || 0;
- topic.properties = sub.properties;
- }
- that._resubscribeTopics[sub.topic] = topic;
- topics.push(sub.topic);
- }
- });
- that.messageIdToTopic[packet.messageId] = topics;
- }
- this.outgoing[packet.messageId] = {
- volatile: true,
- cb: function cb(err, packet) {
- if (!err) {
- var granted = packet.granted;
- for (var i = 0; i < granted.length; i += 1) {
- subs[i].qos = granted[i];
- }
- }
- callback(err, subs);
- }
- };
- this._sendPacket(packet);
- return this;
- };
- MqttClient.prototype.unsubscribe = function () {
- var packet = {
- cmd: "unsubscribe",
- qos: 1,
- messageId: this._nextId()
- };
- var that = this;
- var args = new Array(arguments.length);
- for (var i = 0; i < arguments.length; i++) {
- args[i] = arguments[i];
- }
- var topic = args.shift();
- var callback = args.pop() || nop;
- var opts = args.pop();
- if (typeof topic === "string") {
- topic = [topic];
- }
- if (typeof callback !== "function") {
- opts = callback;
- callback = nop;
- }
- if (this._checkDisconnecting(callback)) {
- return this;
- }
- if (typeof topic === "string") {
- packet.unsubscriptions = [topic];
- } else if (_typeof(topic) === "object" && topic.length) {
- packet.unsubscriptions = topic;
- }
- if (this.options.resubscribe) {
- packet.unsubscriptions.forEach(function (topic) {
- delete that._resubscribeTopics[topic];
- });
- }
- if (_typeof(opts) === "object" && opts.properties) {
- packet.properties = opts.properties;
- }
- this.outgoing[packet.messageId] = {
- volatile: true,
- cb: callback
- };
- this._sendPacket(packet);
- return this;
- };
- MqttClient.prototype.end = function () {
- var that = this;
- var force = arguments[0];
- var opts = arguments[1];
- var cb = arguments[2];
- if (force == null || typeof force !== "boolean") {
- cb = opts || nop;
- opts = force;
- force = false;
- if (_typeof(opts) !== "object") {
- cb = opts;
- opts = null;
- if (typeof cb !== "function") {
- cb = nop;
- }
- }
- }
- if (_typeof(opts) !== "object") {
- cb = opts;
- opts = null;
- }
- cb = cb || nop;
- function closeStores() {
- that.disconnected = true;
- that.incomingStore.close(function () {
- that.outgoingStore.close(function () {
- if (cb) {
- cb.apply(null, arguments);
- }
- that.emit("end");
- });
- });
- if (that._deferredReconnect) {
- that._deferredReconnect();
- }
- }
- function finish() {
- that._cleanUp(force, setImmediate.bind(null, closeStores), opts);
- }
- if (this.disconnecting) {
- return this;
- }
- this._clearReconnect();
- this.disconnecting = true;
- if (!force && Object.keys(this.outgoing).length > 0) {
- this.once("outgoingEmpty", setTimeout.bind(null, finish, 10));
- } else {
- finish();
- }
- return this;
- };
- MqttClient.prototype.removeOutgoingMessage = function (mid) {
- var cb = this.outgoing[mid] ? this.outgoing[mid].cb : null;
- delete this.outgoing[mid];
- this.outgoingStore.del({
- messageId: mid
- }, function () {
- cb(new Error("Message removed"));
- });
- return this;
- };
- MqttClient.prototype.reconnect = function (opts) {
- var that = this;
- var f = function f() {
- if (opts) {
- that.options.incomingStore = opts.incomingStore;
- that.options.outgoingStore = opts.outgoingStore;
- } else {
- that.options.incomingStore = null;
- that.options.outgoingStore = null;
- }
- that.incomingStore = that.options.incomingStore || new Store();
- that.outgoingStore = that.options.outgoingStore || new Store();
- that.disconnecting = false;
- that.disconnected = false;
- that._deferredReconnect = null;
- that._reconnect();
- };
- if (this.disconnecting && !this.disconnected) {
- this._deferredReconnect = f;
- } else {
- f();
- }
- return this;
- };
- MqttClient.prototype._reconnect = function () {
- this.emit("reconnect");
- this._setupStream();
- };
- MqttClient.prototype._setupReconnect = function () {
- var that = this;
- if (!that.disconnecting && !that.reconnectTimer && that.options.reconnectPeriod > 0) {
- if (!this.reconnecting) {
- this.emit("offline");
- this.reconnecting = true;
- }
- that.reconnectTimer = setInterval(function () {
- that._reconnect();
- }, that.options.reconnectPeriod);
- }
- };
- MqttClient.prototype._clearReconnect = function () {
- if (this.reconnectTimer) {
- clearInterval(this.reconnectTimer);
- this.reconnectTimer = null;
- }
- };
- MqttClient.prototype._cleanUp = function (forced, done) {
- var opts = arguments[2];
- if (done) {
- this.stream.on("close", done);
- }
- if (forced) {
- if (this.options.reconnectPeriod === 0 && this.options.clean) {
- flush(this.outgoing);
- }
- this.stream.destroy();
- } else {
- var packet = xtend({
- cmd: "disconnect"
- }, opts);
- this._sendPacket(packet, setImmediate.bind(null, this.stream.end.bind(this.stream)));
- }
- if (!this.disconnecting) {
- this._clearReconnect();
- this._setupReconnect();
- }
- if (this.pingTimer !== null) {
- this.pingTimer.clear();
- this.pingTimer = null;
- }
- if (done && !this.connected) {
- this.stream.removeListener("close", done);
- done();
- }
- };
- MqttClient.prototype._sendPacket = function (packet, cb, cbStorePut) {
- cbStorePut = cbStorePut || nop;
- if (!this.connected) {
- this._storePacket(packet, cb, cbStorePut);
- return;
- }
- this._shiftPingInterval();
- switch (packet.cmd) {
- case "publish":
- break;
- case "pubrel":
- storeAndSend(this, packet, cb, cbStorePut);
- return;
- default:
- sendPacket(this, packet, cb);
- return;
- }
- switch (packet.qos) {
- case 2:
- case 1:
- storeAndSend(this, packet, cb, cbStorePut);
- break;
- case 0:
- default:
- sendPacket(this, packet, cb);
- break;
- }
- };
- MqttClient.prototype._storePacket = function (packet, cb, cbStorePut) {
- cbStorePut = cbStorePut || nop;
- if ((packet.qos || 0) === 0 && this.queueQoSZero || packet.cmd !== "publish") {
- this.queue.push({
- packet: packet,
- cb: cb
- });
- } else if (packet.qos > 0) {
- cb = this.outgoing[packet.messageId] ? this.outgoing[packet.messageId].cb : null;
- this.outgoingStore.put(packet, function (err) {
- if (err) {
- return cb && cb(err);
- }
- cbStorePut();
- });
- } else if (cb) {
- cb(new Error("No connection to broker"));
- }
- };
- MqttClient.prototype._setupPingTimer = function () {
- var that = this;
- if (!this.pingTimer && this.options.keepalive) {
- this.pingResp = true;
- this.pingTimer = reInterval(function () {
- that._checkPing();
- }, this.options.keepalive * 1e3);
- }
- };
- MqttClient.prototype._shiftPingInterval = function () {
- if (this.pingTimer && this.options.keepalive && this.options.reschedulePings) {
- this.pingTimer.reschedule(this.options.keepalive * 1e3);
- }
- };
- MqttClient.prototype._checkPing = function () {
- if (this.pingResp) {
- this.pingResp = false;
- this._sendPacket({
- cmd: "pingreq"
- });
- } else {
- this._cleanUp(true);
- }
- };
- MqttClient.prototype._handlePingresp = function () {
- this.pingResp = true;
- };
- MqttClient.prototype._handleConnack = function (packet) {
- var options = this.options;
- var version = options.protocolVersion;
- var rc = version === 5 ? packet.reasonCode : packet.returnCode;
- clearTimeout(this.connackTimer);
- if (packet.properties) {
- if (packet.properties.topicAliasMaximum) {
- if (!options.properties) {
- options.properties = {};
- }
- options.properties.topicAliasMaximum = packet.properties.topicAliasMaximum;
- }
- if (packet.properties.serverKeepAlive && options.keepalive) {
- options.keepalive = packet.properties.serverKeepAlive;
- this._shiftPingInterval();
- }
- if (packet.properties.maximumPacketSize) {
- if (!options.properties) {
- options.properties = {};
- }
- options.properties.maximumPacketSize = packet.properties.maximumPacketSize;
- }
- }
- if (rc === 0) {
- this.reconnecting = false;
- this._onConnect(packet);
- } else if (rc > 0) {
- var err = new Error("Connection refused: " + errors[rc]);
- err.code = rc;
- this.emit("error", err);
- }
- };
- MqttClient.prototype._handlePublish = function (packet, done) {
- done = typeof done !== "undefined" ? done : nop;
- var topic = packet.topic.toString();
- var message = packet.payload;
- var qos = packet.qos;
- var mid = packet.messageId;
- var that = this;
- var options = this.options;
- var validReasonCodes = [0, 16, 128, 131, 135, 144, 145, 151, 153];
- switch (qos) {
- case 2:
- {
- options.customHandleAcks(topic, message, packet, function (error, code) {
- if (!(error instanceof Error)) {
- code = error;
- error = null;
- }
- if (error) {
- return that.emit("error", error);
- }
- if (validReasonCodes.indexOf(code) === -1) {
- return that.emit("error", new Error("Wrong reason code for pubrec"));
- }
- if (code) {
- that._sendPacket({
- cmd: "pubrec",
- messageId: mid,
- reasonCode: code
- }, done);
- } else {
- that.incomingStore.put(packet, function () {
- that._sendPacket({
- cmd: "pubrec",
- messageId: mid
- }, done);
- });
- }
- });
- break;
- }
- case 1:
- {
- options.customHandleAcks(topic, message, packet, function (error, code) {
- if (!(error instanceof Error)) {
- code = error;
- error = null;
- }
- if (error) {
- return that.emit("error", error);
- }
- if (validReasonCodes.indexOf(code) === -1) {
- return that.emit("error", new Error("Wrong reason code for puback"));
- }
- if (!code) {
- that.emit("message", topic, message, packet);
- }
- that.handleMessage(packet, function (err) {
- if (err) {
- return done && done(err);
- }
- that._sendPacket({
- cmd: "puback",
- messageId: mid,
- reasonCode: code
- }, done);
- });
- });
- break;
- }
- case 0:
- this.emit("message", topic, message, packet);
- this.handleMessage(packet, done);
- break;
- default:
- break;
- }
- };
- MqttClient.prototype.handleMessage = function (packet, callback) {
- callback();
- };
- MqttClient.prototype._handleAck = function (packet) {
- var mid = packet.messageId;
- var type = packet.cmd;
- var response = null;
- var cb = this.outgoing[mid] ? this.outgoing[mid].cb : null;
- var that = this;
- var err;
- if (!cb) {
- return;
- }
- switch (type) {
- case "pubcomp":
- case "puback":
- var pubackRC = packet.reasonCode;
- if (pubackRC && pubackRC > 0 && pubackRC !== 16) {
- err = new Error("Publish error: " + errors[pubackRC]);
- err.code = pubackRC;
- cb(err, packet);
- }
- delete this.outgoing[mid];
- this.outgoingStore.del(packet, cb);
- break;
- case "pubrec":
- response = {
- cmd: "pubrel",
- qos: 2,
- messageId: mid
- };
- var pubrecRC = packet.reasonCode;
- if (pubrecRC && pubrecRC > 0 && pubrecRC !== 16) {
- err = new Error("Publish error: " + errors[pubrecRC]);
- err.code = pubrecRC;
- cb(err, packet);
- } else {
- this._sendPacket(response);
- }
- break;
- case "suback":
- delete this.outgoing[mid];
- for (var grantedI = 0; grantedI < packet.granted.length; grantedI++) {
- if ((packet.granted[grantedI] & 128) !== 0) {
- var topics = this.messageIdToTopic[mid];
- if (topics) {
- topics.forEach(function (topic) {
- delete that._resubscribeTopics[topic];
- });
- }
- }
- }
- cb(null, packet);
- break;
- case "unsuback":
- delete this.outgoing[mid];
- cb(null);
- break;
- default:
- that.emit("error", new Error("unrecognized packet type"));
- }
- if (this.disconnecting && Object.keys(this.outgoing).length === 0) {
- this.emit("outgoingEmpty");
- }
- };
- MqttClient.prototype._handlePubrel = function (packet, callback) {
- callback = typeof callback !== "undefined" ? callback : nop;
- var mid = packet.messageId;
- var that = this;
- var comp = {
- cmd: "pubcomp",
- messageId: mid
- };
- that.incomingStore.get(packet, function (err, pub) {
- if (!err) {
- that.emit("message", pub.topic, pub.payload, pub);
- that.handleMessage(pub, function (err) {
- if (err) {
- return callback(err);
- }
- that.incomingStore.del(pub, nop);
- that._sendPacket(comp, callback);
- });
- } else {
- that._sendPacket(comp, callback);
- }
- });
- };
- MqttClient.prototype._handleDisconnect = function (packet) {
- this.emit("disconnect", packet);
- };
- MqttClient.prototype._nextId = function () {
- var id = this.nextId++;
- if (this.nextId === 65536) {
- this.nextId = 1;
- }
- return id;
- };
- MqttClient.prototype.getLastMessageId = function () {
- return this.nextId === 1 ? 65535 : this.nextId - 1;
- };
- MqttClient.prototype._resubscribe = function (connack) {
- var _resubscribeTopicsKeys = Object.keys(this._resubscribeTopics);
- if (!this._firstConnection && (this.options.clean || this.options.protocolVersion === 5 && !connack.sessionPresent) && _resubscribeTopicsKeys.length > 0) {
- if (this.options.resubscribe) {
- if (this.options.protocolVersion === 5) {
- for (var topicI = 0; topicI < _resubscribeTopicsKeys.length; topicI++) {
- var resubscribeTopic = {};
- resubscribeTopic[_resubscribeTopicsKeys[topicI]] = this._resubscribeTopics[_resubscribeTopicsKeys[topicI]];
- resubscribeTopic.resubscribe = true;
- this.subscribe(resubscribeTopic, {
- properties: resubscribeTopic[_resubscribeTopicsKeys[topicI]].properties
- });
- }
- } else {
- this._resubscribeTopics.resubscribe = true;
- this.subscribe(this._resubscribeTopics);
- }
- } else {
- this._resubscribeTopics = {};
- }
- }
- this._firstConnection = false;
- };
- MqttClient.prototype._onConnect = function (packet) {
- if (this.disconnected) {
- this.emit("connect", packet);
- return;
- }
- var that = this;
- this._setupPingTimer();
- this._resubscribe(packet);
- this.connected = true;
- function startStreamProcess() {
- var outStore = that.outgoingStore.createStream();
- function clearStoreProcessing() {
- that._storeProcessing = false;
- that._packetIdsDuringStoreProcessing = {};
- }
- that.once("close", remove);
- outStore.on("error", function (err) {
- clearStoreProcessing();
- that.removeListener("close", remove);
- that.emit("error", err);
- });
- function remove() {
- outStore.destroy();
- outStore = null;
- clearStoreProcessing();
- }
- function storeDeliver() {
- if (!outStore) {
- return;
- }
- that._storeProcessing = true;
- var packet = outStore.read(1);
- var _cb;
- if (!packet) {
- outStore.once("readable", storeDeliver);
- return;
- }
- if (that._packetIdsDuringStoreProcessing[packet.messageId]) {
- storeDeliver();
- return;
- }
- if (!that.disconnecting && !that.reconnectTimer) {
- _cb = that.outgoing[packet.messageId] ? that.outgoing[packet.messageId].cb : null;
- that.outgoing[packet.messageId] = {
- volatile: false,
- cb: function cb(err, status) {
- if (_cb) {
- _cb(err, status);
- }
- storeDeliver();
- }
- };
- that._packetIdsDuringStoreProcessing[packet.messageId] = true;
- that._sendPacket(packet);
- } else if (outStore.destroy) {
- outStore.destroy();
- }
- }
- outStore.on("end", function () {
- var allProcessed = true;
- for (var id in that._packetIdsDuringStoreProcessing) {
- if (!that._packetIdsDuringStoreProcessing[id]) {
- allProcessed = false;
- break;
- }
- }
- if (allProcessed) {
- clearStoreProcessing();
- that.removeListener("close", remove);
- that.emit("connect", packet);
- } else {
- startStreamProcess();
- }
- });
- storeDeliver();
- }
- startStreamProcess();
- };
- module.exports = MqttClient;
- }).call(this, require("_process"), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
- }, {
- "./store": 7,
- "./validations": 8,
- _process: 92,
- events: 13,
- inherits: 80,
- "mqtt-packet": 84,
- "readable-stream": 108,
- reinterval: 109,
- xtend: 121
- }],
- 2: [function (require, module, exports) {
- (function (Buffer) {
- "use strict";
- var Transform = require("readable-stream").Transform;
- var duplexify = require("duplexify");
- var base64 = require("base64-js");
- var my;
- var proxy;
- var stream;
- var isInitialized = false;
- function buildProxy() {
- var proxy = new Transform();
- proxy._write = function (chunk, encoding, next) {
- my.sendSocketMessage({
- data: chunk.buffer,
- success: function success() {
- next();
- },
- fail: function fail() {
- next(new Error());
- }
- });
- };
- proxy._flush = function socketEnd(done) {
- my.closeSocket({
- success: function success() {
- done();
- }
- });
- };
- return proxy;
- }
- function setDefaultOpts(opts) {
- if (!opts.hostname) {
- opts.hostname = "localhost";
- }
- if (!opts.path) {
- opts.path = "/";
- }
- if (!opts.wsOptions) {
- opts.wsOptions = {};
- }
- }
- function buildUrl(opts, client) {
- var protocol = opts.protocol === "alis" ? "wss" : "ws";
- var url = protocol + "://" + opts.hostname + opts.path;
- if (opts.port && opts.port !== 80 && opts.port !== 443) {
- url = protocol + "://" + opts.hostname + ":" + opts.port + opts.path;
- }
- if (typeof opts.transformWsUrl === "function") {
- url = opts.transformWsUrl(url, opts, client);
- }
- return url;
- }
- function bindEventHandler() {
- if (isInitialized) return;
- isInitialized = true;
- my.onSocketOpen(function () {
- stream.setReadable(proxy);
- stream.setWritable(proxy);
- stream.emit("connect");
- });
- my.onSocketMessage(function (res) {
- if (typeof res.data === "string") {
- var array = base64.toByteArray(res.data);
- var buffer = Buffer.from(array);
- proxy.push(buffer);
- } else {
- var reader = new FileReader();
- reader.addEventListener("load", function () {
- var data = reader.result;
- if (data instanceof ArrayBuffer) data = Buffer.from(data);else data = Buffer.from(data, "utf8");
- proxy.push(data);
- });
- reader.readAsArrayBuffer(res.data);
- }
- });
- my.onSocketClose(function () {
- stream.end();
- stream.destroy();
- });
- my.onSocketError(function (res) {
- stream.destroy(res);
- });
- }
- function buildStream(client, opts) {
- opts.hostname = opts.hostname || opts.host;
- if (!opts.hostname) {
- throw new Error("Could not determine host. Specify host manually.");
- }
- var websocketSubProtocol = opts.protocolId === "MQIsdp" && opts.protocolVersion === 3 ? "mqttv3.1" : "mqtt";
- setDefaultOpts(opts);
- var url = buildUrl(opts, client);
- my = opts.my;
- my.connectSocket({
- url: url,
- protocols: websocketSubProtocol
- });
- proxy = buildProxy();
- stream = duplexify.obj();
- bindEventHandler();
- return stream;
- }
- module.exports = buildStream;
- }).call(this, require("buffer").Buffer);
- }, {
- "base64-js": 10,
- buffer: 12,
- duplexify: 17,
- "readable-stream": 108
- }],
- 3: [function (require, module, exports) {
- "use strict";
- var net = require("net");
- function buildBuilder(client, opts) {
- var port, host;
- opts.port = opts.port || 1883;
- opts.hostname = opts.hostname || opts.host || "localhost";
- port = opts.port;
- host = opts.hostname;
- return net.createConnection(port, host);
- }
- module.exports = buildBuilder;
- }, {
- net: 11
- }],
- 4: [function (require, module, exports) {
- "use strict";
- var tls = require("tls");
- function buildBuilder(mqttClient, opts) {
- var connection;
- opts.port = opts.port || 8883;
- opts.host = opts.hostname || opts.host || "localhost";
- opts.rejectUnauthorized = opts.rejectUnauthorized !== false;
- delete opts.path;
- connection = tls.connect(opts);
- connection.on("secureConnect", function () {
- if (opts.rejectUnauthorized && !connection.authorized) {
- connection.emit("error", new Error("TLS not authorized"));
- } else {
- connection.removeListener("error", handleTLSerrors);
- }
- });
- function handleTLSerrors(err) {
- if (opts.rejectUnauthorized) {
- mqttClient.emit("error", err);
- }
- connection.end();
- }
- connection.on("error", handleTLSerrors);
- return connection;
- }
- module.exports = buildBuilder;
- }, {
- tls: 11
- }],
- 5: [function (require, module, exports) {
- (function (process) {
- "use strict";
- var websocket = require("websocket-stream");
- var urlModule = require("url");
- var WSS_OPTIONS = ["rejectUnauthorized", "ca", "cert", "key", "pfx", "passphrase"];
- var IS_BROWSER = process.title === "browser";
- function buildUrl(opts, client) {
- var url = opts.protocol + "://" + opts.hostname + ":" + opts.port + opts.path;
- if (typeof opts.transformWsUrl === "function") {
- url = opts.transformWsUrl(url, opts, client);
- }
- return url;
- }
- function setDefaultOpts(opts) {
- if (!opts.hostname) {
- opts.hostname = "localhost";
- }
- if (!opts.port) {
- if (opts.protocol === "wss") {
- opts.port = 443;
- } else {
- opts.port = 80;
- }
- }
- if (!opts.path) {
- opts.path = "/";
- }
- if (!opts.wsOptions) {
- opts.wsOptions = {};
- }
- if (!IS_BROWSER && opts.protocol === "wss") {
- WSS_OPTIONS.forEach(function (prop) {
- if (opts.hasOwnProperty(prop) && !opts.wsOptions.hasOwnProperty(prop)) {
- opts.wsOptions[prop] = opts[prop];
- }
- });
- }
- }
- function createWebSocket(client, opts) {
- var websocketSubProtocol = opts.protocolId === "MQIsdp" && opts.protocolVersion === 3 ? "mqttv3.1" : "mqtt";
- setDefaultOpts(opts);
- var url = buildUrl(opts, client);
- return websocket(url, [websocketSubProtocol], opts.wsOptions);
- }
- function buildBuilder(client, opts) {
- return createWebSocket(client, opts);
- }
- function buildBuilderBrowser(client, opts) {
- if (!opts.hostname) {
- opts.hostname = opts.host;
- }
- if (!opts.hostname) {
- if (typeof document === "undefined") {
- throw new Error("Could not determine host. Specify host manually.");
- }
- var parsed = urlModule.parse(document.URL);
- opts.hostname = parsed.hostname;
- if (!opts.port) {
- opts.port = parsed.port;
- }
- }
- return createWebSocket(client, opts);
- }
- if (IS_BROWSER) {
- module.exports = buildBuilderBrowser;
- } else {
- module.exports = buildBuilder;
- }
- }).call(this, require("_process"));
- }, {
- _process: 92,
- url: 113,
- "websocket-stream": 118
- }],
- 6: [function (require, module, exports) {
- (function (process, Buffer) {
- "use strict";
- var Transform = require("readable-stream").Transform;
- var duplexify = require("duplexify");
- var socketTask;
- var proxy;
- var stream;
- function buildProxy() {
- var proxy = new Transform();
- proxy._write = function (chunk, encoding, next) {
- socketTask.send({
- data: chunk.buffer,
- success: function success() {
- next();
- },
- fail: function fail(errMsg) {
- next(new Error(errMsg));
- }
- });
- };
- proxy._flush = function socketEnd(done) {
- socketTask.close({
- success: function success() {
- done();
- }
- });
- };
- return proxy;
- }
- function setDefaultOpts(opts) {
- if (!opts.hostname) {
- opts.hostname = "localhost";
- }
- if (!opts.path) {
- opts.path = "/";
- }
- if (!opts.wsOptions) {
- opts.wsOptions = {};
- }
- }
- function buildUrl(opts, client) {
- var protocol = opts.protocol === "wxs" ? "wss" : "ws";
- var url = protocol + "://" + opts.hostname + opts.path;
- if (opts.port && opts.port !== 80 && opts.port !== 443) {
- url = protocol + "://" + opts.hostname + ":" + opts.port + opts.path;
- }
- if (typeof opts.transformWsUrl === "function") {
- url = opts.transformWsUrl(url, opts, client);
- }
- return url;
- }
- function bindEventHandler() {
- socketTask.onOpen(function () {
- stream.setReadable(proxy);
- stream.setWritable(proxy);
- stream.emit("connect");
- });
- socketTask.onMessage(function (res) {
- var data = res.data;
- if (data instanceof ArrayBuffer) data = Buffer.from(data);else data = Buffer.from(data, "utf8");
- proxy.push(data);
- });
- socketTask.onClose(function () {
- stream.end();
- stream.destroy();
- });
- socketTask.onError(function (res) {
- stream.destroy(new Error(res.errMsg));
- });
- }
- function buildStream(client, opts) {
- opts.hostname = opts.hostname || opts.host;
- if (!opts.hostname) {
- throw new Error("Could not determine host. Specify host manually.");
- }
- var websocketSubProtocol = opts.protocolId === "MQIsdp" && opts.protocolVersion === 3 ? "mqttv3.1" : "mqtt";
- setDefaultOpts(opts);
- var url = buildUrl(opts, client);
- socketTask = wx.connectSocket({
- url: url,
- protocols: websocketSubProtocol
- });
- proxy = buildProxy();
- stream = duplexify.obj();
- stream._destroy = function (err, cb) {
- socketTask.close({
- success: function success() {
- cb && cb(err);
- }
- });
- };
- var destroyRef = stream.destroy;
- stream.destroy = function () {
- stream.destroy = destroyRef;
- var self = this;
- process.nextTick(function () {
- socketTask.close({
- fail: function fail() {
- self._destroy(new Error());
- }
- });
- });
- }.bind(stream);
- bindEventHandler();
- return stream;
- }
- module.exports = buildStream;
- }).call(this, require("_process"), require("buffer").Buffer);
- }, {
- _process: 92,
- buffer: 12,
- duplexify: 17,
- "readable-stream": 108
- }],
- 7: [function (require, module, exports) {
- (function (process) {
- "use strict";
- var xtend = require("xtend");
- var Readable = require("readable-stream").Readable;
- var streamsOpts = {
- objectMode: true
- };
- var defaultStoreOptions = {
- clean: true
- };
- var Map = require("es6-map");
- function Store(options) {
- if (!(this instanceof Store)) {
- return new Store(options);
- }
- this.options = options || {};
- this.options = xtend(defaultStoreOptions, options);
- this._inflights = new Map();
- }
- Store.prototype.put = function (packet, cb) {
- this._inflights.set(packet.messageId, packet);
- if (cb) {
- cb();
- }
- return this;
- };
- Store.prototype.createStream = function () {
- var stream = new Readable(streamsOpts);
- var destroyed = false;
- var values = [];
- var i = 0;
- this._inflights.forEach(function (value, key) {
- values.push(value);
- });
- stream._read = function () {
- if (!destroyed && i < values.length) {
- this.push(values[i++]);
- } else {
- this.push(null);
- }
- };
- stream.destroy = function () {
- if (destroyed) {
- return;
- }
- var self = this;
- destroyed = true;
- process.nextTick(function () {
- self.emit("close");
- });
- };
- return stream;
- };
- Store.prototype.del = function (packet, cb) {
- packet = this._inflights.get(packet.messageId);
- if (packet) {
- this._inflights.delete(packet.messageId);
- cb(null, packet);
- } else if (cb) {
- cb(new Error("missing packet"));
- }
- return this;
- };
- Store.prototype.get = function (packet, cb) {
- packet = this._inflights.get(packet.messageId);
- if (packet) {
- cb(null, packet);
- } else if (cb) {
- cb(new Error("missing packet"));
- }
- return this;
- };
- Store.prototype.close = function (cb) {
- if (this.options.clean) {
- this._inflights = null;
- }
- if (cb) {
- cb();
- }
- };
- module.exports = Store;
- }).call(this, require("_process"));
- }, {
- _process: 92,
- "es6-map": 67,
- "readable-stream": 108,
- xtend: 121
- }],
- 8: [function (require, module, exports) {
- "use strict";
- function validateTopic(topic) {
- var parts = topic.split("/");
- for (var i = 0; i < parts.length; i++) {
- if (parts[i] === "+") {
- continue;
- }
- if (parts[i] === "#") {
- return i === parts.length - 1;
- }
- if (parts[i].indexOf("+") !== -1 || parts[i].indexOf("#") !== -1) {
- return false;
- }
- }
- return true;
- }
- function validateTopics(topics) {
- if (topics.length === 0) {
- return "empty_topic_list";
- }
- for (var i = 0; i < topics.length; i++) {
- if (!validateTopic(topics[i])) {
- return topics[i];
- }
- }
- return null;
- }
- module.exports = {
- validateTopics: validateTopics
- };
- }, {}],
- 9: [function (require, module, exports) {
- (function (process) {
- "use strict";
- var MqttClient = require("../client");
- var Store = require("../store");
- var url = require("url");
- var xtend = require("xtend");
- var protocols = {};
- if (process.title !== "browser") {
- protocols.mqtt = require("./tcp");
- protocols.tcp = require("./tcp");
- protocols.ssl = require("./tls");
- protocols.tls = require("./tls");
- protocols.mqtts = require("./tls");
- } else {
- protocols.wx = require("./wx");
- protocols.wxs = require("./wx");
- protocols.ali = require("./ali");
- protocols.alis = require("./ali");
- }
- protocols.ws = require("./ws");
- protocols.wss = require("./ws");
- function parseAuthOptions(opts) {
- var matches;
- if (opts.auth) {
- matches = opts.auth.match(/^(.+):(.+)$/);
- if (matches) {
- opts.username = matches[1];
- opts.password = matches[2];
- } else {
- opts.username = opts.auth;
- }
- }
- }
- function connect(brokerUrl, opts) {
- if (_typeof(brokerUrl) === "object" && !opts) {
- opts = brokerUrl;
- brokerUrl = null;
- }
- opts = opts || {};
- if (brokerUrl) {
- var parsed = url.parse(brokerUrl, true);
- if (parsed.port != null) {
- parsed.port = Number(parsed.port);
- }
- opts = xtend(parsed, opts);
- if (opts.protocol === null) {
- throw new Error("Missing protocol");
- }
- opts.protocol = opts.protocol.replace(/:$/, "");
- }
- parseAuthOptions(opts);
- if (opts.query && typeof opts.query.clientId === "string") {
- opts.clientId = opts.query.clientId;
- }
- if (opts.cert && opts.key) {
- if (opts.protocol) {
- if (["mqtts", "wss", "wxs", "alis"].indexOf(opts.protocol) === -1) {
- switch (opts.protocol) {
- case "mqtt":
- opts.protocol = "mqtts";
- break;
- case "ws":
- opts.protocol = "wss";
- break;
- case "wx":
- opts.protocol = "wxs";
- break;
- case "ali":
- opts.protocol = "alis";
- break;
- default:
- throw new Error('Unknown protocol for secure connection: "' + opts.protocol + '"!');
- }
- }
- } else {
- throw new Error("Missing secure protocol key");
- }
- }
- if (!protocols[opts.protocol]) {
- var isSecure = ["mqtts", "wss"].indexOf(opts.protocol) !== -1;
- opts.protocol = ["mqtt", "mqtts", "ws", "wss", "wx", "wxs", "ali", "alis"].filter(function (key, index) {
- if (isSecure && index % 2 === 0) {
- return false;
- }
- return typeof protocols[key] === "function";
- })[0];
- }
- if (opts.clean === false && !opts.clientId) {
- throw new Error("Missing clientId for unclean clients");
- }
- if (opts.protocol) {
- opts.defaultProtocol = opts.protocol;
- }
- function wrapper(client) {
- if (opts.servers) {
- if (!client._reconnectCount || client._reconnectCount === opts.servers.length) {
- client._reconnectCount = 0;
- }
- opts.host = opts.servers[client._reconnectCount].host;
- opts.port = opts.servers[client._reconnectCount].port;
- opts.protocol = !opts.servers[client._reconnectCount].protocol ? opts.defaultProtocol : opts.servers[client._reconnectCount].protocol;
- opts.hostname = opts.host;
- client._reconnectCount++;
- }
- return protocols[opts.protocol](client, opts);
- }
- return new MqttClient(wrapper, opts);
- }
- module.exports = connect;
- module.exports.connect = connect;
- module.exports.MqttClient = MqttClient;
- module.exports.Store = Store;
- }).call(this, require("_process"));
- }, {
- "../client": 1,
- "../store": 7,
- "./ali": 2,
- "./tcp": 3,
- "./tls": 4,
- "./ws": 5,
- "./wx": 6,
- _process: 92,
- url: 113,
- xtend: 121
- }],
- 10: [function (require, module, exports) {
- "use strict";
- exports.byteLength = byteLength;
- exports.toByteArray = toByteArray;
- exports.fromByteArray = fromByteArray;
- var lookup = [];
- var revLookup = [];
- var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array;
- var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
- for (var i = 0, len = code.length; i < len; ++i) {
- lookup[i] = code[i];
- revLookup[code.charCodeAt(i)] = i;
- }
- revLookup["-".charCodeAt(0)] = 62;
- revLookup["_".charCodeAt(0)] = 63;
- function getLens(b64) {
- var len = b64.length;
- if (len % 4 > 0) {
- throw new Error("Invalid string. Length must be a multiple of 4");
- }
- var validLen = b64.indexOf("=");
- if (validLen === -1) validLen = len;
- var placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4;
- return [validLen, placeHoldersLen];
- }
- function byteLength(b64) {
- var lens = getLens(b64);
- var validLen = lens[0];
- var placeHoldersLen = lens[1];
- return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
- }
- function _byteLength(b64, validLen, placeHoldersLen) {
- return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
- }
- function toByteArray(b64) {
- var tmp;
- var lens = getLens(b64);
- var validLen = lens[0];
- var placeHoldersLen = lens[1];
- var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));
- var curByte = 0;
- var len = placeHoldersLen > 0 ? validLen - 4 : validLen;
- for (var i = 0; i < len; i += 4) {
- tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];
- arr[curByte++] = tmp >> 16 & 255;
- arr[curByte++] = tmp >> 8 & 255;
- arr[curByte++] = tmp & 255;
- }
- if (placeHoldersLen === 2) {
- tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4;
- arr[curByte++] = tmp & 255;
- }
- if (placeHoldersLen === 1) {
- tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2;
- arr[curByte++] = tmp >> 8 & 255;
- arr[curByte++] = tmp & 255;
- }
- return arr;
- }
- function tripletToBase64(num) {
- return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];
- }
- function encodeChunk(uint8, start, end) {
- var tmp;
- var output = [];
- for (var i = start; i < end; i += 3) {
- tmp = (uint8[i] << 16 & 16711680) + (uint8[i + 1] << 8 & 65280) + (uint8[i + 2] & 255);
- output.push(tripletToBase64(tmp));
- }
- return output.join("");
- }
- function fromByteArray(uint8) {
- var tmp;
- var len = uint8.length;
- var extraBytes = len % 3;
- var parts = [];
- var maxChunkLength = 16383;
- for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
- parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength));
- }
- if (extraBytes === 1) {
- tmp = uint8[len - 1];
- parts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 63] + "==");
- } else if (extraBytes === 2) {
- tmp = (uint8[len - 2] << 8) + uint8[len - 1];
- parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "=");
- }
- return parts.join("");
- }
- }, {}],
- 11: [function (require, module, exports) {}, {}],
- 12: [function (require, module, exports) {
- "use strict";
- var base64 = require("base64-js");
- var ieee754 = require("ieee754");
- exports.Buffer = Buffer;
- exports.SlowBuffer = SlowBuffer;
- exports.INSPECT_MAX_BYTES = 50;
- var K_MAX_LENGTH = 2147483647;
- exports.kMaxLength = K_MAX_LENGTH;
- Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport();
- if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") {
- console.error("This browser lacks typed array (Uint8Array) support which is required by " + "`buffer` v5.x. Use `buffer` v4.x if you require old browser support.");
- }
- function typedArraySupport() {
- try {
- var arr = new Uint8Array(1);
- arr.__proto__ = {
- __proto__: Uint8Array.prototype,
- foo: function foo() {
- return 42;
- }
- };
- return arr.foo() === 42;
- } catch (e) {
- return false;
- }
- }
- Object.defineProperty(Buffer.prototype, "parent", {
- enumerable: true,
- get: function get() {
- if (!Buffer.isBuffer(this)) return undefined;
- return this.buffer;
- }
- });
- Object.defineProperty(Buffer.prototype, "offset", {
- enumerable: true,
- get: function get() {
- if (!Buffer.isBuffer(this)) return undefined;
- return this.byteOffset;
- }
- });
- function createBuffer(length) {
- if (length > K_MAX_LENGTH) {
- throw new RangeError('The value "' + length + '" is invalid for option "size"');
- }
- var buf = new Uint8Array(length);
- buf.__proto__ = Buffer.prototype;
- return buf;
- }
- function Buffer(arg, encodingOrOffset, length) {
- if (typeof arg === "number") {
- if (typeof encodingOrOffset === "string") {
- throw new TypeError('The "string" argument must be of type string. Received type number');
- }
- return allocUnsafe(arg);
- }
- return from(arg, encodingOrOffset, length);
- }
- if (typeof Symbol !== "undefined" && Symbol.species != null && Buffer[Symbol.species] === Buffer) {
- Object.defineProperty(Buffer, Symbol.species, {
- value: null,
- configurable: true,
- enumerable: false,
- writable: false
- });
- }
- Buffer.poolSize = 8192;
- function from(value, encodingOrOffset, length) {
- if (typeof value === "string") {
- return fromString(value, encodingOrOffset);
- }
- if (ArrayBuffer.isView(value)) {
- return fromArrayLike(value);
- }
- if (value == null) {
- throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, " + "or Array-like Object. Received type " + _typeof(value));
- }
- if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) {
- return fromArrayBuffer(value, encodingOrOffset, length);
- }
- if (typeof value === "number") {
- throw new TypeError('The "value" argument must not be of type number. Received type number');
- }
- var valueOf = value.valueOf && value.valueOf();
- if (valueOf != null && valueOf !== value) {
- return Buffer.from(valueOf, encodingOrOffset, length);
- }
- var b = fromObject(value);
- if (b) return b;
- if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") {
- return Buffer.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length);
- }
- throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, " + "or Array-like Object. Received type " + _typeof(value));
- }
- Buffer.from = function (value, encodingOrOffset, length) {
- return from(value, encodingOrOffset, length);
- };
- Buffer.prototype.__proto__ = Uint8Array.prototype;
- Buffer.__proto__ = Uint8Array;
- function assertSize(size) {
- if (typeof size !== "number") {
- throw new TypeError('"size" argument must be of type number');
- } else if (size < 0) {
- throw new RangeError('The value "' + size + '" is invalid for option "size"');
- }
- }
- function alloc(size, fill, encoding) {
- assertSize(size);
- if (size <= 0) {
- return createBuffer(size);
- }
- if (fill !== undefined) {
- return typeof encoding === "string" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill);
- }
- return createBuffer(size);
- }
- Buffer.alloc = function (size, fill, encoding) {
- return alloc(size, fill, encoding);
- };
- function allocUnsafe(size) {
- assertSize(size);
- return createBuffer(size < 0 ? 0 : checked(size) | 0);
- }
- Buffer.allocUnsafe = function (size) {
- return allocUnsafe(size);
- };
- Buffer.allocUnsafeSlow = function (size) {
- return allocUnsafe(size);
- };
- function fromString(string, encoding) {
- if (typeof encoding !== "string" || encoding === "") {
- encoding = "utf8";
- }
- if (!Buffer.isEncoding(encoding)) {
- throw new TypeError("Unknown encoding: " + encoding);
- }
- var length = byteLength(string, encoding) | 0;
- var buf = createBuffer(length);
- var actual = buf.write(string, encoding);
- if (actual !== length) {
- buf = buf.slice(0, actual);
- }
- return buf;
- }
- function fromArrayLike(array) {
- var length = array.length < 0 ? 0 : checked(array.length) | 0;
- var buf = createBuffer(length);
- for (var i = 0; i < length; i += 1) {
- buf[i] = array[i] & 255;
- }
- return buf;
- }
- function fromArrayBuffer(array, byteOffset, length) {
- if (byteOffset < 0 || array.byteLength < byteOffset) {
- throw new RangeError('"offset" is outside of buffer bounds');
- }
- if (array.byteLength < byteOffset + (length || 0)) {
- throw new RangeError('"length" is outside of buffer bounds');
- }
- var buf;
- if (byteOffset === undefined && length === undefined) {
- buf = new Uint8Array(array);
- } else if (length === undefined) {
- buf = new Uint8Array(array, byteOffset);
- } else {
- buf = new Uint8Array(array, byteOffset, length);
- }
- buf.__proto__ = Buffer.prototype;
- return buf;
- }
- function fromObject(obj) {
- if (Buffer.isBuffer(obj)) {
- var len = checked(obj.length) | 0;
- var buf = createBuffer(len);
- if (buf.length === 0) {
- return buf;
- }
- obj.copy(buf, 0, 0, len);
- return buf;
- }
- if (obj.length !== undefined) {
- if (typeof obj.length !== "number" || numberIsNaN(obj.length)) {
- return createBuffer(0);
- }
- return fromArrayLike(obj);
- }
- if (obj.type === "Buffer" && Array.isArray(obj.data)) {
- return fromArrayLike(obj.data);
- }
- }
- function checked(length) {
- if (length >= K_MAX_LENGTH) {
- throw new RangeError("Attempt to allocate Buffer larger than maximum " + "size: 0x" + K_MAX_LENGTH.toString(16) + " bytes");
- }
- return length | 0;
- }
- function SlowBuffer(length) {
- if (+length != length) {
- length = 0;
- }
- return Buffer.alloc(+length);
- }
- Buffer.isBuffer = function isBuffer(b) {
- return b != null && b._isBuffer === true && b !== Buffer.prototype;
- };
- Buffer.compare = function compare(a, b) {
- if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength);
- if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength);
- if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
- throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');
- }
- if (a === b) return 0;
- var x = a.length;
- var y = b.length;
- for (var i = 0, len = Math.min(x, y); i < len; ++i) {
- if (a[i] !== b[i]) {
- x = a[i];
- y = b[i];
- break;
- }
- }
- if (x < y) return -1;
- if (y < x) return 1;
- return 0;
- };
- Buffer.isEncoding = function isEncoding(encoding) {
- switch (String(encoding).toLowerCase()) {
- case "hex":
- case "utf8":
- case "utf-8":
- case "ascii":
- case "latin1":
- case "binary":
- case "base64":
- case "ucs2":
- case "ucs-2":
- case "utf16le":
- case "utf-16le":
- return true;
- default:
- return false;
- }
- };
- Buffer.concat = function concat(list, length) {
- if (!Array.isArray(list)) {
- throw new TypeError('"list" argument must be an Array of Buffers');
- }
- if (list.length === 0) {
- return Buffer.alloc(0);
- }
- var i;
- if (length === undefined) {
- length = 0;
- for (i = 0; i < list.length; ++i) {
- length += list[i].length;
- }
- }
- var buffer = Buffer.allocUnsafe(length);
- var pos = 0;
- for (i = 0; i < list.length; ++i) {
- var buf = list[i];
- if (isInstance(buf, Uint8Array)) {
- buf = Buffer.from(buf);
- }
- if (!Buffer.isBuffer(buf)) {
- throw new TypeError('"list" argument must be an Array of Buffers');
- }
- buf.copy(buffer, pos);
- pos += buf.length;
- }
- return buffer;
- };
- function byteLength(string, encoding) {
- if (Buffer.isBuffer(string)) {
- return string.length;
- }
- if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
- return string.byteLength;
- }
- if (typeof string !== "string") {
- throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + "Received type " + _typeof(string));
- }
- var len = string.length;
- var mustMatch = arguments.length > 2 && arguments[2] === true;
- if (!mustMatch && len === 0) return 0;
- var loweredCase = false;
- for (;;) {
- switch (encoding) {
- case "ascii":
- case "latin1":
- case "binary":
- return len;
- case "utf8":
- case "utf-8":
- return utf8ToBytes(string).length;
- case "ucs2":
- case "ucs-2":
- case "utf16le":
- case "utf-16le":
- return len * 2;
- case "hex":
- return len >>> 1;
- case "base64":
- return base64ToBytes(string).length;
- default:
- if (loweredCase) {
- return mustMatch ? -1 : utf8ToBytes(string).length;
- }
- encoding = ("" + encoding).toLowerCase();
- loweredCase = true;
- }
- }
- }
- Buffer.byteLength = byteLength;
- function slowToString(encoding, start, end) {
- var loweredCase = false;
- if (start === undefined || start < 0) {
- start = 0;
- }
- if (start > this.length) {
- return "";
- }
- if (end === undefined || end > this.length) {
- end = this.length;
- }
- if (end <= 0) {
- return "";
- }
- end >>>= 0;
- start >>>= 0;
- if (end <= start) {
- return "";
- }
- if (!encoding) encoding = "utf8";
- while (true) {
- switch (encoding) {
- case "hex":
- return hexSlice(this, start, end);
- case "utf8":
- case "utf-8":
- return utf8Slice(this, start, end);
- case "ascii":
- return asciiSlice(this, start, end);
- case "latin1":
- case "binary":
- return latin1Slice(this, start, end);
- case "base64":
- return base64Slice(this, start, end);
- case "ucs2":
- case "ucs-2":
- case "utf16le":
- case "utf-16le":
- return utf16leSlice(this, start, end);
- default:
- if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
- encoding = (encoding + "").toLowerCase();
- loweredCase = true;
- }
- }
- }
- Buffer.prototype._isBuffer = true;
- function swap(b, n, m) {
- var i = b[n];
- b[n] = b[m];
- b[m] = i;
- }
- Buffer.prototype.swap16 = function swap16() {
- var len = this.length;
- if (len % 2 !== 0) {
- throw new RangeError("Buffer size must be a multiple of 16-bits");
- }
- for (var i = 0; i < len; i += 2) {
- swap(this, i, i + 1);
- }
- return this;
- };
- Buffer.prototype.swap32 = function swap32() {
- var len = this.length;
- if (len % 4 !== 0) {
- throw new RangeError("Buffer size must be a multiple of 32-bits");
- }
- for (var i = 0; i < len; i += 4) {
- swap(this, i, i + 3);
- swap(this, i + 1, i + 2);
- }
- return this;
- };
- Buffer.prototype.swap64 = function swap64() {
- var len = this.length;
- if (len % 8 !== 0) {
- throw new RangeError("Buffer size must be a multiple of 64-bits");
- }
- for (var i = 0; i < len; i += 8) {
- swap(this, i, i + 7);
- swap(this, i + 1, i + 6);
- swap(this, i + 2, i + 5);
- swap(this, i + 3, i + 4);
- }
- return this;
- };
- Buffer.prototype.toString = function toString() {
- var length = this.length;
- if (length === 0) return "";
- if (arguments.length === 0) return utf8Slice(this, 0, length);
- return slowToString.apply(this, arguments);
- };
- Buffer.prototype.toLocaleString = Buffer.prototype.toString;
- Buffer.prototype.equals = function equals(b) {
- if (!Buffer.isBuffer(b)) throw new TypeError("Argument must be a Buffer");
- if (this === b) return true;
- return Buffer.compare(this, b) === 0;
- };
- Buffer.prototype.inspect = function inspect() {
- var str = "";
- var max = exports.INSPECT_MAX_BYTES;
- str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim();
- if (this.length > max) str += " ... ";
- return "<Buffer " + str + ">";
- };
- Buffer.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {
- if (isInstance(target, Uint8Array)) {
- target = Buffer.from(target, target.offset, target.byteLength);
- }
- if (!Buffer.isBuffer(target)) {
- throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. ' + "Received type " + _typeof(target));
- }
- if (start === undefined) {
- start = 0;
- }
- if (end === undefined) {
- end = target ? target.length : 0;
- }
- if (thisStart === undefined) {
- thisStart = 0;
- }
- if (thisEnd === undefined) {
- thisEnd = this.length;
- }
- if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
- throw new RangeError("out of range index");
- }
- if (thisStart >= thisEnd && start >= end) {
- return 0;
- }
- if (thisStart >= thisEnd) {
- return -1;
- }
- if (start >= end) {
- return 1;
- }
- start >>>= 0;
- end >>>= 0;
- thisStart >>>= 0;
- thisEnd >>>= 0;
- if (this === target) return 0;
- var x = thisEnd - thisStart;
- var y = end - start;
- var len = Math.min(x, y);
- var thisCopy = this.slice(thisStart, thisEnd);
- var targetCopy = target.slice(start, end);
- for (var i = 0; i < len; ++i) {
- if (thisCopy[i] !== targetCopy[i]) {
- x = thisCopy[i];
- y = targetCopy[i];
- break;
- }
- }
- if (x < y) return -1;
- if (y < x) return 1;
- return 0;
- };
- function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
- if (buffer.length === 0) return -1;
- if (typeof byteOffset === "string") {
- encoding = byteOffset;
- byteOffset = 0;
- } else if (byteOffset > 2147483647) {
- byteOffset = 2147483647;
- } else if (byteOffset < -2147483648) {
- byteOffset = -2147483648;
- }
- byteOffset = +byteOffset;
- if (numberIsNaN(byteOffset)) {
- byteOffset = dir ? 0 : buffer.length - 1;
- }
- if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
- if (byteOffset >= buffer.length) {
- if (dir) return -1;else byteOffset = buffer.length - 1;
- } else if (byteOffset < 0) {
- if (dir) byteOffset = 0;else return -1;
- }
- if (typeof val === "string") {
- val = Buffer.from(val, encoding);
- }
- if (Buffer.isBuffer(val)) {
- if (val.length === 0) {
- return -1;
- }
- return arrayIndexOf(buffer, val, byteOffset, encoding, dir);
- } else if (typeof val === "number") {
- val = val & 255;
- if (typeof Uint8Array.prototype.indexOf === "function") {
- if (dir) {
- return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);
- } else {
- return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);
- }
- }
- return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);
- }
- throw new TypeError("val must be string, number or Buffer");
- }
- function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
- var indexSize = 1;
- var arrLength = arr.length;
- var valLength = val.length;
- if (encoding !== undefined) {
- encoding = String(encoding).toLowerCase();
- if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") {
- if (arr.length < 2 || val.length < 2) {
- return -1;
- }
- indexSize = 2;
- arrLength /= 2;
- valLength /= 2;
- byteOffset /= 2;
- }
- }
- function read(buf, i) {
- if (indexSize === 1) {
- return buf[i];
- } else {
- return buf.readUInt16BE(i * indexSize);
- }
- }
- var i;
- if (dir) {
- var foundIndex = -1;
- for (i = byteOffset; i < arrLength; i++) {
- if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
- if (foundIndex === -1) foundIndex = i;
- if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
- } else {
- if (foundIndex !== -1) i -= i - foundIndex;
- foundIndex = -1;
- }
- }
- } else {
- if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
- for (i = byteOffset; i >= 0; i--) {
- var found = true;
- for (var j = 0; j < valLength; j++) {
- if (read(arr, i + j) !== read(val, j)) {
- found = false;
- break;
- }
- }
- if (found) return i;
- }
- }
- return -1;
- }
- Buffer.prototype.includes = function includes(val, byteOffset, encoding) {
- return this.indexOf(val, byteOffset, encoding) !== -1;
- };
- Buffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
- return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
- };
- Buffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
- return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
- };
- function hexWrite(buf, string, offset, length) {
- offset = Number(offset) || 0;
- var remaining = buf.length - offset;
- if (!length) {
- length = remaining;
- } else {
- length = Number(length);
- if (length > remaining) {
- length = remaining;
- }
- }
- var strLen = string.length;
- if (length > strLen / 2) {
- length = strLen / 2;
- }
- for (var i = 0; i < length; ++i) {
- var parsed = parseInt(string.substr(i * 2, 2), 16);
- if (numberIsNaN(parsed)) return i;
- buf[offset + i] = parsed;
- }
- return i;
- }
- function utf8Write(buf, string, offset, length) {
- return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
- }
- function asciiWrite(buf, string, offset, length) {
- return blitBuffer(asciiToBytes(string), buf, offset, length);
- }
- function latin1Write(buf, string, offset, length) {
- return asciiWrite(buf, string, offset, length);
- }
- function base64Write(buf, string, offset, length) {
- return blitBuffer(base64ToBytes(string), buf, offset, length);
- }
- function ucs2Write(buf, string, offset, length) {
- return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
- }
- Buffer.prototype.write = function write(string, offset, length, encoding) {
- if (offset === undefined) {
- encoding = "utf8";
- length = this.length;
- offset = 0;
- } else if (length === undefined && typeof offset === "string") {
- encoding = offset;
- length = this.length;
- offset = 0;
- } else if (isFinite(offset)) {
- offset = offset >>> 0;
- if (isFinite(length)) {
- length = length >>> 0;
- if (encoding === undefined) encoding = "utf8";
- } else {
- encoding = length;
- length = undefined;
- }
- } else {
- throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
- }
- var remaining = this.length - offset;
- if (length === undefined || length > remaining) length = remaining;
- if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
- throw new RangeError("Attempt to write outside buffer bounds");
- }
- if (!encoding) encoding = "utf8";
- var loweredCase = false;
- for (;;) {
- switch (encoding) {
- case "hex":
- return hexWrite(this, string, offset, length);
- case "utf8":
- case "utf-8":
- return utf8Write(this, string, offset, length);
- case "ascii":
- return asciiWrite(this, string, offset, length);
- case "latin1":
- case "binary":
- return latin1Write(this, string, offset, length);
- case "base64":
- return base64Write(this, string, offset, length);
- case "ucs2":
- case "ucs-2":
- case "utf16le":
- case "utf-16le":
- return ucs2Write(this, string, offset, length);
- default:
- if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
- encoding = ("" + encoding).toLowerCase();
- loweredCase = true;
- }
- }
- };
- Buffer.prototype.toJSON = function toJSON() {
- return {
- type: "Buffer",
- data: Array.prototype.slice.call(this._arr || this, 0)
- };
- };
- function base64Slice(buf, start, end) {
- if (start === 0 && end === buf.length) {
- return base64.fromByteArray(buf);
- } else {
- return base64.fromByteArray(buf.slice(start, end));
- }
- }
- function utf8Slice(buf, start, end) {
- end = Math.min(buf.length, end);
- var res = [];
- var i = start;
- while (i < end) {
- var firstByte = buf[i];
- var codePoint = null;
- var bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;
- if (i + bytesPerSequence <= end) {
- var secondByte, thirdByte, fourthByte, tempCodePoint;
- switch (bytesPerSequence) {
- case 1:
- if (firstByte < 128) {
- codePoint = firstByte;
- }
- break;
- case 2:
- secondByte = buf[i + 1];
- if ((secondByte & 192) === 128) {
- tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;
- if (tempCodePoint > 127) {
- codePoint = tempCodePoint;
- }
- }
- break;
- case 3:
- secondByte = buf[i + 1];
- thirdByte = buf[i + 2];
- if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {
- tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;
- if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) {
- codePoint = tempCodePoint;
- }
- }
- break;
- case 4:
- secondByte = buf[i + 1];
- thirdByte = buf[i + 2];
- fourthByte = buf[i + 3];
- if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {
- tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;
- if (tempCodePoint > 65535 && tempCodePoint < 1114112) {
- codePoint = tempCodePoint;
- }
- }
- }
- }
- if (codePoint === null) {
- codePoint = 65533;
- bytesPerSequence = 1;
- } else if (codePoint > 65535) {
- codePoint -= 65536;
- res.push(codePoint >>> 10 & 1023 | 55296);
- codePoint = 56320 | codePoint & 1023;
- }
- res.push(codePoint);
- i += bytesPerSequence;
- }
- return decodeCodePointsArray(res);
- }
- var MAX_ARGUMENTS_LENGTH = 4096;
- function decodeCodePointsArray(codePoints) {
- var len = codePoints.length;
- if (len <= MAX_ARGUMENTS_LENGTH) {
- return String.fromCharCode.apply(String, codePoints);
- }
- var res = "";
- var i = 0;
- while (i < len) {
- res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH));
- }
- return res;
- }
- function asciiSlice(buf, start, end) {
- var ret = "";
- end = Math.min(buf.length, end);
- for (var i = start; i < end; ++i) {
- ret += String.fromCharCode(buf[i] & 127);
- }
- return ret;
- }
- function latin1Slice(buf, start, end) {
- var ret = "";
- end = Math.min(buf.length, end);
- for (var i = start; i < end; ++i) {
- ret += String.fromCharCode(buf[i]);
- }
- return ret;
- }
- function hexSlice(buf, start, end) {
- var len = buf.length;
- if (!start || start < 0) start = 0;
- if (!end || end < 0 || end > len) end = len;
- var out = "";
- for (var i = start; i < end; ++i) {
- out += toHex(buf[i]);
- }
- return out;
- }
- function utf16leSlice(buf, start, end) {
- var bytes = buf.slice(start, end);
- var res = "";
- for (var i = 0; i < bytes.length; i += 2) {
- res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
- }
- return res;
- }
- Buffer.prototype.slice = function slice(start, end) {
- var len = this.length;
- start = ~~start;
- end = end === undefined ? len : ~~end;
- if (start < 0) {
- start += len;
- if (start < 0) start = 0;
- } else if (start > len) {
- start = len;
- }
- if (end < 0) {
- end += len;
- if (end < 0) end = 0;
- } else if (end > len) {
- end = len;
- }
- if (end < start) end = start;
- var newBuf = this.subarray(start, end);
- newBuf.__proto__ = Buffer.prototype;
- return newBuf;
- };
- function checkOffset(offset, ext, length) {
- if (offset % 1 !== 0 || offset < 0) throw new RangeError("offset is not uint");
- if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length");
- }
- Buffer.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) {
- offset = offset >>> 0;
- byteLength = byteLength >>> 0;
- if (!noAssert) checkOffset(offset, byteLength, this.length);
- var val = this[offset];
- var mul = 1;
- var i = 0;
- while (++i < byteLength && (mul *= 256)) {
- val += this[offset + i] * mul;
- }
- return val;
- };
- Buffer.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) {
- offset = offset >>> 0;
- byteLength = byteLength >>> 0;
- if (!noAssert) {
- checkOffset(offset, byteLength, this.length);
- }
- var val = this[offset + --byteLength];
- var mul = 1;
- while (byteLength > 0 && (mul *= 256)) {
- val += this[offset + --byteLength] * mul;
- }
- return val;
- };
- Buffer.prototype.readUInt8 = function readUInt8(offset, noAssert) {
- offset = offset >>> 0;
- if (!noAssert) checkOffset(offset, 1, this.length);
- return this[offset];
- };
- Buffer.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
- offset = offset >>> 0;
- if (!noAssert) checkOffset(offset, 2, this.length);
- return this[offset] | this[offset + 1] << 8;
- };
- Buffer.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
- offset = offset >>> 0;
- if (!noAssert) checkOffset(offset, 2, this.length);
- return this[offset] << 8 | this[offset + 1];
- };
- Buffer.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
- offset = offset >>> 0;
- if (!noAssert) checkOffset(offset, 4, this.length);
- return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;
- };
- Buffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
- offset = offset >>> 0;
- if (!noAssert) checkOffset(offset, 4, this.length);
- return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
- };
- Buffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) {
- offset = offset >>> 0;
- byteLength = byteLength >>> 0;
- if (!noAssert) checkOffset(offset, byteLength, this.length);
- var val = this[offset];
- var mul = 1;
- var i = 0;
- while (++i < byteLength && (mul *= 256)) {
- val += this[offset + i] * mul;
- }
- mul *= 128;
- if (val >= mul) val -= Math.pow(2, 8 * byteLength);
- return val;
- };
- Buffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) {
- offset = offset >>> 0;
- byteLength = byteLength >>> 0;
- if (!noAssert) checkOffset(offset, byteLength, this.length);
- var i = byteLength;
- var mul = 1;
- var val = this[offset + --i];
- while (i > 0 && (mul *= 256)) {
- val += this[offset + --i] * mul;
- }
- mul *= 128;
- if (val >= mul) val -= Math.pow(2, 8 * byteLength);
- return val;
- };
- Buffer.prototype.readInt8 = function readInt8(offset, noAssert) {
- offset = offset >>> 0;
- if (!noAssert) checkOffset(offset, 1, this.length);
- if (!(this[offset] & 128)) return this[offset];
- return (255 - this[offset] + 1) * -1;
- };
- Buffer.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
- offset = offset >>> 0;
- if (!noAssert) checkOffset(offset, 2, this.length);
- var val = this[offset] | this[offset + 1] << 8;
- return val & 32768 ? val | 4294901760 : val;
- };
- Buffer.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
- offset = offset >>> 0;
- if (!noAssert) checkOffset(offset, 2, this.length);
- var val = this[offset + 1] | this[offset] << 8;
- return val & 32768 ? val | 4294901760 : val;
- };
- Buffer.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
- offset = offset >>> 0;
- if (!noAssert) checkOffset(offset, 4, this.length);
- return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
- };
- Buffer.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
- offset = offset >>> 0;
- if (!noAssert) checkOffset(offset, 4, this.length);
- return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
- };
- Buffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
- offset = offset >>> 0;
- if (!noAssert) checkOffset(offset, 4, this.length);
- return ieee754.read(this, offset, true, 23, 4);
- };
- Buffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
- offset = offset >>> 0;
- if (!noAssert) checkOffset(offset, 4, this.length);
- return ieee754.read(this, offset, false, 23, 4);
- };
- Buffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
- offset = offset >>> 0;
- if (!noAssert) checkOffset(offset, 8, this.length);
- return ieee754.read(this, offset, true, 52, 8);
- };
- Buffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
- offset = offset >>> 0;
- if (!noAssert) checkOffset(offset, 8, this.length);
- return ieee754.read(this, offset, false, 52, 8);
- };
- function checkInt(buf, value, offset, ext, max, min) {
- if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
- if (value > max || value < min) throw new RangeError('"value" argument is out of bounds');
- if (offset + ext > buf.length) throw new RangeError("Index out of range");
- }
- Buffer.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) {
- value = +value;
- offset = offset >>> 0;
- byteLength = byteLength >>> 0;
- if (!noAssert) {
- var maxBytes = Math.pow(2, 8 * byteLength) - 1;
- checkInt(this, value, offset, byteLength, maxBytes, 0);
- }
- var mul = 1;
- var i = 0;
- this[offset] = value & 255;
- while (++i < byteLength && (mul *= 256)) {
- this[offset + i] = value / mul & 255;
- }
- return offset + byteLength;
- };
- Buffer.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) {
- value = +value;
- offset = offset >>> 0;
- byteLength = byteLength >>> 0;
- if (!noAssert) {
- var maxBytes = Math.pow(2, 8 * byteLength) - 1;
- checkInt(this, value, offset, byteLength, maxBytes, 0);
- }
- var i = byteLength - 1;
- var mul = 1;
- this[offset + i] = value & 255;
- while (--i >= 0 && (mul *= 256)) {
- this[offset + i] = value / mul & 255;
- }
- return offset + byteLength;
- };
- Buffer.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
- value = +value;
- offset = offset >>> 0;
- if (!noAssert) checkInt(this, value, offset, 1, 255, 0);
- this[offset] = value & 255;
- return offset + 1;
- };
- Buffer.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
- value = +value;
- offset = offset >>> 0;
- if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
- this[offset] = value & 255;
- this[offset + 1] = value >>> 8;
- return offset + 2;
- };
- Buffer.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
- value = +value;
- offset = offset >>> 0;
- if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
- this[offset] = value >>> 8;
- this[offset + 1] = value & 255;
- return offset + 2;
- };
- Buffer.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
- value = +value;
- offset = offset >>> 0;
- if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
- this[offset + 3] = value >>> 24;
- this[offset + 2] = value >>> 16;
- this[offset + 1] = value >>> 8;
- this[offset] = value & 255;
- return offset + 4;
- };
- Buffer.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
- value = +value;
- offset = offset >>> 0;
- if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
- this[offset] = value >>> 24;
- this[offset + 1] = value >>> 16;
- this[offset + 2] = value >>> 8;
- this[offset + 3] = value & 255;
- return offset + 4;
- };
- Buffer.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) {
- value = +value;
- offset = offset >>> 0;
- if (!noAssert) {
- var limit = Math.pow(2, 8 * byteLength - 1);
- checkInt(this, value, offset, byteLength, limit - 1, -limit);
- }
- var i = 0;
- var mul = 1;
- var sub = 0;
- this[offset] = value & 255;
- while (++i < byteLength && (mul *= 256)) {
- if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
- sub = 1;
- }
- this[offset + i] = (value / mul >> 0) - sub & 255;
- }
- return offset + byteLength;
- };
- Buffer.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) {
- value = +value;
- offset = offset >>> 0;
- if (!noAssert) {
- var limit = Math.pow(2, 8 * byteLength - 1);
- checkInt(this, value, offset, byteLength, limit - 1, -limit);
- }
- var i = byteLength - 1;
- var mul = 1;
- var sub = 0;
- this[offset + i] = value & 255;
- while (--i >= 0 && (mul *= 256)) {
- if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
- sub = 1;
- }
- this[offset + i] = (value / mul >> 0) - sub & 255;
- }
- return offset + byteLength;
- };
- Buffer.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
- value = +value;
- offset = offset >>> 0;
- if (!noAssert) checkInt(this, value, offset, 1, 127, -128);
- if (value < 0) value = 255 + value + 1;
- this[offset] = value & 255;
- return offset + 1;
- };
- Buffer.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
- value = +value;
- offset = offset >>> 0;
- if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
- this[offset] = value & 255;
- this[offset + 1] = value >>> 8;
- return offset + 2;
- };
- Buffer.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
- value = +value;
- offset = offset >>> 0;
- if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
- this[offset] = value >>> 8;
- this[offset + 1] = value & 255;
- return offset + 2;
- };
- Buffer.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
- value = +value;
- offset = offset >>> 0;
- if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
- this[offset] = value & 255;
- this[offset + 1] = value >>> 8;
- this[offset + 2] = value >>> 16;
- this[offset + 3] = value >>> 24;
- return offset + 4;
- };
- Buffer.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
- value = +value;
- offset = offset >>> 0;
- if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
- if (value < 0) value = 4294967295 + value + 1;
- this[offset] = value >>> 24;
- this[offset + 1] = value >>> 16;
- this[offset + 2] = value >>> 8;
- this[offset + 3] = value & 255;
- return offset + 4;
- };
- function checkIEEE754(buf, value, offset, ext, max, min) {
- if (offset + ext > buf.length) throw new RangeError("Index out of range");
- if (offset < 0) throw new RangeError("Index out of range");
- }
- function writeFloat(buf, value, offset, littleEndian, noAssert) {
- value = +value;
- offset = offset >>> 0;
- if (!noAssert) {
- checkIEEE754(buf, value, offset, 4, 34028234663852886e22, -34028234663852886e22);
- }
- ieee754.write(buf, value, offset, littleEndian, 23, 4);
- return offset + 4;
- }
- Buffer.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
- return writeFloat(this, value, offset, true, noAssert);
- };
- Buffer.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
- return writeFloat(this, value, offset, false, noAssert);
- };
- function writeDouble(buf, value, offset, littleEndian, noAssert) {
- value = +value;
- offset = offset >>> 0;
- if (!noAssert) {
- checkIEEE754(buf, value, offset, 8, 17976931348623157e292, -17976931348623157e292);
- }
- ieee754.write(buf, value, offset, littleEndian, 52, 8);
- return offset + 8;
- }
- Buffer.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
- return writeDouble(this, value, offset, true, noAssert);
- };
- Buffer.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
- return writeDouble(this, value, offset, false, noAssert);
- };
- Buffer.prototype.copy = function copy(target, targetStart, start, end) {
- if (!Buffer.isBuffer(target)) throw new TypeError("argument should be a Buffer");
- if (!start) start = 0;
- if (!end && end !== 0) end = this.length;
- if (targetStart >= target.length) targetStart = target.length;
- if (!targetStart) targetStart = 0;
- if (end > 0 && end < start) end = start;
- if (end === start) return 0;
- if (target.length === 0 || this.length === 0) return 0;
- if (targetStart < 0) {
- throw new RangeError("targetStart out of bounds");
- }
- if (start < 0 || start >= this.length) throw new RangeError("Index out of range");
- if (end < 0) throw new RangeError("sourceEnd out of bounds");
- if (end > this.length) end = this.length;
- if (target.length - targetStart < end - start) {
- end = target.length - targetStart + start;
- }
- var len = end - start;
- if (this === target && typeof Uint8Array.prototype.copyWithin === "function") {
- this.copyWithin(targetStart, start, end);
- } else if (this === target && start < targetStart && targetStart < end) {
- for (var i = len - 1; i >= 0; --i) {
- target[i + targetStart] = this[i + start];
- }
- } else {
- Uint8Array.prototype.set.call(target, this.subarray(start, end), targetStart);
- }
- return len;
- };
- Buffer.prototype.fill = function fill(val, start, end, encoding) {
- if (typeof val === "string") {
- if (typeof start === "string") {
- encoding = start;
- start = 0;
- end = this.length;
- } else if (typeof end === "string") {
- encoding = end;
- end = this.length;
- }
- if (encoding !== undefined && typeof encoding !== "string") {
- throw new TypeError("encoding must be a string");
- }
- if (typeof encoding === "string" && !Buffer.isEncoding(encoding)) {
- throw new TypeError("Unknown encoding: " + encoding);
- }
- if (val.length === 1) {
- var code = val.charCodeAt(0);
- if (encoding === "utf8" && code < 128 || encoding === "latin1") {
- val = code;
- }
- }
- } else if (typeof val === "number") {
- val = val & 255;
- }
- if (start < 0 || this.length < start || this.length < end) {
- throw new RangeError("Out of range index");
- }
- if (end <= start) {
- return this;
- }
- start = start >>> 0;
- end = end === undefined ? this.length : end >>> 0;
- if (!val) val = 0;
- var i;
- if (typeof val === "number") {
- for (i = start; i < end; ++i) {
- this[i] = val;
- }
- } else {
- var bytes = Buffer.isBuffer(val) ? val : Buffer.from(val, encoding);
- var len = bytes.length;
- if (len === 0) {
- throw new TypeError('The value "' + val + '" is invalid for argument "value"');
- }
- for (i = 0; i < end - start; ++i) {
- this[i + start] = bytes[i % len];
- }
- }
- return this;
- };
- var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
- function base64clean(str) {
- str = str.split("=")[0];
- str = str.trim().replace(INVALID_BASE64_RE, "");
- if (str.length < 2) return "";
- while (str.length % 4 !== 0) {
- str = str + "=";
- }
- return str;
- }
- function toHex(n) {
- if (n < 16) return "0" + n.toString(16);
- return n.toString(16);
- }
- function utf8ToBytes(string, units) {
- units = units || Infinity;
- var codePoint;
- var length = string.length;
- var leadSurrogate = null;
- var bytes = [];
- for (var i = 0; i < length; ++i) {
- codePoint = string.charCodeAt(i);
- if (codePoint > 55295 && codePoint < 57344) {
- if (!leadSurrogate) {
- if (codePoint > 56319) {
- if ((units -= 3) > -1) bytes.push(239, 191, 189);
- continue;
- } else if (i + 1 === length) {
- if ((units -= 3) > -1) bytes.push(239, 191, 189);
- continue;
- }
- leadSurrogate = codePoint;
- continue;
- }
- if (codePoint < 56320) {
- if ((units -= 3) > -1) bytes.push(239, 191, 189);
- leadSurrogate = codePoint;
- continue;
- }
- codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;
- } else if (leadSurrogate) {
- if ((units -= 3) > -1) bytes.push(239, 191, 189);
- }
- leadSurrogate = null;
- if (codePoint < 128) {
- if ((units -= 1) < 0) break;
- bytes.push(codePoint);
- } else if (codePoint < 2048) {
- if ((units -= 2) < 0) break;
- bytes.push(codePoint >> 6 | 192, codePoint & 63 | 128);
- } else if (codePoint < 65536) {
- if ((units -= 3) < 0) break;
- bytes.push(codePoint >> 12 | 224, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);
- } else if (codePoint < 1114112) {
- if ((units -= 4) < 0) break;
- bytes.push(codePoint >> 18 | 240, codePoint >> 12 & 63 | 128, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);
- } else {
- throw new Error("Invalid code point");
- }
- }
- return bytes;
- }
- function asciiToBytes(str) {
- var byteArray = [];
- for (var i = 0; i < str.length; ++i) {
- byteArray.push(str.charCodeAt(i) & 255);
- }
- return byteArray;
- }
- function utf16leToBytes(str, units) {
- var c, hi, lo;
- var byteArray = [];
- for (var i = 0; i < str.length; ++i) {
- if ((units -= 2) < 0) break;
- c = str.charCodeAt(i);
- hi = c >> 8;
- lo = c % 256;
- byteArray.push(lo);
- byteArray.push(hi);
- }
- return byteArray;
- }
- function base64ToBytes(str) {
- return base64.toByteArray(base64clean(str));
- }
- function blitBuffer(src, dst, offset, length) {
- for (var i = 0; i < length; ++i) {
- if (i + offset >= dst.length || i >= src.length) break;
- dst[i + offset] = src[i];
- }
- return i;
- }
- function isInstance(obj, type) {
- return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name;
- }
- function numberIsNaN(obj) {
- return obj !== obj;
- }
- }, {
- "base64-js": 10,
- ieee754: 79
- }],
- 13: [function (require, module, exports) {
- var objectCreate = Object.create || objectCreatePolyfill;
- var objectKeys = Object.keys || objectKeysPolyfill;
- var bind = Function.prototype.bind || functionBindPolyfill;
- function EventEmitter() {
- if (!this._events || !Object.prototype.hasOwnProperty.call(this, "_events")) {
- this._events = objectCreate(null);
- this._eventsCount = 0;
- }
- this._maxListeners = this._maxListeners || undefined;
- }
- module.exports = EventEmitter;
- EventEmitter.EventEmitter = EventEmitter;
- EventEmitter.prototype._events = undefined;
- EventEmitter.prototype._maxListeners = undefined;
- var defaultMaxListeners = 10;
- var hasDefineProperty;
- try {
- var o = {};
- if (Object.defineProperty) Object.defineProperty(o, "x", {
- value: 0
- });
- hasDefineProperty = o.x === 0;
- } catch (err) {
- hasDefineProperty = false;
- }
- if (hasDefineProperty) {
- Object.defineProperty(EventEmitter, "defaultMaxListeners", {
- enumerable: true,
- get: function get() {
- return defaultMaxListeners;
- },
- set: function set(arg) {
- if (typeof arg !== "number" || arg < 0 || arg !== arg) throw new TypeError('"defaultMaxListeners" must be a positive number');
- defaultMaxListeners = arg;
- }
- });
- } else {
- EventEmitter.defaultMaxListeners = defaultMaxListeners;
- }
- EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
- if (typeof n !== "number" || n < 0 || isNaN(n)) throw new TypeError('"n" argument must be a positive number');
- this._maxListeners = n;
- return this;
- };
- function $getMaxListeners(that) {
- if (that._maxListeners === undefined) return EventEmitter.defaultMaxListeners;
- return that._maxListeners;
- }
- EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
- return $getMaxListeners(this);
- };
- function emitNone(handler, isFn, self) {
- if (isFn) handler.call(self);else {
- var len = handler.length;
- var listeners = arrayClone(handler, len);
- for (var i = 0; i < len; ++i) {
- listeners[i].call(self);
- }
- }
- }
- function emitOne(handler, isFn, self, arg1) {
- if (isFn) handler.call(self, arg1);else {
- var len = handler.length;
- var listeners = arrayClone(handler, len);
- for (var i = 0; i < len; ++i) {
- listeners[i].call(self, arg1);
- }
- }
- }
- function emitTwo(handler, isFn, self, arg1, arg2) {
- if (isFn) handler.call(self, arg1, arg2);else {
- var len = handler.length;
- var listeners = arrayClone(handler, len);
- for (var i = 0; i < len; ++i) {
- listeners[i].call(self, arg1, arg2);
- }
- }
- }
- function emitThree(handler, isFn, self, arg1, arg2, arg3) {
- if (isFn) handler.call(self, arg1, arg2, arg3);else {
- var len = handler.length;
- var listeners = arrayClone(handler, len);
- for (var i = 0; i < len; ++i) {
- listeners[i].call(self, arg1, arg2, arg3);
- }
- }
- }
- function emitMany(handler, isFn, self, args) {
- if (isFn) handler.apply(self, args);else {
- var len = handler.length;
- var listeners = arrayClone(handler, len);
- for (var i = 0; i < len; ++i) {
- listeners[i].apply(self, args);
- }
- }
- }
- EventEmitter.prototype.emit = function emit(type) {
- var er, handler, len, args, i, events;
- var doError = type === "error";
- events = this._events;
- if (events) doError = doError && events.error == null;else if (!doError) return false;
- if (doError) {
- if (arguments.length > 1) er = arguments[1];
- if (er instanceof Error) {
- throw er;
- } else {
- var err = new Error('Unhandled "error" event. (' + er + ")");
- err.context = er;
- throw err;
- }
- return false;
- }
- handler = events[type];
- if (!handler) return false;
- var isFn = typeof handler === "function";
- len = arguments.length;
- switch (len) {
- case 1:
- emitNone(handler, isFn, this);
- break;
- case 2:
- emitOne(handler, isFn, this, arguments[1]);
- break;
- case 3:
- emitTwo(handler, isFn, this, arguments[1], arguments[2]);
- break;
- case 4:
- emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]);
- break;
- default:
- args = new Array(len - 1);
- for (i = 1; i < len; i++) {
- args[i - 1] = arguments[i];
- }
- emitMany(handler, isFn, this, args);
- }
- return true;
- };
- function _addListener(target, type, listener, prepend) {
- var m;
- var events;
- var existing;
- if (typeof listener !== "function") throw new TypeError('"listener" argument must be a function');
- events = target._events;
- if (!events) {
- events = target._events = objectCreate(null);
- target._eventsCount = 0;
- } else {
- if (events.newListener) {
- target.emit("newListener", type, listener.listener ? listener.listener : listener);
- events = target._events;
- }
- existing = events[type];
- }
- if (!existing) {
- existing = events[type] = listener;
- ++target._eventsCount;
- } else {
- if (typeof existing === "function") {
- existing = events[type] = prepend ? [listener, existing] : [existing, listener];
- } else {
- if (prepend) {
- existing.unshift(listener);
- } else {
- existing.push(listener);
- }
- }
- if (!existing.warned) {
- m = $getMaxListeners(target);
- if (m && m > 0 && existing.length > m) {
- existing.warned = true;
- var w = new Error("Possible EventEmitter memory leak detected. " + existing.length + ' "' + String(type) + '" listeners ' + "added. Use emitter.setMaxListeners() to " + "increase limit.");
- w.name = "MaxListenersExceededWarning";
- w.emitter = target;
- w.type = type;
- w.count = existing.length;
- if ((typeof console === "undefined" ? "undefined" : _typeof(console)) === "object" && console.warn) {
- console.warn("%s: %s", w.name, w.message);
- }
- }
- }
- }
- return target;
- }
- EventEmitter.prototype.addListener = function addListener(type, listener) {
- return _addListener(this, type, listener, false);
- };
- EventEmitter.prototype.on = EventEmitter.prototype.addListener;
- EventEmitter.prototype.prependListener = function prependListener(type, listener) {
- return _addListener(this, type, listener, true);
- };
- function onceWrapper() {
- if (!this.fired) {
- this.target.removeListener(this.type, this.wrapFn);
- this.fired = true;
- switch (arguments.length) {
- case 0:
- return this.listener.call(this.target);
- case 1:
- return this.listener.call(this.target, arguments[0]);
- case 2:
- return this.listener.call(this.target, arguments[0], arguments[1]);
- case 3:
- return this.listener.call(this.target, arguments[0], arguments[1], arguments[2]);
- default:
- var args = new Array(arguments.length);
- for (var i = 0; i < args.length; ++i) {
- args[i] = arguments[i];
- }
- this.listener.apply(this.target, args);
- }
- }
- }
- function _onceWrap(target, type, listener) {
- var state = {
- fired: false,
- wrapFn: undefined,
- target: target,
- type: type,
- listener: listener
- };
- var wrapped = bind.call(onceWrapper, state);
- wrapped.listener = listener;
- state.wrapFn = wrapped;
- return wrapped;
- }
- EventEmitter.prototype.once = function once(type, listener) {
- if (typeof listener !== "function") throw new TypeError('"listener" argument must be a function');
- this.on(type, _onceWrap(this, type, listener));
- return this;
- };
- EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) {
- if (typeof listener !== "function") throw new TypeError('"listener" argument must be a function');
- this.prependListener(type, _onceWrap(this, type, listener));
- return this;
- };
- EventEmitter.prototype.removeListener = function removeListener(type, listener) {
- var list, events, position, i, originalListener;
- if (typeof listener !== "function") throw new TypeError('"listener" argument must be a function');
- events = this._events;
- if (!events) return this;
- list = events[type];
- if (!list) return this;
- if (list === listener || list.listener === listener) {
- if (--this._eventsCount === 0) this._events = objectCreate(null);else {
- delete events[type];
- if (events.removeListener) this.emit("removeListener", type, list.listener || listener);
- }
- } else if (typeof list !== "function") {
- position = -1;
- for (i = list.length - 1; i >= 0; i--) {
- if (list[i] === listener || list[i].listener === listener) {
- originalListener = list[i].listener;
- position = i;
- break;
- }
- }
- if (position < 0) return this;
- if (position === 0) list.shift();else spliceOne(list, position);
- if (list.length === 1) events[type] = list[0];
- if (events.removeListener) this.emit("removeListener", type, originalListener || listener);
- }
- return this;
- };
- EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) {
- var listeners, events, i;
- events = this._events;
- if (!events) return this;
- if (!events.removeListener) {
- if (arguments.length === 0) {
- this._events = objectCreate(null);
- this._eventsCount = 0;
- } else if (events[type]) {
- if (--this._eventsCount === 0) this._events = objectCreate(null);else delete events[type];
- }
- return this;
- }
- if (arguments.length === 0) {
- var keys = objectKeys(events);
- var key;
- for (i = 0; i < keys.length; ++i) {
- key = keys[i];
- if (key === "removeListener") continue;
- this.removeAllListeners(key);
- }
- this.removeAllListeners("removeListener");
- this._events = objectCreate(null);
- this._eventsCount = 0;
- return this;
- }
- listeners = events[type];
- if (typeof listeners === "function") {
- this.removeListener(type, listeners);
- } else if (listeners) {
- for (i = listeners.length - 1; i >= 0; i--) {
- this.removeListener(type, listeners[i]);
- }
- }
- return this;
- };
- function _listeners(target, type, unwrap) {
- var events = target._events;
- if (!events) return [];
- var evlistener = events[type];
- if (!evlistener) return [];
- if (typeof evlistener === "function") return unwrap ? [evlistener.listener || evlistener] : [evlistener];
- return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
- }
- EventEmitter.prototype.listeners = function listeners(type) {
- return _listeners(this, type, true);
- };
- EventEmitter.prototype.rawListeners = function rawListeners(type) {
- return _listeners(this, type, false);
- };
- EventEmitter.listenerCount = function (emitter, type) {
- if (typeof emitter.listenerCount === "function") {
- return emitter.listenerCount(type);
- } else {
- return listenerCount.call(emitter, type);
- }
- };
- EventEmitter.prototype.listenerCount = listenerCount;
- function listenerCount(type) {
- var events = this._events;
- if (events) {
- var evlistener = events[type];
- if (typeof evlistener === "function") {
- return 1;
- } else if (evlistener) {
- return evlistener.length;
- }
- }
- return 0;
- }
- EventEmitter.prototype.eventNames = function eventNames() {
- return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];
- };
- function spliceOne(list, index) {
- for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {
- list[i] = list[k];
- }
- list.pop();
- }
- function arrayClone(arr, n) {
- var copy = new Array(n);
- for (var i = 0; i < n; ++i) {
- copy[i] = arr[i];
- }
- return copy;
- }
- function unwrapListeners(arr) {
- var ret = new Array(arr.length);
- for (var i = 0; i < ret.length; ++i) {
- ret[i] = arr[i].listener || arr[i];
- }
- return ret;
- }
- function objectCreatePolyfill(proto) {
- var F = function F() {};
- F.prototype = proto;
- return new F();
- }
- function objectKeysPolyfill(obj) {
- var keys = [];
- for (var k in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, k)) {
- keys.push(k);
- }
- }
- return k;
- }
- function functionBindPolyfill(context) {
- var fn = this;
- return function () {
- return fn.apply(context, arguments);
- };
- }
- }, {}],
- 14: [function (require, module, exports) {
- (function (Buffer) {
- function isArray(arg) {
- if (Array.isArray) {
- return Array.isArray(arg);
- }
- return objectToString(arg) === "[object Array]";
- }
- exports.isArray = isArray;
- function isBoolean(arg) {
- return typeof arg === "boolean";
- }
- exports.isBoolean = isBoolean;
- function isNull(arg) {
- return arg === null;
- }
- exports.isNull = isNull;
- function isNullOrUndefined(arg) {
- return arg == null;
- }
- exports.isNullOrUndefined = isNullOrUndefined;
- function isNumber(arg) {
- return typeof arg === "number";
- }
- exports.isNumber = isNumber;
- function isString(arg) {
- return typeof arg === "string";
- }
- exports.isString = isString;
- function isSymbol(arg) {
- return _typeof(arg) === "symbol";
- }
- exports.isSymbol = isSymbol;
- function isUndefined(arg) {
- return arg === void 0;
- }
- exports.isUndefined = isUndefined;
- function isRegExp(re) {
- return objectToString(re) === "[object RegExp]";
- }
- exports.isRegExp = isRegExp;
- function isObject(arg) {
- return _typeof(arg) === "object" && arg !== null;
- }
- exports.isObject = isObject;
- function isDate(d) {
- return objectToString(d) === "[object Date]";
- }
- exports.isDate = isDate;
- function isError(e) {
- return objectToString(e) === "[object Error]" || e instanceof Error;
- }
- exports.isError = isError;
- function isFunction(arg) {
- return typeof arg === "function";
- }
- exports.isFunction = isFunction;
- function isPrimitive(arg) {
- return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || _typeof(arg) === "symbol" || typeof arg === "undefined";
- }
- exports.isPrimitive = isPrimitive;
- exports.isBuffer = Buffer.isBuffer;
- function objectToString(o) {
- return Object.prototype.toString.call(o);
- }
- }).call(this, {
- isBuffer: require("../../is-buffer/index.js")
- });
- }, {
- "../../is-buffer/index.js": 81
- }],
- 15: [function (require, module, exports) {
- "use strict";
- var copy = require("es5-ext/object/copy"),
- normalizeOptions = require("es5-ext/object/normalize-options"),
- ensureCallable = require("es5-ext/object/valid-callable"),
- map = require("es5-ext/object/map"),
- callable = require("es5-ext/object/valid-callable"),
- validValue = require("es5-ext/object/valid-value"),
- bind = Function.prototype.bind,
- defineProperty = Object.defineProperty,
- hasOwnProperty = Object.prototype.hasOwnProperty,
- define;
- define = function define(name, desc, options) {
- var value = validValue(desc) && callable(desc.value),
- dgs;
- dgs = copy(desc);
- delete dgs.writable;
- delete dgs.value;
- dgs.get = function () {
- if (!options.overwriteDefinition && hasOwnProperty.call(this, name)) return value;
- desc.value = bind.call(value, options.resolveContext ? options.resolveContext(this) : this);
- defineProperty(this, name, desc);
- return this[name];
- };
- return dgs;
- };
- module.exports = function (props) {
- var options = normalizeOptions(arguments[1]);
- if (options.resolveContext != null) ensureCallable(options.resolveContext);
- return map(props, function (desc, name) {
- return define(name, desc, options);
- });
- };
- }, {
- "es5-ext/object/copy": 39,
- "es5-ext/object/map": 48,
- "es5-ext/object/normalize-options": 49,
- "es5-ext/object/valid-callable": 54,
- "es5-ext/object/valid-value": 55
- }],
- 16: [function (require, module, exports) {
- "use strict";
- var assign = require("es5-ext/object/assign"),
- normalizeOpts = require("es5-ext/object/normalize-options"),
- isCallable = require("es5-ext/object/is-callable"),
- contains = require("es5-ext/string/#/contains"),
- d;
- d = module.exports = function (dscr, value) {
- var c, e, w, options, desc;
- if (arguments.length < 2 || typeof dscr !== "string") {
- options = value;
- value = dscr;
- dscr = null;
- } else {
- options = arguments[2];
- }
- if (dscr == null) {
- c = w = true;
- e = false;
- } else {
- c = contains.call(dscr, "c");
- e = contains.call(dscr, "e");
- w = contains.call(dscr, "w");
- }
- desc = {
- value: value,
- configurable: c,
- enumerable: e,
- writable: w
- };
- return !options ? desc : assign(normalizeOpts(options), desc);
- };
- d.gs = function (dscr, get, set) {
- var c, e, options, desc;
- if (typeof dscr !== "string") {
- options = set;
- set = get;
- get = dscr;
- dscr = null;
- } else {
- options = arguments[3];
- }
- if (get == null) {
- get = undefined;
- } else if (!isCallable(get)) {
- options = get;
- get = set = undefined;
- } else if (set == null) {
- set = undefined;
- } else if (!isCallable(set)) {
- options = set;
- set = undefined;
- }
- if (dscr == null) {
- c = true;
- e = false;
- } else {
- c = contains.call(dscr, "c");
- e = contains.call(dscr, "e");
- }
- desc = {
- get: get,
- set: set,
- configurable: c,
- enumerable: e
- };
- return !options ? desc : assign(normalizeOpts(options), desc);
- };
- }, {
- "es5-ext/object/assign": 36,
- "es5-ext/object/is-callable": 42,
- "es5-ext/object/normalize-options": 49,
- "es5-ext/string/#/contains": 56
- }],
- 17: [function (require, module, exports) {
- (function (process, Buffer) {
- var stream = require("readable-stream");
- var eos = require("end-of-stream");
- var inherits = require("inherits");
- var shift = require("stream-shift");
- var SIGNAL_FLUSH = Buffer.from && Buffer.from !== Uint8Array.from ? Buffer.from([0]) : new Buffer([0]);
- var onuncork = function onuncork(self, fn) {
- if (self._corked) self.once("uncork", fn);else fn();
- };
- var autoDestroy = function autoDestroy(self, err) {
- if (self._autoDestroy) self.destroy(err);
- };
- var destroyer = function destroyer(self, end) {
- return function (err) {
- if (err) autoDestroy(self, err.message === "premature close" ? null : err);else if (end && !self._ended) self.end();
- };
- };
- var end = function end(ws, fn) {
- if (!ws) return fn();
- if (ws._writableState && ws._writableState.finished) return fn();
- if (ws._writableState) return ws.end(fn);
- ws.end();
- fn();
- };
- var toStreams2 = function toStreams2(rs) {
- return new stream.Readable({
- objectMode: true,
- highWaterMark: 16
- }).wrap(rs);
- };
- var Duplexify = function Duplexify(writable, readable, opts) {
- if (!(this instanceof Duplexify)) return new Duplexify(writable, readable, opts);
- stream.Duplex.call(this, opts);
- this._writable = null;
- this._readable = null;
- this._readable2 = null;
- this._autoDestroy = !opts || opts.autoDestroy !== false;
- this._forwardDestroy = !opts || opts.destroy !== false;
- this._forwardEnd = !opts || opts.end !== false;
- this._corked = 1;
- this._ondrain = null;
- this._drained = false;
- this._forwarding = false;
- this._unwrite = null;
- this._unread = null;
- this._ended = false;
- this.destroyed = false;
- if (writable) this.setWritable(writable);
- if (readable) this.setReadable(readable);
- };
- inherits(Duplexify, stream.Duplex);
- Duplexify.obj = function (writable, readable, opts) {
- if (!opts) opts = {};
- opts.objectMode = true;
- opts.highWaterMark = 16;
- return new Duplexify(writable, readable, opts);
- };
- Duplexify.prototype.cork = function () {
- if (++this._corked === 1) this.emit("cork");
- };
- Duplexify.prototype.uncork = function () {
- if (this._corked && --this._corked === 0) this.emit("uncork");
- };
- Duplexify.prototype.setWritable = function (writable) {
- if (this._unwrite) this._unwrite();
- if (this.destroyed) {
- if (writable && writable.destroy) writable.destroy();
- return;
- }
- if (writable === null || writable === false) {
- this.end();
- return;
- }
- var self = this;
- var unend = eos(writable, {
- writable: true,
- readable: false
- }, destroyer(this, this._forwardEnd));
- var ondrain = function ondrain() {
- var ondrain = self._ondrain;
- self._ondrain = null;
- if (ondrain) ondrain();
- };
- var clear = function clear() {
- self._writable.removeListener("drain", ondrain);
- unend();
- };
- if (this._unwrite) process.nextTick(ondrain);
- this._writable = writable;
- this._writable.on("drain", ondrain);
- this._unwrite = clear;
- this.uncork();
- };
- Duplexify.prototype.setReadable = function (readable) {
- if (this._unread) this._unread();
- if (this.destroyed) {
- if (readable && readable.destroy) readable.destroy();
- return;
- }
- if (readable === null || readable === false) {
- this.push(null);
- this.resume();
- return;
- }
- var self = this;
- var unend = eos(readable, {
- writable: false,
- readable: true
- }, destroyer(this));
- var onreadable = function onreadable() {
- self._forward();
- };
- var onend = function onend() {
- self.push(null);
- };
- var clear = function clear() {
- self._readable2.removeListener("readable", onreadable);
- self._readable2.removeListener("end", onend);
- unend();
- };
- this._drained = true;
- this._readable = readable;
- this._readable2 = readable._readableState ? readable : toStreams2(readable);
- this._readable2.on("readable", onreadable);
- this._readable2.on("end", onend);
- this._unread = clear;
- this._forward();
- };
- Duplexify.prototype._read = function () {
- this._drained = true;
- this._forward();
- };
- Duplexify.prototype._forward = function () {
- if (this._forwarding || !this._readable2 || !this._drained) return;
- this._forwarding = true;
- var data;
- while (this._drained && (data = shift(this._readable2)) !== null) {
- if (this.destroyed) continue;
- this._drained = this.push(data);
- }
- this._forwarding = false;
- };
- Duplexify.prototype.destroy = function (err) {
- if (this.destroyed) return;
- this.destroyed = true;
- var self = this;
- process.nextTick(function () {
- self._destroy(err);
- });
- };
- Duplexify.prototype._destroy = function (err) {
- if (err) {
- var ondrain = this._ondrain;
- this._ondrain = null;
- if (ondrain) ondrain(err);else this.emit("error", err);
- }
- if (this._forwardDestroy) {
- if (this._readable && this._readable.destroy) this._readable.destroy();
- if (this._writable && this._writable.destroy) this._writable.destroy();
- }
- this.emit("close");
- };
- Duplexify.prototype._write = function (data, enc, cb) {
- if (this.destroyed) return cb();
- if (this._corked) return onuncork(this, this._write.bind(this, data, enc, cb));
- if (data === SIGNAL_FLUSH) return this._finish(cb);
- if (!this._writable) return cb();
- if (this._writable.write(data) === false) this._ondrain = cb;else cb();
- };
- Duplexify.prototype._finish = function (cb) {
- var self = this;
- this.emit("preend");
- onuncork(this, function () {
- end(self._forwardEnd && self._writable, function () {
- if (self._writableState.prefinished === false) self._writableState.prefinished = true;
- self.emit("prefinish");
- onuncork(self, cb);
- });
- });
- };
- Duplexify.prototype.end = function (data, enc, cb) {
- if (typeof data === "function") return this.end(null, null, data);
- if (typeof enc === "function") return this.end(data, null, enc);
- this._ended = true;
- if (data) this.write(data);
- if (!this._writableState.ending) this.write(SIGNAL_FLUSH);
- return stream.Writable.prototype.end.call(this, cb);
- };
- module.exports = Duplexify;
- }).call(this, require("_process"), require("buffer").Buffer);
- }, {
- _process: 92,
- buffer: 12,
- "end-of-stream": 18,
- inherits: 80,
- "readable-stream": 108,
- "stream-shift": 111
- }],
- 18: [function (require, module, exports) {
- var once = require("once");
- var noop = function noop() {};
- var isRequest = function isRequest(stream) {
- return stream.setHeader && typeof stream.abort === "function";
- };
- var isChildProcess = function isChildProcess(stream) {
- return stream.stdio && Array.isArray(stream.stdio) && stream.stdio.length === 3;
- };
- var eos = function eos(stream, opts, callback) {
- if (typeof opts === "function") return eos(stream, null, opts);
- if (!opts) opts = {};
- callback = once(callback || noop);
- var ws = stream._writableState;
- var rs = stream._readableState;
- var readable = opts.readable || opts.readable !== false && stream.readable;
- var writable = opts.writable || opts.writable !== false && stream.writable;
- var onlegacyfinish = function onlegacyfinish() {
- if (!stream.writable) onfinish();
- };
- var onfinish = function onfinish() {
- writable = false;
- if (!readable) callback.call(stream);
- };
- var onend = function onend() {
- readable = false;
- if (!writable) callback.call(stream);
- };
- var onexit = function onexit(exitCode) {
- callback.call(stream, exitCode ? new Error("exited with error code: " + exitCode) : null);
- };
- var onerror = function onerror(err) {
- callback.call(stream, err);
- };
- var onclose = function onclose() {
- if (readable && !(rs && rs.ended)) return callback.call(stream, new Error("premature close"));
- if (writable && !(ws && ws.ended)) return callback.call(stream, new Error("premature close"));
- };
- var onrequest = function onrequest() {
- stream.req.on("finish", onfinish);
- };
- if (isRequest(stream)) {
- stream.on("complete", onfinish);
- stream.on("abort", onclose);
- if (stream.req) onrequest();else stream.on("request", onrequest);
- } else if (writable && !ws) {
- stream.on("end", onlegacyfinish);
- stream.on("close", onlegacyfinish);
- }
- if (isChildProcess(stream)) stream.on("exit", onexit);
- stream.on("end", onend);
- stream.on("finish", onfinish);
- if (opts.error !== false) stream.on("error", onerror);
- stream.on("close", onclose);
- return function () {
- stream.removeListener("complete", onfinish);
- stream.removeListener("abort", onclose);
- stream.removeListener("request", onrequest);
- if (stream.req) stream.req.removeListener("finish", onfinish);
- stream.removeListener("end", onlegacyfinish);
- stream.removeListener("close", onlegacyfinish);
- stream.removeListener("finish", onfinish);
- stream.removeListener("exit", onexit);
- stream.removeListener("end", onend);
- stream.removeListener("error", onerror);
- stream.removeListener("close", onclose);
- };
- };
- module.exports = eos;
- }, {
- once: 90
- }],
- 19: [function (require, module, exports) {
- "use strict";
- var value = require("../../object/valid-value");
- module.exports = function () {
- value(this).length = 0;
- return this;
- };
- }, {
- "../../object/valid-value": 55
- }],
- 20: [function (require, module, exports) {
- "use strict";
- var numberIsNaN = require("../../number/is-nan"),
- toPosInt = require("../../number/to-pos-integer"),
- value = require("../../object/valid-value"),
- indexOf = Array.prototype.indexOf,
- objHasOwnProperty = Object.prototype.hasOwnProperty,
- abs = Math.abs,
- floor = Math.floor;
- module.exports = function (searchElement) {
- var i, length, fromIndex, val;
- if (!numberIsNaN(searchElement)) return indexOf.apply(this, arguments);
- length = toPosInt(value(this).length);
- fromIndex = arguments[1];
- if (isNaN(fromIndex)) fromIndex = 0;else if (fromIndex >= 0) fromIndex = floor(fromIndex);else fromIndex = toPosInt(this.length) - floor(abs(fromIndex));
- for (i = fromIndex; i < length; ++i) {
- if (objHasOwnProperty.call(this, i)) {
- val = this[i];
- if (numberIsNaN(val)) return i;
- }
- }
- return -1;
- };
- }, {
- "../../number/is-nan": 30,
- "../../number/to-pos-integer": 34,
- "../../object/valid-value": 55
- }],
- 21: [function (require, module, exports) {
- "use strict";
- module.exports = require("./is-implemented")() ? Array.from : require("./shim");
- }, {
- "./is-implemented": 22,
- "./shim": 23
- }],
- 22: [function (require, module, exports) {
- "use strict";
- module.exports = function () {
- var from = Array.from,
- arr,
- result;
- if (typeof from !== "function") return false;
- arr = ["raz", "dwa"];
- result = from(arr);
- return Boolean(result && result !== arr && result[1] === "dwa");
- };
- }, {}],
- 23: [function (require, module, exports) {
- "use strict";
- var iteratorSymbol = require("es6-symbol").iterator,
- isArguments = require("../../function/is-arguments"),
- isFunction = require("../../function/is-function"),
- toPosInt = require("../../number/to-pos-integer"),
- callable = require("../../object/valid-callable"),
- validValue = require("../../object/valid-value"),
- isValue = require("../../object/is-value"),
- isString = require("../../string/is-string"),
- isArray = Array.isArray,
- call = Function.prototype.call,
- desc = {
- configurable: true,
- enumerable: true,
- writable: true,
- value: null
- },
- defineProperty = Object.defineProperty;
- module.exports = function (arrayLike) {
- var mapFn = arguments[1],
- thisArg = arguments[2],
- Context,
- i,
- j,
- arr,
- length,
- code,
- iterator,
- result,
- getIterator,
- value;
- arrayLike = Object(validValue(arrayLike));
- if (isValue(mapFn)) callable(mapFn);
- if (!this || this === Array || !isFunction(this)) {
- if (!mapFn) {
- if (isArguments(arrayLike)) {
- length = arrayLike.length;
- if (length !== 1) return Array.apply(null, arrayLike);
- arr = new Array(1);
- arr[0] = arrayLike[0];
- return arr;
- }
- if (isArray(arrayLike)) {
- arr = new Array(length = arrayLike.length);
- for (i = 0; i < length; ++i) {
- arr[i] = arrayLike[i];
- }
- return arr;
- }
- }
- arr = [];
- } else {
- Context = this;
- }
- if (!isArray(arrayLike)) {
- if ((getIterator = arrayLike[iteratorSymbol]) !== undefined) {
- iterator = callable(getIterator).call(arrayLike);
- if (Context) arr = new Context();
- result = iterator.next();
- i = 0;
- while (!result.done) {
- value = mapFn ? call.call(mapFn, thisArg, result.value, i) : result.value;
- if (Context) {
- desc.value = value;
- defineProperty(arr, i, desc);
- } else {
- arr[i] = value;
- }
- result = iterator.next();
- ++i;
- }
- length = i;
- } else if (isString(arrayLike)) {
- length = arrayLike.length;
- if (Context) arr = new Context();
- for (i = 0, j = 0; i < length; ++i) {
- value = arrayLike[i];
- if (i + 1 < length) {
- code = value.charCodeAt(0);
- if (code >= 55296 && code <= 56319) value += arrayLike[++i];
- }
- value = mapFn ? call.call(mapFn, thisArg, value, j) : value;
- if (Context) {
- desc.value = value;
- defineProperty(arr, j, desc);
- } else {
- arr[j] = value;
- }
- ++j;
- }
- length = j;
- }
- }
- if (length === undefined) {
- length = toPosInt(arrayLike.length);
- if (Context) arr = new Context(length);
- for (i = 0; i < length; ++i) {
- value = mapFn ? call.call(mapFn, thisArg, arrayLike[i], i) : arrayLike[i];
- if (Context) {
- desc.value = value;
- defineProperty(arr, i, desc);
- } else {
- arr[i] = value;
- }
- }
- }
- if (Context) {
- desc.value = null;
- arr.length = length;
- }
- return arr;
- };
- }, {
- "../../function/is-arguments": 24,
- "../../function/is-function": 25,
- "../../number/to-pos-integer": 34,
- "../../object/is-value": 44,
- "../../object/valid-callable": 54,
- "../../object/valid-value": 55,
- "../../string/is-string": 59,
- "es6-symbol": 73
- }],
- 24: [function (require, module, exports) {
- "use strict";
- var objToString = Object.prototype.toString,
- id = objToString.call(function () {
- return arguments;
- }());
- module.exports = function (value) {
- return objToString.call(value) === id;
- };
- }, {}],
- 25: [function (require, module, exports) {
- "use strict";
- var objToString = Object.prototype.toString,
- id = objToString.call(require("./noop"));
- module.exports = function (value) {
- return typeof value === "function" && objToString.call(value) === id;
- };
- }, {
- "./noop": 26
- }],
- 26: [function (require, module, exports) {
- "use strict";
- module.exports = function () {};
- }, {}],
- 27: [function (require, module, exports) {
- "use strict";
- module.exports = require("./is-implemented")() ? Math.sign : require("./shim");
- }, {
- "./is-implemented": 28,
- "./shim": 29
- }],
- 28: [function (require, module, exports) {
- "use strict";
- module.exports = function () {
- var sign = Math.sign;
- if (typeof sign !== "function") return false;
- return sign(10) === 1 && sign(-20) === -1;
- };
- }, {}],
- 29: [function (require, module, exports) {
- "use strict";
- module.exports = function (value) {
- value = Number(value);
- if (isNaN(value) || value === 0) return value;
- return value > 0 ? 1 : -1;
- };
- }, {}],
- 30: [function (require, module, exports) {
- "use strict";
- module.exports = require("./is-implemented")() ? Number.isNaN : require("./shim");
- }, {
- "./is-implemented": 31,
- "./shim": 32
- }],
- 31: [function (require, module, exports) {
- "use strict";
- module.exports = function () {
- var numberIsNaN = Number.isNaN;
- if (typeof numberIsNaN !== "function") return false;
- return !numberIsNaN({}) && numberIsNaN(NaN) && !numberIsNaN(34);
- };
- }, {}],
- 32: [function (require, module, exports) {
- "use strict";
- module.exports = function (value) {
- return value !== value;
- };
- }, {}],
- 33: [function (require, module, exports) {
- "use strict";
- var sign = require("../math/sign"),
- abs = Math.abs,
- floor = Math.floor;
- module.exports = function (value) {
- if (isNaN(value)) return 0;
- value = Number(value);
- if (value === 0 || !isFinite(value)) return value;
- return sign(value) * floor(abs(value));
- };
- }, {
- "../math/sign": 27
- }],
- 34: [function (require, module, exports) {
- "use strict";
- var toInteger = require("./to-integer"),
- max = Math.max;
- module.exports = function (value) {
- return max(0, toInteger(value));
- };
- }, {
- "./to-integer": 33
- }],
- 35: [function (require, module, exports) {
- "use strict";
- var callable = require("./valid-callable"),
- value = require("./valid-value"),
- bind = Function.prototype.bind,
- call = Function.prototype.call,
- keys = Object.keys,
- objPropertyIsEnumerable = Object.prototype.propertyIsEnumerable;
- module.exports = function (method, defVal) {
- return function (obj, cb) {
- var list,
- thisArg = arguments[2],
- compareFn = arguments[3];
- obj = Object(value(obj));
- callable(cb);
- list = keys(obj);
- if (compareFn) {
- list.sort(typeof compareFn === "function" ? bind.call(compareFn, obj) : undefined);
- }
- if (typeof method !== "function") method = list[method];
- return call.call(method, list, function (key, index) {
- if (!objPropertyIsEnumerable.call(obj, key)) return defVal;
- return call.call(cb, thisArg, obj[key], key, obj, index);
- });
- };
- };
- }, {
- "./valid-callable": 54,
- "./valid-value": 55
- }],
- 36: [function (require, module, exports) {
- "use strict";
- module.exports = require("./is-implemented")() ? Object.assign : require("./shim");
- }, {
- "./is-implemented": 37,
- "./shim": 38
- }],
- 37: [function (require, module, exports) {
- "use strict";
- module.exports = function () {
- var assign = Object.assign,
- obj;
- if (typeof assign !== "function") return false;
- obj = {
- foo: "raz"
- };
- assign(obj, {
- bar: "dwa"
- }, {
- trzy: "trzy"
- });
- return obj.foo + obj.bar + obj.trzy === "razdwatrzy";
- };
- }, {}],
- 38: [function (require, module, exports) {
- "use strict";
- var keys = require("../keys"),
- value = require("../valid-value"),
- max = Math.max;
- module.exports = function (dest, src) {
- var error,
- i,
- length = max(arguments.length, 2),
- assign;
- dest = Object(value(dest));
- assign = function assign(key) {
- try {
- dest[key] = src[key];
- } catch (e) {
- if (!error) error = e;
- }
- };
- for (i = 1; i < length; ++i) {
- src = arguments[i];
- keys(src).forEach(assign);
- }
- if (error !== undefined) throw error;
- return dest;
- };
- }, {
- "../keys": 45,
- "../valid-value": 55
- }],
- 39: [function (require, module, exports) {
- "use strict";
- var aFrom = require("../array/from"),
- assign = require("./assign"),
- value = require("./valid-value");
- module.exports = function (obj) {
- var copy = Object(value(obj)),
- propertyNames = arguments[1],
- options = Object(arguments[2]);
- if (copy !== obj && !propertyNames) return copy;
- var result = {};
- if (propertyNames) {
- aFrom(propertyNames, function (propertyName) {
- if (options.ensure || propertyName in obj) result[propertyName] = obj[propertyName];
- });
- } else {
- assign(result, obj);
- }
- return result;
- };
- }, {
- "../array/from": 21,
- "./assign": 36,
- "./valid-value": 55
- }],
- 40: [function (require, module, exports) {
- "use strict";
- var create = Object.create,
- shim;
- if (!require("./set-prototype-of/is-implemented")()) {
- shim = require("./set-prototype-of/shim");
- }
- module.exports = function () {
- var nullObject, polyProps, desc;
- if (!shim) return create;
- if (shim.level !== 1) return create;
- nullObject = {};
- polyProps = {};
- desc = {
- configurable: false,
- enumerable: false,
- writable: true,
- value: undefined
- };
- Object.getOwnPropertyNames(Object.prototype).forEach(function (name) {
- if (name === "__proto__") {
- polyProps[name] = {
- configurable: true,
- enumerable: false,
- writable: true,
- value: undefined
- };
- return;
- }
- polyProps[name] = desc;
- });
- Object.defineProperties(nullObject, polyProps);
- Object.defineProperty(shim, "nullPolyfill", {
- configurable: false,
- enumerable: false,
- writable: false,
- value: nullObject
- });
- return function (prototype, props) {
- return create(prototype === null ? nullObject : prototype, props);
- };
- }();
- }, {
- "./set-prototype-of/is-implemented": 52,
- "./set-prototype-of/shim": 53
- }],
- 41: [function (require, module, exports) {
- "use strict";
- module.exports = require("./_iterate")("forEach");
- }, {
- "./_iterate": 35
- }],
- 42: [function (require, module, exports) {
- "use strict";
- module.exports = function (obj) {
- return typeof obj === "function";
- };
- }, {}],
- 43: [function (require, module, exports) {
- "use strict";
- var isValue = require("./is-value");
- var map = {
- function: true,
- object: true
- };
- module.exports = function (value) {
- return isValue(value) && map[_typeof(value)] || false;
- };
- }, {
- "./is-value": 44
- }],
- 44: [function (require, module, exports) {
- "use strict";
- var _undefined = require("../function/noop")();
- module.exports = function (val) {
- return val !== _undefined && val !== null;
- };
- }, {
- "../function/noop": 26
- }],
- 45: [function (require, module, exports) {
- "use strict";
- module.exports = require("./is-implemented")() ? Object.keys : require("./shim");
- }, {
- "./is-implemented": 46,
- "./shim": 47
- }],
- 46: [function (require, module, exports) {
- "use strict";
- module.exports = function () {
- try {
- Object.keys("primitive");
- return true;
- } catch (e) {
- return false;
- }
- };
- }, {}],
- 47: [function (require, module, exports) {
- "use strict";
- var isValue = require("../is-value");
- var keys = Object.keys;
- module.exports = function (object) {
- return keys(isValue(object) ? Object(object) : object);
- };
- }, {
- "../is-value": 44
- }],
- 48: [function (require, module, exports) {
- "use strict";
- var callable = require("./valid-callable"),
- forEach = require("./for-each"),
- call = Function.prototype.call;
- module.exports = function (obj, cb) {
- var result = {},
- thisArg = arguments[2];
- callable(cb);
- forEach(obj, function (value, key, targetObj, index) {
- result[key] = call.call(cb, thisArg, value, key, targetObj, index);
- });
- return result;
- };
- }, {
- "./for-each": 41,
- "./valid-callable": 54
- }],
- 49: [function (require, module, exports) {
- "use strict";
- var isValue = require("./is-value");
- var forEach = Array.prototype.forEach,
- create = Object.create;
- var process = function process(src, obj) {
- var key;
- for (key in src) {
- obj[key] = src[key];
- }
- };
- module.exports = function (opts1) {
- var result = create(null);
- forEach.call(arguments, function (options) {
- if (!isValue(options)) return;
- process(Object(options), result);
- });
- return result;
- };
- }, {
- "./is-value": 44
- }],
- 50: [function (require, module, exports) {
- "use strict";
- var forEach = Array.prototype.forEach,
- create = Object.create;
- module.exports = function (arg) {
- var set = create(null);
- forEach.call(arguments, function (name) {
- set[name] = true;
- });
- return set;
- };
- }, {}],
- 51: [function (require, module, exports) {
- "use strict";
- module.exports = require("./is-implemented")() ? Object.setPrototypeOf : require("./shim");
- }, {
- "./is-implemented": 52,
- "./shim": 53
- }],
- 52: [function (require, module, exports) {
- "use strict";
- var create = Object.create,
- getPrototypeOf = Object.getPrototypeOf,
- plainObject = {};
- module.exports = function () {
- var setPrototypeOf = Object.setPrototypeOf,
- customCreate = arguments[0] || create;
- if (typeof setPrototypeOf !== "function") return false;
- return getPrototypeOf(setPrototypeOf(customCreate(null), plainObject)) === plainObject;
- };
- }, {}],
- 53: [function (require, module, exports) {
- "use strict";
- var isObject = require("../is-object"),
- value = require("../valid-value"),
- objIsPrototypeOf = Object.prototype.isPrototypeOf,
- defineProperty = Object.defineProperty,
- nullDesc = {
- configurable: true,
- enumerable: false,
- writable: true,
- value: undefined
- },
- validate;
- validate = function validate(obj, prototype) {
- value(obj);
- if (prototype === null || isObject(prototype)) return obj;
- throw new TypeError("Prototype must be null or an object");
- };
- module.exports = function (status) {
- var fn, set;
- if (!status) return null;
- if (status.level === 2) {
- if (status.set) {
- set = status.set;
- fn = function fn(obj, prototype) {
- set.call(validate(obj, prototype), prototype);
- return obj;
- };
- } else {
- fn = function fn(obj, prototype) {
- validate(obj, prototype).__proto__ = prototype;
- return obj;
- };
- }
- } else {
- fn = function self(obj, prototype) {
- var isNullBase;
- validate(obj, prototype);
- isNullBase = objIsPrototypeOf.call(self.nullPolyfill, obj);
- if (isNullBase) delete self.nullPolyfill.__proto__;
- if (prototype === null) prototype = self.nullPolyfill;
- obj.__proto__ = prototype;
- if (isNullBase) defineProperty(self.nullPolyfill, "__proto__", nullDesc);
- return obj;
- };
- }
- return Object.defineProperty(fn, "level", {
- configurable: false,
- enumerable: false,
- writable: false,
- value: status.level
- });
- }(function () {
- var tmpObj1 = Object.create(null),
- tmpObj2 = {},
- set,
- desc = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__");
- if (desc) {
- try {
- set = desc.set;
- set.call(tmpObj1, tmpObj2);
- } catch (ignore) {}
- if (Object.getPrototypeOf(tmpObj1) === tmpObj2) return {
- set: set,
- level: 2
- };
- }
- tmpObj1.__proto__ = tmpObj2;
- if (Object.getPrototypeOf(tmpObj1) === tmpObj2) return {
- level: 2
- };
- tmpObj1 = {};
- tmpObj1.__proto__ = tmpObj2;
- if (Object.getPrototypeOf(tmpObj1) === tmpObj2) return {
- level: 1
- };
- return false;
- }());
- require("../create");
- }, {
- "../create": 40,
- "../is-object": 43,
- "../valid-value": 55
- }],
- 54: [function (require, module, exports) {
- "use strict";
- module.exports = function (fn) {
- if (typeof fn !== "function") throw new TypeError(fn + " is not a function");
- return fn;
- };
- }, {}],
- 55: [function (require, module, exports) {
- "use strict";
- var isValue = require("./is-value");
- module.exports = function (value) {
- if (!isValue(value)) throw new TypeError("Cannot use null or undefined");
- return value;
- };
- }, {
- "./is-value": 44
- }],
- 56: [function (require, module, exports) {
- "use strict";
- module.exports = require("./is-implemented")() ? String.prototype.contains : require("./shim");
- }, {
- "./is-implemented": 57,
- "./shim": 58
- }],
- 57: [function (require, module, exports) {
- "use strict";
- var str = "razdwatrzy";
- module.exports = function () {
- if (typeof str.contains !== "function") return false;
- return str.contains("dwa") === true && str.contains("foo") === false;
- };
- }, {}],
- 58: [function (require, module, exports) {
- "use strict";
- var indexOf = String.prototype.indexOf;
- module.exports = function (searchString) {
- return indexOf.call(this, searchString, arguments[1]) > -1;
- };
- }, {}],
- 59: [function (require, module, exports) {
- "use strict";
- var objToString = Object.prototype.toString,
- id = objToString.call("");
- module.exports = function (value) {
- return typeof value === "string" || value && _typeof(value) === "object" && (value instanceof String || objToString.call(value) === id) || false;
- };
- }, {}],
- 60: [function (require, module, exports) {
- "use strict";
- var setPrototypeOf = require("es5-ext/object/set-prototype-of"),
- contains = require("es5-ext/string/#/contains"),
- d = require("d"),
- _Symbol = require("es6-symbol"),
- Iterator = require("./");
- var defineProperty = Object.defineProperty,
- ArrayIterator;
- ArrayIterator = module.exports = function (arr, kind) {
- if (!(this instanceof ArrayIterator)) throw new TypeError("Constructor requires 'new'");
- Iterator.call(this, arr);
- if (!kind) kind = "value";else if (contains.call(kind, "key+value")) kind = "key+value";else if (contains.call(kind, "key")) kind = "key";else kind = "value";
- defineProperty(this, "__kind__", d("", kind));
- };
- if (setPrototypeOf) setPrototypeOf(ArrayIterator, Iterator);
- delete ArrayIterator.prototype.constructor;
- ArrayIterator.prototype = Object.create(Iterator.prototype, {
- _resolve: d(function (i) {
- if (this.__kind__ === "value") return this.__list__[i];
- if (this.__kind__ === "key+value") return [i, this.__list__[i]];
- return i;
- })
- });
- defineProperty(ArrayIterator.prototype, _Symbol.toStringTag, d("c", "Array Iterator"));
- }, {
- "./": 63,
- d: 16,
- "es5-ext/object/set-prototype-of": 51,
- "es5-ext/string/#/contains": 56,
- "es6-symbol": 73
- }],
- 61: [function (require, module, exports) {
- "use strict";
- var isArguments = require("es5-ext/function/is-arguments"),
- callable = require("es5-ext/object/valid-callable"),
- isString = require("es5-ext/string/is-string"),
- get = require("./get");
- var isArray = Array.isArray,
- call = Function.prototype.call,
- some = Array.prototype.some;
- module.exports = function (iterable, cb) {
- var mode,
- thisArg = arguments[2],
- result,
- doBreak,
- broken,
- i,
- length,
- char,
- code;
- if (isArray(iterable) || isArguments(iterable)) mode = "array";else if (isString(iterable)) mode = "string";else iterable = get(iterable);
- callable(cb);
- doBreak = function doBreak() {
- broken = true;
- };
- if (mode === "array") {
- some.call(iterable, function (value) {
- call.call(cb, thisArg, value, doBreak);
- return broken;
- });
- return;
- }
- if (mode === "string") {
- length = iterable.length;
- for (i = 0; i < length; ++i) {
- char = iterable[i];
- if (i + 1 < length) {
- code = char.charCodeAt(0);
- if (code >= 55296 && code <= 56319) char += iterable[++i];
- }
- call.call(cb, thisArg, char, doBreak);
- if (broken) break;
- }
- return;
- }
- result = iterable.next();
- while (!result.done) {
- call.call(cb, thisArg, result.value, doBreak);
- if (broken) return;
- result = iterable.next();
- }
- };
- }, {
- "./get": 62,
- "es5-ext/function/is-arguments": 24,
- "es5-ext/object/valid-callable": 54,
- "es5-ext/string/is-string": 59
- }],
- 62: [function (require, module, exports) {
- "use strict";
- var isArguments = require("es5-ext/function/is-arguments"),
- isString = require("es5-ext/string/is-string"),
- ArrayIterator = require("./array"),
- StringIterator = require("./string"),
- iterable = require("./valid-iterable"),
- iteratorSymbol = require("es6-symbol").iterator;
- module.exports = function (obj) {
- if (typeof iterable(obj)[iteratorSymbol] === "function") return obj[iteratorSymbol]();
- if (isArguments(obj)) return new ArrayIterator(obj);
- if (isString(obj)) return new StringIterator(obj);
- return new ArrayIterator(obj);
- };
- }, {
- "./array": 60,
- "./string": 65,
- "./valid-iterable": 66,
- "es5-ext/function/is-arguments": 24,
- "es5-ext/string/is-string": 59,
- "es6-symbol": 73
- }],
- 63: [function (require, module, exports) {
- "use strict";
- var clear = require("es5-ext/array/#/clear"),
- assign = require("es5-ext/object/assign"),
- callable = require("es5-ext/object/valid-callable"),
- value = require("es5-ext/object/valid-value"),
- d = require("d"),
- autoBind = require("d/auto-bind"),
- _Symbol2 = require("es6-symbol");
- var defineProperty = Object.defineProperty,
- defineProperties = Object.defineProperties,
- _Iterator;
- module.exports = _Iterator = function Iterator(list, context) {
- if (!(this instanceof _Iterator)) throw new TypeError("Constructor requires 'new'");
- defineProperties(this, {
- __list__: d("w", value(list)),
- __context__: d("w", context),
- __nextIndex__: d("w", 0)
- });
- if (!context) return;
- callable(context.on);
- context.on("_add", this._onAdd);
- context.on("_delete", this._onDelete);
- context.on("_clear", this._onClear);
- };
- delete _Iterator.prototype.constructor;
- defineProperties(_Iterator.prototype, assign({
- _next: d(function () {
- var i;
- if (!this.__list__) return undefined;
- if (this.__redo__) {
- i = this.__redo__.shift();
- if (i !== undefined) return i;
- }
- if (this.__nextIndex__ < this.__list__.length) return this.__nextIndex__++;
- this._unBind();
- return undefined;
- }),
- next: d(function () {
- return this._createResult(this._next());
- }),
- _createResult: d(function (i) {
- if (i === undefined) return {
- done: true,
- value: undefined
- };
- return {
- done: false,
- value: this._resolve(i)
- };
- }),
- _resolve: d(function (i) {
- return this.__list__[i];
- }),
- _unBind: d(function () {
- this.__list__ = null;
- delete this.__redo__;
- if (!this.__context__) return;
- this.__context__.off("_add", this._onAdd);
- this.__context__.off("_delete", this._onDelete);
- this.__context__.off("_clear", this._onClear);
- this.__context__ = null;
- }),
- toString: d(function () {
- return "[object " + (this[_Symbol2.toStringTag] || "Object") + "]";
- })
- }, autoBind({
- _onAdd: d(function (index) {
- if (index >= this.__nextIndex__) return;
- ++this.__nextIndex__;
- if (!this.__redo__) {
- defineProperty(this, "__redo__", d("c", [index]));
- return;
- }
- this.__redo__.forEach(function (redo, i) {
- if (redo >= index) this.__redo__[i] = ++redo;
- }, this);
- this.__redo__.push(index);
- }),
- _onDelete: d(function (index) {
- var i;
- if (index >= this.__nextIndex__) return;
- --this.__nextIndex__;
- if (!this.__redo__) return;
- i = this.__redo__.indexOf(index);
- if (i !== -1) this.__redo__.splice(i, 1);
- this.__redo__.forEach(function (redo, j) {
- if (redo > index) this.__redo__[j] = --redo;
- }, this);
- }),
- _onClear: d(function () {
- if (this.__redo__) clear.call(this.__redo__);
- this.__nextIndex__ = 0;
- })
- })));
- defineProperty(_Iterator.prototype, _Symbol2.iterator, d(function () {
- return this;
- }));
- }, {
- d: 16,
- "d/auto-bind": 15,
- "es5-ext/array/#/clear": 19,
- "es5-ext/object/assign": 36,
- "es5-ext/object/valid-callable": 54,
- "es5-ext/object/valid-value": 55,
- "es6-symbol": 73
- }],
- 64: [function (require, module, exports) {
- "use strict";
- var isArguments = require("es5-ext/function/is-arguments"),
- isValue = require("es5-ext/object/is-value"),
- isString = require("es5-ext/string/is-string");
- var iteratorSymbol = require("es6-symbol").iterator,
- isArray = Array.isArray;
- module.exports = function (value) {
- if (!isValue(value)) return false;
- if (isArray(value)) return true;
- if (isString(value)) return true;
- if (isArguments(value)) return true;
- return typeof value[iteratorSymbol] === "function";
- };
- }, {
- "es5-ext/function/is-arguments": 24,
- "es5-ext/object/is-value": 44,
- "es5-ext/string/is-string": 59,
- "es6-symbol": 73
- }],
- 65: [function (require, module, exports) {
- "use strict";
- var setPrototypeOf = require("es5-ext/object/set-prototype-of"),
- d = require("d"),
- _Symbol3 = require("es6-symbol"),
- Iterator = require("./");
- var defineProperty = Object.defineProperty,
- StringIterator;
- StringIterator = module.exports = function (str) {
- if (!(this instanceof StringIterator)) throw new TypeError("Constructor requires 'new'");
- str = String(str);
- Iterator.call(this, str);
- defineProperty(this, "__length__", d("", str.length));
- };
- if (setPrototypeOf) setPrototypeOf(StringIterator, Iterator);
- delete StringIterator.prototype.constructor;
- StringIterator.prototype = Object.create(Iterator.prototype, {
- _next: d(function () {
- if (!this.__list__) return undefined;
- if (this.__nextIndex__ < this.__length__) return this.__nextIndex__++;
- this._unBind();
- return undefined;
- }),
- _resolve: d(function (i) {
- var char = this.__list__[i],
- code;
- if (this.__nextIndex__ === this.__length__) return char;
- code = char.charCodeAt(0);
- if (code >= 55296 && code <= 56319) return char + this.__list__[this.__nextIndex__++];
- return char;
- })
- });
- defineProperty(StringIterator.prototype, _Symbol3.toStringTag, d("c", "String Iterator"));
- }, {
- "./": 63,
- d: 16,
- "es5-ext/object/set-prototype-of": 51,
- "es6-symbol": 73
- }],
- 66: [function (require, module, exports) {
- "use strict";
- var isIterable = require("./is-iterable");
- module.exports = function (value) {
- if (!isIterable(value)) throw new TypeError(value + " is not iterable");
- return value;
- };
- }, {
- "./is-iterable": 64
- }],
- 67: [function (require, module, exports) {
- "use strict";
- module.exports = require("./is-implemented")() ? Map : require("./polyfill");
- }, {
- "./is-implemented": 68,
- "./polyfill": 72
- }],
- 68: [function (require, module, exports) {
- "use strict";
- module.exports = function () {
- var map, iterator, result;
- if (typeof Map !== "function") return false;
- try {
- map = new Map([["raz", "one"], ["dwa", "two"], ["trzy", "three"]]);
- } catch (e) {
- return false;
- }
- if (String(map) !== "[object Map]") return false;
- if (map.size !== 3) return false;
- if (typeof map.clear !== "function") return false;
- if (typeof map.delete !== "function") return false;
- if (typeof map.entries !== "function") return false;
- if (typeof map.forEach !== "function") return false;
- if (typeof map.get !== "function") return false;
- if (typeof map.has !== "function") return false;
- if (typeof map.keys !== "function") return false;
- if (typeof map.set !== "function") return false;
- if (typeof map.values !== "function") return false;
- iterator = map.entries();
- result = iterator.next();
- if (result.done !== false) return false;
- if (!result.value) return false;
- if (result.value[0] !== "raz") return false;
- if (result.value[1] !== "one") return false;
- return true;
- };
- }, {}],
- 69: [function (require, module, exports) {
- "use strict";
- module.exports = function () {
- if (typeof Map === "undefined") return false;
- return Object.prototype.toString.call(new Map()) === "[object Map]";
- }();
- }, {}],
- 70: [function (require, module, exports) {
- "use strict";
- module.exports = require("es5-ext/object/primitive-set")("key", "value", "key+value");
- }, {
- "es5-ext/object/primitive-set": 50
- }],
- 71: [function (require, module, exports) {
- "use strict";
- var setPrototypeOf = require("es5-ext/object/set-prototype-of"),
- d = require("d"),
- Iterator = require("es6-iterator"),
- toStringTagSymbol = require("es6-symbol").toStringTag,
- kinds = require("./iterator-kinds"),
- defineProperties = Object.defineProperties,
- unBind = Iterator.prototype._unBind,
- MapIterator;
- MapIterator = module.exports = function (map, kind) {
- if (!(this instanceof MapIterator)) return new MapIterator(map, kind);
- Iterator.call(this, map.__mapKeysData__, map);
- if (!kind || !kinds[kind]) kind = "key+value";
- defineProperties(this, {
- __kind__: d("", kind),
- __values__: d("w", map.__mapValuesData__)
- });
- };
- if (setPrototypeOf) setPrototypeOf(MapIterator, Iterator);
- MapIterator.prototype = Object.create(Iterator.prototype, {
- constructor: d(MapIterator),
- _resolve: d(function (i) {
- if (this.__kind__ === "value") return this.__values__[i];
- if (this.__kind__ === "key") return this.__list__[i];
- return [this.__list__[i], this.__values__[i]];
- }),
- _unBind: d(function () {
- this.__values__ = null;
- unBind.call(this);
- }),
- toString: d(function () {
- return "[object Map Iterator]";
- })
- });
- Object.defineProperty(MapIterator.prototype, toStringTagSymbol, d("c", "Map Iterator"));
- }, {
- "./iterator-kinds": 70,
- d: 16,
- "es5-ext/object/set-prototype-of": 51,
- "es6-iterator": 63,
- "es6-symbol": 73
- }],
- 72: [function (require, module, exports) {
- "use strict";
- var clear = require("es5-ext/array/#/clear"),
- eIndexOf = require("es5-ext/array/#/e-index-of"),
- setPrototypeOf = require("es5-ext/object/set-prototype-of"),
- callable = require("es5-ext/object/valid-callable"),
- validValue = require("es5-ext/object/valid-value"),
- d = require("d"),
- ee = require("event-emitter"),
- _Symbol4 = require("es6-symbol"),
- iterator = require("es6-iterator/valid-iterable"),
- forOf = require("es6-iterator/for-of"),
- Iterator = require("./lib/iterator"),
- isNative = require("./is-native-implemented"),
- call = Function.prototype.call,
- defineProperties = Object.defineProperties,
- getPrototypeOf = Object.getPrototypeOf,
- _MapPoly;
- module.exports = _MapPoly = function MapPoly() {
- var iterable = arguments[0],
- keys,
- values,
- self;
- if (!(this instanceof _MapPoly)) throw new TypeError("Constructor requires 'new'");
- if (isNative && setPrototypeOf && Map !== _MapPoly) {
- self = setPrototypeOf(new Map(), getPrototypeOf(this));
- } else {
- self = this;
- }
- if (iterable != null) iterator(iterable);
- defineProperties(self, {
- __mapKeysData__: d("c", keys = []),
- __mapValuesData__: d("c", values = [])
- });
- if (!iterable) return self;
- forOf(iterable, function (value) {
- var key = validValue(value)[0];
- value = value[1];
- if (eIndexOf.call(keys, key) !== -1) return;
- keys.push(key);
- values.push(value);
- }, self);
- return self;
- };
- if (isNative) {
- if (setPrototypeOf) setPrototypeOf(_MapPoly, Map);
- _MapPoly.prototype = Object.create(Map.prototype, {
- constructor: d(_MapPoly)
- });
- }
- ee(defineProperties(_MapPoly.prototype, {
- clear: d(function () {
- if (!this.__mapKeysData__.length) return;
- clear.call(this.__mapKeysData__);
- clear.call(this.__mapValuesData__);
- this.emit("_clear");
- }),
- delete: d(function (key) {
- var index = eIndexOf.call(this.__mapKeysData__, key);
- if (index === -1) return false;
- this.__mapKeysData__.splice(index, 1);
- this.__mapValuesData__.splice(index, 1);
- this.emit("_delete", index, key);
- return true;
- }),
- entries: d(function () {
- return new Iterator(this, "key+value");
- }),
- forEach: d(function (cb) {
- var thisArg = arguments[1],
- iterator,
- result;
- callable(cb);
- iterator = this.entries();
- result = iterator._next();
- while (result !== undefined) {
- call.call(cb, thisArg, this.__mapValuesData__[result], this.__mapKeysData__[result], this);
- result = iterator._next();
- }
- }),
- get: d(function (key) {
- var index = eIndexOf.call(this.__mapKeysData__, key);
- if (index === -1) return;
- return this.__mapValuesData__[index];
- }),
- has: d(function (key) {
- return eIndexOf.call(this.__mapKeysData__, key) !== -1;
- }),
- keys: d(function () {
- return new Iterator(this, "key");
- }),
- set: d(function (key, value) {
- var index = eIndexOf.call(this.__mapKeysData__, key),
- emit;
- if (index === -1) {
- index = this.__mapKeysData__.push(key) - 1;
- emit = true;
- }
- this.__mapValuesData__[index] = value;
- if (emit) this.emit("_add", index, key);
- return this;
- }),
- size: d.gs(function () {
- return this.__mapKeysData__.length;
- }),
- values: d(function () {
- return new Iterator(this, "value");
- }),
- toString: d(function () {
- return "[object Map]";
- })
- }));
- Object.defineProperty(_MapPoly.prototype, _Symbol4.iterator, d(function () {
- return this.entries();
- }));
- Object.defineProperty(_MapPoly.prototype, _Symbol4.toStringTag, d("c", "Map"));
- }, {
- "./is-native-implemented": 69,
- "./lib/iterator": 71,
- d: 16,
- "es5-ext/array/#/clear": 19,
- "es5-ext/array/#/e-index-of": 20,
- "es5-ext/object/set-prototype-of": 51,
- "es5-ext/object/valid-callable": 54,
- "es5-ext/object/valid-value": 55,
- "es6-iterator/for-of": 61,
- "es6-iterator/valid-iterable": 66,
- "es6-symbol": 73,
- "event-emitter": 78
- }],
- 73: [function (require, module, exports) {
- "use strict";
- module.exports = require("./is-implemented")() ? Symbol : require("./polyfill");
- }, {
- "./is-implemented": 74,
- "./polyfill": 76
- }],
- 74: [function (require, module, exports) {
- "use strict";
- var validTypes = {
- object: true,
- symbol: true
- };
- module.exports = function () {
- var symbol;
- if (typeof Symbol !== "function") return false;
- symbol = Symbol("test symbol");
- try {
- String(symbol);
- } catch (e) {
- return false;
- }
- if (!validTypes[_typeof(Symbol.iterator)]) return false;
- if (!validTypes[_typeof(Symbol.toPrimitive)]) return false;
- if (!validTypes[_typeof(Symbol.toStringTag)]) return false;
- return true;
- };
- }, {}],
- 75: [function (require, module, exports) {
- "use strict";
- module.exports = function (x) {
- if (!x) return false;
- if (_typeof(x) === "symbol") return true;
- if (!x.constructor) return false;
- if (x.constructor.name !== "Symbol") return false;
- return x[x.constructor.toStringTag] === "Symbol";
- };
- }, {}],
- 76: [function (require, module, exports) {
- "use strict";
- var d = require("d"),
- validateSymbol = require("./validate-symbol"),
- create = Object.create,
- defineProperties = Object.defineProperties,
- defineProperty = Object.defineProperty,
- objPrototype = Object.prototype,
- NativeSymbol,
- SymbolPolyfill,
- HiddenSymbol,
- globalSymbols = create(null),
- isNativeSafe;
- if (typeof Symbol === "function") {
- NativeSymbol = Symbol;
- try {
- String(NativeSymbol());
- isNativeSafe = true;
- } catch (ignore) {}
- }
- var generateName = function () {
- var created = create(null);
- return function (desc) {
- var postfix = 0,
- name,
- ie11BugWorkaround;
- while (created[desc + (postfix || "")]) {
- ++postfix;
- }
- desc += postfix || "";
- created[desc] = true;
- name = "@@" + desc;
- defineProperty(objPrototype, name, d.gs(null, function (value) {
- if (ie11BugWorkaround) return;
- ie11BugWorkaround = true;
- defineProperty(this, name, d(value));
- ie11BugWorkaround = false;
- }));
- return name;
- };
- }();
- HiddenSymbol = function _Symbol5(description) {
- if (this instanceof HiddenSymbol) throw new TypeError("Symbol is not a constructor");
- return SymbolPolyfill(description);
- };
- module.exports = SymbolPolyfill = function _Symbol6(description) {
- var symbol;
- if (this instanceof _Symbol6) throw new TypeError("Symbol is not a constructor");
- if (isNativeSafe) return NativeSymbol(description);
- symbol = create(HiddenSymbol.prototype);
- description = description === undefined ? "" : String(description);
- return defineProperties(symbol, {
- __description__: d("", description),
- __name__: d("", generateName(description))
- });
- };
- defineProperties(SymbolPolyfill, {
- for: d(function (key) {
- if (globalSymbols[key]) return globalSymbols[key];
- return globalSymbols[key] = SymbolPolyfill(String(key));
- }),
- keyFor: d(function (s) {
- var key;
- validateSymbol(s);
- for (key in globalSymbols) {
- if (globalSymbols[key] === s) return key;
- }
- }),
- hasInstance: d("", NativeSymbol && NativeSymbol.hasInstance || SymbolPolyfill("hasInstance")),
- isConcatSpreadable: d("", NativeSymbol && NativeSymbol.isConcatSpreadable || SymbolPolyfill("isConcatSpreadable")),
- iterator: d("", NativeSymbol && NativeSymbol.iterator || SymbolPolyfill("iterator")),
- match: d("", NativeSymbol && NativeSymbol.match || SymbolPolyfill("match")),
- replace: d("", NativeSymbol && NativeSymbol.replace || SymbolPolyfill("replace")),
- search: d("", NativeSymbol && NativeSymbol.search || SymbolPolyfill("search")),
- species: d("", NativeSymbol && NativeSymbol.species || SymbolPolyfill("species")),
- split: d("", NativeSymbol && NativeSymbol.split || SymbolPolyfill("split")),
- toPrimitive: d("", NativeSymbol && NativeSymbol.toPrimitive || SymbolPolyfill("toPrimitive")),
- toStringTag: d("", NativeSymbol && NativeSymbol.toStringTag || SymbolPolyfill("toStringTag")),
- unscopables: d("", NativeSymbol && NativeSymbol.unscopables || SymbolPolyfill("unscopables"))
- });
- defineProperties(HiddenSymbol.prototype, {
- constructor: d(SymbolPolyfill),
- toString: d("", function () {
- return this.__name__;
- })
- });
- defineProperties(SymbolPolyfill.prototype, {
- toString: d(function () {
- return "Symbol (" + validateSymbol(this).__description__ + ")";
- }),
- valueOf: d(function () {
- return validateSymbol(this);
- })
- });
- defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toPrimitive, d("", function () {
- var symbol = validateSymbol(this);
- if (_typeof(symbol) === "symbol") return symbol;
- return symbol.toString();
- }));
- defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toStringTag, d("c", "Symbol"));
- defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toStringTag, d("c", SymbolPolyfill.prototype[SymbolPolyfill.toStringTag]));
- defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toPrimitive, d("c", SymbolPolyfill.prototype[SymbolPolyfill.toPrimitive]));
- }, {
- "./validate-symbol": 77,
- d: 16
- }],
- 77: [function (require, module, exports) {
- "use strict";
- var isSymbol = require("./is-symbol");
- module.exports = function (value) {
- if (!isSymbol(value)) throw new TypeError(value + " is not a symbol");
- return value;
- };
- }, {
- "./is-symbol": 75
- }],
- 78: [function (require, module, exports) {
- "use strict";
- var d = require("d"),
- callable = require("es5-ext/object/valid-callable"),
- apply = Function.prototype.apply,
- call = Function.prototype.call,
- create = Object.create,
- defineProperty = Object.defineProperty,
- defineProperties = Object.defineProperties,
- hasOwnProperty = Object.prototype.hasOwnProperty,
- descriptor = {
- configurable: true,
- enumerable: false,
- writable: true
- },
- on,
- _once2,
- off,
- emit,
- methods,
- descriptors,
- base;
- on = function on(type, listener) {
- var data;
- callable(listener);
- if (!hasOwnProperty.call(this, "__ee__")) {
- data = descriptor.value = create(null);
- defineProperty(this, "__ee__", descriptor);
- descriptor.value = null;
- } else {
- data = this.__ee__;
- }
- if (!data[type]) data[type] = listener;else if (_typeof(data[type]) === "object") data[type].push(listener);else data[type] = [data[type], listener];
- return this;
- };
- _once2 = function once(type, listener) {
- var _once, self;
- callable(listener);
- self = this;
- on.call(this, type, _once = function once() {
- off.call(self, type, _once);
- apply.call(listener, this, arguments);
- });
- _once.__eeOnceListener__ = listener;
- return this;
- };
- off = function off(type, listener) {
- var data, listeners, candidate, i;
- callable(listener);
- if (!hasOwnProperty.call(this, "__ee__")) return this;
- data = this.__ee__;
- if (!data[type]) return this;
- listeners = data[type];
- if (_typeof(listeners) === "object") {
- for (i = 0; candidate = listeners[i]; ++i) {
- if (candidate === listener || candidate.__eeOnceListener__ === listener) {
- if (listeners.length === 2) data[type] = listeners[i ? 0 : 1];else listeners.splice(i, 1);
- }
- }
- } else {
- if (listeners === listener || listeners.__eeOnceListener__ === listener) {
- delete data[type];
- }
- }
- return this;
- };
- emit = function emit(type) {
- var i, l, listener, listeners, args;
- if (!hasOwnProperty.call(this, "__ee__")) return;
- listeners = this.__ee__[type];
- if (!listeners) return;
- if (_typeof(listeners) === "object") {
- l = arguments.length;
- args = new Array(l - 1);
- for (i = 1; i < l; ++i) {
- args[i - 1] = arguments[i];
- }
- listeners = listeners.slice();
- for (i = 0; listener = listeners[i]; ++i) {
- apply.call(listener, this, args);
- }
- } else {
- switch (arguments.length) {
- case 1:
- call.call(listeners, this);
- break;
- case 2:
- call.call(listeners, this, arguments[1]);
- break;
- case 3:
- call.call(listeners, this, arguments[1], arguments[2]);
- break;
- default:
- l = arguments.length;
- args = new Array(l - 1);
- for (i = 1; i < l; ++i) {
- args[i - 1] = arguments[i];
- }
- apply.call(listeners, this, args);
- }
- }
- };
- methods = {
- on: on,
- once: _once2,
- off: off,
- emit: emit
- };
- descriptors = {
- on: d(on),
- once: d(_once2),
- off: d(off),
- emit: d(emit)
- };
- base = defineProperties({}, descriptors);
- module.exports = exports = function exports(o) {
- return o == null ? create(base) : defineProperties(Object(o), descriptors);
- };
- exports.methods = methods;
- }, {
- d: 16,
- "es5-ext/object/valid-callable": 54
- }],
- 79: [function (require, module, exports) {
- exports.read = function (buffer, offset, isLE, mLen, nBytes) {
- var e, m;
- var eLen = nBytes * 8 - mLen - 1;
- var eMax = (1 << eLen) - 1;
- var eBias = eMax >> 1;
- var nBits = -7;
- var i = isLE ? nBytes - 1 : 0;
- var d = isLE ? -1 : 1;
- var s = buffer[offset + i];
- i += d;
- e = s & (1 << -nBits) - 1;
- s >>= -nBits;
- nBits += eLen;
- for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
- m = e & (1 << -nBits) - 1;
- e >>= -nBits;
- nBits += mLen;
- for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
- if (e === 0) {
- e = 1 - eBias;
- } else if (e === eMax) {
- return m ? NaN : (s ? -1 : 1) * Infinity;
- } else {
- m = m + Math.pow(2, mLen);
- e = e - eBias;
- }
- return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
- };
- exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
- var e, m, c;
- var eLen = nBytes * 8 - mLen - 1;
- var eMax = (1 << eLen) - 1;
- var eBias = eMax >> 1;
- var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
- var i = isLE ? 0 : nBytes - 1;
- var d = isLE ? 1 : -1;
- var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
- value = Math.abs(value);
- if (isNaN(value) || value === Infinity) {
- m = isNaN(value) ? 1 : 0;
- e = eMax;
- } else {
- e = Math.floor(Math.log(value) / Math.LN2);
- if (value * (c = Math.pow(2, -e)) < 1) {
- e--;
- c *= 2;
- }
- if (e + eBias >= 1) {
- value += rt / c;
- } else {
- value += rt * Math.pow(2, 1 - eBias);
- }
- if (value * c >= 2) {
- e++;
- c /= 2;
- }
- if (e + eBias >= eMax) {
- m = 0;
- e = eMax;
- } else if (e + eBias >= 1) {
- m = (value * c - 1) * Math.pow(2, mLen);
- e = e + eBias;
- } else {
- m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
- e = 0;
- }
- }
- for (; mLen >= 8; buffer[offset + i] = m & 255, i += d, m /= 256, mLen -= 8) {}
- e = e << mLen | m;
- eLen += mLen;
- for (; eLen > 0; buffer[offset + i] = e & 255, i += d, e /= 256, eLen -= 8) {}
- buffer[offset + i - d] |= s * 128;
- };
- }, {}],
- 80: [function (require, module, exports) {
- if (typeof Object.create === "function") {
- module.exports = function inherits(ctor, superCtor) {
- ctor.super_ = superCtor;
- ctor.prototype = Object.create(superCtor.prototype, {
- constructor: {
- value: ctor,
- enumerable: false,
- writable: true,
- configurable: true
- }
- });
- };
- } else {
- module.exports = function inherits(ctor, superCtor) {
- ctor.super_ = superCtor;
- var TempCtor = function TempCtor() {};
- TempCtor.prototype = superCtor.prototype;
- ctor.prototype = new TempCtor();
- ctor.prototype.constructor = ctor;
- };
- }
- }, {}],
- 81: [function (require, module, exports) {
- module.exports = function (obj) {
- return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer);
- };
- function isBuffer(obj) {
- return !!obj.constructor && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
- }
- function isSlowBuffer(obj) {
- return typeof obj.readFloatLE === "function" && typeof obj.slice === "function" && isBuffer(obj.slice(0, 0));
- }
- }, {}],
- 82: [function (require, module, exports) {
- "use strict";
- var Buffer = require("safe-buffer").Buffer;
- var protocol = module.exports;
- protocol.types = {
- 0: "reserved",
- 1: "connect",
- 2: "connack",
- 3: "publish",
- 4: "puback",
- 5: "pubrec",
- 6: "pubrel",
- 7: "pubcomp",
- 8: "subscribe",
- 9: "suback",
- 10: "unsubscribe",
- 11: "unsuback",
- 12: "pingreq",
- 13: "pingresp",
- 14: "disconnect",
- 15: "auth"
- };
- protocol.codes = {};
- for (var k in protocol.types) {
- var v = protocol.types[k];
- protocol.codes[v] = k;
- }
- protocol.CMD_SHIFT = 4;
- protocol.CMD_MASK = 240;
- protocol.DUP_MASK = 8;
- protocol.QOS_MASK = 3;
- protocol.QOS_SHIFT = 1;
- protocol.RETAIN_MASK = 1;
- protocol.LENGTH_MASK = 127;
- protocol.LENGTH_FIN_MASK = 128;
- protocol.SESSIONPRESENT_MASK = 1;
- protocol.SESSIONPRESENT_HEADER = Buffer.from([protocol.SESSIONPRESENT_MASK]);
- protocol.CONNACK_HEADER = Buffer.from([protocol.codes["connack"] << protocol.CMD_SHIFT]);
- protocol.USERNAME_MASK = 128;
- protocol.PASSWORD_MASK = 64;
- protocol.WILL_RETAIN_MASK = 32;
- protocol.WILL_QOS_MASK = 24;
- protocol.WILL_QOS_SHIFT = 3;
- protocol.WILL_FLAG_MASK = 4;
- protocol.CLEAN_SESSION_MASK = 2;
- protocol.CONNECT_HEADER = Buffer.from([protocol.codes["connect"] << protocol.CMD_SHIFT]);
- protocol.properties = {
- sessionExpiryInterval: 17,
- willDelayInterval: 24,
- receiveMaximum: 33,
- maximumPacketSize: 39,
- topicAliasMaximum: 34,
- requestResponseInformation: 25,
- requestProblemInformation: 23,
- userProperties: 38,
- authenticationMethod: 21,
- authenticationData: 22,
- payloadFormatIndicator: 1,
- messageExpiryInterval: 2,
- contentType: 3,
- responseTopic: 8,
- correlationData: 9,
- maximumQoS: 36,
- retainAvailable: 37,
- assignedClientIdentifier: 18,
- reasonString: 31,
- wildcardSubscriptionAvailable: 40,
- subscriptionIdentifiersAvailable: 41,
- sharedSubscriptionAvailable: 42,
- serverKeepAlive: 19,
- responseInformation: 26,
- serverReference: 28,
- topicAlias: 35,
- subscriptionIdentifier: 11
- };
- protocol.propertiesCodes = {};
- for (var prop in protocol.properties) {
- var id = protocol.properties[prop];
- protocol.propertiesCodes[id] = prop;
- }
- protocol.propertiesTypes = {
- sessionExpiryInterval: "int32",
- willDelayInterval: "int32",
- receiveMaximum: "int16",
- maximumPacketSize: "int32",
- topicAliasMaximum: "int16",
- requestResponseInformation: "byte",
- requestProblemInformation: "byte",
- userProperties: "pair",
- authenticationMethod: "string",
- authenticationData: "binary",
- payloadFormatIndicator: "byte",
- messageExpiryInterval: "int32",
- contentType: "string",
- responseTopic: "string",
- correlationData: "binary",
- maximumQoS: "int8",
- retainAvailable: "byte",
- assignedClientIdentifier: "string",
- reasonString: "string",
- wildcardSubscriptionAvailable: "byte",
- subscriptionIdentifiersAvailable: "byte",
- sharedSubscriptionAvailable: "byte",
- serverKeepAlive: "int32",
- responseInformation: "string",
- serverReference: "string",
- topicAlias: "int16",
- subscriptionIdentifier: "var"
- };
- function genHeader(type) {
- return [0, 1, 2].map(function (qos) {
- return [0, 1].map(function (dup) {
- return [0, 1].map(function (retain) {
- var buf = new Buffer(1);
- buf.writeUInt8(protocol.codes[type] << protocol.CMD_SHIFT | (dup ? protocol.DUP_MASK : 0) | qos << protocol.QOS_SHIFT | retain, 0, true);
- return buf;
- });
- });
- });
- }
- protocol.PUBLISH_HEADER = genHeader("publish");
- protocol.SUBSCRIBE_HEADER = genHeader("subscribe");
- protocol.SUBSCRIBE_OPTIONS_QOS_MASK = 3;
- protocol.SUBSCRIBE_OPTIONS_NL_MASK = 1;
- protocol.SUBSCRIBE_OPTIONS_NL_SHIFT = 2;
- protocol.SUBSCRIBE_OPTIONS_RAP_MASK = 1;
- protocol.SUBSCRIBE_OPTIONS_RAP_SHIFT = 3;
- protocol.SUBSCRIBE_OPTIONS_RH_MASK = 3;
- protocol.SUBSCRIBE_OPTIONS_RH_SHIFT = 4;
- protocol.SUBSCRIBE_OPTIONS_RH = [0, 16, 32];
- protocol.SUBSCRIBE_OPTIONS_NL = 4;
- protocol.SUBSCRIBE_OPTIONS_RAP = 8;
- protocol.SUBSCRIBE_OPTIONS_QOS = [0, 1, 2];
- protocol.UNSUBSCRIBE_HEADER = genHeader("unsubscribe");
- protocol.ACKS = {
- unsuback: genHeader("unsuback"),
- puback: genHeader("puback"),
- pubcomp: genHeader("pubcomp"),
- pubrel: genHeader("pubrel"),
- pubrec: genHeader("pubrec")
- };
- protocol.SUBACK_HEADER = Buffer.from([protocol.codes["suback"] << protocol.CMD_SHIFT]);
- protocol.VERSION3 = Buffer.from([3]);
- protocol.VERSION4 = Buffer.from([4]);
- protocol.VERSION5 = Buffer.from([5]);
- protocol.QOS = [0, 1, 2].map(function (qos) {
- return Buffer.from([qos]);
- });
- protocol.EMPTY = {
- pingreq: Buffer.from([protocol.codes["pingreq"] << 4, 0]),
- pingresp: Buffer.from([protocol.codes["pingresp"] << 4, 0]),
- disconnect: Buffer.from([protocol.codes["disconnect"] << 4, 0])
- };
- }, {
- "safe-buffer": 110
- }],
- 83: [function (require, module, exports) {
- "use strict";
- var Buffer = require("safe-buffer").Buffer;
- var writeToStream = require("./writeToStream");
- var EE = require("events").EventEmitter;
- var inherits = require("inherits");
- function generate(packet, opts) {
- var stream = new Accumulator();
- writeToStream(packet, stream, opts);
- return stream.concat();
- }
- function Accumulator() {
- this._array = new Array(20);
- this._i = 0;
- }
- inherits(Accumulator, EE);
- Accumulator.prototype.write = function (chunk) {
- this._array[this._i++] = chunk;
- return true;
- };
- Accumulator.prototype.concat = function () {
- var length = 0;
- var lengths = new Array(this._array.length);
- var list = this._array;
- var pos = 0;
- var i;
- var result;
- for (i = 0; i < list.length && list[i] !== undefined; i++) {
- if (typeof list[i] !== "string") lengths[i] = list[i].length;else lengths[i] = Buffer.byteLength(list[i]);
- length += lengths[i];
- }
- result = Buffer.allocUnsafe(length);
- for (i = 0; i < list.length && list[i] !== undefined; i++) {
- if (typeof list[i] !== "string") {
- list[i].copy(result, pos);
- pos += lengths[i];
- } else {
- result.write(list[i], pos);
- pos += lengths[i];
- }
- }
- return result;
- };
- module.exports = generate;
- }, {
- "./writeToStream": 89,
- events: 13,
- inherits: 80,
- "safe-buffer": 110
- }],
- 84: [function (require, module, exports) {
- "use strict";
- exports.parser = require("./parser");
- exports.generate = require("./generate");
- exports.writeToStream = require("./writeToStream");
- }, {
- "./generate": 83,
- "./parser": 88,
- "./writeToStream": 89
- }],
- 85: [function (require, module, exports) {
- var DuplexStream = require("readable-stream/duplex"),
- util = require("util"),
- Buffer = require("safe-buffer").Buffer;
- function BufferList(callback) {
- if (!(this instanceof BufferList)) return new BufferList(callback);
- this._bufs = [];
- this.length = 0;
- if (typeof callback == "function") {
- this._callback = callback;
- var piper = function piper(err) {
- if (this._callback) {
- this._callback(err);
- this._callback = null;
- }
- }.bind(this);
- this.on("pipe", function onPipe(src) {
- src.on("error", piper);
- });
- this.on("unpipe", function onUnpipe(src) {
- src.removeListener("error", piper);
- });
- } else {
- this.append(callback);
- }
- DuplexStream.call(this);
- }
- util.inherits(BufferList, DuplexStream);
- BufferList.prototype._offset = function _offset(offset) {
- var tot = 0,
- i = 0,
- _t;
- if (offset === 0) return [0, 0];
- for (; i < this._bufs.length; i++) {
- _t = tot + this._bufs[i].length;
- if (offset < _t || i == this._bufs.length - 1) return [i, offset - tot];
- tot = _t;
- }
- };
- BufferList.prototype.append = function append(buf) {
- var i = 0;
- if (Buffer.isBuffer(buf)) {
- this._appendBuffer(buf);
- } else if (Array.isArray(buf)) {
- for (; i < buf.length; i++) {
- this.append(buf[i]);
- }
- } else if (buf instanceof BufferList) {
- for (; i < buf._bufs.length; i++) {
- this.append(buf._bufs[i]);
- }
- } else if (buf != null) {
- if (typeof buf == "number") buf = buf.toString();
- this._appendBuffer(Buffer.from(buf));
- }
- return this;
- };
- BufferList.prototype._appendBuffer = function appendBuffer(buf) {
- this._bufs.push(buf);
- this.length += buf.length;
- };
- BufferList.prototype._write = function _write(buf, encoding, callback) {
- this._appendBuffer(buf);
- if (typeof callback == "function") callback();
- };
- BufferList.prototype._read = function _read(size) {
- if (!this.length) return this.push(null);
- size = Math.min(size, this.length);
- this.push(this.slice(0, size));
- this.consume(size);
- };
- BufferList.prototype.end = function end(chunk) {
- DuplexStream.prototype.end.call(this, chunk);
- if (this._callback) {
- this._callback(null, this.slice());
- this._callback = null;
- }
- };
- BufferList.prototype.get = function get(index) {
- return this.slice(index, index + 1)[0];
- };
- BufferList.prototype.slice = function slice(start, end) {
- if (typeof start == "number" && start < 0) start += this.length;
- if (typeof end == "number" && end < 0) end += this.length;
- return this.copy(null, 0, start, end);
- };
- BufferList.prototype.copy = function copy(dst, dstStart, srcStart, srcEnd) {
- if (typeof srcStart != "number" || srcStart < 0) srcStart = 0;
- if (typeof srcEnd != "number" || srcEnd > this.length) srcEnd = this.length;
- if (srcStart >= this.length) return dst || Buffer.alloc(0);
- if (srcEnd <= 0) return dst || Buffer.alloc(0);
- var copy = !!dst,
- off = this._offset(srcStart),
- len = srcEnd - srcStart,
- bytes = len,
- bufoff = copy && dstStart || 0,
- start = off[1],
- l,
- i;
- if (srcStart === 0 && srcEnd == this.length) {
- if (!copy) {
- return this._bufs.length === 1 ? this._bufs[0] : Buffer.concat(this._bufs, this.length);
- }
- for (i = 0; i < this._bufs.length; i++) {
- this._bufs[i].copy(dst, bufoff);
- bufoff += this._bufs[i].length;
- }
- return dst;
- }
- if (bytes <= this._bufs[off[0]].length - start) {
- return copy ? this._bufs[off[0]].copy(dst, dstStart, start, start + bytes) : this._bufs[off[0]].slice(start, start + bytes);
- }
- if (!copy) dst = Buffer.allocUnsafe(len);
- for (i = off[0]; i < this._bufs.length; i++) {
- l = this._bufs[i].length - start;
- if (bytes > l) {
- this._bufs[i].copy(dst, bufoff, start);
- } else {
- this._bufs[i].copy(dst, bufoff, start, start + bytes);
- break;
- }
- bufoff += l;
- bytes -= l;
- if (start) start = 0;
- }
- return dst;
- };
- BufferList.prototype.shallowSlice = function shallowSlice(start, end) {
- start = start || 0;
- end = end || this.length;
- if (start < 0) start += this.length;
- if (end < 0) end += this.length;
- var startOffset = this._offset(start),
- endOffset = this._offset(end),
- buffers = this._bufs.slice(startOffset[0], endOffset[0] + 1);
- if (endOffset[1] == 0) buffers.pop();else buffers[buffers.length - 1] = buffers[buffers.length - 1].slice(0, endOffset[1]);
- if (startOffset[1] != 0) buffers[0] = buffers[0].slice(startOffset[1]);
- return new BufferList(buffers);
- };
- BufferList.prototype.toString = function toString(encoding, start, end) {
- return this.slice(start, end).toString(encoding);
- };
- BufferList.prototype.consume = function consume(bytes) {
- while (this._bufs.length) {
- if (bytes >= this._bufs[0].length) {
- bytes -= this._bufs[0].length;
- this.length -= this._bufs[0].length;
- this._bufs.shift();
- } else {
- this._bufs[0] = this._bufs[0].slice(bytes);
- this.length -= bytes;
- break;
- }
- }
- return this;
- };
- BufferList.prototype.duplicate = function duplicate() {
- var i = 0,
- copy = new BufferList();
- for (; i < this._bufs.length; i++) {
- copy.append(this._bufs[i]);
- }
- return copy;
- };
- BufferList.prototype.destroy = function destroy() {
- this._bufs.length = 0;
- this.length = 0;
- this.push(null);
- };
- (function () {
- var methods = {
- readDoubleBE: 8,
- readDoubleLE: 8,
- readFloatBE: 4,
- readFloatLE: 4,
- readInt32BE: 4,
- readInt32LE: 4,
- readUInt32BE: 4,
- readUInt32LE: 4,
- readInt16BE: 2,
- readInt16LE: 2,
- readUInt16BE: 2,
- readUInt16LE: 2,
- readInt8: 1,
- readUInt8: 1
- };
- for (var m in methods) {
- (function (m) {
- BufferList.prototype[m] = function (offset) {
- return this.slice(offset, offset + methods[m])[m](0);
- };
- })(m);
- }
- })();
- module.exports = BufferList;
- }, {
- "readable-stream/duplex": 97,
- "safe-buffer": 110,
- util: 117
- }],
- 86: [function (require, module, exports) {
- "use strict";
- var Buffer = require("safe-buffer").Buffer;
- var max = 65536;
- var cache = {};
- function generateBuffer(i) {
- var buffer = Buffer.allocUnsafe(2);
- buffer.writeUInt8(i >> 8, 0);
- buffer.writeUInt8(i & 255, 0 + 1);
- return buffer;
- }
- function generateCache() {
- for (var i = 0; i < max; i++) {
- cache[i] = generateBuffer(i);
- }
- }
- function calcVariableByteIntLength(length) {
- if (length >= 0 && length < 128) return 1;else if (length >= 128 && length < 16384) return 2;else if (length >= 16384 && length < 2097152) return 3;else if (length >= 2097152 && length < 268435456) return 4;else return 0;
- }
- function genBufVariableByteInt(num) {
- var digit = 0;
- var pos = 0;
- var length = calcVariableByteIntLength(num);
- var buffer = Buffer.allocUnsafe(length);
- do {
- digit = num % 128 | 0;
- num = num / 128 | 0;
- if (num > 0) digit = digit | 128;
- buffer.writeUInt8(digit, pos++);
- } while (num > 0);
- return {
- data: buffer,
- length: length
- };
- }
- function generate4ByteBuffer(num) {
- var buffer = Buffer.allocUnsafe(4);
- buffer.writeUInt32BE(num, 0);
- return buffer;
- }
- module.exports = {
- cache: cache,
- generateCache: generateCache,
- generateNumber: generateBuffer,
- genBufVariableByteInt: genBufVariableByteInt,
- generate4ByteBuffer: generate4ByteBuffer
- };
- }, {
- "safe-buffer": 110
- }],
- 87: [function (require, module, exports) {
- function Packet() {
- this.cmd = null;
- this.retain = false;
- this.qos = 0;
- this.dup = false;
- this.length = -1;
- this.topic = null;
- this.payload = null;
- }
- module.exports = Packet;
- }, {}],
- 88: [function (require, module, exports) {
- "use strict";
- var bl = require("bl");
- var inherits = require("inherits");
- var EE = require("events").EventEmitter;
- var Packet = require("./packet");
- var constants = require("./constants");
- function Parser(opt) {
- if (!(this instanceof Parser)) return new Parser(opt);
- this.settings = opt || {};
- this._states = ["_parseHeader", "_parseLength", "_parsePayload", "_newPacket"];
- this._resetState();
- }
- inherits(Parser, EE);
- Parser.prototype._resetState = function () {
- this.packet = new Packet();
- this.error = null;
- this._list = bl();
- this._stateCounter = 0;
- };
- Parser.prototype.parse = function (buf) {
- if (this.error) this._resetState();
- this._list.append(buf);
- while ((this.packet.length !== -1 || this._list.length > 0) && this[this._states[this._stateCounter]]() && !this.error) {
- this._stateCounter++;
- if (this._stateCounter >= this._states.length) this._stateCounter = 0;
- }
- return this._list.length;
- };
- Parser.prototype._parseHeader = function () {
- var zero = this._list.readUInt8(0);
- this.packet.cmd = constants.types[zero >> constants.CMD_SHIFT];
- this.packet.retain = (zero & constants.RETAIN_MASK) !== 0;
- this.packet.qos = zero >> constants.QOS_SHIFT & constants.QOS_MASK;
- this.packet.dup = (zero & constants.DUP_MASK) !== 0;
- this._list.consume(1);
- return true;
- };
- Parser.prototype._parseLength = function () {
- var result = this._parseVarByteNum(true);
- if (result) {
- this.packet.length = result.value;
- this._list.consume(result.bytes);
- }
- return !!result;
- };
- Parser.prototype._parsePayload = function () {
- var result = false;
- if (this.packet.length === 0 || this._list.length >= this.packet.length) {
- this._pos = 0;
- switch (this.packet.cmd) {
- case "connect":
- this._parseConnect();
- break;
- case "connack":
- this._parseConnack();
- break;
- case "publish":
- this._parsePublish();
- break;
- case "puback":
- case "pubrec":
- case "pubrel":
- case "pubcomp":
- this._parseConfirmation();
- break;
- case "subscribe":
- this._parseSubscribe();
- break;
- case "suback":
- this._parseSuback();
- break;
- case "unsubscribe":
- this._parseUnsubscribe();
- break;
- case "unsuback":
- this._parseUnsuback();
- break;
- case "pingreq":
- case "pingresp":
- break;
- case "disconnect":
- this._parseDisconnect();
- break;
- case "auth":
- this._parseAuth();
- break;
- default:
- this._emitError(new Error("Not supported"));
- }
- result = true;
- }
- return result;
- };
- Parser.prototype._parseConnect = function () {
- var protocolId;
- var clientId;
- var topic;
- var payload;
- var password;
- var username;
- var flags = {};
- var packet = this.packet;
- protocolId = this._parseString();
- if (protocolId === null) return this._emitError(new Error("Cannot parse protocolId"));
- if (protocolId !== "MQTT" && protocolId !== "MQIsdp") {
- return this._emitError(new Error("Invalid protocolId"));
- }
- packet.protocolId = protocolId;
- if (this._pos >= this._list.length) return this._emitError(new Error("Packet too short"));
- packet.protocolVersion = this._list.readUInt8(this._pos);
- if (packet.protocolVersion !== 3 && packet.protocolVersion !== 4 && packet.protocolVersion !== 5) {
- return this._emitError(new Error("Invalid protocol version"));
- }
- this._pos++;
- if (this._pos >= this._list.length) {
- return this._emitError(new Error("Packet too short"));
- }
- flags.username = this._list.readUInt8(this._pos) & constants.USERNAME_MASK;
- flags.password = this._list.readUInt8(this._pos) & constants.PASSWORD_MASK;
- flags.will = this._list.readUInt8(this._pos) & constants.WILL_FLAG_MASK;
- if (flags.will) {
- packet.will = {};
- packet.will.retain = (this._list.readUInt8(this._pos) & constants.WILL_RETAIN_MASK) !== 0;
- packet.will.qos = (this._list.readUInt8(this._pos) & constants.WILL_QOS_MASK) >> constants.WILL_QOS_SHIFT;
- }
- packet.clean = (this._list.readUInt8(this._pos) & constants.CLEAN_SESSION_MASK) !== 0;
- this._pos++;
- packet.keepalive = this._parseNum();
- if (packet.keepalive === -1) return this._emitError(new Error("Packet too short"));
- if (packet.protocolVersion === 5) {
- var properties = this._parseProperties();
- if (Object.getOwnPropertyNames(properties).length) {
- packet.properties = properties;
- }
- }
- clientId = this._parseString();
- if (clientId === null) return this._emitError(new Error("Packet too short"));
- packet.clientId = clientId;
- if (flags.will) {
- if (packet.protocolVersion === 5) {
- var willProperties = this._parseProperties();
- if (Object.getOwnPropertyNames(willProperties).length) {
- packet.will.properties = willProperties;
- }
- }
- topic = this._parseString();
- if (topic === null) return this._emitError(new Error("Cannot parse will topic"));
- packet.will.topic = topic;
- payload = this._parseBuffer();
- if (payload === null) return this._emitError(new Error("Cannot parse will payload"));
- packet.will.payload = payload;
- }
- if (flags.username) {
- username = this._parseString();
- if (username === null) return this._emitError(new Error("Cannot parse username"));
- packet.username = username;
- }
- if (flags.password) {
- password = this._parseBuffer();
- if (password === null) return this._emitError(new Error("Cannot parse password"));
- packet.password = password;
- }
- this.settings = packet;
- return packet;
- };
- Parser.prototype._parseConnack = function () {
- var packet = this.packet;
- if (this._list.length < 2) return null;
- packet.sessionPresent = !!(this._list.readUInt8(this._pos++) & constants.SESSIONPRESENT_MASK);
- if (this.settings.protocolVersion === 5) {
- packet.reasonCode = this._list.readUInt8(this._pos++);
- } else {
- packet.returnCode = this._list.readUInt8(this._pos++);
- }
- if (packet.returnCode === -1 || packet.reasonCode === -1) return this._emitError(new Error("Cannot parse return code"));
- if (this.settings.protocolVersion === 5) {
- var properties = this._parseProperties();
- if (Object.getOwnPropertyNames(properties).length) {
- packet.properties = properties;
- }
- }
- };
- Parser.prototype._parsePublish = function () {
- var packet = this.packet;
- packet.topic = this._parseString();
- if (packet.topic === null) return this._emitError(new Error("Cannot parse topic"));
- if (packet.qos > 0) if (!this._parseMessageId()) {
- return;
- }
- if (this.settings.protocolVersion === 5) {
- var properties = this._parseProperties();
- if (Object.getOwnPropertyNames(properties).length) {
- packet.properties = properties;
- }
- }
- packet.payload = this._list.slice(this._pos, packet.length);
- };
- Parser.prototype._parseSubscribe = function () {
- var packet = this.packet;
- var topic;
- var options;
- var qos;
- var rh;
- var rap;
- var nl;
- var subscription;
- if (packet.qos !== 1) {
- return this._emitError(new Error("Wrong subscribe header"));
- }
- packet.subscriptions = [];
- if (!this._parseMessageId()) {
- return;
- }
- if (this.settings.protocolVersion === 5) {
- var properties = this._parseProperties();
- if (Object.getOwnPropertyNames(properties).length) {
- packet.properties = properties;
- }
- }
- while (this._pos < packet.length) {
- topic = this._parseString();
- if (topic === null) return this._emitError(new Error("Cannot parse topic"));
- options = this._parseByte();
- qos = options & constants.SUBSCRIBE_OPTIONS_QOS_MASK;
- nl = (options >> constants.SUBSCRIBE_OPTIONS_NL_SHIFT & constants.SUBSCRIBE_OPTIONS_NL_MASK) !== 0;
- rap = (options >> constants.SUBSCRIBE_OPTIONS_RAP_SHIFT & constants.SUBSCRIBE_OPTIONS_RAP_MASK) !== 0;
- rh = options >> constants.SUBSCRIBE_OPTIONS_RH_SHIFT & constants.SUBSCRIBE_OPTIONS_RH_MASK;
- subscription = {
- topic: topic,
- qos: qos
- };
- if (this.settings.protocolVersion === 5) {
- subscription.nl = nl;
- subscription.rap = rap;
- subscription.rh = rh;
- }
- packet.subscriptions.push(subscription);
- }
- };
- Parser.prototype._parseSuback = function () {
- var packet = this.packet;
- this.packet.granted = [];
- if (!this._parseMessageId()) {
- return;
- }
- if (this.settings.protocolVersion === 5) {
- var properties = this._parseProperties();
- if (Object.getOwnPropertyNames(properties).length) {
- packet.properties = properties;
- }
- }
- while (this._pos < this.packet.length) {
- this.packet.granted.push(this._list.readUInt8(this._pos++));
- }
- };
- Parser.prototype._parseUnsubscribe = function () {
- var packet = this.packet;
- packet.unsubscriptions = [];
- if (!this._parseMessageId()) {
- return;
- }
- if (this.settings.protocolVersion === 5) {
- var properties = this._parseProperties();
- if (Object.getOwnPropertyNames(properties).length) {
- packet.properties = properties;
- }
- }
- while (this._pos < packet.length) {
- var topic;
- topic = this._parseString();
- if (topic === null) return this._emitError(new Error("Cannot parse topic"));
- packet.unsubscriptions.push(topic);
- }
- };
- Parser.prototype._parseUnsuback = function () {
- var packet = this.packet;
- if (!this._parseMessageId()) return this._emitError(new Error("Cannot parse messageId"));
- if (this.settings.protocolVersion === 5) {
- var properties = this._parseProperties();
- if (Object.getOwnPropertyNames(properties).length) {
- packet.properties = properties;
- }
- packet.granted = [];
- while (this._pos < this.packet.length) {
- this.packet.granted.push(this._list.readUInt8(this._pos++));
- }
- }
- };
- Parser.prototype._parseConfirmation = function () {
- var packet = this.packet;
- this._parseMessageId();
- if (this.settings.protocolVersion === 5) {
- if (packet.length > 2) {
- packet.reasonCode = this._parseByte();
- var properties = this._parseProperties();
- if (Object.getOwnPropertyNames(properties).length) {
- packet.properties = properties;
- }
- }
- }
- return true;
- };
- Parser.prototype._parseDisconnect = function () {
- var packet = this.packet;
- if (this.settings.protocolVersion === 5) {
- packet.reasonCode = this._parseByte();
- var properties = this._parseProperties();
- if (Object.getOwnPropertyNames(properties).length) {
- packet.properties = properties;
- }
- }
- return true;
- };
- Parser.prototype._parseAuth = function () {
- var packet = this.packet;
- if (this.settings.protocolVersion !== 5) {
- return this._emitError(new Error("Not supported auth packet for this version MQTT"));
- }
- packet.reasonCode = this._parseByte();
- var properties = this._parseProperties();
- if (Object.getOwnPropertyNames(properties).length) {
- packet.properties = properties;
- }
- return true;
- };
- Parser.prototype._parseMessageId = function () {
- var packet = this.packet;
- packet.messageId = this._parseNum();
- if (packet.messageId === null) {
- this._emitError(new Error("Cannot parse messageId"));
- return false;
- }
- return true;
- };
- Parser.prototype._parseString = function (maybeBuffer) {
- var length = this._parseNum();
- var result;
- var end = length + this._pos;
- if (length === -1 || end > this._list.length || end > this.packet.length) return null;
- result = this._list.toString("utf8", this._pos, end);
- this._pos += length;
- return result;
- };
- Parser.prototype._parseStringPair = function () {
- return {
- name: this._parseString(),
- value: this._parseString()
- };
- };
- Parser.prototype._parseBuffer = function () {
- var length = this._parseNum();
- var result;
- var end = length + this._pos;
- if (length === -1 || end > this._list.length || end > this.packet.length) return null;
- result = this._list.slice(this._pos, end);
- this._pos += length;
- return result;
- };
- Parser.prototype._parseNum = function () {
- if (this._list.length - this._pos < 2) return -1;
- var result = this._list.readUInt16BE(this._pos);
- this._pos += 2;
- return result;
- };
- Parser.prototype._parse4ByteNum = function () {
- if (this._list.length - this._pos < 4) return -1;
- var result = this._list.readUInt32BE(this._pos);
- this._pos += 4;
- return result;
- };
- Parser.prototype._parseVarByteNum = function (fullInfoFlag) {
- var bytes = 0;
- var mul = 1;
- var length = 0;
- var result = true;
- var current;
- var padding = this._pos ? this._pos : 0;
- while (bytes < 5) {
- current = this._list.readUInt8(padding + bytes++);
- length += mul * (current & constants.LENGTH_MASK);
- mul *= 128;
- if ((current & constants.LENGTH_FIN_MASK) === 0) break;
- if (this._list.length <= bytes) {
- result = false;
- break;
- }
- }
- if (padding) {
- this._pos += bytes;
- }
- result = result ? fullInfoFlag ? {
- bytes: bytes,
- value: length
- } : length : false;
- return result;
- };
- Parser.prototype._parseByte = function () {
- var result = this._list.readUInt8(this._pos);
- this._pos++;
- return result;
- };
- Parser.prototype._parseByType = function (type) {
- switch (type) {
- case "byte":
- {
- return this._parseByte() !== 0;
- }
- case "int8":
- {
- return this._parseByte();
- }
- case "int16":
- {
- return this._parseNum();
- }
- case "int32":
- {
- return this._parse4ByteNum();
- }
- case "var":
- {
- return this._parseVarByteNum();
- }
- case "string":
- {
- return this._parseString();
- }
- case "pair":
- {
- return this._parseStringPair();
- }
- case "binary":
- {
- return this._parseBuffer();
- }
- }
- };
- Parser.prototype._parseProperties = function () {
- var length = this._parseVarByteNum();
- var start = this._pos;
- var end = start + length;
- var result = {};
- while (this._pos < end) {
- var type = this._parseByte();
- var name = constants.propertiesCodes[type];
- if (!name) {
- this._emitError(new Error("Unknown property"));
- return false;
- }
- if (name === "userProperties") {
- if (!result[name]) {
- result[name] = {};
- }
- var currentUserProperty = this._parseByType(constants.propertiesTypes[name]);
- result[name][currentUserProperty.name] = currentUserProperty.value;
- continue;
- }
- result[name] = this._parseByType(constants.propertiesTypes[name]);
- }
- return result;
- };
- Parser.prototype._newPacket = function () {
- if (this.packet) {
- this._list.consume(this.packet.length);
- this.emit("packet", this.packet);
- }
- this.packet = new Packet();
- this._pos = 0;
- return true;
- };
- Parser.prototype._emitError = function (err) {
- this.error = err;
- this.emit("error", err);
- };
- module.exports = Parser;
- }, {
- "./constants": 82,
- "./packet": 87,
- bl: 85,
- events: 13,
- inherits: 80
- }],
- 89: [function (require, module, exports) {
- "use strict";
- var protocol = require("./constants");
- var Buffer = require("safe-buffer").Buffer;
- var empty = Buffer.allocUnsafe(0);
- var zeroBuf = Buffer.from([0]);
- var numbers = require("./numbers");
- var nextTick = require("process-nextick-args").nextTick;
- var numCache = numbers.cache;
- var generateNumber = numbers.generateNumber;
- var generateCache = numbers.generateCache;
- var genBufVariableByteInt = numbers.genBufVariableByteInt;
- var generate4ByteBuffer = numbers.generate4ByteBuffer;
- var writeNumber = writeNumberCached;
- var toGenerate = true;
- function generate(packet, stream, opts) {
- if (stream.cork) {
- stream.cork();
- nextTick(uncork, stream);
- }
- if (toGenerate) {
- toGenerate = false;
- generateCache();
- }
- switch (packet.cmd) {
- case "connect":
- return connect(packet, stream, opts);
- case "connack":
- return connack(packet, stream, opts);
- case "publish":
- return publish(packet, stream, opts);
- case "puback":
- case "pubrec":
- case "pubrel":
- case "pubcomp":
- return confirmation(packet, stream, opts);
- case "subscribe":
- return subscribe(packet, stream, opts);
- case "suback":
- return suback(packet, stream, opts);
- case "unsubscribe":
- return unsubscribe(packet, stream, opts);
- case "unsuback":
- return unsuback(packet, stream, opts);
- case "pingreq":
- case "pingresp":
- return emptyPacket(packet, stream, opts);
- case "disconnect":
- return disconnect(packet, stream, opts);
- case "auth":
- return auth(packet, stream, opts);
- default:
- stream.emit("error", new Error("Unknown command"));
- return false;
- }
- }
- Object.defineProperty(generate, "cacheNumbers", {
- get: function get() {
- return writeNumber === writeNumberCached;
- },
- set: function set(value) {
- if (value) {
- if (!numCache || Object.keys(numCache).length === 0) toGenerate = true;
- writeNumber = writeNumberCached;
- } else {
- toGenerate = false;
- writeNumber = writeNumberGenerated;
- }
- }
- });
- function uncork(stream) {
- stream.uncork();
- }
- function connect(packet, stream, opts) {
- var settings = packet || {};
- var protocolId = settings.protocolId || "MQTT";
- var protocolVersion = settings.protocolVersion || 4;
- var will = settings.will;
- var clean = settings.clean;
- var keepalive = settings.keepalive || 0;
- var clientId = settings.clientId || "";
- var username = settings.username;
- var password = settings.password;
- var properties = settings.properties;
- if (clean === undefined) clean = true;
- var length = 0;
- if (!protocolId || typeof protocolId !== "string" && !Buffer.isBuffer(protocolId)) {
- stream.emit("error", new Error("Invalid protocolId"));
- return false;
- } else length += protocolId.length + 2;
- if (protocolVersion !== 3 && protocolVersion !== 4 && protocolVersion !== 5) {
- stream.emit("error", new Error("Invalid protocol version"));
- return false;
- } else length += 1;
- if ((typeof clientId === "string" || Buffer.isBuffer(clientId)) && (clientId || protocolVersion === 4) && (clientId || clean)) {
- length += clientId.length + 2;
- } else {
- if (protocolVersion < 4) {
- stream.emit("error", new Error("clientId must be supplied before 3.1.1"));
- return false;
- }
- if (clean * 1 === 0) {
- stream.emit("error", new Error("clientId must be given if cleanSession set to 0"));
- return false;
- }
- }
- if (typeof keepalive !== "number" || keepalive < 0 || keepalive > 65535 || keepalive % 1 !== 0) {
- stream.emit("error", new Error("Invalid keepalive"));
- return false;
- } else length += 2;
- length += 1;
- if (protocolVersion === 5) {
- var propertiesData = getProperties(stream, properties);
- length += propertiesData.length;
- }
- if (will) {
- if (_typeof(will) !== "object") {
- stream.emit("error", new Error("Invalid will"));
- return false;
- }
- if (!will.topic || typeof will.topic !== "string") {
- stream.emit("error", new Error("Invalid will topic"));
- return false;
- } else {
- length += Buffer.byteLength(will.topic) + 2;
- }
- if (will.payload) {
- if (will.payload.length >= 0) {
- if (typeof will.payload === "string") {
- length += Buffer.byteLength(will.payload) + 2;
- } else {
- length += will.payload.length + 2;
- }
- } else {
- stream.emit("error", new Error("Invalid will payload"));
- return false;
- }
- var willProperties = {};
- if (protocolVersion === 5) {
- willProperties = getProperties(stream, will.properties);
- length += willProperties.length;
- }
- }
- }
- var providedUsername = false;
- if (username != null) {
- if (isStringOrBuffer(username)) {
- providedUsername = true;
- length += Buffer.byteLength(username) + 2;
- } else {
- stream.emit("error", new Error("Invalid username"));
- return false;
- }
- }
- if (password != null) {
- if (!providedUsername) {
- stream.emit("error", new Error("Username is required to use password"));
- return false;
- }
- if (isStringOrBuffer(password)) {
- length += byteLength(password) + 2;
- } else {
- stream.emit("error", new Error("Invalid password"));
- return false;
- }
- }
- stream.write(protocol.CONNECT_HEADER);
- writeVarByteInt(stream, length);
- writeStringOrBuffer(stream, protocolId);
- stream.write(protocolVersion === 4 ? protocol.VERSION4 : protocolVersion === 5 ? protocol.VERSION5 : protocol.VERSION3);
- var flags = 0;
- flags |= username != null ? protocol.USERNAME_MASK : 0;
- flags |= password != null ? protocol.PASSWORD_MASK : 0;
- flags |= will && will.retain ? protocol.WILL_RETAIN_MASK : 0;
- flags |= will && will.qos ? will.qos << protocol.WILL_QOS_SHIFT : 0;
- flags |= will ? protocol.WILL_FLAG_MASK : 0;
- flags |= clean ? protocol.CLEAN_SESSION_MASK : 0;
- stream.write(Buffer.from([flags]));
- writeNumber(stream, keepalive);
- if (protocolVersion === 5) {
- propertiesData.write();
- }
- writeStringOrBuffer(stream, clientId);
- if (will) {
- if (protocolVersion === 5) {
- willProperties.write();
- }
- writeString(stream, will.topic);
- writeStringOrBuffer(stream, will.payload);
- }
- if (username != null) {
- writeStringOrBuffer(stream, username);
- }
- if (password != null) {
- writeStringOrBuffer(stream, password);
- }
- return true;
- }
- function connack(packet, stream, opts) {
- var version = opts ? opts.protocolVersion : 4;
- var settings = packet || {};
- var rc = version === 5 ? settings.reasonCode : settings.returnCode;
- var properties = settings.properties;
- var length = 2;
- if (typeof rc !== "number") {
- stream.emit("error", new Error("Invalid return code"));
- return false;
- }
- var propertiesData = null;
- if (version === 5) {
- propertiesData = getProperties(stream, properties);
- length += propertiesData.length;
- }
- stream.write(protocol.CONNACK_HEADER);
- writeVarByteInt(stream, length);
- stream.write(settings.sessionPresent ? protocol.SESSIONPRESENT_HEADER : zeroBuf);
- stream.write(Buffer.from([rc]));
- if (propertiesData != null) {
- propertiesData.write();
- }
- return true;
- }
- function publish(packet, stream, opts) {
- var version = opts ? opts.protocolVersion : 4;
- var settings = packet || {};
- var qos = settings.qos || 0;
- var retain = settings.retain ? protocol.RETAIN_MASK : 0;
- var topic = settings.topic;
- var payload = settings.payload || empty;
- var id = settings.messageId;
- var properties = settings.properties;
- var length = 0;
- if (typeof topic === "string") length += Buffer.byteLength(topic) + 2;else if (Buffer.isBuffer(topic)) length += topic.length + 2;else {
- stream.emit("error", new Error("Invalid topic"));
- return false;
- }
- if (!Buffer.isBuffer(payload)) length += Buffer.byteLength(payload);else length += payload.length;
- if (qos && typeof id !== "number") {
- stream.emit("error", new Error("Invalid messageId"));
- return false;
- } else if (qos) length += 2;
- var propertiesData = null;
- if (version === 5) {
- propertiesData = getProperties(stream, properties);
- length += propertiesData.length;
- }
- stream.write(protocol.PUBLISH_HEADER[qos][settings.dup ? 1 : 0][retain ? 1 : 0]);
- writeVarByteInt(stream, length);
- writeNumber(stream, byteLength(topic));
- stream.write(topic);
- if (qos > 0) writeNumber(stream, id);
- if (propertiesData != null) {
- propertiesData.write();
- }
- return stream.write(payload);
- }
- function confirmation(packet, stream, opts) {
- var version = opts ? opts.protocolVersion : 4;
- var settings = packet || {};
- var type = settings.cmd || "puback";
- var id = settings.messageId;
- var dup = settings.dup && type === "pubrel" ? protocol.DUP_MASK : 0;
- var qos = 0;
- var reasonCode = settings.reasonCode;
- var properties = settings.properties;
- var length = version === 5 ? 3 : 2;
- if (type === "pubrel") qos = 1;
- if (typeof id !== "number") {
- stream.emit("error", new Error("Invalid messageId"));
- return false;
- }
- var propertiesData = null;
- if (version === 5) {
- propertiesData = getPropertiesByMaximumPacketSize(stream, properties, opts, length);
- if (!propertiesData) {
- return false;
- }
- length += propertiesData.length;
- }
- stream.write(protocol.ACKS[type][qos][dup][0]);
- writeVarByteInt(stream, length);
- writeNumber(stream, id);
- if (version === 5) {
- stream.write(Buffer.from([reasonCode]));
- }
- if (propertiesData !== null) {
- propertiesData.write();
- }
- return true;
- }
- function subscribe(packet, stream, opts) {
- var version = opts ? opts.protocolVersion : 4;
- var settings = packet || {};
- var dup = settings.dup ? protocol.DUP_MASK : 0;
- var id = settings.messageId;
- var subs = settings.subscriptions;
- var properties = settings.properties;
- var length = 0;
- if (typeof id !== "number") {
- stream.emit("error", new Error("Invalid messageId"));
- return false;
- } else length += 2;
- var propertiesData = null;
- if (version === 5) {
- propertiesData = getProperties(stream, properties);
- length += propertiesData.length;
- }
- if (_typeof(subs) === "object" && subs.length) {
- for (var i = 0; i < subs.length; i += 1) {
- var itopic = subs[i].topic;
- var iqos = subs[i].qos;
- if (typeof itopic !== "string") {
- stream.emit("error", new Error("Invalid subscriptions - invalid topic"));
- return false;
- }
- if (typeof iqos !== "number") {
- stream.emit("error", new Error("Invalid subscriptions - invalid qos"));
- return false;
- }
- if (version === 5) {
- var nl = subs[i].nl || false;
- if (typeof nl !== "boolean") {
- stream.emit("error", new Error("Invalid subscriptions - invalid No Local"));
- return false;
- }
- var rap = subs[i].rap || false;
- if (typeof rap !== "boolean") {
- stream.emit("error", new Error("Invalid subscriptions - invalid Retain as Published"));
- return false;
- }
- var rh = subs[i].rh || 0;
- if (typeof rh !== "number" || rh > 2) {
- stream.emit("error", new Error("Invalid subscriptions - invalid Retain Handling"));
- return false;
- }
- }
- length += Buffer.byteLength(itopic) + 2 + 1;
- }
- } else {
- stream.emit("error", new Error("Invalid subscriptions"));
- return false;
- }
- stream.write(protocol.SUBSCRIBE_HEADER[1][dup ? 1 : 0][0]);
- writeVarByteInt(stream, length);
- writeNumber(stream, id);
- if (propertiesData !== null) {
- propertiesData.write();
- }
- var result = true;
- for (var j = 0; j < subs.length; j++) {
- var sub = subs[j];
- var jtopic = sub.topic;
- var jqos = sub.qos;
- var jnl = +sub.nl;
- var jrap = +sub.rap;
- var jrh = sub.rh;
- var joptions;
- writeString(stream, jtopic);
- joptions = protocol.SUBSCRIBE_OPTIONS_QOS[jqos];
- if (version === 5) {
- joptions |= jnl ? protocol.SUBSCRIBE_OPTIONS_NL : 0;
- joptions |= jrap ? protocol.SUBSCRIBE_OPTIONS_RAP : 0;
- joptions |= jrh ? protocol.SUBSCRIBE_OPTIONS_RH[jrh] : 0;
- }
- result = stream.write(Buffer.from([joptions]));
- }
- return result;
- }
- function suback(packet, stream, opts) {
- var version = opts ? opts.protocolVersion : 4;
- var settings = packet || {};
- var id = settings.messageId;
- var granted = settings.granted;
- var properties = settings.properties;
- var length = 0;
- if (typeof id !== "number") {
- stream.emit("error", new Error("Invalid messageId"));
- return false;
- } else length += 2;
- if (_typeof(granted) === "object" && granted.length) {
- for (var i = 0; i < granted.length; i += 1) {
- if (typeof granted[i] !== "number") {
- stream.emit("error", new Error("Invalid qos vector"));
- return false;
- }
- length += 1;
- }
- } else {
- stream.emit("error", new Error("Invalid qos vector"));
- return false;
- }
- var propertiesData = null;
- if (version === 5) {
- propertiesData = getPropertiesByMaximumPacketSize(stream, properties, opts, length);
- if (!propertiesData) {
- return false;
- }
- length += propertiesData.length;
- }
- stream.write(protocol.SUBACK_HEADER);
- writeVarByteInt(stream, length);
- writeNumber(stream, id);
- if (propertiesData !== null) {
- propertiesData.write();
- }
- return stream.write(Buffer.from(granted));
- }
- function unsubscribe(packet, stream, opts) {
- var version = opts ? opts.protocolVersion : 4;
- var settings = packet || {};
- var id = settings.messageId;
- var dup = settings.dup ? protocol.DUP_MASK : 0;
- var unsubs = settings.unsubscriptions;
- var properties = settings.properties;
- var length = 0;
- if (typeof id !== "number") {
- stream.emit("error", new Error("Invalid messageId"));
- return false;
- } else {
- length += 2;
- }
- if (_typeof(unsubs) === "object" && unsubs.length) {
- for (var i = 0; i < unsubs.length; i += 1) {
- if (typeof unsubs[i] !== "string") {
- stream.emit("error", new Error("Invalid unsubscriptions"));
- return false;
- }
- length += Buffer.byteLength(unsubs[i]) + 2;
- }
- } else {
- stream.emit("error", new Error("Invalid unsubscriptions"));
- return false;
- }
- var propertiesData = null;
- if (version === 5) {
- propertiesData = getProperties(stream, properties);
- length += propertiesData.length;
- }
- stream.write(protocol.UNSUBSCRIBE_HEADER[1][dup ? 1 : 0][0]);
- writeVarByteInt(stream, length);
- writeNumber(stream, id);
- if (propertiesData !== null) {
- propertiesData.write();
- }
- var result = true;
- for (var j = 0; j < unsubs.length; j++) {
- result = writeString(stream, unsubs[j]);
- }
- return result;
- }
- function unsuback(packet, stream, opts) {
- var version = opts ? opts.protocolVersion : 4;
- var settings = packet || {};
- var id = settings.messageId;
- var dup = settings.dup ? protocol.DUP_MASK : 0;
- var granted = settings.granted;
- var properties = settings.properties;
- var type = settings.cmd;
- var qos = 0;
- var length = 2;
- if (typeof id !== "number") {
- stream.emit("error", new Error("Invalid messageId"));
- return false;
- }
- if (version === 5) {
- if (_typeof(granted) === "object" && granted.length) {
- for (var i = 0; i < granted.length; i += 1) {
- if (typeof granted[i] !== "number") {
- stream.emit("error", new Error("Invalid qos vector"));
- return false;
- }
- length += 1;
- }
- } else {
- stream.emit("error", new Error("Invalid qos vector"));
- return false;
- }
- }
- var propertiesData = null;
- if (version === 5) {
- propertiesData = getPropertiesByMaximumPacketSize(stream, properties, opts, length);
- if (!propertiesData) {
- return false;
- }
- length += propertiesData.length;
- }
- stream.write(protocol.ACKS[type][qos][dup][0]);
- writeVarByteInt(stream, length);
- writeNumber(stream, id);
- if (propertiesData !== null) {
- propertiesData.write();
- }
- if (version === 5) {
- stream.write(Buffer.from(granted));
- }
- return true;
- }
- function emptyPacket(packet, stream, opts) {
- return stream.write(protocol.EMPTY[packet.cmd]);
- }
- function disconnect(packet, stream, opts) {
- var version = opts ? opts.protocolVersion : 4;
- var settings = packet || {};
- var reasonCode = settings.reasonCode;
- var properties = settings.properties;
- var length = version === 5 ? 1 : 0;
- var propertiesData = null;
- if (version === 5) {
- propertiesData = getPropertiesByMaximumPacketSize(stream, properties, opts, length);
- if (!propertiesData) {
- return false;
- }
- length += propertiesData.length;
- }
- stream.write(Buffer.from([protocol.codes["disconnect"] << 4]));
- writeVarByteInt(stream, length);
- if (version === 5) {
- stream.write(Buffer.from([reasonCode]));
- }
- if (propertiesData !== null) {
- propertiesData.write();
- }
- return true;
- }
- function auth(packet, stream, opts) {
- var version = opts ? opts.protocolVersion : 4;
- var settings = packet || {};
- var reasonCode = settings.reasonCode;
- var properties = settings.properties;
- var length = version === 5 ? 1 : 0;
- if (version !== 5) stream.emit("error", new Error("Invalid mqtt version for auth packet"));
- var propertiesData = getPropertiesByMaximumPacketSize(stream, properties, opts, length);
- if (!propertiesData) {
- return false;
- }
- length += propertiesData.length;
- stream.write(Buffer.from([protocol.codes["auth"] << 4]));
- writeVarByteInt(stream, length);
- stream.write(Buffer.from([reasonCode]));
- if (propertiesData !== null) {
- propertiesData.write();
- }
- return true;
- }
- var varByteIntCache = {};
- function writeVarByteInt(stream, num) {
- var buffer = varByteIntCache[num];
- if (!buffer) {
- buffer = genBufVariableByteInt(num).data;
- if (num < 16384) varByteIntCache[num] = buffer;
- }
- stream.write(buffer);
- }
- function writeString(stream, string) {
- var strlen = Buffer.byteLength(string);
- writeNumber(stream, strlen);
- stream.write(string, "utf8");
- }
- function writeStringPair(stream, name, value) {
- writeString(stream, name);
- writeString(stream, value);
- }
- function writeNumberCached(stream, number) {
- return stream.write(numCache[number]);
- }
- function writeNumberGenerated(stream, number) {
- return stream.write(generateNumber(number));
- }
- function write4ByteNumber(stream, number) {
- return stream.write(generate4ByteBuffer(number));
- }
- function writeStringOrBuffer(stream, toWrite) {
- if (typeof toWrite === "string") {
- writeString(stream, toWrite);
- } else if (toWrite) {
- writeNumber(stream, toWrite.length);
- stream.write(toWrite);
- } else writeNumber(stream, 0);
- }
- function getProperties(stream, properties) {
- if (_typeof(properties) !== "object" || properties.length != null) {
- return {
- length: 1,
- write: function write() {
- writeProperties(stream, {}, 0);
- }
- };
- }
- var propertiesLength = 0;
- function getLengthProperty(name) {
- var type = protocol.propertiesTypes[name];
- var value = properties[name];
- var length = 0;
- switch (type) {
- case "byte":
- {
- if (typeof value !== "boolean") {
- stream.emit("error", new Error("Invalid " + name));
- return false;
- }
- length += 1 + 1;
- break;
- }
- case "int8":
- {
- if (typeof value !== "number") {
- stream.emit("error", new Error("Invalid " + name));
- return false;
- }
- length += 1 + 1;
- break;
- }
- case "binary":
- {
- if (value && value === null) {
- stream.emit("error", new Error("Invalid " + name));
- return false;
- }
- length += 1 + Buffer.byteLength(value) + 2;
- break;
- }
- case "int16":
- {
- if (typeof value !== "number") {
- stream.emit("error", new Error("Invalid " + name));
- return false;
- }
- length += 1 + 2;
- break;
- }
- case "int32":
- {
- if (typeof value !== "number") {
- stream.emit("error", new Error("Invalid " + name));
- return false;
- }
- length += 1 + 4;
- break;
- }
- case "var":
- {
- if (typeof value !== "number") {
- stream.emit("error", new Error("Invalid " + name));
- return false;
- }
- length += 1 + genBufVariableByteInt(value).length;
- break;
- }
- case "string":
- {
- if (typeof value !== "string") {
- stream.emit("error", new Error("Invalid " + name));
- return false;
- }
- length += 1 + 2 + Buffer.byteLength(value.toString());
- break;
- }
- case "pair":
- {
- if (_typeof(value) !== "object") {
- stream.emit("error", new Error("Invalid " + name));
- return false;
- }
- length += Object.getOwnPropertyNames(value).reduce(function (result, name) {
- result += 1 + 2 + Buffer.byteLength(name.toString()) + 2 + Buffer.byteLength(value[name].toString());
- return result;
- }, 0);
- break;
- }
- default:
- {
- stream.emit("error", new Error("Invalid property " + name));
- return false;
- }
- }
- return length;
- }
- if (properties) {
- for (var propName in properties) {
- var propLength = getLengthProperty(propName);
- if (!propLength) return false;
- propertiesLength += propLength;
- }
- }
- var propertiesLengthLength = genBufVariableByteInt(propertiesLength).length;
- return {
- length: propertiesLengthLength + propertiesLength,
- write: function write() {
- writeProperties(stream, properties, propertiesLength);
- }
- };
- }
- function getPropertiesByMaximumPacketSize(stream, properties, opts, length) {
- var mayEmptyProps = ["reasonString", "userProperties"];
- var maximumPacketSize = opts && opts.properties && opts.properties.maximumPacketSize ? opts.properties.maximumPacketSize : 0;
- var propertiesData = getProperties(stream, properties);
- if (maximumPacketSize) {
- while (length + propertiesData.length > maximumPacketSize) {
- var currentMayEmptyProp = mayEmptyProps.shift();
- if (currentMayEmptyProp && properties[currentMayEmptyProp]) {
- delete properties[currentMayEmptyProp];
- propertiesData = getProperties(stream, properties);
- } else {
- return false;
- }
- }
- }
- return propertiesData;
- }
- function writeProperties(stream, properties, propertiesLength) {
- writeVarByteInt(stream, propertiesLength);
- for (var propName in properties) {
- if (properties.hasOwnProperty(propName) && properties[propName] !== null) {
- var value = properties[propName];
- var type = protocol.propertiesTypes[propName];
- switch (type) {
- case "byte":
- {
- stream.write(Buffer.from([protocol.properties[propName]]));
- stream.write(Buffer.from([+value]));
- break;
- }
- case "int8":
- {
- stream.write(Buffer.from([protocol.properties[propName]]));
- stream.write(Buffer.from([value]));
- break;
- }
- case "binary":
- {
- stream.write(Buffer.from([protocol.properties[propName]]));
- writeStringOrBuffer(stream, value);
- break;
- }
- case "int16":
- {
- stream.write(Buffer.from([protocol.properties[propName]]));
- writeNumber(stream, value);
- break;
- }
- case "int32":
- {
- stream.write(Buffer.from([protocol.properties[propName]]));
- write4ByteNumber(stream, value);
- break;
- }
- case "var":
- {
- stream.write(Buffer.from([protocol.properties[propName]]));
- writeVarByteInt(stream, value);
- break;
- }
- case "string":
- {
- stream.write(Buffer.from([protocol.properties[propName]]));
- writeString(stream, value);
- break;
- }
- case "pair":
- {
- Object.getOwnPropertyNames(value).forEach(function (name) {
- stream.write(Buffer.from([protocol.properties[propName]]));
- writeStringPair(stream, name.toString(), value[name].toString());
- });
- break;
- }
- default:
- {
- stream.emit("error", new Error("Invalid property " + propName));
- return false;
- }
- }
- }
- }
- }
- function byteLength(bufOrString) {
- if (!bufOrString) return 0;else if (bufOrString instanceof Buffer) return bufOrString.length;else return Buffer.byteLength(bufOrString);
- }
- function isStringOrBuffer(field) {
- return typeof field === "string" || field instanceof Buffer;
- }
- module.exports = generate;
- }, {
- "./constants": 82,
- "./numbers": 86,
- "process-nextick-args": 91,
- "safe-buffer": 110
- }],
- 90: [function (require, module, exports) {
- var wrappy = require("wrappy");
- module.exports = wrappy(once);
- module.exports.strict = wrappy(onceStrict);
- once.proto = once(function () {
- Object.defineProperty(Function.prototype, "once", {
- value: function value() {
- return once(this);
- },
- configurable: true
- });
- Object.defineProperty(Function.prototype, "onceStrict", {
- value: function value() {
- return onceStrict(this);
- },
- configurable: true
- });
- });
- function once(fn) {
- var f = function f() {
- if (f.called) return f.value;
- f.called = true;
- return f.value = fn.apply(this, arguments);
- };
- f.called = false;
- return f;
- }
- function onceStrict(fn) {
- var f = function f() {
- if (f.called) throw new Error(f.onceError);
- f.called = true;
- return f.value = fn.apply(this, arguments);
- };
- var name = fn.name || "Function wrapped with `once`";
- f.onceError = name + " shouldn't be called more than once";
- f.called = false;
- return f;
- }
- }, {
- wrappy: 120
- }],
- 91: [function (require, module, exports) {
- (function (process) {
- "use strict";
- if (!process.version || process.version.indexOf("v0.") === 0 || process.version.indexOf("v1.") === 0 && process.version.indexOf("v1.8.") !== 0) {
- module.exports = {
- nextTick: nextTick
- };
- } else {
- module.exports = process;
- }
- function nextTick(fn, arg1, arg2, arg3) {
- if (typeof fn !== "function") {
- throw new TypeError('"callback" argument must be a function');
- }
- var len = arguments.length;
- var args, i;
- switch (len) {
- case 0:
- case 1:
- return process.nextTick(fn);
- case 2:
- return process.nextTick(function afterTickOne() {
- fn.call(null, arg1);
- });
- case 3:
- return process.nextTick(function afterTickTwo() {
- fn.call(null, arg1, arg2);
- });
- case 4:
- return process.nextTick(function afterTickThree() {
- fn.call(null, arg1, arg2, arg3);
- });
- default:
- args = new Array(len - 1);
- i = 0;
- while (i < args.length) {
- args[i++] = arguments[i];
- }
- return process.nextTick(function afterTick() {
- fn.apply(null, args);
- });
- }
- }
- }).call(this, require("_process"));
- }, {
- _process: 92
- }],
- 92: [function (require, module, exports) {
- var process = module.exports = {};
- var cachedSetTimeout;
- var cachedClearTimeout;
- function defaultSetTimout() {
- throw new Error("setTimeout has not been defined");
- }
- function defaultClearTimeout() {
- throw new Error("clearTimeout has not been defined");
- }
- (function () {
- try {
- if (typeof setTimeout === "function") {
- cachedSetTimeout = setTimeout;
- } else {
- cachedSetTimeout = defaultSetTimout;
- }
- } catch (e) {
- cachedSetTimeout = defaultSetTimout;
- }
- try {
- if (typeof clearTimeout === "function") {
- cachedClearTimeout = clearTimeout;
- } else {
- cachedClearTimeout = defaultClearTimeout;
- }
- } catch (e) {
- cachedClearTimeout = defaultClearTimeout;
- }
- })();
- function runTimeout(fun) {
- if (cachedSetTimeout === setTimeout) {
- return setTimeout(fun, 0);
- }
- if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
- cachedSetTimeout = setTimeout;
- return setTimeout(fun, 0);
- }
- try {
- return cachedSetTimeout(fun, 0);
- } catch (e) {
- try {
- return cachedSetTimeout.call(null, fun, 0);
- } catch (e) {
- return cachedSetTimeout.call(this, fun, 0);
- }
- }
- }
- function runClearTimeout(marker) {
- if (cachedClearTimeout === clearTimeout) {
- return clearTimeout(marker);
- }
- if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
- cachedClearTimeout = clearTimeout;
- return clearTimeout(marker);
- }
- try {
- return cachedClearTimeout(marker);
- } catch (e) {
- try {
- return cachedClearTimeout.call(null, marker);
- } catch (e) {
- return cachedClearTimeout.call(this, marker);
- }
- }
- }
- var queue = [];
- var draining = false;
- var currentQueue;
- var queueIndex = -1;
- function cleanUpNextTick() {
- if (!draining || !currentQueue) {
- return;
- }
- draining = false;
- if (currentQueue.length) {
- queue = currentQueue.concat(queue);
- } else {
- queueIndex = -1;
- }
- if (queue.length) {
- drainQueue();
- }
- }
- function drainQueue() {
- if (draining) {
- return;
- }
- var timeout = runTimeout(cleanUpNextTick);
- draining = true;
- var len = queue.length;
- while (len) {
- currentQueue = queue;
- queue = [];
- while (++queueIndex < len) {
- if (currentQueue) {
- currentQueue[queueIndex].run();
- }
- }
- queueIndex = -1;
- len = queue.length;
- }
- currentQueue = null;
- draining = false;
- runClearTimeout(timeout);
- }
- process.nextTick = function (fun) {
- var args = new Array(arguments.length - 1);
- if (arguments.length > 1) {
- for (var i = 1; i < arguments.length; i++) {
- args[i - 1] = arguments[i];
- }
- }
- queue.push(new Item(fun, args));
- if (queue.length === 1 && !draining) {
- runTimeout(drainQueue);
- }
- };
- function Item(fun, array) {
- this.fun = fun;
- this.array = array;
- }
- Item.prototype.run = function () {
- this.fun.apply(null, this.array);
- };
- process.title = "browser";
- process.browser = true;
- process.env = {};
- process.argv = [];
- process.version = "";
- process.versions = {};
- function noop() {}
- process.on = noop;
- process.addListener = noop;
- process.once = noop;
- process.off = noop;
- process.removeListener = noop;
- process.removeAllListeners = noop;
- process.emit = noop;
- process.prependListener = noop;
- process.prependOnceListener = noop;
- process.listeners = function (name) {
- return [];
- };
- process.binding = function (name) {
- throw new Error("process.binding is not supported");
- };
- process.cwd = function () {
- return "/";
- };
- process.chdir = function (dir) {
- throw new Error("process.chdir is not supported");
- };
- process.umask = function () {
- return 0;
- };
- }, {}],
- 93: [function (require, module, exports) {
- (function (global) {
- (function (root) {
- var freeExports = _typeof(exports) == "object" && exports && !exports.nodeType && exports;
- var freeModule = _typeof(module) == "object" && module && !module.nodeType && module;
- var freeGlobal = _typeof(global) == "object" && global;
- if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal) {
- root = freeGlobal;
- }
- var punycode,
- maxInt = 2147483647,
- base = 36,
- tMin = 1,
- tMax = 26,
- skew = 38,
- damp = 700,
- initialBias = 72,
- initialN = 128,
- delimiter = "-",
- regexPunycode = /^xn--/,
- regexNonASCII = /[^\x20-\x7E]/,
- regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g,
- errors = {
- overflow: "Overflow: input needs wider integers to process",
- "not-basic": "Illegal input >= 0x80 (not a basic code point)",
- "invalid-input": "Invalid input"
- },
- baseMinusTMin = base - tMin,
- floor = Math.floor,
- stringFromCharCode = String.fromCharCode,
- key;
- function error(type) {
- throw new RangeError(errors[type]);
- }
- function map(array, fn) {
- var length = array.length;
- var result = [];
- while (length--) {
- result[length] = fn(array[length]);
- }
- return result;
- }
- function mapDomain(string, fn) {
- var parts = string.split("@");
- var result = "";
- if (parts.length > 1) {
- result = parts[0] + "@";
- string = parts[1];
- }
- string = string.replace(regexSeparators, ".");
- var labels = string.split(".");
- var encoded = map(labels, fn).join(".");
- return result + encoded;
- }
- function ucs2decode(string) {
- var output = [],
- counter = 0,
- length = string.length,
- value,
- extra;
- while (counter < length) {
- value = string.charCodeAt(counter++);
- if (value >= 55296 && value <= 56319 && counter < length) {
- extra = string.charCodeAt(counter++);
- if ((extra & 64512) == 56320) {
- output.push(((value & 1023) << 10) + (extra & 1023) + 65536);
- } else {
- output.push(value);
- counter--;
- }
- } else {
- output.push(value);
- }
- }
- return output;
- }
- function ucs2encode(array) {
- return map(array, function (value) {
- var output = "";
- if (value > 65535) {
- value -= 65536;
- output += stringFromCharCode(value >>> 10 & 1023 | 55296);
- value = 56320 | value & 1023;
- }
- output += stringFromCharCode(value);
- return output;
- }).join("");
- }
- function basicToDigit(codePoint) {
- if (codePoint - 48 < 10) {
- return codePoint - 22;
- }
- if (codePoint - 65 < 26) {
- return codePoint - 65;
- }
- if (codePoint - 97 < 26) {
- return codePoint - 97;
- }
- return base;
- }
- function digitToBasic(digit, flag) {
- return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
- }
- function adapt(delta, numPoints, firstTime) {
- var k = 0;
- delta = firstTime ? floor(delta / damp) : delta >> 1;
- delta += floor(delta / numPoints);
- for (; delta > baseMinusTMin * tMax >> 1; k += base) {
- delta = floor(delta / baseMinusTMin);
- }
- return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
- }
- function decode(input) {
- var output = [],
- inputLength = input.length,
- out,
- i = 0,
- n = initialN,
- bias = initialBias,
- basic,
- j,
- index,
- oldi,
- w,
- k,
- digit,
- t,
- baseMinusT;
- basic = input.lastIndexOf(delimiter);
- if (basic < 0) {
- basic = 0;
- }
- for (j = 0; j < basic; ++j) {
- if (input.charCodeAt(j) >= 128) {
- error("not-basic");
- }
- output.push(input.charCodeAt(j));
- }
- for (index = basic > 0 ? basic + 1 : 0; index < inputLength;) {
- for (oldi = i, w = 1, k = base;; k += base) {
- if (index >= inputLength) {
- error("invalid-input");
- }
- digit = basicToDigit(input.charCodeAt(index++));
- if (digit >= base || digit > floor((maxInt - i) / w)) {
- error("overflow");
- }
- i += digit * w;
- t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
- if (digit < t) {
- break;
- }
- baseMinusT = base - t;
- if (w > floor(maxInt / baseMinusT)) {
- error("overflow");
- }
- w *= baseMinusT;
- }
- out = output.length + 1;
- bias = adapt(i - oldi, out, oldi == 0);
- if (floor(i / out) > maxInt - n) {
- error("overflow");
- }
- n += floor(i / out);
- i %= out;
- output.splice(i++, 0, n);
- }
- return ucs2encode(output);
- }
- function encode(input) {
- var n,
- delta,
- handledCPCount,
- basicLength,
- bias,
- j,
- m,
- q,
- k,
- t,
- currentValue,
- output = [],
- inputLength,
- handledCPCountPlusOne,
- baseMinusT,
- qMinusT;
- input = ucs2decode(input);
- inputLength = input.length;
- n = initialN;
- delta = 0;
- bias = initialBias;
- for (j = 0; j < inputLength; ++j) {
- currentValue = input[j];
- if (currentValue < 128) {
- output.push(stringFromCharCode(currentValue));
- }
- }
- handledCPCount = basicLength = output.length;
- if (basicLength) {
- output.push(delimiter);
- }
- while (handledCPCount < inputLength) {
- for (m = maxInt, j = 0; j < inputLength; ++j) {
- currentValue = input[j];
- if (currentValue >= n && currentValue < m) {
- m = currentValue;
- }
- }
- handledCPCountPlusOne = handledCPCount + 1;
- if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
- error("overflow");
- }
- delta += (m - n) * handledCPCountPlusOne;
- n = m;
- for (j = 0; j < inputLength; ++j) {
- currentValue = input[j];
- if (currentValue < n && ++delta > maxInt) {
- error("overflow");
- }
- if (currentValue == n) {
- for (q = delta, k = base;; k += base) {
- t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
- if (q < t) {
- break;
- }
- qMinusT = q - t;
- baseMinusT = base - t;
- output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)));
- q = floor(qMinusT / baseMinusT);
- }
- output.push(stringFromCharCode(digitToBasic(q, 0)));
- bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
- delta = 0;
- ++handledCPCount;
- }
- }
- ++delta;
- ++n;
- }
- return output.join("");
- }
- function toUnicode(input) {
- return mapDomain(input, function (string) {
- return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;
- });
- }
- function toASCII(input) {
- return mapDomain(input, function (string) {
- return regexNonASCII.test(string) ? "xn--" + encode(string) : string;
- });
- }
- punycode = {
- version: "1.4.1",
- ucs2: {
- decode: ucs2decode,
- encode: ucs2encode
- },
- decode: decode,
- encode: encode,
- toASCII: toASCII,
- toUnicode: toUnicode
- };
- if (typeof define == "function" && _typeof(define.amd) == "object" && define.amd) {
- define("punycode", function () {
- return punycode;
- });
- } else if (freeExports && freeModule) {
- if (module.exports == freeExports) {
- freeModule.exports = punycode;
- } else {
- for (key in punycode) {
- punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
- }
- }
- } else {
- root.punycode = punycode;
- }
- })(this);
- }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
- }, {}],
- 94: [function (require, module, exports) {
- "use strict";
- function hasOwnProperty(obj, prop) {
- return Object.prototype.hasOwnProperty.call(obj, prop);
- }
- module.exports = function (qs, sep, eq, options) {
- sep = sep || "&";
- eq = eq || "=";
- var obj = {};
- if (typeof qs !== "string" || qs.length === 0) {
- return obj;
- }
- var regexp = /\+/g;
- qs = qs.split(sep);
- var maxKeys = 1e3;
- if (options && typeof options.maxKeys === "number") {
- maxKeys = options.maxKeys;
- }
- var len = qs.length;
- if (maxKeys > 0 && len > maxKeys) {
- len = maxKeys;
- }
- for (var i = 0; i < len; ++i) {
- var x = qs[i].replace(regexp, "%20"),
- idx = x.indexOf(eq),
- kstr,
- vstr,
- k,
- v;
- if (idx >= 0) {
- kstr = x.substr(0, idx);
- vstr = x.substr(idx + 1);
- } else {
- kstr = x;
- vstr = "";
- }
- k = decodeURIComponent(kstr);
- v = decodeURIComponent(vstr);
- if (!hasOwnProperty(obj, k)) {
- obj[k] = v;
- } else if (isArray(obj[k])) {
- obj[k].push(v);
- } else {
- obj[k] = [obj[k], v];
- }
- }
- return obj;
- };
- var isArray = Array.isArray || function (xs) {
- return Object.prototype.toString.call(xs) === "[object Array]";
- };
- }, {}],
- 95: [function (require, module, exports) {
- "use strict";
- var stringifyPrimitive = function stringifyPrimitive(v) {
- switch (_typeof(v)) {
- case "string":
- return v;
- case "boolean":
- return v ? "true" : "false";
- case "number":
- return isFinite(v) ? v : "";
- default:
- return "";
- }
- };
- module.exports = function (obj, sep, eq, name) {
- sep = sep || "&";
- eq = eq || "=";
- if (obj === null) {
- obj = undefined;
- }
- if (_typeof(obj) === "object") {
- return map(objectKeys(obj), function (k) {
- var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
- if (isArray(obj[k])) {
- return map(obj[k], function (v) {
- return ks + encodeURIComponent(stringifyPrimitive(v));
- }).join(sep);
- } else {
- return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
- }
- }).join(sep);
- }
- if (!name) return "";
- return encodeURIComponent(stringifyPrimitive(name)) + eq + encodeURIComponent(stringifyPrimitive(obj));
- };
- var isArray = Array.isArray || function (xs) {
- return Object.prototype.toString.call(xs) === "[object Array]";
- };
- function map(xs, f) {
- if (xs.map) return xs.map(f);
- var res = [];
- for (var i = 0; i < xs.length; i++) {
- res.push(f(xs[i], i));
- }
- return res;
- }
- var objectKeys = Object.keys || function (obj) {
- var res = [];
- for (var key in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);
- }
- return res;
- };
- }, {}],
- 96: [function (require, module, exports) {
- "use strict";
- exports.decode = exports.parse = require("./decode");
- exports.encode = exports.stringify = require("./encode");
- }, {
- "./decode": 94,
- "./encode": 95
- }],
- 97: [function (require, module, exports) {
- module.exports = require("./lib/_stream_duplex.js");
- }, {
- "./lib/_stream_duplex.js": 98
- }],
- 98: [function (require, module, exports) {
- "use strict";
- var pna = require("process-nextick-args");
- var objectKeys = Object.keys || function (obj) {
- var keys = [];
- for (var key in obj) {
- keys.push(key);
- }
- return keys;
- };
- module.exports = Duplex;
- var util = require("core-util-is");
- util.inherits = require("inherits");
- var Readable = require("./_stream_readable");
- var Writable = require("./_stream_writable");
- util.inherits(Duplex, Readable);
- {
- var keys = objectKeys(Writable.prototype);
- for (var v = 0; v < keys.length; v++) {
- var method = keys[v];
- if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
- }
- }
- function Duplex(options) {
- if (!(this instanceof Duplex)) return new Duplex(options);
- Readable.call(this, options);
- Writable.call(this, options);
- if (options && options.readable === false) this.readable = false;
- if (options && options.writable === false) this.writable = false;
- this.allowHalfOpen = true;
- if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
- this.once("end", onend);
- }
- Object.defineProperty(Duplex.prototype, "writableHighWaterMark", {
- enumerable: false,
- get: function get() {
- return this._writableState.highWaterMark;
- }
- });
- function onend() {
- if (this.allowHalfOpen || this._writableState.ended) return;
- pna.nextTick(onEndNT, this);
- }
- function onEndNT(self) {
- self.end();
- }
- Object.defineProperty(Duplex.prototype, "destroyed", {
- get: function get() {
- if (this._readableState === undefined || this._writableState === undefined) {
- return false;
- }
- return this._readableState.destroyed && this._writableState.destroyed;
- },
- set: function set(value) {
- if (this._readableState === undefined || this._writableState === undefined) {
- return;
- }
- this._readableState.destroyed = value;
- this._writableState.destroyed = value;
- }
- });
- Duplex.prototype._destroy = function (err, cb) {
- this.push(null);
- this.end();
- pna.nextTick(cb, err);
- };
- }, {
- "./_stream_readable": 100,
- "./_stream_writable": 102,
- "core-util-is": 14,
- inherits: 80,
- "process-nextick-args": 91
- }],
- 99: [function (require, module, exports) {
- "use strict";
- module.exports = PassThrough;
- var Transform = require("./_stream_transform");
- var util = require("core-util-is");
- util.inherits = require("inherits");
- util.inherits(PassThrough, Transform);
- function PassThrough(options) {
- if (!(this instanceof PassThrough)) return new PassThrough(options);
- Transform.call(this, options);
- }
- PassThrough.prototype._transform = function (chunk, encoding, cb) {
- cb(null, chunk);
- };
- }, {
- "./_stream_transform": 101,
- "core-util-is": 14,
- inherits: 80
- }],
- 100: [function (require, module, exports) {
- (function (process, global) {
- "use strict";
- var pna = require("process-nextick-args");
- module.exports = Readable;
- var isArray = require("isarray");
- var Duplex;
- Readable.ReadableState = ReadableState;
- var EE = require("events").EventEmitter;
- var EElistenerCount = function EElistenerCount(emitter, type) {
- return emitter.listeners(type).length;
- };
- var Stream = require("./internal/streams/stream");
- var Buffer = require("safe-buffer").Buffer;
- var OurUint8Array = global.Uint8Array || function () {};
- function _uint8ArrayToBuffer(chunk) {
- return Buffer.from(chunk);
- }
- function _isUint8Array(obj) {
- return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
- }
- var util = require("core-util-is");
- util.inherits = require("inherits");
- var debugUtil = require("util");
- var debug = void 0;
- if (debugUtil && debugUtil.debuglog) {
- debug = debugUtil.debuglog("stream");
- } else {
- debug = function debug() {};
- }
- var BufferList = require("./internal/streams/BufferList");
- var destroyImpl = require("./internal/streams/destroy");
- var StringDecoder;
- util.inherits(Readable, Stream);
- var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
- function prependListener(emitter, event, fn) {
- if (typeof emitter.prependListener === "function") return emitter.prependListener(event, fn);
- if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
- }
- function ReadableState(options, stream) {
- Duplex = Duplex || require("./_stream_duplex");
- options = options || {};
- var isDuplex = stream instanceof Duplex;
- this.objectMode = !!options.objectMode;
- if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
- var hwm = options.highWaterMark;
- var readableHwm = options.readableHighWaterMark;
- var defaultHwm = this.objectMode ? 16 : 16 * 1024;
- if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;
- this.highWaterMark = Math.floor(this.highWaterMark);
- this.buffer = new BufferList();
- this.length = 0;
- this.pipes = null;
- this.pipesCount = 0;
- this.flowing = null;
- this.ended = false;
- this.endEmitted = false;
- this.reading = false;
- this.sync = true;
- this.needReadable = false;
- this.emittedReadable = false;
- this.readableListening = false;
- this.resumeScheduled = false;
- this.destroyed = false;
- this.defaultEncoding = options.defaultEncoding || "utf8";
- this.awaitDrain = 0;
- this.readingMore = false;
- this.decoder = null;
- this.encoding = null;
- if (options.encoding) {
- if (!StringDecoder) StringDecoder = require("string_decoder/").StringDecoder;
- this.decoder = new StringDecoder(options.encoding);
- this.encoding = options.encoding;
- }
- }
- function Readable(options) {
- Duplex = Duplex || require("./_stream_duplex");
- if (!(this instanceof Readable)) return new Readable(options);
- this._readableState = new ReadableState(options, this);
- this.readable = true;
- if (options) {
- if (typeof options.read === "function") this._read = options.read;
- if (typeof options.destroy === "function") this._destroy = options.destroy;
- }
- Stream.call(this);
- }
- Object.defineProperty(Readable.prototype, "destroyed", {
- get: function get() {
- if (this._readableState === undefined) {
- return false;
- }
- return this._readableState.destroyed;
- },
- set: function set(value) {
- if (!this._readableState) {
- return;
- }
- this._readableState.destroyed = value;
- }
- });
- Readable.prototype.destroy = destroyImpl.destroy;
- Readable.prototype._undestroy = destroyImpl.undestroy;
- Readable.prototype._destroy = function (err, cb) {
- this.push(null);
- cb(err);
- };
- Readable.prototype.push = function (chunk, encoding) {
- var state = this._readableState;
- var skipChunkCheck;
- if (!state.objectMode) {
- if (typeof chunk === "string") {
- encoding = encoding || state.defaultEncoding;
- if (encoding !== state.encoding) {
- chunk = Buffer.from(chunk, encoding);
- encoding = "";
- }
- skipChunkCheck = true;
- }
- } else {
- skipChunkCheck = true;
- }
- return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
- };
- Readable.prototype.unshift = function (chunk) {
- return readableAddChunk(this, chunk, null, true, false);
- };
- function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
- var state = stream._readableState;
- if (chunk === null) {
- state.reading = false;
- onEofChunk(stream, state);
- } else {
- var er;
- if (!skipChunkCheck) er = chunkInvalid(state, chunk);
- if (er) {
- stream.emit("error", er);
- } else if (state.objectMode || chunk && chunk.length > 0) {
- if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
- chunk = _uint8ArrayToBuffer(chunk);
- }
- if (addToFront) {
- if (state.endEmitted) stream.emit("error", new Error("stream.unshift() after end event"));else addChunk(stream, state, chunk, true);
- } else if (state.ended) {
- stream.emit("error", new Error("stream.push() after EOF"));
- } else {
- state.reading = false;
- if (state.decoder && !encoding) {
- chunk = state.decoder.write(chunk);
- if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
- } else {
- addChunk(stream, state, chunk, false);
- }
- }
- } else if (!addToFront) {
- state.reading = false;
- }
- }
- return needMoreData(state);
- }
- function addChunk(stream, state, chunk, addToFront) {
- if (state.flowing && state.length === 0 && !state.sync) {
- stream.emit("data", chunk);
- stream.read(0);
- } else {
- state.length += state.objectMode ? 1 : chunk.length;
- if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
- if (state.needReadable) emitReadable(stream);
- }
- maybeReadMore(stream, state);
- }
- function chunkInvalid(state, chunk) {
- var er;
- if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== undefined && !state.objectMode) {
- er = new TypeError("Invalid non-string/buffer chunk");
- }
- return er;
- }
- function needMoreData(state) {
- return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
- }
- Readable.prototype.isPaused = function () {
- return this._readableState.flowing === false;
- };
- Readable.prototype.setEncoding = function (enc) {
- if (!StringDecoder) StringDecoder = require("string_decoder/").StringDecoder;
- this._readableState.decoder = new StringDecoder(enc);
- this._readableState.encoding = enc;
- return this;
- };
- var MAX_HWM = 8388608;
- function computeNewHighWaterMark(n) {
- if (n >= MAX_HWM) {
- n = MAX_HWM;
- } else {
- n--;
- n |= n >>> 1;
- n |= n >>> 2;
- n |= n >>> 4;
- n |= n >>> 8;
- n |= n >>> 16;
- n++;
- }
- return n;
- }
- function howMuchToRead(n, state) {
- if (n <= 0 || state.length === 0 && state.ended) return 0;
- if (state.objectMode) return 1;
- if (n !== n) {
- if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
- }
- if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
- if (n <= state.length) return n;
- if (!state.ended) {
- state.needReadable = true;
- return 0;
- }
- return state.length;
- }
- Readable.prototype.read = function (n) {
- debug("read", n);
- n = parseInt(n, 10);
- var state = this._readableState;
- var nOrig = n;
- if (n !== 0) state.emittedReadable = false;
- if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
- debug("read: emitReadable", state.length, state.ended);
- if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
- return null;
- }
- n = howMuchToRead(n, state);
- if (n === 0 && state.ended) {
- if (state.length === 0) endReadable(this);
- return null;
- }
- var doRead = state.needReadable;
- debug("need readable", doRead);
- if (state.length === 0 || state.length - n < state.highWaterMark) {
- doRead = true;
- debug("length less than watermark", doRead);
- }
- if (state.ended || state.reading) {
- doRead = false;
- debug("reading or ended", doRead);
- } else if (doRead) {
- debug("do read");
- state.reading = true;
- state.sync = true;
- if (state.length === 0) state.needReadable = true;
- this._read(state.highWaterMark);
- state.sync = false;
- if (!state.reading) n = howMuchToRead(nOrig, state);
- }
- var ret;
- if (n > 0) ret = fromList(n, state);else ret = null;
- if (ret === null) {
- state.needReadable = true;
- n = 0;
- } else {
- state.length -= n;
- }
- if (state.length === 0) {
- if (!state.ended) state.needReadable = true;
- if (nOrig !== n && state.ended) endReadable(this);
- }
- if (ret !== null) this.emit("data", ret);
- return ret;
- };
- function onEofChunk(stream, state) {
- if (state.ended) return;
- if (state.decoder) {
- var chunk = state.decoder.end();
- if (chunk && chunk.length) {
- state.buffer.push(chunk);
- state.length += state.objectMode ? 1 : chunk.length;
- }
- }
- state.ended = true;
- emitReadable(stream);
- }
- function emitReadable(stream) {
- var state = stream._readableState;
- state.needReadable = false;
- if (!state.emittedReadable) {
- debug("emitReadable", state.flowing);
- state.emittedReadable = true;
- if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);
- }
- }
- function emitReadable_(stream) {
- debug("emit readable");
- stream.emit("readable");
- flow(stream);
- }
- function maybeReadMore(stream, state) {
- if (!state.readingMore) {
- state.readingMore = true;
- pna.nextTick(maybeReadMore_, stream, state);
- }
- }
- function maybeReadMore_(stream, state) {
- var len = state.length;
- while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
- debug("maybeReadMore read 0");
- stream.read(0);
- if (len === state.length) break;else len = state.length;
- }
- state.readingMore = false;
- }
- Readable.prototype._read = function (n) {
- this.emit("error", new Error("_read() is not implemented"));
- };
- Readable.prototype.pipe = function (dest, pipeOpts) {
- var src = this;
- var state = this._readableState;
- switch (state.pipesCount) {
- case 0:
- state.pipes = dest;
- break;
- case 1:
- state.pipes = [state.pipes, dest];
- break;
- default:
- state.pipes.push(dest);
- break;
- }
- state.pipesCount += 1;
- debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts);
- var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
- var endFn = doEnd ? onend : unpipe;
- if (state.endEmitted) pna.nextTick(endFn);else src.once("end", endFn);
- dest.on("unpipe", onunpipe);
- function onunpipe(readable, unpipeInfo) {
- debug("onunpipe");
- if (readable === src) {
- if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
- unpipeInfo.hasUnpiped = true;
- cleanup();
- }
- }
- }
- function onend() {
- debug("onend");
- dest.end();
- }
- var ondrain = pipeOnDrain(src);
- dest.on("drain", ondrain);
- var cleanedUp = false;
- function cleanup() {
- debug("cleanup");
- dest.removeListener("close", onclose);
- dest.removeListener("finish", onfinish);
- dest.removeListener("drain", ondrain);
- dest.removeListener("error", onerror);
- dest.removeListener("unpipe", onunpipe);
- src.removeListener("end", onend);
- src.removeListener("end", unpipe);
- src.removeListener("data", ondata);
- cleanedUp = true;
- if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
- }
- var increasedAwaitDrain = false;
- src.on("data", ondata);
- function ondata(chunk) {
- debug("ondata");
- increasedAwaitDrain = false;
- var ret = dest.write(chunk);
- if (false === ret && !increasedAwaitDrain) {
- if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
- debug("false write response, pause", src._readableState.awaitDrain);
- src._readableState.awaitDrain++;
- increasedAwaitDrain = true;
- }
- src.pause();
- }
- }
- function onerror(er) {
- debug("onerror", er);
- unpipe();
- dest.removeListener("error", onerror);
- if (EElistenerCount(dest, "error") === 0) dest.emit("error", er);
- }
- prependListener(dest, "error", onerror);
- function onclose() {
- dest.removeListener("finish", onfinish);
- unpipe();
- }
- dest.once("close", onclose);
- function onfinish() {
- debug("onfinish");
- dest.removeListener("close", onclose);
- unpipe();
- }
- dest.once("finish", onfinish);
- function unpipe() {
- debug("unpipe");
- src.unpipe(dest);
- }
- dest.emit("pipe", src);
- if (!state.flowing) {
- debug("pipe resume");
- src.resume();
- }
- return dest;
- };
- function pipeOnDrain(src) {
- return function () {
- var state = src._readableState;
- debug("pipeOnDrain", state.awaitDrain);
- if (state.awaitDrain) state.awaitDrain--;
- if (state.awaitDrain === 0 && EElistenerCount(src, "data")) {
- state.flowing = true;
- flow(src);
- }
- };
- }
- Readable.prototype.unpipe = function (dest) {
- var state = this._readableState;
- var unpipeInfo = {
- hasUnpiped: false
- };
- if (state.pipesCount === 0) return this;
- if (state.pipesCount === 1) {
- if (dest && dest !== state.pipes) return this;
- if (!dest) dest = state.pipes;
- state.pipes = null;
- state.pipesCount = 0;
- state.flowing = false;
- if (dest) dest.emit("unpipe", this, unpipeInfo);
- return this;
- }
- if (!dest) {
- var dests = state.pipes;
- var len = state.pipesCount;
- state.pipes = null;
- state.pipesCount = 0;
- state.flowing = false;
- for (var i = 0; i < len; i++) {
- dests[i].emit("unpipe", this, unpipeInfo);
- }
- return this;
- }
- var index = indexOf(state.pipes, dest);
- if (index === -1) return this;
- state.pipes.splice(index, 1);
- state.pipesCount -= 1;
- if (state.pipesCount === 1) state.pipes = state.pipes[0];
- dest.emit("unpipe", this, unpipeInfo);
- return this;
- };
- Readable.prototype.on = function (ev, fn) {
- var res = Stream.prototype.on.call(this, ev, fn);
- if (ev === "data") {
- if (this._readableState.flowing !== false) this.resume();
- } else if (ev === "readable") {
- var state = this._readableState;
- if (!state.endEmitted && !state.readableListening) {
- state.readableListening = state.needReadable = true;
- state.emittedReadable = false;
- if (!state.reading) {
- pna.nextTick(nReadingNextTick, this);
- } else if (state.length) {
- emitReadable(this);
- }
- }
- }
- return res;
- };
- Readable.prototype.addListener = Readable.prototype.on;
- function nReadingNextTick(self) {
- debug("readable nexttick read 0");
- self.read(0);
- }
- Readable.prototype.resume = function () {
- var state = this._readableState;
- if (!state.flowing) {
- debug("resume");
- state.flowing = true;
- resume(this, state);
- }
- return this;
- };
- function resume(stream, state) {
- if (!state.resumeScheduled) {
- state.resumeScheduled = true;
- pna.nextTick(resume_, stream, state);
- }
- }
- function resume_(stream, state) {
- if (!state.reading) {
- debug("resume read 0");
- stream.read(0);
- }
- state.resumeScheduled = false;
- state.awaitDrain = 0;
- stream.emit("resume");
- flow(stream);
- if (state.flowing && !state.reading) stream.read(0);
- }
- Readable.prototype.pause = function () {
- debug("call pause flowing=%j", this._readableState.flowing);
- if (false !== this._readableState.flowing) {
- debug("pause");
- this._readableState.flowing = false;
- this.emit("pause");
- }
- return this;
- };
- function flow(stream) {
- var state = stream._readableState;
- debug("flow", state.flowing);
- while (state.flowing && stream.read() !== null) {}
- }
- Readable.prototype.wrap = function (stream) {
- var _this = this;
- var state = this._readableState;
- var paused = false;
- stream.on("end", function () {
- debug("wrapped end");
- if (state.decoder && !state.ended) {
- var chunk = state.decoder.end();
- if (chunk && chunk.length) _this.push(chunk);
- }
- _this.push(null);
- });
- stream.on("data", function (chunk) {
- debug("wrapped data");
- if (state.decoder) chunk = state.decoder.write(chunk);
- if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
- var ret = _this.push(chunk);
- if (!ret) {
- paused = true;
- stream.pause();
- }
- });
- for (var i in stream) {
- if (this[i] === undefined && typeof stream[i] === "function") {
- this[i] = function (method) {
- return function () {
- return stream[method].apply(stream, arguments);
- };
- }(i);
- }
- }
- for (var n = 0; n < kProxyEvents.length; n++) {
- stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
- }
- this._read = function (n) {
- debug("wrapped _read", n);
- if (paused) {
- paused = false;
- stream.resume();
- }
- };
- return this;
- };
- Object.defineProperty(Readable.prototype, "readableHighWaterMark", {
- enumerable: false,
- get: function get() {
- return this._readableState.highWaterMark;
- }
- });
- Readable._fromList = fromList;
- function fromList(n, state) {
- if (state.length === 0) return null;
- var ret;
- if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
- if (state.decoder) ret = state.buffer.join("");else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
- state.buffer.clear();
- } else {
- ret = fromListPartial(n, state.buffer, state.decoder);
- }
- return ret;
- }
- function fromListPartial(n, list, hasStrings) {
- var ret;
- if (n < list.head.data.length) {
- ret = list.head.data.slice(0, n);
- list.head.data = list.head.data.slice(n);
- } else if (n === list.head.data.length) {
- ret = list.shift();
- } else {
- ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
- }
- return ret;
- }
- function copyFromBufferString(n, list) {
- var p = list.head;
- var c = 1;
- var ret = p.data;
- n -= ret.length;
- while (p = p.next) {
- var str = p.data;
- var nb = n > str.length ? str.length : n;
- if (nb === str.length) ret += str;else ret += str.slice(0, n);
- n -= nb;
- if (n === 0) {
- if (nb === str.length) {
- ++c;
- if (p.next) list.head = p.next;else list.head = list.tail = null;
- } else {
- list.head = p;
- p.data = str.slice(nb);
- }
- break;
- }
- ++c;
- }
- list.length -= c;
- return ret;
- }
- function copyFromBuffer(n, list) {
- var ret = Buffer.allocUnsafe(n);
- var p = list.head;
- var c = 1;
- p.data.copy(ret);
- n -= p.data.length;
- while (p = p.next) {
- var buf = p.data;
- var nb = n > buf.length ? buf.length : n;
- buf.copy(ret, ret.length - n, 0, nb);
- n -= nb;
- if (n === 0) {
- if (nb === buf.length) {
- ++c;
- if (p.next) list.head = p.next;else list.head = list.tail = null;
- } else {
- list.head = p;
- p.data = buf.slice(nb);
- }
- break;
- }
- ++c;
- }
- list.length -= c;
- return ret;
- }
- function endReadable(stream) {
- var state = stream._readableState;
- if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
- if (!state.endEmitted) {
- state.ended = true;
- pna.nextTick(endReadableNT, state, stream);
- }
- }
- function endReadableNT(state, stream) {
- if (!state.endEmitted && state.length === 0) {
- state.endEmitted = true;
- stream.readable = false;
- stream.emit("end");
- }
- }
- function indexOf(xs, x) {
- for (var i = 0, l = xs.length; i < l; i++) {
- if (xs[i] === x) return i;
- }
- return -1;
- }
- }).call(this, require("_process"), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
- }, {
- "./_stream_duplex": 98,
- "./internal/streams/BufferList": 103,
- "./internal/streams/destroy": 104,
- "./internal/streams/stream": 105,
- _process: 92,
- "core-util-is": 14,
- events: 13,
- inherits: 80,
- isarray: 106,
- "process-nextick-args": 91,
- "safe-buffer": 110,
- "string_decoder/": 107,
- util: 11
- }],
- 101: [function (require, module, exports) {
- "use strict";
- module.exports = Transform;
- var Duplex = require("./_stream_duplex");
- var util = require("core-util-is");
- util.inherits = require("inherits");
- util.inherits(Transform, Duplex);
- function afterTransform(er, data) {
- var ts = this._transformState;
- ts.transforming = false;
- var cb = ts.writecb;
- if (!cb) {
- return this.emit("error", new Error("write callback called multiple times"));
- }
- ts.writechunk = null;
- ts.writecb = null;
- if (data != null) this.push(data);
- cb(er);
- var rs = this._readableState;
- rs.reading = false;
- if (rs.needReadable || rs.length < rs.highWaterMark) {
- this._read(rs.highWaterMark);
- }
- }
- function Transform(options) {
- if (!(this instanceof Transform)) return new Transform(options);
- Duplex.call(this, options);
- this._transformState = {
- afterTransform: afterTransform.bind(this),
- needTransform: false,
- transforming: false,
- writecb: null,
- writechunk: null,
- writeencoding: null
- };
- this._readableState.needReadable = true;
- this._readableState.sync = false;
- if (options) {
- if (typeof options.transform === "function") this._transform = options.transform;
- if (typeof options.flush === "function") this._flush = options.flush;
- }
- this.on("prefinish", prefinish);
- }
- function prefinish() {
- var _this = this;
- if (typeof this._flush === "function") {
- this._flush(function (er, data) {
- done(_this, er, data);
- });
- } else {
- done(this, null, null);
- }
- }
- Transform.prototype.push = function (chunk, encoding) {
- this._transformState.needTransform = false;
- return Duplex.prototype.push.call(this, chunk, encoding);
- };
- Transform.prototype._transform = function (chunk, encoding, cb) {
- throw new Error("_transform() is not implemented");
- };
- Transform.prototype._write = function (chunk, encoding, cb) {
- var ts = this._transformState;
- ts.writecb = cb;
- ts.writechunk = chunk;
- ts.writeencoding = encoding;
- if (!ts.transforming) {
- var rs = this._readableState;
- if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
- }
- };
- Transform.prototype._read = function (n) {
- var ts = this._transformState;
- if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
- ts.transforming = true;
- this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
- } else {
- ts.needTransform = true;
- }
- };
- Transform.prototype._destroy = function (err, cb) {
- var _this2 = this;
- Duplex.prototype._destroy.call(this, err, function (err2) {
- cb(err2);
- _this2.emit("close");
- });
- };
- function done(stream, er, data) {
- if (er) return stream.emit("error", er);
- if (data != null) stream.push(data);
- if (stream._writableState.length) throw new Error("Calling transform done when ws.length != 0");
- if (stream._transformState.transforming) throw new Error("Calling transform done when still transforming");
- return stream.push(null);
- }
- }, {
- "./_stream_duplex": 98,
- "core-util-is": 14,
- inherits: 80
- }],
- 102: [function (require, module, exports) {
- (function (process, global, setImmediate) {
- "use strict";
- var pna = require("process-nextick-args");
- module.exports = Writable;
- function WriteReq(chunk, encoding, cb) {
- this.chunk = chunk;
- this.encoding = encoding;
- this.callback = cb;
- this.next = null;
- }
- function CorkedRequest(state) {
- var _this = this;
- this.next = null;
- this.entry = null;
- this.finish = function () {
- onCorkedFinish(_this, state);
- };
- }
- var asyncWrite = !process.browser && ["v0.10", "v0.9."].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
- var Duplex;
- Writable.WritableState = WritableState;
- var util = require("core-util-is");
- util.inherits = require("inherits");
- var internalUtil = {
- deprecate: require("util-deprecate")
- };
- var Stream = require("./internal/streams/stream");
- var Buffer = require("safe-buffer").Buffer;
- var OurUint8Array = global.Uint8Array || function () {};
- function _uint8ArrayToBuffer(chunk) {
- return Buffer.from(chunk);
- }
- function _isUint8Array(obj) {
- return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
- }
- var destroyImpl = require("./internal/streams/destroy");
- util.inherits(Writable, Stream);
- function nop() {}
- function WritableState(options, stream) {
- Duplex = Duplex || require("./_stream_duplex");
- options = options || {};
- var isDuplex = stream instanceof Duplex;
- this.objectMode = !!options.objectMode;
- if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
- var hwm = options.highWaterMark;
- var writableHwm = options.writableHighWaterMark;
- var defaultHwm = this.objectMode ? 16 : 16 * 1024;
- if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
- this.highWaterMark = Math.floor(this.highWaterMark);
- this.finalCalled = false;
- this.needDrain = false;
- this.ending = false;
- this.ended = false;
- this.finished = false;
- this.destroyed = false;
- var noDecode = options.decodeStrings === false;
- this.decodeStrings = !noDecode;
- this.defaultEncoding = options.defaultEncoding || "utf8";
- this.length = 0;
- this.writing = false;
- this.corked = 0;
- this.sync = true;
- this.bufferProcessing = false;
- this.onwrite = function (er) {
- onwrite(stream, er);
- };
- this.writecb = null;
- this.writelen = 0;
- this.bufferedRequest = null;
- this.lastBufferedRequest = null;
- this.pendingcb = 0;
- this.prefinished = false;
- this.errorEmitted = false;
- this.bufferedRequestCount = 0;
- this.corkedRequestsFree = new CorkedRequest(this);
- }
- WritableState.prototype.getBuffer = function getBuffer() {
- var current = this.bufferedRequest;
- var out = [];
- while (current) {
- out.push(current);
- current = current.next;
- }
- return out;
- };
- (function () {
- try {
- Object.defineProperty(WritableState.prototype, "buffer", {
- get: internalUtil.deprecate(function () {
- return this.getBuffer();
- }, "_writableState.buffer is deprecated. Use _writableState.getBuffer " + "instead.", "DEP0003")
- });
- } catch (_) {}
- })();
- var realHasInstance;
- if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") {
- realHasInstance = Function.prototype[Symbol.hasInstance];
- Object.defineProperty(Writable, Symbol.hasInstance, {
- value: function value(object) {
- if (realHasInstance.call(this, object)) return true;
- if (this !== Writable) return false;
- return object && object._writableState instanceof WritableState;
- }
- });
- } else {
- realHasInstance = function realHasInstance(object) {
- return object instanceof this;
- };
- }
- function Writable(options) {
- Duplex = Duplex || require("./_stream_duplex");
- if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
- return new Writable(options);
- }
- this._writableState = new WritableState(options, this);
- this.writable = true;
- if (options) {
- if (typeof options.write === "function") this._write = options.write;
- if (typeof options.writev === "function") this._writev = options.writev;
- if (typeof options.destroy === "function") this._destroy = options.destroy;
- if (typeof options.final === "function") this._final = options.final;
- }
- Stream.call(this);
- }
- Writable.prototype.pipe = function () {
- this.emit("error", new Error("Cannot pipe, not readable"));
- };
- function writeAfterEnd(stream, cb) {
- var er = new Error("write after end");
- stream.emit("error", er);
- pna.nextTick(cb, er);
- }
- function validChunk(stream, state, chunk, cb) {
- var valid = true;
- var er = false;
- if (chunk === null) {
- er = new TypeError("May not write null values to stream");
- } else if (typeof chunk !== "string" && chunk !== undefined && !state.objectMode) {
- er = new TypeError("Invalid non-string/buffer chunk");
- }
- if (er) {
- stream.emit("error", er);
- pna.nextTick(cb, er);
- valid = false;
- }
- return valid;
- }
- Writable.prototype.write = function (chunk, encoding, cb) {
- var state = this._writableState;
- var ret = false;
- var isBuf = !state.objectMode && _isUint8Array(chunk);
- if (isBuf && !Buffer.isBuffer(chunk)) {
- chunk = _uint8ArrayToBuffer(chunk);
- }
- if (typeof encoding === "function") {
- cb = encoding;
- encoding = null;
- }
- if (isBuf) encoding = "buffer";else if (!encoding) encoding = state.defaultEncoding;
- if (typeof cb !== "function") cb = nop;
- if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
- state.pendingcb++;
- ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
- }
- return ret;
- };
- Writable.prototype.cork = function () {
- var state = this._writableState;
- state.corked++;
- };
- Writable.prototype.uncork = function () {
- var state = this._writableState;
- if (state.corked) {
- state.corked--;
- if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
- }
- };
- Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
- if (typeof encoding === "string") encoding = encoding.toLowerCase();
- if (!(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((encoding + "").toLowerCase()) > -1)) throw new TypeError("Unknown encoding: " + encoding);
- this._writableState.defaultEncoding = encoding;
- return this;
- };
- function decodeChunk(state, chunk, encoding) {
- if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") {
- chunk = Buffer.from(chunk, encoding);
- }
- return chunk;
- }
- Object.defineProperty(Writable.prototype, "writableHighWaterMark", {
- enumerable: false,
- get: function get() {
- return this._writableState.highWaterMark;
- }
- });
- function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
- if (!isBuf) {
- var newChunk = decodeChunk(state, chunk, encoding);
- if (chunk !== newChunk) {
- isBuf = true;
- encoding = "buffer";
- chunk = newChunk;
- }
- }
- var len = state.objectMode ? 1 : chunk.length;
- state.length += len;
- var ret = state.length < state.highWaterMark;
- if (!ret) state.needDrain = true;
- if (state.writing || state.corked) {
- var last = state.lastBufferedRequest;
- state.lastBufferedRequest = {
- chunk: chunk,
- encoding: encoding,
- isBuf: isBuf,
- callback: cb,
- next: null
- };
- if (last) {
- last.next = state.lastBufferedRequest;
- } else {
- state.bufferedRequest = state.lastBufferedRequest;
- }
- state.bufferedRequestCount += 1;
- } else {
- doWrite(stream, state, false, len, chunk, encoding, cb);
- }
- return ret;
- }
- function doWrite(stream, state, writev, len, chunk, encoding, cb) {
- state.writelen = len;
- state.writecb = cb;
- state.writing = true;
- state.sync = true;
- if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
- state.sync = false;
- }
- function onwriteError(stream, state, sync, er, cb) {
- --state.pendingcb;
- if (sync) {
- pna.nextTick(cb, er);
- pna.nextTick(finishMaybe, stream, state);
- stream._writableState.errorEmitted = true;
- stream.emit("error", er);
- } else {
- cb(er);
- stream._writableState.errorEmitted = true;
- stream.emit("error", er);
- finishMaybe(stream, state);
- }
- }
- function onwriteStateUpdate(state) {
- state.writing = false;
- state.writecb = null;
- state.length -= state.writelen;
- state.writelen = 0;
- }
- function onwrite(stream, er) {
- var state = stream._writableState;
- var sync = state.sync;
- var cb = state.writecb;
- onwriteStateUpdate(state);
- if (er) onwriteError(stream, state, sync, er, cb);else {
- var finished = needFinish(state);
- if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
- clearBuffer(stream, state);
- }
- if (sync) {
- asyncWrite(afterWrite, stream, state, finished, cb);
- } else {
- afterWrite(stream, state, finished, cb);
- }
- }
- }
- function afterWrite(stream, state, finished, cb) {
- if (!finished) onwriteDrain(stream, state);
- state.pendingcb--;
- cb();
- finishMaybe(stream, state);
- }
- function onwriteDrain(stream, state) {
- if (state.length === 0 && state.needDrain) {
- state.needDrain = false;
- stream.emit("drain");
- }
- }
- function clearBuffer(stream, state) {
- state.bufferProcessing = true;
- var entry = state.bufferedRequest;
- if (stream._writev && entry && entry.next) {
- var l = state.bufferedRequestCount;
- var buffer = new Array(l);
- var holder = state.corkedRequestsFree;
- holder.entry = entry;
- var count = 0;
- var allBuffers = true;
- while (entry) {
- buffer[count] = entry;
- if (!entry.isBuf) allBuffers = false;
- entry = entry.next;
- count += 1;
- }
- buffer.allBuffers = allBuffers;
- doWrite(stream, state, true, state.length, buffer, "", holder.finish);
- state.pendingcb++;
- state.lastBufferedRequest = null;
- if (holder.next) {
- state.corkedRequestsFree = holder.next;
- holder.next = null;
- } else {
- state.corkedRequestsFree = new CorkedRequest(state);
- }
- state.bufferedRequestCount = 0;
- } else {
- while (entry) {
- var chunk = entry.chunk;
- var encoding = entry.encoding;
- var cb = entry.callback;
- var len = state.objectMode ? 1 : chunk.length;
- doWrite(stream, state, false, len, chunk, encoding, cb);
- entry = entry.next;
- state.bufferedRequestCount--;
- if (state.writing) {
- break;
- }
- }
- if (entry === null) state.lastBufferedRequest = null;
- }
- state.bufferedRequest = entry;
- state.bufferProcessing = false;
- }
- Writable.prototype._write = function (chunk, encoding, cb) {
- cb(new Error("_write() is not implemented"));
- };
- Writable.prototype._writev = null;
- Writable.prototype.end = function (chunk, encoding, cb) {
- var state = this._writableState;
- if (typeof chunk === "function") {
- cb = chunk;
- chunk = null;
- encoding = null;
- } else if (typeof encoding === "function") {
- cb = encoding;
- encoding = null;
- }
- if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
- if (state.corked) {
- state.corked = 1;
- this.uncork();
- }
- if (!state.ending && !state.finished) endWritable(this, state, cb);
- };
- function needFinish(state) {
- return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
- }
- function callFinal(stream, state) {
- stream._final(function (err) {
- state.pendingcb--;
- if (err) {
- stream.emit("error", err);
- }
- state.prefinished = true;
- stream.emit("prefinish");
- finishMaybe(stream, state);
- });
- }
- function prefinish(stream, state) {
- if (!state.prefinished && !state.finalCalled) {
- if (typeof stream._final === "function") {
- state.pendingcb++;
- state.finalCalled = true;
- pna.nextTick(callFinal, stream, state);
- } else {
- state.prefinished = true;
- stream.emit("prefinish");
- }
- }
- }
- function finishMaybe(stream, state) {
- var need = needFinish(state);
- if (need) {
- prefinish(stream, state);
- if (state.pendingcb === 0) {
- state.finished = true;
- stream.emit("finish");
- }
- }
- return need;
- }
- function endWritable(stream, state, cb) {
- state.ending = true;
- finishMaybe(stream, state);
- if (cb) {
- if (state.finished) pna.nextTick(cb);else stream.once("finish", cb);
- }
- state.ended = true;
- stream.writable = false;
- }
- function onCorkedFinish(corkReq, state, err) {
- var entry = corkReq.entry;
- corkReq.entry = null;
- while (entry) {
- var cb = entry.callback;
- state.pendingcb--;
- cb(err);
- entry = entry.next;
- }
- if (state.corkedRequestsFree) {
- state.corkedRequestsFree.next = corkReq;
- } else {
- state.corkedRequestsFree = corkReq;
- }
- }
- Object.defineProperty(Writable.prototype, "destroyed", {
- get: function get() {
- if (this._writableState === undefined) {
- return false;
- }
- return this._writableState.destroyed;
- },
- set: function set(value) {
- if (!this._writableState) {
- return;
- }
- this._writableState.destroyed = value;
- }
- });
- Writable.prototype.destroy = destroyImpl.destroy;
- Writable.prototype._undestroy = destroyImpl.undestroy;
- Writable.prototype._destroy = function (err, cb) {
- this.end();
- cb(err);
- };
- }).call(this, require("_process"), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}, require("timers").setImmediate);
- }, {
- "./_stream_duplex": 98,
- "./internal/streams/destroy": 104,
- "./internal/streams/stream": 105,
- _process: 92,
- "core-util-is": 14,
- inherits: 80,
- "process-nextick-args": 91,
- "safe-buffer": 110,
- timers: 112,
- "util-deprecate": 115
- }],
- 103: [function (require, module, exports) {
- "use strict";
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
- var Buffer = require("safe-buffer").Buffer;
- var util = require("util");
- function copyBuffer(src, target, offset) {
- src.copy(target, offset);
- }
- module.exports = function () {
- function BufferList() {
- _classCallCheck(this, BufferList);
- this.head = null;
- this.tail = null;
- this.length = 0;
- }
- BufferList.prototype.push = function push(v) {
- var entry = {
- data: v,
- next: null
- };
- if (this.length > 0) this.tail.next = entry;else this.head = entry;
- this.tail = entry;
- ++this.length;
- };
- BufferList.prototype.unshift = function unshift(v) {
- var entry = {
- data: v,
- next: this.head
- };
- if (this.length === 0) this.tail = entry;
- this.head = entry;
- ++this.length;
- };
- BufferList.prototype.shift = function shift() {
- if (this.length === 0) return;
- var ret = this.head.data;
- if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
- --this.length;
- return ret;
- };
- BufferList.prototype.clear = function clear() {
- this.head = this.tail = null;
- this.length = 0;
- };
- BufferList.prototype.join = function join(s) {
- if (this.length === 0) return "";
- var p = this.head;
- var ret = "" + p.data;
- while (p = p.next) {
- ret += s + p.data;
- }
- return ret;
- };
- BufferList.prototype.concat = function concat(n) {
- if (this.length === 0) return Buffer.alloc(0);
- if (this.length === 1) return this.head.data;
- var ret = Buffer.allocUnsafe(n >>> 0);
- var p = this.head;
- var i = 0;
- while (p) {
- copyBuffer(p.data, ret, i);
- i += p.data.length;
- p = p.next;
- }
- return ret;
- };
- return BufferList;
- }();
- if (util && util.inspect && util.inspect.custom) {
- module.exports.prototype[util.inspect.custom] = function () {
- var obj = util.inspect({
- length: this.length
- });
- return this.constructor.name + " " + obj;
- };
- }
- }, {
- "safe-buffer": 110,
- util: 11
- }],
- 104: [function (require, module, exports) {
- "use strict";
- var pna = require("process-nextick-args");
- function destroy(err, cb) {
- var _this = this;
- var readableDestroyed = this._readableState && this._readableState.destroyed;
- var writableDestroyed = this._writableState && this._writableState.destroyed;
- if (readableDestroyed || writableDestroyed) {
- if (cb) {
- cb(err);
- } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
- pna.nextTick(emitErrorNT, this, err);
- }
- return this;
- }
- if (this._readableState) {
- this._readableState.destroyed = true;
- }
- if (this._writableState) {
- this._writableState.destroyed = true;
- }
- this._destroy(err || null, function (err) {
- if (!cb && err) {
- pna.nextTick(emitErrorNT, _this, err);
- if (_this._writableState) {
- _this._writableState.errorEmitted = true;
- }
- } else if (cb) {
- cb(err);
- }
- });
- return this;
- }
- function undestroy() {
- if (this._readableState) {
- this._readableState.destroyed = false;
- this._readableState.reading = false;
- this._readableState.ended = false;
- this._readableState.endEmitted = false;
- }
- if (this._writableState) {
- this._writableState.destroyed = false;
- this._writableState.ended = false;
- this._writableState.ending = false;
- this._writableState.finished = false;
- this._writableState.errorEmitted = false;
- }
- }
- function emitErrorNT(self, err) {
- self.emit("error", err);
- }
- module.exports = {
- destroy: destroy,
- undestroy: undestroy
- };
- }, {
- "process-nextick-args": 91
- }],
- 105: [function (require, module, exports) {
- module.exports = require("events").EventEmitter;
- }, {
- events: 13
- }],
- 106: [function (require, module, exports) {
- var toString = {}.toString;
- module.exports = Array.isArray || function (arr) {
- return toString.call(arr) == "[object Array]";
- };
- }, {}],
- 107: [function (require, module, exports) {
- "use strict";
- var Buffer = require("safe-buffer").Buffer;
- var isEncoding = Buffer.isEncoding || function (encoding) {
- encoding = "" + encoding;
- switch (encoding && encoding.toLowerCase()) {
- case "hex":
- case "utf8":
- case "utf-8":
- case "ascii":
- case "binary":
- case "base64":
- case "ucs2":
- case "ucs-2":
- case "utf16le":
- case "utf-16le":
- case "raw":
- return true;
- default:
- return false;
- }
- };
- function _normalizeEncoding(enc) {
- if (!enc) return "utf8";
- var retried;
- while (true) {
- switch (enc) {
- case "utf8":
- case "utf-8":
- return "utf8";
- case "ucs2":
- case "ucs-2":
- case "utf16le":
- case "utf-16le":
- return "utf16le";
- case "latin1":
- case "binary":
- return "latin1";
- case "base64":
- case "ascii":
- case "hex":
- return enc;
- default:
- if (retried) return;
- enc = ("" + enc).toLowerCase();
- retried = true;
- }
- }
- }
- function normalizeEncoding(enc) {
- var nenc = _normalizeEncoding(enc);
- if (typeof nenc !== "string" && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error("Unknown encoding: " + enc);
- return nenc || enc;
- }
- exports.StringDecoder = StringDecoder;
- function StringDecoder(encoding) {
- this.encoding = normalizeEncoding(encoding);
- var nb;
- switch (this.encoding) {
- case "utf16le":
- this.text = utf16Text;
- this.end = utf16End;
- nb = 4;
- break;
- case "utf8":
- this.fillLast = utf8FillLast;
- nb = 4;
- break;
- case "base64":
- this.text = base64Text;
- this.end = base64End;
- nb = 3;
- break;
- default:
- this.write = simpleWrite;
- this.end = simpleEnd;
- return;
- }
- this.lastNeed = 0;
- this.lastTotal = 0;
- this.lastChar = Buffer.allocUnsafe(nb);
- }
- StringDecoder.prototype.write = function (buf) {
- if (buf.length === 0) return "";
- var r;
- var i;
- if (this.lastNeed) {
- r = this.fillLast(buf);
- if (r === undefined) return "";
- i = this.lastNeed;
- this.lastNeed = 0;
- } else {
- i = 0;
- }
- if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
- return r || "";
- };
- StringDecoder.prototype.end = utf8End;
- StringDecoder.prototype.text = utf8Text;
- StringDecoder.prototype.fillLast = function (buf) {
- if (this.lastNeed <= buf.length) {
- buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
- return this.lastChar.toString(this.encoding, 0, this.lastTotal);
- }
- buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
- this.lastNeed -= buf.length;
- };
- function utf8CheckByte(byte) {
- if (byte <= 127) return 0;else if (byte >> 5 === 6) return 2;else if (byte >> 4 === 14) return 3;else if (byte >> 3 === 30) return 4;
- return byte >> 6 === 2 ? -1 : -2;
- }
- function utf8CheckIncomplete(self, buf, i) {
- var j = buf.length - 1;
- if (j < i) return 0;
- var nb = utf8CheckByte(buf[j]);
- if (nb >= 0) {
- if (nb > 0) self.lastNeed = nb - 1;
- return nb;
- }
- if (--j < i || nb === -2) return 0;
- nb = utf8CheckByte(buf[j]);
- if (nb >= 0) {
- if (nb > 0) self.lastNeed = nb - 2;
- return nb;
- }
- if (--j < i || nb === -2) return 0;
- nb = utf8CheckByte(buf[j]);
- if (nb >= 0) {
- if (nb > 0) {
- if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
- }
- return nb;
- }
- return 0;
- }
- function utf8CheckExtraBytes(self, buf, p) {
- if ((buf[0] & 192) !== 128) {
- self.lastNeed = 0;
- return "�";
- }
- if (self.lastNeed > 1 && buf.length > 1) {
- if ((buf[1] & 192) !== 128) {
- self.lastNeed = 1;
- return "�";
- }
- if (self.lastNeed > 2 && buf.length > 2) {
- if ((buf[2] & 192) !== 128) {
- self.lastNeed = 2;
- return "�";
- }
- }
- }
- }
- function utf8FillLast(buf) {
- var p = this.lastTotal - this.lastNeed;
- var r = utf8CheckExtraBytes(this, buf, p);
- if (r !== undefined) return r;
- if (this.lastNeed <= buf.length) {
- buf.copy(this.lastChar, p, 0, this.lastNeed);
- return this.lastChar.toString(this.encoding, 0, this.lastTotal);
- }
- buf.copy(this.lastChar, p, 0, buf.length);
- this.lastNeed -= buf.length;
- }
- function utf8Text(buf, i) {
- var total = utf8CheckIncomplete(this, buf, i);
- if (!this.lastNeed) return buf.toString("utf8", i);
- this.lastTotal = total;
- var end = buf.length - (total - this.lastNeed);
- buf.copy(this.lastChar, 0, end);
- return buf.toString("utf8", i, end);
- }
- function utf8End(buf) {
- var r = buf && buf.length ? this.write(buf) : "";
- if (this.lastNeed) return r + "�";
- return r;
- }
- function utf16Text(buf, i) {
- if ((buf.length - i) % 2 === 0) {
- var r = buf.toString("utf16le", i);
- if (r) {
- var c = r.charCodeAt(r.length - 1);
- if (c >= 55296 && c <= 56319) {
- this.lastNeed = 2;
- this.lastTotal = 4;
- this.lastChar[0] = buf[buf.length - 2];
- this.lastChar[1] = buf[buf.length - 1];
- return r.slice(0, -1);
- }
- }
- return r;
- }
- this.lastNeed = 1;
- this.lastTotal = 2;
- this.lastChar[0] = buf[buf.length - 1];
- return buf.toString("utf16le", i, buf.length - 1);
- }
- function utf16End(buf) {
- var r = buf && buf.length ? this.write(buf) : "";
- if (this.lastNeed) {
- var end = this.lastTotal - this.lastNeed;
- return r + this.lastChar.toString("utf16le", 0, end);
- }
- return r;
- }
- function base64Text(buf, i) {
- var n = (buf.length - i) % 3;
- if (n === 0) return buf.toString("base64", i);
- this.lastNeed = 3 - n;
- this.lastTotal = 3;
- if (n === 1) {
- this.lastChar[0] = buf[buf.length - 1];
- } else {
- this.lastChar[0] = buf[buf.length - 2];
- this.lastChar[1] = buf[buf.length - 1];
- }
- return buf.toString("base64", i, buf.length - n);
- }
- function base64End(buf) {
- var r = buf && buf.length ? this.write(buf) : "";
- if (this.lastNeed) return r + this.lastChar.toString("base64", 0, 3 - this.lastNeed);
- return r;
- }
- function simpleWrite(buf) {
- return buf.toString(this.encoding);
- }
- function simpleEnd(buf) {
- return buf && buf.length ? this.write(buf) : "";
- }
- }, {
- "safe-buffer": 110
- }],
- 108: [function (require, module, exports) {
- exports = module.exports = require("./lib/_stream_readable.js");
- exports.Stream = exports;
- exports.Readable = exports;
- exports.Writable = require("./lib/_stream_writable.js");
- exports.Duplex = require("./lib/_stream_duplex.js");
- exports.Transform = require("./lib/_stream_transform.js");
- exports.PassThrough = require("./lib/_stream_passthrough.js");
- }, {
- "./lib/_stream_duplex.js": 98,
- "./lib/_stream_passthrough.js": 99,
- "./lib/_stream_readable.js": 100,
- "./lib/_stream_transform.js": 101,
- "./lib/_stream_writable.js": 102
- }],
- 109: [function (require, module, exports) {
- "use strict";
- function ReInterval(callback, interval, args) {
- var self = this;
- this._callback = callback;
- this._args = args;
- this._interval = setInterval(callback, interval, this._args);
- this.reschedule = function (interval) {
- if (!interval) interval = self._interval;
- if (self._interval) clearInterval(self._interval);
- self._interval = setInterval(self._callback, interval, self._args);
- };
- this.clear = function () {
- if (self._interval) {
- clearInterval(self._interval);
- self._interval = undefined;
- }
- };
- this.destroy = function () {
- if (self._interval) {
- clearInterval(self._interval);
- }
- self._callback = undefined;
- self._interval = undefined;
- self._args = undefined;
- };
- }
- function reInterval() {
- if (typeof arguments[0] !== "function") throw new Error("callback needed");
- if (typeof arguments[1] !== "number") throw new Error("interval needed");
- var args;
- if (arguments.length > 0) {
- args = new Array(arguments.length - 2);
- for (var i = 0; i < args.length; i++) {
- args[i] = arguments[i + 2];
- }
- }
- return new ReInterval(arguments[0], arguments[1], args);
- }
- module.exports = reInterval;
- }, {}],
- 110: [function (require, module, exports) {
- var buffer = require("buffer");
- var Buffer = buffer.Buffer;
- function copyProps(src, dst) {
- for (var key in src) {
- dst[key] = src[key];
- }
- }
- if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
- module.exports = buffer;
- } else {
- copyProps(buffer, exports);
- exports.Buffer = SafeBuffer;
- }
- function SafeBuffer(arg, encodingOrOffset, length) {
- return Buffer(arg, encodingOrOffset, length);
- }
- copyProps(Buffer, SafeBuffer);
- SafeBuffer.from = function (arg, encodingOrOffset, length) {
- if (typeof arg === "number") {
- throw new TypeError("Argument must not be a number");
- }
- return Buffer(arg, encodingOrOffset, length);
- };
- SafeBuffer.alloc = function (size, fill, encoding) {
- if (typeof size !== "number") {
- throw new TypeError("Argument must be a number");
- }
- var buf = Buffer(size);
- if (fill !== undefined) {
- if (typeof encoding === "string") {
- buf.fill(fill, encoding);
- } else {
- buf.fill(fill);
- }
- } else {
- buf.fill(0);
- }
- return buf;
- };
- SafeBuffer.allocUnsafe = function (size) {
- if (typeof size !== "number") {
- throw new TypeError("Argument must be a number");
- }
- return Buffer(size);
- };
- SafeBuffer.allocUnsafeSlow = function (size) {
- if (typeof size !== "number") {
- throw new TypeError("Argument must be a number");
- }
- return buffer.SlowBuffer(size);
- };
- }, {
- buffer: 12
- }],
- 111: [function (require, module, exports) {
- module.exports = shift;
- function shift(stream) {
- var rs = stream._readableState;
- if (!rs) return null;
- return rs.objectMode ? stream.read() : stream.read(getStateLength(rs));
- }
- function getStateLength(state) {
- if (state.buffer.length) {
- if (state.buffer.head) {
- return state.buffer.head.data.length;
- }
- return state.buffer[0].length;
- }
- return state.length;
- }
- }, {}],
- 112: [function (require, module, exports) {
- (function (setImmediate, clearImmediate) {
- var nextTick = require("process/browser.js").nextTick;
- var apply = Function.prototype.apply;
- var slice = Array.prototype.slice;
- var immediateIds = {};
- var nextImmediateId = 0;
- exports.setTimeout = function () {
- return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
- };
- exports.setInterval = function () {
- return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
- };
- exports.clearTimeout = exports.clearInterval = function (timeout) {
- timeout.close();
- };
- function Timeout(id, clearFn) {
- this._id = id;
- this._clearFn = clearFn;
- }
- Timeout.prototype.unref = Timeout.prototype.ref = function () {};
- Timeout.prototype.close = function () {
- this._clearFn.call(window, this._id);
- };
- exports.enroll = function (item, msecs) {
- clearTimeout(item._idleTimeoutId);
- item._idleTimeout = msecs;
- };
- exports.unenroll = function (item) {
- clearTimeout(item._idleTimeoutId);
- item._idleTimeout = -1;
- };
- exports._unrefActive = exports.active = function (item) {
- clearTimeout(item._idleTimeoutId);
- var msecs = item._idleTimeout;
- if (msecs >= 0) {
- item._idleTimeoutId = setTimeout(function onTimeout() {
- if (item._onTimeout) item._onTimeout();
- }, msecs);
- }
- };
- exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function (fn) {
- var id = nextImmediateId++;
- var args = arguments.length < 2 ? false : slice.call(arguments, 1);
- immediateIds[id] = true;
- nextTick(function onNextTick() {
- if (immediateIds[id]) {
- if (args) {
- fn.apply(null, args);
- } else {
- fn.call(null);
- }
- exports.clearImmediate(id);
- }
- });
- return id;
- };
- exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function (id) {
- delete immediateIds[id];
- };
- }).call(this, require("timers").setImmediate, require("timers").clearImmediate);
- }, {
- "process/browser.js": 92,
- timers: 112
- }],
- 113: [function (require, module, exports) {
- "use strict";
- var punycode = require("punycode");
- var util = require("./util");
- exports.parse = urlParse;
- exports.resolve = urlResolve;
- exports.resolveObject = urlResolveObject;
- exports.format = urlFormat;
- exports.Url = Url;
- function Url() {
- this.protocol = null;
- this.slashes = null;
- this.auth = null;
- this.host = null;
- this.port = null;
- this.hostname = null;
- this.hash = null;
- this.search = null;
- this.query = null;
- this.pathname = null;
- this.path = null;
- this.href = null;
- }
- var protocolPattern = /^([a-z0-9.+-]+:)/i,
- portPattern = /:[0-9]*$/,
- simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
- delims = ["<", ">", '"', "`", " ", "\r", "\n", "\t"],
- unwise = ["{", "}", "|", "\\", "^", "`"].concat(delims),
- autoEscape = ["'"].concat(unwise),
- nonHostChars = ["%", "/", "?", ";", "#"].concat(autoEscape),
- hostEndingChars = ["/", "?", "#"],
- hostnameMaxLen = 255,
- hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
- hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
- unsafeProtocol = {
- javascript: true,
- "javascript:": true
- },
- hostlessProtocol = {
- javascript: true,
- "javascript:": true
- },
- slashedProtocol = {
- http: true,
- https: true,
- ftp: true,
- gopher: true,
- file: true,
- "http:": true,
- "https:": true,
- "ftp:": true,
- "gopher:": true,
- "file:": true
- },
- querystring = require("querystring");
- function urlParse(url, parseQueryString, slashesDenoteHost) {
- if (url && util.isObject(url) && url instanceof Url) return url;
- var u = new Url();
- u.parse(url, parseQueryString, slashesDenoteHost);
- return u;
- }
- Url.prototype.parse = function (url, parseQueryString, slashesDenoteHost) {
- if (!util.isString(url)) {
- throw new TypeError("Parameter 'url' must be a string, not " + _typeof(url));
- }
- var queryIndex = url.indexOf("?"),
- splitter = queryIndex !== -1 && queryIndex < url.indexOf("#") ? "?" : "#",
- uSplit = url.split(splitter),
- slashRegex = /\\/g;
- uSplit[0] = uSplit[0].replace(slashRegex, "/");
- url = uSplit.join(splitter);
- var rest = url;
- rest = rest.trim();
- if (!slashesDenoteHost && url.split("#").length === 1) {
- var simplePath = simplePathPattern.exec(rest);
- if (simplePath) {
- this.path = rest;
- this.href = rest;
- this.pathname = simplePath[1];
- if (simplePath[2]) {
- this.search = simplePath[2];
- if (parseQueryString) {
- this.query = querystring.parse(this.search.substr(1));
- } else {
- this.query = this.search.substr(1);
- }
- } else if (parseQueryString) {
- this.search = "";
- this.query = {};
- }
- return this;
- }
- }
- var proto = protocolPattern.exec(rest);
- if (proto) {
- proto = proto[0];
- var lowerProto = proto.toLowerCase();
- this.protocol = lowerProto;
- rest = rest.substr(proto.length);
- }
- if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
- var slashes = rest.substr(0, 2) === "//";
- if (slashes && !(proto && hostlessProtocol[proto])) {
- rest = rest.substr(2);
- this.slashes = true;
- }
- }
- if (!hostlessProtocol[proto] && (slashes || proto && !slashedProtocol[proto])) {
- var hostEnd = -1;
- for (var i = 0; i < hostEndingChars.length; i++) {
- var hec = rest.indexOf(hostEndingChars[i]);
- if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) hostEnd = hec;
- }
- var auth, atSign;
- if (hostEnd === -1) {
- atSign = rest.lastIndexOf("@");
- } else {
- atSign = rest.lastIndexOf("@", hostEnd);
- }
- if (atSign !== -1) {
- auth = rest.slice(0, atSign);
- rest = rest.slice(atSign + 1);
- this.auth = decodeURIComponent(auth);
- }
- hostEnd = -1;
- for (var i = 0; i < nonHostChars.length; i++) {
- var hec = rest.indexOf(nonHostChars[i]);
- if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) hostEnd = hec;
- }
- if (hostEnd === -1) hostEnd = rest.length;
- this.host = rest.slice(0, hostEnd);
- rest = rest.slice(hostEnd);
- this.parseHost();
- this.hostname = this.hostname || "";
- var ipv6Hostname = this.hostname[0] === "[" && this.hostname[this.hostname.length - 1] === "]";
- if (!ipv6Hostname) {
- var hostparts = this.hostname.split(/\./);
- for (var i = 0, l = hostparts.length; i < l; i++) {
- var part = hostparts[i];
- if (!part) continue;
- if (!part.match(hostnamePartPattern)) {
- var newpart = "";
- for (var j = 0, k = part.length; j < k; j++) {
- if (part.charCodeAt(j) > 127) {
- newpart += "x";
- } else {
- newpart += part[j];
- }
- }
- if (!newpart.match(hostnamePartPattern)) {
- var validParts = hostparts.slice(0, i);
- var notHost = hostparts.slice(i + 1);
- var bit = part.match(hostnamePartStart);
- if (bit) {
- validParts.push(bit[1]);
- notHost.unshift(bit[2]);
- }
- if (notHost.length) {
- rest = "/" + notHost.join(".") + rest;
- }
- this.hostname = validParts.join(".");
- break;
- }
- }
- }
- }
- if (this.hostname.length > hostnameMaxLen) {
- this.hostname = "";
- } else {
- this.hostname = this.hostname.toLowerCase();
- }
- if (!ipv6Hostname) {
- this.hostname = punycode.toASCII(this.hostname);
- }
- var p = this.port ? ":" + this.port : "";
- var h = this.hostname || "";
- this.host = h + p;
- this.href += this.host;
- if (ipv6Hostname) {
- this.hostname = this.hostname.substr(1, this.hostname.length - 2);
- if (rest[0] !== "/") {
- rest = "/" + rest;
- }
- }
- }
- if (!unsafeProtocol[lowerProto]) {
- for (var i = 0, l = autoEscape.length; i < l; i++) {
- var ae = autoEscape[i];
- if (rest.indexOf(ae) === -1) continue;
- var esc = encodeURIComponent(ae);
- if (esc === ae) {
- esc = escape(ae);
- }
- rest = rest.split(ae).join(esc);
- }
- }
- var hash = rest.indexOf("#");
- if (hash !== -1) {
- this.hash = rest.substr(hash);
- rest = rest.slice(0, hash);
- }
- var qm = rest.indexOf("?");
- if (qm !== -1) {
- this.search = rest.substr(qm);
- this.query = rest.substr(qm + 1);
- if (parseQueryString) {
- this.query = querystring.parse(this.query);
- }
- rest = rest.slice(0, qm);
- } else if (parseQueryString) {
- this.search = "";
- this.query = {};
- }
- if (rest) this.pathname = rest;
- if (slashedProtocol[lowerProto] && this.hostname && !this.pathname) {
- this.pathname = "/";
- }
- if (this.pathname || this.search) {
- var p = this.pathname || "";
- var s = this.search || "";
- this.path = p + s;
- }
- this.href = this.format();
- return this;
- };
- function urlFormat(obj) {
- if (util.isString(obj)) obj = urlParse(obj);
- if (!(obj instanceof Url)) return Url.prototype.format.call(obj);
- return obj.format();
- }
- Url.prototype.format = function () {
- var auth = this.auth || "";
- if (auth) {
- auth = encodeURIComponent(auth);
- auth = auth.replace(/%3A/i, ":");
- auth += "@";
- }
- var protocol = this.protocol || "",
- pathname = this.pathname || "",
- hash = this.hash || "",
- host = false,
- query = "";
- if (this.host) {
- host = auth + this.host;
- } else if (this.hostname) {
- host = auth + (this.hostname.indexOf(":") === -1 ? this.hostname : "[" + this.hostname + "]");
- if (this.port) {
- host += ":" + this.port;
- }
- }
- if (this.query && util.isObject(this.query) && Object.keys(this.query).length) {
- query = querystring.stringify(this.query);
- }
- var search = this.search || query && "?" + query || "";
- if (protocol && protocol.substr(-1) !== ":") protocol += ":";
- if (this.slashes || (!protocol || slashedProtocol[protocol]) && host !== false) {
- host = "//" + (host || "");
- if (pathname && pathname.charAt(0) !== "/") pathname = "/" + pathname;
- } else if (!host) {
- host = "";
- }
- if (hash && hash.charAt(0) !== "#") hash = "#" + hash;
- if (search && search.charAt(0) !== "?") search = "?" + search;
- pathname = pathname.replace(/[?#]/g, function (match) {
- return encodeURIComponent(match);
- });
- search = search.replace("#", "%23");
- return protocol + host + pathname + search + hash;
- };
- function urlResolve(source, relative) {
- return urlParse(source, false, true).resolve(relative);
- }
- Url.prototype.resolve = function (relative) {
- return this.resolveObject(urlParse(relative, false, true)).format();
- };
- function urlResolveObject(source, relative) {
- if (!source) return relative;
- return urlParse(source, false, true).resolveObject(relative);
- }
- Url.prototype.resolveObject = function (relative) {
- if (util.isString(relative)) {
- var rel = new Url();
- rel.parse(relative, false, true);
- relative = rel;
- }
- var result = new Url();
- var tkeys = Object.keys(this);
- for (var tk = 0; tk < tkeys.length; tk++) {
- var tkey = tkeys[tk];
- result[tkey] = this[tkey];
- }
- result.hash = relative.hash;
- if (relative.href === "") {
- result.href = result.format();
- return result;
- }
- if (relative.slashes && !relative.protocol) {
- var rkeys = Object.keys(relative);
- for (var rk = 0; rk < rkeys.length; rk++) {
- var rkey = rkeys[rk];
- if (rkey !== "protocol") result[rkey] = relative[rkey];
- }
- if (slashedProtocol[result.protocol] && result.hostname && !result.pathname) {
- result.path = result.pathname = "/";
- }
- result.href = result.format();
- return result;
- }
- if (relative.protocol && relative.protocol !== result.protocol) {
- if (!slashedProtocol[relative.protocol]) {
- var keys = Object.keys(relative);
- for (var v = 0; v < keys.length; v++) {
- var k = keys[v];
- result[k] = relative[k];
- }
- result.href = result.format();
- return result;
- }
- result.protocol = relative.protocol;
- if (!relative.host && !hostlessProtocol[relative.protocol]) {
- var relPath = (relative.pathname || "").split("/");
- while (relPath.length && !(relative.host = relPath.shift())) {
- ;
- }
- if (!relative.host) relative.host = "";
- if (!relative.hostname) relative.hostname = "";
- if (relPath[0] !== "") relPath.unshift("");
- if (relPath.length < 2) relPath.unshift("");
- result.pathname = relPath.join("/");
- } else {
- result.pathname = relative.pathname;
- }
- result.search = relative.search;
- result.query = relative.query;
- result.host = relative.host || "";
- result.auth = relative.auth;
- result.hostname = relative.hostname || relative.host;
- result.port = relative.port;
- if (result.pathname || result.search) {
- var p = result.pathname || "";
- var s = result.search || "";
- result.path = p + s;
- }
- result.slashes = result.slashes || relative.slashes;
- result.href = result.format();
- return result;
- }
- var isSourceAbs = result.pathname && result.pathname.charAt(0) === "/",
- isRelAbs = relative.host || relative.pathname && relative.pathname.charAt(0) === "/",
- mustEndAbs = isRelAbs || isSourceAbs || result.host && relative.pathname,
- removeAllDots = mustEndAbs,
- srcPath = result.pathname && result.pathname.split("/") || [],
- relPath = relative.pathname && relative.pathname.split("/") || [],
- psychotic = result.protocol && !slashedProtocol[result.protocol];
- if (psychotic) {
- result.hostname = "";
- result.port = null;
- if (result.host) {
- if (srcPath[0] === "") srcPath[0] = result.host;else srcPath.unshift(result.host);
- }
- result.host = "";
- if (relative.protocol) {
- relative.hostname = null;
- relative.port = null;
- if (relative.host) {
- if (relPath[0] === "") relPath[0] = relative.host;else relPath.unshift(relative.host);
- }
- relative.host = null;
- }
- mustEndAbs = mustEndAbs && (relPath[0] === "" || srcPath[0] === "");
- }
- if (isRelAbs) {
- result.host = relative.host || relative.host === "" ? relative.host : result.host;
- result.hostname = relative.hostname || relative.hostname === "" ? relative.hostname : result.hostname;
- result.search = relative.search;
- result.query = relative.query;
- srcPath = relPath;
- } else if (relPath.length) {
- if (!srcPath) srcPath = [];
- srcPath.pop();
- srcPath = srcPath.concat(relPath);
- result.search = relative.search;
- result.query = relative.query;
- } else if (!util.isNullOrUndefined(relative.search)) {
- if (psychotic) {
- result.hostname = result.host = srcPath.shift();
- var authInHost = result.host && result.host.indexOf("@") > 0 ? result.host.split("@") : false;
- if (authInHost) {
- result.auth = authInHost.shift();
- result.host = result.hostname = authInHost.shift();
- }
- }
- result.search = relative.search;
- result.query = relative.query;
- if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
- result.path = (result.pathname ? result.pathname : "") + (result.search ? result.search : "");
- }
- result.href = result.format();
- return result;
- }
- if (!srcPath.length) {
- result.pathname = null;
- if (result.search) {
- result.path = "/" + result.search;
- } else {
- result.path = null;
- }
- result.href = result.format();
- return result;
- }
- var last = srcPath.slice(-1)[0];
- var hasTrailingSlash = (result.host || relative.host || srcPath.length > 1) && (last === "." || last === "..") || last === "";
- var up = 0;
- for (var i = srcPath.length; i >= 0; i--) {
- last = srcPath[i];
- if (last === ".") {
- srcPath.splice(i, 1);
- } else if (last === "..") {
- srcPath.splice(i, 1);
- up++;
- } else if (up) {
- srcPath.splice(i, 1);
- up--;
- }
- }
- if (!mustEndAbs && !removeAllDots) {
- for (; up--; up) {
- srcPath.unshift("..");
- }
- }
- if (mustEndAbs && srcPath[0] !== "" && (!srcPath[0] || srcPath[0].charAt(0) !== "/")) {
- srcPath.unshift("");
- }
- if (hasTrailingSlash && srcPath.join("/").substr(-1) !== "/") {
- srcPath.push("");
- }
- var isAbsolute = srcPath[0] === "" || srcPath[0] && srcPath[0].charAt(0) === "/";
- if (psychotic) {
- result.hostname = result.host = isAbsolute ? "" : srcPath.length ? srcPath.shift() : "";
- var authInHost = result.host && result.host.indexOf("@") > 0 ? result.host.split("@") : false;
- if (authInHost) {
- result.auth = authInHost.shift();
- result.host = result.hostname = authInHost.shift();
- }
- }
- mustEndAbs = mustEndAbs || result.host && srcPath.length;
- if (mustEndAbs && !isAbsolute) {
- srcPath.unshift("");
- }
- if (!srcPath.length) {
- result.pathname = null;
- result.path = null;
- } else {
- result.pathname = srcPath.join("/");
- }
- if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
- result.path = (result.pathname ? result.pathname : "") + (result.search ? result.search : "");
- }
- result.auth = relative.auth || result.auth;
- result.slashes = result.slashes || relative.slashes;
- result.href = result.format();
- return result;
- };
- Url.prototype.parseHost = function () {
- var host = this.host;
- var port = portPattern.exec(host);
- if (port) {
- port = port[0];
- if (port !== ":") {
- this.port = port.substr(1);
- }
- host = host.substr(0, host.length - port.length);
- }
- if (host) this.hostname = host;
- };
- }, {
- "./util": 114,
- punycode: 93,
- querystring: 96
- }],
- 114: [function (require, module, exports) {
- "use strict";
- module.exports = {
- isString: function isString(arg) {
- return typeof arg === "string";
- },
- isObject: function isObject(arg) {
- return _typeof(arg) === "object" && arg !== null;
- },
- isNull: function isNull(arg) {
- return arg === null;
- },
- isNullOrUndefined: function isNullOrUndefined(arg) {
- return arg == null;
- }
- };
- }, {}],
- 115: [function (require, module, exports) {
- (function (global) {
- module.exports = deprecate;
- function deprecate(fn, msg) {
- if (config("noDeprecation")) {
- return fn;
- }
- var warned = false;
- function deprecated() {
- if (!warned) {
- if (config("throwDeprecation")) {
- throw new Error(msg);
- } else if (config("traceDeprecation")) {
- console.trace(msg);
- } else {
- console.warn(msg);
- }
- warned = true;
- }
- return fn.apply(this, arguments);
- }
- return deprecated;
- }
- function config(name) {
- try {
- if (!global.localStorage) return false;
- } catch (_) {
- return false;
- }
- var val = global.localStorage[name];
- if (null == val) return false;
- return String(val).toLowerCase() === "true";
- }
- }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
- }, {}],
- 116: [function (require, module, exports) {
- module.exports = function isBuffer(arg) {
- return arg && _typeof(arg) === "object" && typeof arg.copy === "function" && typeof arg.fill === "function" && typeof arg.readUInt8 === "function";
- };
- }, {}],
- 117: [function (require, module, exports) {
- (function (process, global) {
- var formatRegExp = /%[sdj%]/g;
- exports.format = function (f) {
- if (!isString(f)) {
- var objects = [];
- for (var i = 0; i < arguments.length; i++) {
- objects.push(inspect(arguments[i]));
- }
- return objects.join(" ");
- }
- var i = 1;
- var args = arguments;
- var len = args.length;
- var str = String(f).replace(formatRegExp, function (x) {
- if (x === "%%") return "%";
- if (i >= len) return x;
- switch (x) {
- case "%s":
- return String(args[i++]);
- case "%d":
- return Number(args[i++]);
- case "%j":
- try {
- return JSON.stringify(args[i++]);
- } catch (_) {
- return "[Circular]";
- }
- default:
- return x;
- }
- });
- for (var x = args[i]; i < len; x = args[++i]) {
- if (isNull(x) || !isObject(x)) {
- str += " " + x;
- } else {
- str += " " + inspect(x);
- }
- }
- return str;
- };
- exports.deprecate = function (fn, msg) {
- if (isUndefined(global.process)) {
- return function () {
- return exports.deprecate(fn, msg).apply(this, arguments);
- };
- }
- if (process.noDeprecation === true) {
- return fn;
- }
- var warned = false;
- function deprecated() {
- if (!warned) {
- if (process.throwDeprecation) {
- throw new Error(msg);
- } else if (process.traceDeprecation) {
- console.trace(msg);
- } else {
- console.error(msg);
- }
- warned = true;
- }
- return fn.apply(this, arguments);
- }
- return deprecated;
- };
- var debugs = {};
- var debugEnviron;
- exports.debuglog = function (set) {
- if (isUndefined(debugEnviron)) debugEnviron = process.env.NODE_DEBUG || "";
- set = set.toUpperCase();
- if (!debugs[set]) {
- if (new RegExp("\\b" + set + "\\b", "i").test(debugEnviron)) {
- var pid = process.pid;
- debugs[set] = function () {
- var msg = exports.format.apply(exports, arguments);
- console.error("%s %d: %s", set, pid, msg);
- };
- } else {
- debugs[set] = function () {};
- }
- }
- return debugs[set];
- };
- function inspect(obj, opts) {
- var ctx = {
- seen: [],
- stylize: stylizeNoColor
- };
- if (arguments.length >= 3) ctx.depth = arguments[2];
- if (arguments.length >= 4) ctx.colors = arguments[3];
- if (isBoolean(opts)) {
- ctx.showHidden = opts;
- } else if (opts) {
- exports._extend(ctx, opts);
- }
- if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
- if (isUndefined(ctx.depth)) ctx.depth = 2;
- if (isUndefined(ctx.colors)) ctx.colors = false;
- if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
- if (ctx.colors) ctx.stylize = stylizeWithColor;
- return formatValue(ctx, obj, ctx.depth);
- }
- exports.inspect = inspect;
- inspect.colors = {
- bold: [1, 22],
- italic: [3, 23],
- underline: [4, 24],
- inverse: [7, 27],
- white: [37, 39],
- grey: [90, 39],
- black: [30, 39],
- blue: [34, 39],
- cyan: [36, 39],
- green: [32, 39],
- magenta: [35, 39],
- red: [31, 39],
- yellow: [33, 39]
- };
- inspect.styles = {
- special: "cyan",
- number: "yellow",
- boolean: "yellow",
- undefined: "grey",
- null: "bold",
- string: "green",
- date: "magenta",
- regexp: "red"
- };
- function stylizeWithColor(str, styleType) {
- var style = inspect.styles[styleType];
- if (style) {
- return "[" + inspect.colors[style][0] + "m" + str + "[" + inspect.colors[style][1] + "m";
- } else {
- return str;
- }
- }
- function stylizeNoColor(str, styleType) {
- return str;
- }
- function arrayToHash(array) {
- var hash = {};
- array.forEach(function (val, idx) {
- hash[val] = true;
- });
- return hash;
- }
- function formatValue(ctx, value, recurseTimes) {
- if (ctx.customInspect && value && isFunction(value.inspect) && value.inspect !== exports.inspect && !(value.constructor && value.constructor.prototype === value)) {
- var ret = value.inspect(recurseTimes, ctx);
- if (!isString(ret)) {
- ret = formatValue(ctx, ret, recurseTimes);
- }
- return ret;
- }
- var primitive = formatPrimitive(ctx, value);
- if (primitive) {
- return primitive;
- }
- var keys = Object.keys(value);
- var visibleKeys = arrayToHash(keys);
- if (ctx.showHidden) {
- keys = Object.getOwnPropertyNames(value);
- }
- if (isError(value) && (keys.indexOf("message") >= 0 || keys.indexOf("description") >= 0)) {
- return formatError(value);
- }
- if (keys.length === 0) {
- if (isFunction(value)) {
- var name = value.name ? ": " + value.name : "";
- return ctx.stylize("[Function" + name + "]", "special");
- }
- if (isRegExp(value)) {
- return ctx.stylize(RegExp.prototype.toString.call(value), "regexp");
- }
- if (isDate(value)) {
- return ctx.stylize(Date.prototype.toString.call(value), "date");
- }
- if (isError(value)) {
- return formatError(value);
- }
- }
- var base = "",
- array = false,
- braces = ["{", "}"];
- if (isArray(value)) {
- array = true;
- braces = ["[", "]"];
- }
- if (isFunction(value)) {
- var n = value.name ? ": " + value.name : "";
- base = " [Function" + n + "]";
- }
- if (isRegExp(value)) {
- base = " " + RegExp.prototype.toString.call(value);
- }
- if (isDate(value)) {
- base = " " + Date.prototype.toUTCString.call(value);
- }
- if (isError(value)) {
- base = " " + formatError(value);
- }
- if (keys.length === 0 && (!array || value.length == 0)) {
- return braces[0] + base + braces[1];
- }
- if (recurseTimes < 0) {
- if (isRegExp(value)) {
- return ctx.stylize(RegExp.prototype.toString.call(value), "regexp");
- } else {
- return ctx.stylize("[Object]", "special");
- }
- }
- ctx.seen.push(value);
- var output;
- if (array) {
- output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
- } else {
- output = keys.map(function (key) {
- return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
- });
- }
- ctx.seen.pop();
- return reduceToSingleString(output, base, braces);
- }
- function formatPrimitive(ctx, value) {
- if (isUndefined(value)) return ctx.stylize("undefined", "undefined");
- if (isString(value)) {
- var simple = "'" + JSON.stringify(value).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, '"') + "'";
- return ctx.stylize(simple, "string");
- }
- if (isNumber(value)) return ctx.stylize("" + value, "number");
- if (isBoolean(value)) return ctx.stylize("" + value, "boolean");
- if (isNull(value)) return ctx.stylize("null", "null");
- }
- function formatError(value) {
- return "[" + Error.prototype.toString.call(value) + "]";
- }
- function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
- var output = [];
- for (var i = 0, l = value.length; i < l; ++i) {
- if (hasOwnProperty(value, String(i))) {
- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true));
- } else {
- output.push("");
- }
- }
- keys.forEach(function (key) {
- if (!key.match(/^\d+$/)) {
- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key, true));
- }
- });
- return output;
- }
- function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
- var name, str, desc;
- desc = Object.getOwnPropertyDescriptor(value, key) || {
- value: value[key]
- };
- if (desc.get) {
- if (desc.set) {
- str = ctx.stylize("[Getter/Setter]", "special");
- } else {
- str = ctx.stylize("[Getter]", "special");
- }
- } else {
- if (desc.set) {
- str = ctx.stylize("[Setter]", "special");
- }
- }
- if (!hasOwnProperty(visibleKeys, key)) {
- name = "[" + key + "]";
- }
- if (!str) {
- if (ctx.seen.indexOf(desc.value) < 0) {
- if (isNull(recurseTimes)) {
- str = formatValue(ctx, desc.value, null);
- } else {
- str = formatValue(ctx, desc.value, recurseTimes - 1);
- }
- if (str.indexOf("\n") > -1) {
- if (array) {
- str = str.split("\n").map(function (line) {
- return " " + line;
- }).join("\n").substr(2);
- } else {
- str = "\n" + str.split("\n").map(function (line) {
- return " " + line;
- }).join("\n");
- }
- }
- } else {
- str = ctx.stylize("[Circular]", "special");
- }
- }
- if (isUndefined(name)) {
- if (array && key.match(/^\d+$/)) {
- return str;
- }
- name = JSON.stringify("" + key);
- if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
- name = name.substr(1, name.length - 2);
- name = ctx.stylize(name, "name");
- } else {
- name = name.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'");
- name = ctx.stylize(name, "string");
- }
- }
- return name + ": " + str;
- }
- function reduceToSingleString(output, base, braces) {
- var numLinesEst = 0;
- var length = output.reduce(function (prev, cur) {
- numLinesEst++;
- if (cur.indexOf("\n") >= 0) numLinesEst++;
- return prev + cur.replace(/\u001b\[\d\d?m/g, "").length + 1;
- }, 0);
- if (length > 60) {
- return braces[0] + (base === "" ? "" : base + "\n ") + " " + output.join(",\n ") + " " + braces[1];
- }
- return braces[0] + base + " " + output.join(", ") + " " + braces[1];
- }
- function isArray(ar) {
- return Array.isArray(ar);
- }
- exports.isArray = isArray;
- function isBoolean(arg) {
- return typeof arg === "boolean";
- }
- exports.isBoolean = isBoolean;
- function isNull(arg) {
- return arg === null;
- }
- exports.isNull = isNull;
- function isNullOrUndefined(arg) {
- return arg == null;
- }
- exports.isNullOrUndefined = isNullOrUndefined;
- function isNumber(arg) {
- return typeof arg === "number";
- }
- exports.isNumber = isNumber;
- function isString(arg) {
- return typeof arg === "string";
- }
- exports.isString = isString;
- function isSymbol(arg) {
- return _typeof(arg) === "symbol";
- }
- exports.isSymbol = isSymbol;
- function isUndefined(arg) {
- return arg === void 0;
- }
- exports.isUndefined = isUndefined;
- function isRegExp(re) {
- return isObject(re) && objectToString(re) === "[object RegExp]";
- }
- exports.isRegExp = isRegExp;
- function isObject(arg) {
- return _typeof(arg) === "object" && arg !== null;
- }
- exports.isObject = isObject;
- function isDate(d) {
- return isObject(d) && objectToString(d) === "[object Date]";
- }
- exports.isDate = isDate;
- function isError(e) {
- return isObject(e) && (objectToString(e) === "[object Error]" || e instanceof Error);
- }
- exports.isError = isError;
- function isFunction(arg) {
- return typeof arg === "function";
- }
- exports.isFunction = isFunction;
- function isPrimitive(arg) {
- return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || _typeof(arg) === "symbol" || typeof arg === "undefined";
- }
- exports.isPrimitive = isPrimitive;
- exports.isBuffer = require("./support/isBuffer");
- function objectToString(o) {
- return Object.prototype.toString.call(o);
- }
- function pad(n) {
- return n < 10 ? "0" + n.toString(10) : n.toString(10);
- }
- var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
- function timestamp() {
- var d = new Date();
- var time = [pad(d.getHours()), pad(d.getMinutes()), pad(d.getSeconds())].join(":");
- return [d.getDate(), months[d.getMonth()], time].join(" ");
- }
- exports.log = function () {
- console.log("%s - %s", timestamp(), exports.format.apply(exports, arguments));
- };
- exports.inherits = require("inherits");
- exports._extend = function (origin, add) {
- if (!add || !isObject(add)) return origin;
- var keys = Object.keys(add);
- var i = keys.length;
- while (i--) {
- origin[keys[i]] = add[keys[i]];
- }
- return origin;
- };
- function hasOwnProperty(obj, prop) {
- return Object.prototype.hasOwnProperty.call(obj, prop);
- }
- }).call(this, require("_process"), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
- }, {
- "./support/isBuffer": 116,
- _process: 92,
- inherits: 80
- }],
- 118: [function (require, module, exports) {
- (function (process, global) {
- "use strict";
- var Transform = require("readable-stream").Transform;
- var duplexify = require("duplexify");
- var WS = require("ws");
- var Buffer = require("safe-buffer").Buffer;
- module.exports = WebSocketStream;
- function buildProxy(options, socketWrite, socketEnd) {
- var proxy = new Transform({
- objectMode: options.objectMode
- });
- proxy._write = socketWrite;
- proxy._flush = socketEnd;
- return proxy;
- }
- function WebSocketStream(target, protocols, options) {
- var stream, socket;
- var isBrowser = process.title === "browser";
- var isNative = !!global.WebSocket;
- var socketWrite = isBrowser ? socketWriteBrowser : socketWriteNode;
- if (protocols && !Array.isArray(protocols) && "object" === _typeof(protocols)) {
- options = protocols;
- protocols = null;
- if (typeof options.protocol === "string" || Array.isArray(options.protocol)) {
- protocols = options.protocol;
- }
- }
- if (!options) options = {};
- if (options.objectMode === undefined) {
- options.objectMode = !(options.binary === true || options.binary === undefined);
- }
- var proxy = buildProxy(options, socketWrite, socketEnd);
- if (!options.objectMode) {
- proxy._writev = writev;
- }
- var bufferSize = options.browserBufferSize || 1024 * 512;
- var bufferTimeout = options.browserBufferTimeout || 1e3;
- if (_typeof(target) === "object") {
- socket = target;
- } else {
- if (isNative && isBrowser) {
- socket = new WS(target, protocols);
- } else {
- socket = new WS(target, protocols, options);
- }
- socket.binaryType = "arraybuffer";
- }
- if (socket.readyState === socket.OPEN) {
- stream = proxy;
- } else {
- stream = duplexify.obj();
- socket.onopen = onopen;
- }
- stream.socket = socket;
- socket.onclose = onclose;
- socket.onerror = onerror;
- socket.onmessage = onmessage;
- proxy.on("close", destroy);
- var coerceToBuffer = !options.objectMode;
- function socketWriteNode(chunk, enc, next) {
- if (socket.readyState !== socket.OPEN) {
- next();
- return;
- }
- if (coerceToBuffer && typeof chunk === "string") {
- chunk = Buffer.from(chunk, "utf8");
- }
- socket.send(chunk, next);
- }
- function socketWriteBrowser(chunk, enc, next) {
- if (socket.bufferedAmount > bufferSize) {
- setTimeout(socketWriteBrowser, bufferTimeout, chunk, enc, next);
- return;
- }
- if (coerceToBuffer && typeof chunk === "string") {
- chunk = Buffer.from(chunk, "utf8");
- }
- try {
- socket.send(chunk);
- } catch (err) {
- return next(err);
- }
- next();
- }
- function socketEnd(done) {
- socket.close();
- done();
- }
- function onopen() {
- stream.setReadable(proxy);
- stream.setWritable(proxy);
- stream.emit("connect");
- }
- function onclose() {
- stream.end();
- stream.destroy();
- }
- function onerror(err) {
- stream.destroy(err);
- }
- function onmessage(event) {
- var data = event.data;
- if (data instanceof ArrayBuffer) data = Buffer.from(data);else data = Buffer.from(data, "utf8");
- proxy.push(data);
- }
- function destroy() {
- socket.close();
- }
- function writev(chunks, cb) {
- var buffers = new Array(chunks.length);
- for (var i = 0; i < chunks.length; i++) {
- if (typeof chunks[i].chunk === "string") {
- buffers[i] = Buffer.from(chunks[i], "utf8");
- } else {
- buffers[i] = chunks[i].chunk;
- }
- }
- this._write(Buffer.concat(buffers), "binary", cb);
- }
- return stream;
- }
- }).call(this, require("_process"), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
- }, {
- _process: 92,
- duplexify: 17,
- "readable-stream": 108,
- "safe-buffer": 110,
- ws: 119
- }],
- 119: [function (require, module, exports) {
- var ws = null;
- if (typeof WebSocket !== "undefined") {
- ws = WebSocket;
- } else if (typeof MozWebSocket !== "undefined") {
- ws = MozWebSocket;
- } else if (typeof window !== "undefined") {
- ws = window.WebSocket || window.MozWebSocket;
- }
- module.exports = ws;
- }, {}],
- 120: [function (require, module, exports) {
- module.exports = wrappy;
- function wrappy(fn, cb) {
- if (fn && cb) return wrappy(fn)(cb);
- if (typeof fn !== "function") throw new TypeError("need wrapper function");
- Object.keys(fn).forEach(function (k) {
- wrapper[k] = fn[k];
- });
- return wrapper;
- function wrapper() {
- var args = new Array(arguments.length);
- for (var i = 0; i < args.length; i++) {
- args[i] = arguments[i];
- }
- var ret = fn.apply(this, args);
- var cb = args[args.length - 1];
- if (typeof ret === "function" && ret !== cb) {
- Object.keys(cb).forEach(function (k) {
- ret[k] = cb[k];
- });
- }
- return ret;
- }
- }
- }, {}],
- 121: [function (require, module, exports) {
- module.exports = extend;
- var hasOwnProperty = Object.prototype.hasOwnProperty;
- function extend() {
- var target = {};
- for (var i = 0; i < arguments.length; i++) {
- var source = arguments[i];
- for (var key in source) {
- if (hasOwnProperty.call(source, key)) {
- target[key] = source[key];
- }
- }
- }
- return target;
- }
- }, {}]
- }, {}, [9])(9);
- });
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! (webpack)/buildin/global.js */ 3), __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"]))
- /***/ }),
- /* 75 */,
- /* 76 */,
- /* 77 */,
- /* 78 */,
- /* 79 */,
- /* 80 */,
- /* 81 */,
- /* 82 */,
- /* 83 */
- /*!***********************************************!*\
- !*** E:/git/2021项目/v3-H5/component/public.js ***!
- \***********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.parseTime = parseTime;
- var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
- // 日期格式化
- function parseTime(time, pattern) {
- if (arguments.length === 0 || !time) {
- return null;
- }
- if (time.indexOf('T') !== -1) {
- var newTime = time.split('T');
- time = newTime[0] + ' ' + newTime[1];
- }
- var format = pattern || '{y}-{m}-{d} {h}:{i}:{s}';
- var date;
- if ((0, _typeof2.default)(time) === 'object') {
- date = time;
- } else {
- if (typeof time === 'string' && /^[0-9]+$/.test(time)) {
- time = parseInt(time);
- } else if (typeof time === 'string') {
- time = time.replace(new RegExp(/-/gm), '/');
- }
- if (typeof time === 'number' && time.toString().length === 10) {
- time = time * 1000;
- }
- date = new Date(time);
- }
- var formatObj = {
- y: date.getFullYear(),
- m: date.getMonth() + 1,
- d: date.getDate(),
- h: date.getHours(),
- i: date.getMinutes(),
- s: date.getSeconds(),
- a: date.getDay()
- };
- var time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, function (result, key) {
- var value = formatObj[key];
- // Note: getDay() returns 0 on Sunday
- if (key === 'a') {
- return ['日', '一', '二', '三', '四', '五', '六'][value];
- }
- if (result.length > 0 && value < 10) {
- value = '0' + value;
- }
- return value || 0;
- });
- return time_str;
- }
- /***/ }),
- /* 84 */,
- /* 85 */,
- /* 86 */,
- /* 87 */,
- /* 88 */,
- /* 89 */,
- /* 90 */,
- /* 91 */,
- /* 92 */,
- /* 93 */,
- /* 94 */,
- /* 95 */,
- /* 96 */,
- /* 97 */,
- /* 98 */,
- /* 99 */,
- /* 100 */,
- /* 101 */,
- /* 102 */,
- /* 103 */,
- /* 104 */,
- /* 105 */,
- /* 106 */,
- /* 107 */,
- /* 108 */
- /*!****************************************!*\
- !*** E:/git/2021项目/v3-H5/utils/md5.js ***!
- \****************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- /**
- * Namespace for hashing and other cryptographic functions
- * Copyright (c) Andrew Valums
- * Licensed under the MIT license, http://valums.com/mit-license/
- */
- var V = V || {};
- V.Security = V.Security || {};
- (function () {
- // for faster access
- var S = V.Security;
- /**
- * The highest integer value a number can go to without losing precision.
- */
- S.maxExactInt = Math.pow(2, 53);
- /**
- * Converts string from internal UTF-16 to UTF-8
- * and saves it using array of numbers (bytes), 0-255 per cell
- * @param {String} str
- * @return {Array}
- */
- S.toUtf8ByteArr = function (str) {
- var arr = [],
- code;
- for (var i = 0; i < str.length; i++) {
- code = str.charCodeAt(i);
- /*
- Note that charCodeAt will always return a value that is less than 65,536.
- This is because the higher code points are represented by a pair of (lower valued)
- "surrogate" pseudo-characters which are used to comprise the real character.
- Because of this, in order to examine or reproduce the full character for
- individual characters of value 65,536 and above, for such characters,
- it is necessary to retrieve not only charCodeAt(0), but also charCodeAt(1).
- */
- if (0xD800 <= code && code <= 0xDBFF) {
- // UTF-16 high surrogate
- var hi = code,
- low = str.charCodeAt(i + 1);
- code = (hi - 0xD800) * 0x400 + (low - 0xDC00) + 0x10000;
- i++;
- }
- if (code <= 127) {
- arr[arr.length] = code;
- } else if (code <= 2047) {
- arr[arr.length] = (code >>> 6) + 0xC0;
- arr[arr.length] = code & 0x3F | 0x80;
- } else if (code <= 65535) {
- arr[arr.length] = (code >>> 12) + 0xE0;
- arr[arr.length] = code >>> 6 & 0x3F | 0x80;
- arr[arr.length] = code & 0x3F | 0x80;
- } else if (code <= 1114111) {
- arr[arr.length] = (code >>> 18) + 0xF0;
- arr[arr.length] = code >>> 12 & 0x3F | 0x80;
- arr[arr.length] = code >>> 6 & 0x3F | 0x80;
- arr[arr.length] = code & 0x3F | 0x80;
- } else {
- throw 'Unicode standart supports code points up-to U+10FFFF';
- }
- }
- return arr;
- };
- /**
- * Outputs 32 integer bits of a number in hex format.
- * Preserves leading zeros.
- * @param {Number} num
- */
- S.toHex32 = function (num) {
- // if negative
- if (num & 0x80000000) {
- // convert to positive number
- num = num & ~0x80000000;
- num += Math.pow(2, 31);
- }
- var str = num.toString(16);
- while (str.length < 8) {
- str = '0' + str;
- }
- return str;
- };
- /**
- * Changes the order of 4 bytes in integer representation of number.
- * From 1234 to 4321.
- * @param {Number} num Only 32 int bits are used.
- */
- S.reverseBytes = function (num) {
- var res = 0;
- res += num >>> 24 & 0xff;
- res += (num >>> 16 & 0xff) << 8;
- res += (num >>> 8 & 0xff) << 16;
- res += (num & 0xff) << 24;
- return res;
- };
- S.leftRotate = function (x, c) {
- return x << c | x >>> 32 - c;
- };
- /**
- * RSA Data Security, Inc. MD5 Message-Digest Algorithm
- * http://tools.ietf.org/html/rfc1321
- * http://en.wikipedia.org/wiki/MD5
- * @param {String} message
- */
- S.md5 = function (message) {
- // r specifies the per-round shift amounts
- var r = [7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21];
- // Use binary integer part of the sines of integers (Radians) as constants:
- var k = [];
- for (var i = 0; i <= 63; i++) {
- k[i] = Math.abs(Math.sin(i + 1)) * Math.pow(2, 32) << 0;
- }
- var h0 = 0x67452301,
- h1 = 0xEFCDAB89,
- h2 = 0x98BADCFE,
- h3 = 0x10325476,
- bytes,
- unpadded;
- //Pre-processing:
- bytes = S.toUtf8ByteArr(message);
- message = null;
- unpadded = bytes.length;
- //append "1" bit to message
- //append "0" bits until message length in bits ≡ 448 (mod 512)
- bytes.push(0x80);
- var zeroBytes = Math.abs(448 - bytes.length * 8 % 512) / 8;
- while (zeroBytes--) {
- bytes.push(0);
- }
- //append bit length of unpadded message as 64-bit little-endian integer to message
- bytes.push(unpadded * 8 & 0xff, unpadded * 8 >> 8 & 0xff, unpadded * 8 >> 16 & 0xff, unpadded * 8 >> 24 & 0xff);
- var i = 4;
- while (i--) {
- bytes.push(0);
- }
- var leftRotate = S.leftRotate;
- //Process the message in successive 512-bit chunks:
- var i = 0,
- w = [];
- while (i < bytes.length) {
- //break chunk into sixteen 32-bit words w[i], 0 ≤ i ≤ 15
- for (var j = 0; j <= 15; j++) {
- w[j] = (bytes[i + 4 * j] << 0) + (bytes[i + 4 * j + 1] << 8) + (bytes[i + 4 * j + 2] << 16) + (bytes[i + 4 * j + 3] << 24);
- }
- //Initialize hash value for this chunk:
- var a = h0,
- b = h1,
- c = h2,
- d = h3,
- f,
- g;
- //Main loop:
- for (var j = 0; j <= 63; j++) {
- if (j <= 15) {
- f = b & c | ~b & d;
- g = j;
- } else if (j <= 31) {
- f = d & b | ~d & c;
- g = (5 * j + 1) % 16;
- } else if (j <= 47) {
- f = b ^ c ^ d;
- g = (3 * j + 5) % 16;
- } else {
- f = c ^ (b | ~d);
- g = 7 * j % 16;
- }
- var temp = d;
- d = c;
- c = b;
- b = b + leftRotate(a + f + k[j] + w[g], r[j]);
- a = temp;
- }
- //Add this chunk's hash to result so far:
- h0 = h0 + a << 0;
- h1 = h1 + b << 0;
- h2 = h2 + c << 0;
- h3 = h3 + d << 0;
- i += 512 / 8;
- }
- // fix when starting with 0
- var res = out(h0) + out(h1) + out(h2) + out(h3);
- function out(h) {
- return S.toHex32(S.reverseBytes(h));
- }
- return res;
- };
- })();
- /*
- * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
- * Digest Algorithm, as defined in RFC 1321.
- * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
- * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
- * Distributed under the BSD License
- * See http://pajhome.org.uk/crypt/md5 for more info.
- */
- /*
- * Configurable variables. You may need to tweak these to be compatible with
- * the server-side, but the defaults work in most cases.
- */
- var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */
- var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */
- /*
- * These are the functions you'll usually want to call
- * They take string arguments and return either hex or base-64 encoded strings
- */
- function hex_md5(s) {
- return rstr2hex(rstr_md5(str2rstr_utf8(s)));
- }
- function b64_md5(s) {
- return rstr2b64(rstr_md5(str2rstr_utf8(s)));
- }
- function any_md5(s, e) {
- return rstr2any(rstr_md5(str2rstr_utf8(s)), e);
- }
- function hex_hmac_md5(k, d) {
- return rstr2hex(rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d)));
- }
- function b64_hmac_md5(k, d) {
- return rstr2b64(rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d)));
- }
- function any_hmac_md5(k, d, e) {
- return rstr2any(rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d)), e);
- }
- /*
- * Perform a simple self-test to see if the VM is working
- */
- function md5_vm_test() {
- return hex_md5("abc").toLowerCase() == "900150983cd24fb0d6963f7d28e17f72";
- }
- /*
- * Calculate the MD5 of a raw string
- */
- function rstr_md5(s) {
- return binl2rstr(binl_md5(rstr2binl(s), s.length * 8));
- }
- /*
- * Calculate the HMAC-MD5, of a key and some data (raw strings)
- */
- function rstr_hmac_md5(key, data) {
- var bkey = rstr2binl(key);
- if (bkey.length > 16) bkey = binl_md5(bkey, key.length * 8);
- var ipad = Array(16),
- opad = Array(16);
- for (var i = 0; i < 16; i++) {
- ipad[i] = bkey[i] ^ 0x36363636;
- opad[i] = bkey[i] ^ 0x5C5C5C5C;
- }
- var hash = binl_md5(ipad.concat(rstr2binl(data)), 512 + data.length * 8);
- return binl2rstr(binl_md5(opad.concat(hash), 512 + 128));
- }
- /*
- * Convert a raw string to a hex string
- */
- function rstr2hex(input) {
- try {
- hexcase;
- } catch (e) {
- hexcase = 0;
- }
- var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
- var output = "";
- var x;
- for (var i = 0; i < input.length; i++) {
- x = input.charCodeAt(i);
- output += hex_tab.charAt(x >>> 4 & 0x0F) + hex_tab.charAt(x & 0x0F);
- }
- return output;
- }
- /*
- * Convert a raw string to a base-64 string
- */
- function rstr2b64(input) {
- try {
- b64pad;
- } catch (e) {
- b64pad = '';
- }
- var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
- var output = "";
- var len = input.length;
- for (var i = 0; i < len; i += 3) {
- var triplet = input.charCodeAt(i) << 16 | (i + 1 < len ? input.charCodeAt(i + 1) << 8 : 0) | (i + 2 < len ? input.charCodeAt(i + 2) : 0);
- for (var j = 0; j < 4; j++) {
- if (i * 8 + j * 6 > input.length * 8) output += b64pad;else output += tab.charAt(triplet >>> 6 * (3 - j) & 0x3F);
- }
- }
- return output;
- }
- /*
- * Convert a raw string to an arbitrary string encoding
- */
- function rstr2any(input, encoding) {
- var divisor = encoding.length;
- var i, j, q, x, quotient;
- /* Convert to an array of 16-bit big-endian values, forming the dividend */
- var dividend = Array(Math.ceil(input.length / 2));
- for (i = 0; i < dividend.length; i++) {
- dividend[i] = input.charCodeAt(i * 2) << 8 | input.charCodeAt(i * 2 + 1);
- }
- /*
- * Repeatedly perform a long division. The binary array forms the dividend,
- * the length of the encoding is the divisor. Once computed, the quotient
- * forms the dividend for the next step. All remainders are stored for later
- * use.
- */
- var full_length = Math.ceil(input.length * 8 / (Math.log(encoding.length) / Math.log(2)));
- var remainders = Array(full_length);
- for (j = 0; j < full_length; j++) {
- quotient = Array();
- x = 0;
- for (i = 0; i < dividend.length; i++) {
- x = (x << 16) + dividend[i];
- q = Math.floor(x / divisor);
- x -= q * divisor;
- if (quotient.length > 0 || q > 0) quotient[quotient.length] = q;
- }
- remainders[j] = x;
- dividend = quotient;
- }
- /* Convert the remainders to the output string */
- var output = "";
- for (i = remainders.length - 1; i >= 0; i--) {
- output += encoding.charAt(remainders[i]);
- }
- return output;
- }
- /*
- * Encode a string as utf-8.
- * For efficiency, this assumes the input is valid utf-16.
- */
- function str2rstr_utf8(input) {
- return unescape(encodeURI(input));
- }
- /*
- * Encode a string as utf-16
- */
- function str2rstr_utf16le(input) {
- var output = "";
- for (var i = 0; i < input.length; i++) {
- output += String.fromCharCode(input.charCodeAt(i) & 0xFF, input.charCodeAt(i) >>> 8 & 0xFF);
- }
- return output;
- }
- function str2rstr_utf16be(input) {
- var output = "";
- for (var i = 0; i < input.length; i++) {
- output += String.fromCharCode(input.charCodeAt(i) >>> 8 & 0xFF, input.charCodeAt(i) & 0xFF);
- }
- return output;
- }
- /*
- * Convert a raw string to an array of little-endian words
- * Characters >255 have their high-byte silently ignored.
- */
- function rstr2binl(input) {
- var output = Array(input.length >> 2);
- for (var i = 0; i < output.length; i++) {
- output[i] = 0;
- }
- for (var i = 0; i < input.length * 8; i += 8) {
- output[i >> 5] |= (input.charCodeAt(i / 8) & 0xFF) << i % 32;
- }
- return output;
- }
- /*
- * Convert an array of little-endian words to a string
- */
- function binl2rstr(input) {
- var output = "";
- for (var i = 0; i < input.length * 32; i += 8) {
- output += String.fromCharCode(input[i >> 5] >>> i % 32 & 0xFF);
- }
- return output;
- }
- /*
- * Calculate the MD5 of an array of little-endian words, and a bit length.
- */
- function binl_md5(x, len) {
- /* append padding */
- x[len >> 5] |= 0x80 << len % 32;
- x[(len + 64 >>> 9 << 4) + 14] = len;
- var a = 1732584193;
- var b = -271733879;
- var c = -1732584194;
- var d = 271733878;
- for (var i = 0; i < x.length; i += 16) {
- var olda = a;
- var oldb = b;
- var oldc = c;
- var oldd = d;
- a = md5_ff(a, b, c, d, x[i + 0], 7, -680876936);
- d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586);
- c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819);
- b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330);
- a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897);
- d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426);
- c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341);
- b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983);
- a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416);
- d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417);
- c = md5_ff(c, d, a, b, x[i + 10], 17, -42063);
- b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162);
- a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682);
- d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101);
- c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290);
- b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329);
- a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510);
- d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632);
- c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713);
- b = md5_gg(b, c, d, a, x[i + 0], 20, -373897302);
- a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691);
- d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083);
- c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335);
- b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848);
- a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438);
- d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690);
- c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961);
- b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501);
- a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467);
- d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784);
- c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473);
- b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734);
- a = md5_hh(a, b, c, d, x[i + 5], 4, -378558);
- d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463);
- c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562);
- b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556);
- a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060);
- d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353);
- c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632);
- b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640);
- a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174);
- d = md5_hh(d, a, b, c, x[i + 0], 11, -358537222);
- c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979);
- b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189);
- a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487);
- d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835);
- c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520);
- b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651);
- a = md5_ii(a, b, c, d, x[i + 0], 6, -198630844);
- d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415);
- c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905);
- b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055);
- a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571);
- d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606);
- c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523);
- b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799);
- a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359);
- d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744);
- c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380);
- b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649);
- a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070);
- d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379);
- c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259);
- b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551);
- a = safe_add(a, olda);
- b = safe_add(b, oldb);
- c = safe_add(c, oldc);
- d = safe_add(d, oldd);
- }
- return Array(a, b, c, d);
- }
- /*
- * These functions implement the four basic operations the algorithm uses.
- */
- function md5_cmn(q, a, b, x, s, t) {
- return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b);
- }
- function md5_ff(a, b, c, d, x, s, t) {
- return md5_cmn(b & c | ~b & d, a, b, x, s, t);
- }
- function md5_gg(a, b, c, d, x, s, t) {
- return md5_cmn(b & d | c & ~d, a, b, x, s, t);
- }
- function md5_hh(a, b, c, d, x, s, t) {
- return md5_cmn(b ^ c ^ d, a, b, x, s, t);
- }
- function md5_ii(a, b, c, d, x, s, t) {
- return md5_cmn(c ^ (b | ~d), a, b, x, s, t);
- }
- /*
- * Add integers, wrapping at 2^32. This uses 16-bit operations internally
- * to work around bugs in some JS interpreters.
- */
- function safe_add(x, y) {
- var lsw = (x & 0xFFFF) + (y & 0xFFFF);
- var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
- return msw << 16 | lsw & 0xFFFF;
- }
- /*
- * Bitwise rotate a 32-bit number to the left.
- */
- function bit_rol(num, cnt) {
- return num << cnt | num >>> 32 - cnt;
- }
- function md5cycle(x, k) {
- var a = x[0],
- b = x[1],
- c = x[2],
- d = x[3];
- a = ff(a, b, c, d, k[0], 7, -680876936);
- d = ff(d, a, b, c, k[1], 12, -389564586);
- c = ff(c, d, a, b, k[2], 17, 606105819);
- b = ff(b, c, d, a, k[3], 22, -1044525330);
- a = ff(a, b, c, d, k[4], 7, -176418897);
- d = ff(d, a, b, c, k[5], 12, 1200080426);
- c = ff(c, d, a, b, k[6], 17, -1473231341);
- b = ff(b, c, d, a, k[7], 22, -45705983);
- a = ff(a, b, c, d, k[8], 7, 1770035416);
- d = ff(d, a, b, c, k[9], 12, -1958414417);
- c = ff(c, d, a, b, k[10], 17, -42063);
- b = ff(b, c, d, a, k[11], 22, -1990404162);
- a = ff(a, b, c, d, k[12], 7, 1804603682);
- d = ff(d, a, b, c, k[13], 12, -40341101);
- c = ff(c, d, a, b, k[14], 17, -1502002290);
- b = ff(b, c, d, a, k[15], 22, 1236535329);
- a = gg(a, b, c, d, k[1], 5, -165796510);
- d = gg(d, a, b, c, k[6], 9, -1069501632);
- c = gg(c, d, a, b, k[11], 14, 643717713);
- b = gg(b, c, d, a, k[0], 20, -373897302);
- a = gg(a, b, c, d, k[5], 5, -701558691);
- d = gg(d, a, b, c, k[10], 9, 38016083);
- c = gg(c, d, a, b, k[15], 14, -660478335);
- b = gg(b, c, d, a, k[4], 20, -405537848);
- a = gg(a, b, c, d, k[9], 5, 568446438);
- d = gg(d, a, b, c, k[14], 9, -1019803690);
- c = gg(c, d, a, b, k[3], 14, -187363961);
- b = gg(b, c, d, a, k[8], 20, 1163531501);
- a = gg(a, b, c, d, k[13], 5, -1444681467);
- d = gg(d, a, b, c, k[2], 9, -51403784);
- c = gg(c, d, a, b, k[7], 14, 1735328473);
- b = gg(b, c, d, a, k[12], 20, -1926607734);
- a = hh(a, b, c, d, k[5], 4, -378558);
- d = hh(d, a, b, c, k[8], 11, -2022574463);
- c = hh(c, d, a, b, k[11], 16, 1839030562);
- b = hh(b, c, d, a, k[14], 23, -35309556);
- a = hh(a, b, c, d, k[1], 4, -1530992060);
- d = hh(d, a, b, c, k[4], 11, 1272893353);
- c = hh(c, d, a, b, k[7], 16, -155497632);
- b = hh(b, c, d, a, k[10], 23, -1094730640);
- a = hh(a, b, c, d, k[13], 4, 681279174);
- d = hh(d, a, b, c, k[0], 11, -358537222);
- c = hh(c, d, a, b, k[3], 16, -722521979);
- b = hh(b, c, d, a, k[6], 23, 76029189);
- a = hh(a, b, c, d, k[9], 4, -640364487);
- d = hh(d, a, b, c, k[12], 11, -421815835);
- c = hh(c, d, a, b, k[15], 16, 530742520);
- b = hh(b, c, d, a, k[2], 23, -995338651);
- a = ii(a, b, c, d, k[0], 6, -198630844);
- d = ii(d, a, b, c, k[7], 10, 1126891415);
- c = ii(c, d, a, b, k[14], 15, -1416354905);
- b = ii(b, c, d, a, k[5], 21, -57434055);
- a = ii(a, b, c, d, k[12], 6, 1700485571);
- d = ii(d, a, b, c, k[3], 10, -1894986606);
- c = ii(c, d, a, b, k[10], 15, -1051523);
- b = ii(b, c, d, a, k[1], 21, -2054922799);
- a = ii(a, b, c, d, k[8], 6, 1873313359);
- d = ii(d, a, b, c, k[15], 10, -30611744);
- c = ii(c, d, a, b, k[6], 15, -1560198380);
- b = ii(b, c, d, a, k[13], 21, 1309151649);
- a = ii(a, b, c, d, k[4], 6, -145523070);
- d = ii(d, a, b, c, k[11], 10, -1120210379);
- c = ii(c, d, a, b, k[2], 15, 718787259);
- b = ii(b, c, d, a, k[9], 21, -343485551);
- x[0] = add32(a, x[0]);
- x[1] = add32(b, x[1]);
- x[2] = add32(c, x[2]);
- x[3] = add32(d, x[3]);
- }
- function cmn(q, a, b, x, s, t) {
- a = add32(add32(a, q), add32(x, t));
- return add32(a << s | a >>> 32 - s, b);
- }
- function ff(a, b, c, d, x, s, t) {
- return cmn(b & c | ~b & d, a, b, x, s, t);
- }
- function gg(a, b, c, d, x, s, t) {
- return cmn(b & d | c & ~d, a, b, x, s, t);
- }
- function hh(a, b, c, d, x, s, t) {
- return cmn(b ^ c ^ d, a, b, x, s, t);
- }
- function ii(a, b, c, d, x, s, t) {
- return cmn(c ^ (b | ~d), a, b, x, s, t);
- }
- function md51(s) {
- var txt = '';
- var n = s.length,
- state = [1732584193, -271733879, -1732584194, 271733878],
- i;
- for (i = 64; i <= s.length; i += 64) {
- md5cycle(state, md5blk(s.substring(i - 64, i)));
- }
- s = s.substring(i - 64);
- var tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
- for (i = 0; i < s.length; i++) {
- tail[i >> 2] |= s.charCodeAt(i) << (i % 4 << 3);
- }
- tail[i >> 2] |= 0x80 << (i % 4 << 3);
- if (i > 55) {
- md5cycle(state, tail);
- for (i = 0; i < 16; i++) {
- tail[i] = 0;
- }
- }
- tail[14] = n * 8;
- md5cycle(state, tail);
- return state;
- }
- /* there needs to be support for Unicode here,
- * unless we pretend that we can redefine the MD-5
- * algorithm for multi-byte characters (perhaps
- * by adding every four 16-bit characters and
- * shortening the sum to 32 bits). Otherwise
- * I suggest performing MD-5 as if every character
- * was two bytes--e.g., 0040 0025 = @%--but then
- * how will an ordinary MD-5 sum be matched?
- * There is no way to standardize text to something
- * like UTF-8 before transformation; speed cost is
- * utterly prohibitive. The JavaScript standard
- * itself needs to look at this: it should start
- * providing access to strings as preformed UTF-8
- * 8-bit unsigned value arrays.
- */
- function md5blk(s) {
- /* I figured global was faster. */
- var md5blks = [],
- i; /* Andy King said do it this way. */
- for (i = 0; i < 64; i += 4) {
- md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24);
- }
- return md5blks;
- }
- var hex_chr = '0123456789abcdef'.split('');
- function rhex(n) {
- var s = '',
- j = 0;
- for (; j < 4; j++) {
- s += hex_chr[n >> j * 8 + 4 & 0x0F] + hex_chr[n >> j * 8 & 0x0F];
- }
- return s;
- }
- function hex(x) {
- for (var i = 0; i < x.length; i++) {
- x[i] = rhex(x[i]);
- }
- return x.join('');
- }
- function md5(s) {
- return hex(md51(s));
- }
- /* this function is much faster,
- so if possible we use it. Some IEs
- are the only ones I know of that
- need the idiotic second function,
- generated by an if clause. */
- function add32(a, b) {
- return a + b & 0xFFFFFFFF;
- }
- if (md5('hello') != '5d41402abc4b2a76b9719d911017c592') {
- var _add = function _add(x, y) {
- var lsw = (x & 0xFFFF) + (y & 0xFFFF),
- msw = (x >> 16) + (y >> 16) + (lsw >> 16);
- return msw << 16 | lsw & 0xFFFF;
- };
- }
- (function () {
- function md5cycle(x, k) {
- var a = x[0],
- b = x[1],
- c = x[2],
- d = x[3];
- a = ff(a, b, c, d, k[0], 7, -680876936);
- d = ff(d, a, b, c, k[1], 12, -389564586);
- c = ff(c, d, a, b, k[2], 17, 606105819);
- b = ff(b, c, d, a, k[3], 22, -1044525330);
- a = ff(a, b, c, d, k[4], 7, -176418897);
- d = ff(d, a, b, c, k[5], 12, 1200080426);
- c = ff(c, d, a, b, k[6], 17, -1473231341);
- b = ff(b, c, d, a, k[7], 22, -45705983);
- a = ff(a, b, c, d, k[8], 7, 1770035416);
- d = ff(d, a, b, c, k[9], 12, -1958414417);
- c = ff(c, d, a, b, k[10], 17, -42063);
- b = ff(b, c, d, a, k[11], 22, -1990404162);
- a = ff(a, b, c, d, k[12], 7, 1804603682);
- d = ff(d, a, b, c, k[13], 12, -40341101);
- c = ff(c, d, a, b, k[14], 17, -1502002290);
- b = ff(b, c, d, a, k[15], 22, 1236535329);
- a = gg(a, b, c, d, k[1], 5, -165796510);
- d = gg(d, a, b, c, k[6], 9, -1069501632);
- c = gg(c, d, a, b, k[11], 14, 643717713);
- b = gg(b, c, d, a, k[0], 20, -373897302);
- a = gg(a, b, c, d, k[5], 5, -701558691);
- d = gg(d, a, b, c, k[10], 9, 38016083);
- c = gg(c, d, a, b, k[15], 14, -660478335);
- b = gg(b, c, d, a, k[4], 20, -405537848);
- a = gg(a, b, c, d, k[9], 5, 568446438);
- d = gg(d, a, b, c, k[14], 9, -1019803690);
- c = gg(c, d, a, b, k[3], 14, -187363961);
- b = gg(b, c, d, a, k[8], 20, 1163531501);
- a = gg(a, b, c, d, k[13], 5, -1444681467);
- d = gg(d, a, b, c, k[2], 9, -51403784);
- c = gg(c, d, a, b, k[7], 14, 1735328473);
- b = gg(b, c, d, a, k[12], 20, -1926607734);
- a = hh(a, b, c, d, k[5], 4, -378558);
- d = hh(d, a, b, c, k[8], 11, -2022574463);
- c = hh(c, d, a, b, k[11], 16, 1839030562);
- b = hh(b, c, d, a, k[14], 23, -35309556);
- a = hh(a, b, c, d, k[1], 4, -1530992060);
- d = hh(d, a, b, c, k[4], 11, 1272893353);
- c = hh(c, d, a, b, k[7], 16, -155497632);
- b = hh(b, c, d, a, k[10], 23, -1094730640);
- a = hh(a, b, c, d, k[13], 4, 681279174);
- d = hh(d, a, b, c, k[0], 11, -358537222);
- c = hh(c, d, a, b, k[3], 16, -722521979);
- b = hh(b, c, d, a, k[6], 23, 76029189);
- a = hh(a, b, c, d, k[9], 4, -640364487);
- d = hh(d, a, b, c, k[12], 11, -421815835);
- c = hh(c, d, a, b, k[15], 16, 530742520);
- b = hh(b, c, d, a, k[2], 23, -995338651);
- a = ii(a, b, c, d, k[0], 6, -198630844);
- d = ii(d, a, b, c, k[7], 10, 1126891415);
- c = ii(c, d, a, b, k[14], 15, -1416354905);
- b = ii(b, c, d, a, k[5], 21, -57434055);
- a = ii(a, b, c, d, k[12], 6, 1700485571);
- d = ii(d, a, b, c, k[3], 10, -1894986606);
- c = ii(c, d, a, b, k[10], 15, -1051523);
- b = ii(b, c, d, a, k[1], 21, -2054922799);
- a = ii(a, b, c, d, k[8], 6, 1873313359);
- d = ii(d, a, b, c, k[15], 10, -30611744);
- c = ii(c, d, a, b, k[6], 15, -1560198380);
- b = ii(b, c, d, a, k[13], 21, 1309151649);
- a = ii(a, b, c, d, k[4], 6, -145523070);
- d = ii(d, a, b, c, k[11], 10, -1120210379);
- c = ii(c, d, a, b, k[2], 15, 718787259);
- b = ii(b, c, d, a, k[9], 21, -343485551);
- x[0] = add32(a, x[0]);
- x[1] = add32(b, x[1]);
- x[2] = add32(c, x[2]);
- x[3] = add32(d, x[3]);
- }
- function cmn(q, a, b, x, s, t) {
- a = add32(add32(a, q), add32(x, t));
- return add32(a << s | a >>> 32 - s, b);
- }
- function ff(a, b, c, d, x, s, t) {
- return cmn(b & c | ~b & d, a, b, x, s, t);
- }
- function gg(a, b, c, d, x, s, t) {
- return cmn(b & d | c & ~d, a, b, x, s, t);
- }
- function hh(a, b, c, d, x, s, t) {
- return cmn(b ^ c ^ d, a, b, x, s, t);
- }
- function ii(a, b, c, d, x, s, t) {
- return cmn(c ^ (b | ~d), a, b, x, s, t);
- }
- function md51(s) {
- // Converts the string to UTF-8 "bytes" when necessary
- if (s.match(/[\x80-\xFF]/)) {
- s = unescape(encodeURI(s));
- }
- var txt = '';
- var n = s.length,
- state = [1732584193, -271733879, -1732584194, 271733878],
- i;
- for (i = 64; i <= s.length; i += 64) {
- md5cycle(state, md5blk(s.substring(i - 64, i)));
- }
- s = s.substring(i - 64);
- var tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
- for (i = 0; i < s.length; i++) {
- tail[i >> 2] |= s.charCodeAt(i) << (i % 4 << 3);
- }
- tail[i >> 2] |= 0x80 << (i % 4 << 3);
- if (i > 55) {
- md5cycle(state, tail);
- for (i = 0; i < 16; i++) {
- tail[i] = 0;
- }
- }
- tail[14] = n * 8;
- md5cycle(state, tail);
- return state;
- }
- /* there needs to be support for Unicode here,
- * unless we pretend that we can redefine the MD-5
- * algorithm for multi-byte characters (perhaps
- * by adding every four 16-bit characters and
- * shortening the sum to 32 bits). Otherwise
- * I suggest performing MD-5 as if every character
- * was two bytes--e.g., 0040 0025 = @%--but then
- * how will an ordinary MD-5 sum be matched?
- * There is no way to standardize text to something
- * like UTF-8 before transformation; speed cost is
- * utterly prohibitive. The JavaScript standard
- * itself needs to look at this: it should start
- * providing access to strings as preformed UTF-8
- * 8-bit unsigned value arrays.
- */
- function md5blk(s) {
- /* I figured global was faster. */
- var md5blks = [],
- i; /* Andy King said do it this way. */
- for (i = 0; i < 64; i += 4) {
- md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24);
- }
- return md5blks;
- }
- var hex_chr = '0123456789abcdef'.split('');
- function rhex(n) {
- var s = '',
- j = 0;
- for (; j < 4; j++) {
- s += hex_chr[n >> j * 8 + 4 & 0x0F] + hex_chr[n >> j * 8 & 0x0F];
- }
- return s;
- }
- function hex(x) {
- for (var i = 0; i < x.length; i++) {
- x[i] = rhex(x[i]);
- }
- return x.join('');
- }
- var md5_utf8 = function md5_utf8(s) {
- return hex(md51(s));
- };
- /* this function is much faster,
- so if possible we use it. Some IEs
- are the only ones I know of that
- need the idiotic second function,
- generated by an if clause. */
- function add32(a, b) {
- return a + b & 0xFFFFFFFF;
- }
- if (md5('hello') != '5d41402abc4b2a76b9719d911017c592') {
- var _add2 = function _add2(x, y) {
- var lsw = (x & 0xFFFF) + (y & 0xFFFF),
- msw = (x >> 16) + (y >> 16) + (lsw >> 16);
- return msw << 16 | lsw & 0xFFFF;
- };
- }
- })();
- /* md5.js - MD5 Message-Digest
- * Copyright (C) 1999,2002 Masanao Izumo <iz@onicos.co.jp>
- * Version: 2.0.0
- * LastModified: May 13 2002
- *
- * This program is free software. You can redistribute it and/or modify
- * it without any warranty. This library calculates the MD5 based on RFC1321.
- * See RFC1321 for more information and algorism.
- */
- /* Interface:
- * md5_128bits = MD5_hash(data);
- * md5_hexstr = MD5_hexhash(data);
- */
- /* ChangeLog
- * 2002/05/13: Version 2.0.0 released
- * NOTICE: API is changed.
- * 2002/04/15: Bug fix about MD5 length.
- */
- // md5_T[i] = parseInt(Math.abs(Math.sin(i)) * 4294967296.0);
- var MD5_T = new Array(0x00000000, 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501, 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be, 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821, 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa, 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8, 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed, 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a, 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c, 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70, 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05, 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665, 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039, 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1, 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1, 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391);
- var MD5_round1 = new Array(new Array(0, 7, 1), new Array(1, 12, 2), new Array(2, 17, 3), new Array(3, 22, 4), new Array(4, 7, 5), new Array(5, 12, 6), new Array(6, 17, 7), new Array(7, 22, 8), new Array(8, 7, 9), new Array(9, 12, 10), new Array(10, 17, 11), new Array(11, 22, 12), new Array(12, 7, 13), new Array(13, 12, 14), new Array(14, 17, 15), new Array(15, 22, 16));
- var MD5_round2 = new Array(new Array(1, 5, 17), new Array(6, 9, 18), new Array(11, 14, 19), new Array(0, 20, 20), new Array(5, 5, 21), new Array(10, 9, 22), new Array(15, 14, 23), new Array(4, 20, 24), new Array(9, 5, 25), new Array(14, 9, 26), new Array(3, 14, 27), new Array(8, 20, 28), new Array(13, 5, 29), new Array(2, 9, 30), new Array(7, 14, 31), new Array(12, 20, 32));
- var MD5_round3 = new Array(new Array(5, 4, 33), new Array(8, 11, 34), new Array(11, 16, 35), new Array(14, 23, 36), new Array(1, 4, 37), new Array(4, 11, 38), new Array(7, 16, 39), new Array(10, 23, 40), new Array(13, 4, 41), new Array(0, 11, 42), new Array(3, 16, 43), new Array(6, 23, 44), new Array(9, 4, 45), new Array(12, 11, 46), new Array(15, 16, 47), new Array(2, 23, 48));
- var MD5_round4 = new Array(new Array(0, 6, 49), new Array(7, 10, 50), new Array(14, 15, 51), new Array(5, 21, 52), new Array(12, 6, 53), new Array(3, 10, 54), new Array(10, 15, 55), new Array(1, 21, 56), new Array(8, 6, 57), new Array(15, 10, 58), new Array(6, 15, 59), new Array(13, 21, 60), new Array(4, 6, 61), new Array(11, 10, 62), new Array(2, 15, 63), new Array(9, 21, 64));
- function MD5_F(x, y, z) {
- return x & y | ~x & z;
- }
- function MD5_G(x, y, z) {
- return x & z | y & ~z;
- }
- function MD5_H(x, y, z) {
- return x ^ y ^ z;
- }
- function MD5_I(x, y, z) {
- return y ^ (x | ~z);
- }
- var MD5_round = new Array(new Array(MD5_F, MD5_round1), new Array(MD5_G, MD5_round2), new Array(MD5_H, MD5_round3), new Array(MD5_I, MD5_round4));
- function MD5_pack(n32) {
- return String.fromCharCode(n32 & 0xff) + String.fromCharCode(n32 >>> 8 & 0xff) + String.fromCharCode(n32 >>> 16 & 0xff) + String.fromCharCode(n32 >>> 24 & 0xff);
- }
- function MD5_unpack(s4) {
- return s4.charCodeAt(0) | s4.charCodeAt(1) << 8 | s4.charCodeAt(2) << 16 | s4.charCodeAt(3) << 24;
- }
- function MD5_number(n) {
- while (n < 0) {
- n += 4294967296;
- }
- while (n > 4294967295) {
- n -= 4294967296;
- }
- return n;
- }
- function MD5_apply_round(x, s, f, abcd, r) {
- var a, b, c, d;
- var kk, ss, ii;
- var t, u;
- a = abcd[0];
- b = abcd[1];
- c = abcd[2];
- d = abcd[3];
- kk = r[0];
- ss = r[1];
- ii = r[2];
- u = f(s[b], s[c], s[d]);
- t = s[a] + u + x[kk] + MD5_T[ii];
- t = MD5_number(t);
- t = t << ss | t >>> 32 - ss;
- t += s[b];
- s[a] = MD5_number(t);
- }
- function MD5_hash(data) {
- var abcd, x, state, s;
- var len, index, padLen, f, r;
- var i, j, k;
- var tmp;
- state = new Array(0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476);
- len = data.length;
- index = len & 0x3f;
- padLen = index < 56 ? 56 - index : 120 - index;
- if (padLen > 0) {
- data += "\x80";
- for (i = 0; i < padLen - 1; i++) {
- data += "\x00";
- }
- }
- data += MD5_pack(len * 8);
- data += MD5_pack(0);
- len += padLen + 8;
- abcd = new Array(0, 1, 2, 3);
- x = new Array(16);
- s = new Array(4);
- for (k = 0; k < len; k += 64) {
- for (i = 0, j = k; i < 16; i++, j += 4) {
- x[i] = data.charCodeAt(j) | data.charCodeAt(j + 1) << 8 | data.charCodeAt(j + 2) << 16 | data.charCodeAt(j + 3) << 24;
- }
- for (i = 0; i < 4; i++) {
- s[i] = state[i];
- }
- for (i = 0; i < 4; i++) {
- f = MD5_round[i][0];
- r = MD5_round[i][1];
- for (j = 0; j < 16; j++) {
- MD5_apply_round(x, s, f, abcd, r[j]);
- tmp = abcd[0];
- abcd[0] = abcd[3];
- abcd[3] = abcd[2];
- abcd[2] = abcd[1];
- abcd[1] = tmp;
- }
- }
- for (i = 0; i < 4; i++) {
- state[i] += s[i];
- state[i] = MD5_number(state[i]);
- }
- }
- return MD5_pack(state[0]) + MD5_pack(state[1]) + MD5_pack(state[2]) + MD5_pack(state[3]);
- }
- function MD5_hexhash(data) {
- var i, out, c;
- var bit128;
- bit128 = MD5_hash(data);
- out = "";
- for (i = 0; i < 16; i++) {
- c = bit128.charCodeAt(i);
- out += "0123456789abcdef".charAt(c >> 4 & 0xf);
- out += "0123456789abcdef".charAt(c & 0xf);
- }
- return out;
- }
- module.exports = {
- hex_md5: hex_md5
- };
- /***/ }),
- /* 109 */
- /*!*******************************************!*\
- !*** E:/git/2021项目/v3-H5/utils/secret.js ***!
- \*******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.Decrypt = Decrypt;
- exports.Encrypt = Encrypt;
- var _cryptoJs = _interopRequireDefault(__webpack_require__(/*! @/utils/crypto-js.js */ 110));
- //引入crypto-js
- //const CryptoJS = require('crypto-js');
- // //十六位十六进制数作为密钥(秘钥为随机生成,必须与后端保持一致!)
- // const key = 'J4ny0Ja678Y7P2so';
- // //十六位十六进制数作为密钥偏移量(秘钥为随机生成,必须与后端保持一致!)
- // const iv = 'pTNorfvZW2UZJbd0';
- var key = _cryptoJs.default.enc.Utf8.parse("J4ny0Ja678Y7P2so"); //十六位十六进制数作为密钥
- var iv = _cryptoJs.default.enc.Utf8.parse('pTNorfvZW2UZJbd0'); //十六位十六进制数作为密钥偏移量
- //解密方法
- function Decrypt(word) {
- var encryptedHexStr = _cryptoJs.default.enc.Hex.parse(word);
- var srcs = _cryptoJs.default.enc.Base64.stringify(encryptedHexStr);
- var decrypt = _cryptoJs.default.AES.decrypt(srcs, key, {
- iv: iv,
- mode: _cryptoJs.default.mode.CBC,
- padding: _cryptoJs.default.pad.Pkcs7
- });
- var decryptedStr = decrypt.toString(_cryptoJs.default.enc.Utf8);
- return decryptedStr.toString();
- }
- //加密方法
- function Encrypt(word) {
- var srcs = _cryptoJs.default.enc.Utf8.parse(word);
- var encrypted = _cryptoJs.default.AES.encrypt(srcs, key, {
- iv: iv,
- mode: _cryptoJs.default.mode.CBC,
- padding: _cryptoJs.default.pad.Pkcs7
- });
- return encrypted.ciphertext.toString().toUpperCase();
- }
- /***/ }),
- /* 110 */
- /*!**********************************************!*\
- !*** E:/git/2021项目/v3-H5/utils/crypto-js.js ***!
- \**********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- /* WEBPACK VAR INJECTION */(function(global) {var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ 13);
- ;
- (function (root, factory) {
- if (( false ? undefined : _typeof(exports)) === "object") {
- // CommonJS
- module.exports = exports = factory();
- } else if (true) {
- // AMD
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
- __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
- (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- } else {}
- })(this, function () {
- /*globals window, global, require*/
- /**
- * CryptoJS core components.
- */
- var CryptoJS = CryptoJS || function (Math, undefined) {
- var crypto;
- // Native crypto from window (Browser)
- if (typeof window !== 'undefined' && window.crypto) {
- crypto = window.crypto;
- }
- // Native crypto in web worker (Browser)
- if (typeof self !== 'undefined' && self.crypto) {
- crypto = self.crypto;
- }
- // Native crypto from worker
- if (typeof globalThis !== 'undefined' && globalThis.crypto) {
- crypto = globalThis.crypto;
- }
- // Native (experimental IE 11) crypto from window (Browser)
- if (!crypto && typeof window !== 'undefined' && window.msCrypto) {
- crypto = window.msCrypto;
- }
- // Native crypto from global (NodeJS)
- if (!crypto && typeof global !== 'undefined' && global.crypto) {
- crypto = global.crypto;
- }
- // Native crypto import via require (NodeJS)
- if (!crypto && "function" === 'function') {
- try {
- crypto = __webpack_require__(/*! crypto */ 111);
- } catch (err) {}
- }
- /*
- * Cryptographically secure pseudorandom number generator
- *
- * As Math.random() is cryptographically not safe to use
- */
- var cryptoSecureRandomInt = function cryptoSecureRandomInt() {
- if (crypto) {
- // Use getRandomValues method (Browser)
- if (typeof crypto.getRandomValues === 'function') {
- try {
- return crypto.getRandomValues(new Uint32Array(1))[0];
- } catch (err) {}
- }
- // Use randomBytes method (NodeJS)
- if (typeof crypto.randomBytes === 'function') {
- try {
- return crypto.randomBytes(4).readInt32LE();
- } catch (err) {}
- }
- }
- throw new Error('Native crypto module could not be used to get secure random number.');
- };
- /*
- * Local polyfill of Object.create
- */
- var create = Object.create || function () {
- function F() {}
- return function (obj) {
- var subtype;
- F.prototype = obj;
- subtype = new F();
- F.prototype = null;
- return subtype;
- };
- }();
- /**
- * CryptoJS namespace.
- */
- var C = {};
- /**
- * Library namespace.
- */
- var C_lib = C.lib = {};
- /**
- * Base object for prototypal inheritance.
- */
- var Base = C_lib.Base = function () {
- return {
- /**
- * Creates a new object that inherits from this object.
- *
- * @param {Object} overrides Properties to copy into the new object.
- *
- * @return {Object} The new object.
- *
- * @static
- *
- * @example
- *
- * var MyType = CryptoJS.lib.Base.extend({
- * field: 'value',
- *
- * method: function () {
- * }
- * });
- */
- extend: function extend(overrides) {
- // Spawn
- var subtype = create(this);
- // Augment
- if (overrides) {
- subtype.mixIn(overrides);
- }
- // Create default initializer
- if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {
- subtype.init = function () {
- subtype.$super.init.apply(this, arguments);
- };
- }
- // Initializer's prototype is the subtype object
- subtype.init.prototype = subtype;
- // Reference supertype
- subtype.$super = this;
- return subtype;
- },
- /**
- * Extends this object and runs the init method.
- * Arguments to create() will be passed to init().
- *
- * @return {Object} The new object.
- *
- * @static
- *
- * @example
- *
- * var instance = MyType.create();
- */
- create: function create() {
- var instance = this.extend();
- instance.init.apply(instance, arguments);
- return instance;
- },
- /**
- * Initializes a newly created object.
- * Override this method to add some logic when your objects are created.
- *
- * @example
- *
- * var MyType = CryptoJS.lib.Base.extend({
- * init: function () {
- * // ...
- * }
- * });
- */
- init: function init() {},
- /**
- * Copies properties into this object.
- *
- * @param {Object} properties The properties to mix in.
- *
- * @example
- *
- * MyType.mixIn({
- * field: 'value'
- * });
- */
- mixIn: function mixIn(properties) {
- for (var propertyName in properties) {
- if (properties.hasOwnProperty(propertyName)) {
- this[propertyName] = properties[propertyName];
- }
- }
- // IE won't copy toString using the loop above
- if (properties.hasOwnProperty('toString')) {
- this.toString = properties.toString;
- }
- },
- /**
- * Creates a copy of this object.
- *
- * @return {Object} The clone.
- *
- * @example
- *
- * var clone = instance.clone();
- */
- clone: function clone() {
- return this.init.prototype.extend(this);
- }
- };
- }();
- /**
- * An array of 32-bit words.
- *
- * @property {Array} words The array of 32-bit words.
- * @property {number} sigBytes The number of significant bytes in this word array.
- */
- var WordArray = C_lib.WordArray = Base.extend({
- /**
- * Initializes a newly created word array.
- *
- * @param {Array} words (Optional) An array of 32-bit words.
- * @param {number} sigBytes (Optional) The number of significant bytes in the words.
- *
- * @example
- *
- * var wordArray = CryptoJS.lib.WordArray.create();
- * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
- * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
- */
- init: function init(words, sigBytes) {
- words = this.words = words || [];
- if (sigBytes != undefined) {
- this.sigBytes = sigBytes;
- } else {
- this.sigBytes = words.length * 4;
- }
- },
- /**
- * Converts this word array to a string.
- *
- * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex
- *
- * @return {string} The stringified word array.
- *
- * @example
- *
- * var string = wordArray + '';
- * var string = wordArray.toString();
- * var string = wordArray.toString(CryptoJS.enc.Utf8);
- */
- toString: function toString(encoder) {
- return (encoder || Hex).stringify(this);
- },
- /**
- * Concatenates a word array to this word array.
- *
- * @param {WordArray} wordArray The word array to append.
- *
- * @return {WordArray} This word array.
- *
- * @example
- *
- * wordArray1.concat(wordArray2);
- */
- concat: function concat(wordArray) {
- // Shortcuts
- var thisWords = this.words;
- var thatWords = wordArray.words;
- var thisSigBytes = this.sigBytes;
- var thatSigBytes = wordArray.sigBytes;
- // Clamp excess bits
- this.clamp();
- // Concat
- if (thisSigBytes % 4) {
- // Copy one byte at a time
- for (var i = 0; i < thatSigBytes; i++) {
- var thatByte = thatWords[i >>> 2] >>> 24 - i % 4 * 8 & 0xff;
- thisWords[thisSigBytes + i >>> 2] |= thatByte << 24 - (thisSigBytes + i) % 4 * 8;
- }
- } else {
- // Copy one word at a time
- for (var j = 0; j < thatSigBytes; j += 4) {
- thisWords[thisSigBytes + j >>> 2] = thatWords[j >>> 2];
- }
- }
- this.sigBytes += thatSigBytes;
- // Chainable
- return this;
- },
- /**
- * Removes insignificant bits.
- *
- * @example
- *
- * wordArray.clamp();
- */
- clamp: function clamp() {
- // Shortcuts
- var words = this.words;
- var sigBytes = this.sigBytes;
- // Clamp
- words[sigBytes >>> 2] &= 0xffffffff << 32 - sigBytes % 4 * 8;
- words.length = Math.ceil(sigBytes / 4);
- },
- /**
- * Creates a copy of this word array.
- *
- * @return {WordArray} The clone.
- *
- * @example
- *
- * var clone = wordArray.clone();
- */
- clone: function clone() {
- var clone = Base.clone.call(this);
- clone.words = this.words.slice(0);
- return clone;
- },
- /**
- * Creates a word array filled with random bytes.
- *
- * @param {number} nBytes The number of random bytes to generate.
- *
- * @return {WordArray} The random word array.
- *
- * @static
- *
- * @example
- *
- * var wordArray = CryptoJS.lib.WordArray.random(16);
- */
- random: function random(nBytes) {
- var words = [];
- for (var i = 0; i < nBytes; i += 4) {
- words.push(cryptoSecureRandomInt());
- }
- return new WordArray.init(words, nBytes);
- }
- });
- /**
- * Encoder namespace.
- */
- var C_enc = C.enc = {};
- /**
- * Hex encoding strategy.
- */
- var Hex = C_enc.Hex = {
- /**
- * Converts a word array to a hex string.
- *
- * @param {WordArray} wordArray The word array.
- *
- * @return {string} The hex string.
- *
- * @static
- *
- * @example
- *
- * var hexString = CryptoJS.enc.Hex.stringify(wordArray);
- */
- stringify: function stringify(wordArray) {
- // Shortcuts
- var words = wordArray.words;
- var sigBytes = wordArray.sigBytes;
- // Convert
- var hexChars = [];
- for (var i = 0; i < sigBytes; i++) {
- var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff;
- hexChars.push((bite >>> 4).toString(16));
- hexChars.push((bite & 0x0f).toString(16));
- }
- return hexChars.join('');
- },
- /**
- * Converts a hex string to a word array.
- *
- * @param {string} hexStr The hex string.
- *
- * @return {WordArray} The word array.
- *
- * @static
- *
- * @example
- *
- * var wordArray = CryptoJS.enc.Hex.parse(hexString);
- */
- parse: function parse(hexStr) {
- // Shortcut
- var hexStrLength = hexStr.length;
- // Convert
- var words = [];
- for (var i = 0; i < hexStrLength; i += 2) {
- words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << 24 - i % 8 * 4;
- }
- return new WordArray.init(words, hexStrLength / 2);
- }
- };
- /**
- * Latin1 encoding strategy.
- */
- var Latin1 = C_enc.Latin1 = {
- /**
- * Converts a word array to a Latin1 string.
- *
- * @param {WordArray} wordArray The word array.
- *
- * @return {string} The Latin1 string.
- *
- * @static
- *
- * @example
- *
- * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
- */
- stringify: function stringify(wordArray) {
- // Shortcuts
- var words = wordArray.words;
- var sigBytes = wordArray.sigBytes;
- // Convert
- var latin1Chars = [];
- for (var i = 0; i < sigBytes; i++) {
- var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff;
- latin1Chars.push(String.fromCharCode(bite));
- }
- return latin1Chars.join('');
- },
- /**
- * Converts a Latin1 string to a word array.
- *
- * @param {string} latin1Str The Latin1 string.
- *
- * @return {WordArray} The word array.
- *
- * @static
- *
- * @example
- *
- * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
- */
- parse: function parse(latin1Str) {
- // Shortcut
- var latin1StrLength = latin1Str.length;
- // Convert
- var words = [];
- for (var i = 0; i < latin1StrLength; i++) {
- words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << 24 - i % 4 * 8;
- }
- return new WordArray.init(words, latin1StrLength);
- }
- };
- /**
- * UTF-8 encoding strategy.
- */
- var Utf8 = C_enc.Utf8 = {
- /**
- * Converts a word array to a UTF-8 string.
- *
- * @param {WordArray} wordArray The word array.
- *
- * @return {string} The UTF-8 string.
- *
- * @static
- *
- * @example
- *
- * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
- */
- stringify: function stringify(wordArray) {
- try {
- return decodeURIComponent(escape(Latin1.stringify(wordArray)));
- } catch (e) {
- throw new Error('Malformed UTF-8 data');
- }
- },
- /**
- * Converts a UTF-8 string to a word array.
- *
- * @param {string} utf8Str The UTF-8 string.
- *
- * @return {WordArray} The word array.
- *
- * @static
- *
- * @example
- *
- * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
- */
- parse: function parse(utf8Str) {
- return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
- }
- };
- /**
- * Abstract buffered block algorithm template.
- *
- * The property blockSize must be implemented in a concrete subtype.
- *
- * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0
- */
- var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({
- /**
- * Resets this block algorithm's data buffer to its initial state.
- *
- * @example
- *
- * bufferedBlockAlgorithm.reset();
- */
- reset: function reset() {
- // Initial values
- this._data = new WordArray.init();
- this._nDataBytes = 0;
- },
- /**
- * Adds new data to this block algorithm's buffer.
- *
- * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.
- *
- * @example
- *
- * bufferedBlockAlgorithm._append('data');
- * bufferedBlockAlgorithm._append(wordArray);
- */
- _append: function _append(data) {
- // Convert string to WordArray, else assume WordArray already
- if (typeof data == 'string') {
- data = Utf8.parse(data);
- }
- // Append
- this._data.concat(data);
- this._nDataBytes += data.sigBytes;
- },
- /**
- * Processes available data blocks.
- *
- * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.
- *
- * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.
- *
- * @return {WordArray} The processed data.
- *
- * @example
- *
- * var processedData = bufferedBlockAlgorithm._process();
- * var processedData = bufferedBlockAlgorithm._process(!!'flush');
- */
- _process: function _process(doFlush) {
- var processedWords;
- // Shortcuts
- var data = this._data;
- var dataWords = data.words;
- var dataSigBytes = data.sigBytes;
- var blockSize = this.blockSize;
- var blockSizeBytes = blockSize * 4;
- // Count blocks ready
- var nBlocksReady = dataSigBytes / blockSizeBytes;
- if (doFlush) {
- // Round up to include partial blocks
- nBlocksReady = Math.ceil(nBlocksReady);
- } else {
- // Round down to include only full blocks,
- // less the number of blocks that must remain in the buffer
- nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);
- }
- // Count words ready
- var nWordsReady = nBlocksReady * blockSize;
- // Count bytes ready
- var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);
- // Process blocks
- if (nWordsReady) {
- for (var offset = 0; offset < nWordsReady; offset += blockSize) {
- // Perform concrete-algorithm logic
- this._doProcessBlock(dataWords, offset);
- }
- // Remove processed words
- processedWords = dataWords.splice(0, nWordsReady);
- data.sigBytes -= nBytesReady;
- }
- // Return processed words
- return new WordArray.init(processedWords, nBytesReady);
- },
- /**
- * Creates a copy of this object.
- *
- * @return {Object} The clone.
- *
- * @example
- *
- * var clone = bufferedBlockAlgorithm.clone();
- */
- clone: function clone() {
- var clone = Base.clone.call(this);
- clone._data = this._data.clone();
- return clone;
- },
- _minBufferSize: 0
- });
- /**
- * Abstract hasher template.
- *
- * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)
- */
- var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({
- /**
- * Configuration options.
- */
- cfg: Base.extend(),
- /**
- * Initializes a newly created hasher.
- *
- * @param {Object} cfg (Optional) The configuration options to use for this hash computation.
- *
- * @example
- *
- * var hasher = CryptoJS.algo.SHA256.create();
- */
- init: function init(cfg) {
- // Apply config defaults
- this.cfg = this.cfg.extend(cfg);
- // Set initial values
- this.reset();
- },
- /**
- * Resets this hasher to its initial state.
- *
- * @example
- *
- * hasher.reset();
- */
- reset: function reset() {
- // Reset data buffer
- BufferedBlockAlgorithm.reset.call(this);
- // Perform concrete-hasher logic
- this._doReset();
- },
- /**
- * Updates this hasher with a message.
- *
- * @param {WordArray|string} messageUpdate The message to append.
- *
- * @return {Hasher} This hasher.
- *
- * @example
- *
- * hasher.update('message');
- * hasher.update(wordArray);
- */
- update: function update(messageUpdate) {
- // Append
- this._append(messageUpdate);
- // Update the hash
- this._process();
- // Chainable
- return this;
- },
- /**
- * Finalizes the hash computation.
- * Note that the finalize operation is effectively a destructive, read-once operation.
- *
- * @param {WordArray|string} messageUpdate (Optional) A final message update.
- *
- * @return {WordArray} The hash.
- *
- * @example
- *
- * var hash = hasher.finalize();
- * var hash = hasher.finalize('message');
- * var hash = hasher.finalize(wordArray);
- */
- finalize: function finalize(messageUpdate) {
- // Final message update
- if (messageUpdate) {
- this._append(messageUpdate);
- }
- // Perform concrete-hasher logic
- var hash = this._doFinalize();
- return hash;
- },
- blockSize: 512 / 32,
- /**
- * Creates a shortcut function to a hasher's object interface.
- *
- * @param {Hasher} hasher The hasher to create a helper for.
- *
- * @return {Function} The shortcut function.
- *
- * @static
- *
- * @example
- *
- * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
- */
- _createHelper: function _createHelper(hasher) {
- return function (message, cfg) {
- return new hasher.init(cfg).finalize(message);
- };
- },
- /**
- * Creates a shortcut function to the HMAC's object interface.
- *
- * @param {Hasher} hasher The hasher to use in this HMAC helper.
- *
- * @return {Function} The shortcut function.
- *
- * @static
- *
- * @example
- *
- * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
- */
- _createHmacHelper: function _createHmacHelper(hasher) {
- return function (message, key) {
- return new C_algo.HMAC.init(hasher, key).finalize(message);
- };
- }
- });
- /**
- * Algorithm namespace.
- */
- var C_algo = C.algo = {};
- return C;
- }(Math);
- (function (undefined) {
- // Shortcuts
- var C = CryptoJS;
- var C_lib = C.lib;
- var Base = C_lib.Base;
- var X32WordArray = C_lib.WordArray;
- /**
- * x64 namespace.
- */
- var C_x64 = C.x64 = {};
- /**
- * A 64-bit word.
- */
- var X64Word = C_x64.Word = Base.extend({
- /**
- * Initializes a newly created 64-bit word.
- *
- * @param {number} high The high 32 bits.
- * @param {number} low The low 32 bits.
- *
- * @example
- *
- * var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607);
- */
- init: function init(high, low) {
- this.high = high;
- this.low = low;
- }
- /**
- * Bitwise NOTs this word.
- *
- * @return {X64Word} A new x64-Word object after negating.
- *
- * @example
- *
- * var negated = x64Word.not();
- */
- // not: function () {
- // var high = ~this.high;
- // var low = ~this.low;
- // return X64Word.create(high, low);
- // },
- /**
- * Bitwise ANDs this word with the passed word.
- *
- * @param {X64Word} word The x64-Word to AND with this word.
- *
- * @return {X64Word} A new x64-Word object after ANDing.
- *
- * @example
- *
- * var anded = x64Word.and(anotherX64Word);
- */
- // and: function (word) {
- // var high = this.high & word.high;
- // var low = this.low & word.low;
- // return X64Word.create(high, low);
- // },
- /**
- * Bitwise ORs this word with the passed word.
- *
- * @param {X64Word} word The x64-Word to OR with this word.
- *
- * @return {X64Word} A new x64-Word object after ORing.
- *
- * @example
- *
- * var ored = x64Word.or(anotherX64Word);
- */
- // or: function (word) {
- // var high = this.high | word.high;
- // var low = this.low | word.low;
- // return X64Word.create(high, low);
- // },
- /**
- * Bitwise XORs this word with the passed word.
- *
- * @param {X64Word} word The x64-Word to XOR with this word.
- *
- * @return {X64Word} A new x64-Word object after XORing.
- *
- * @example
- *
- * var xored = x64Word.xor(anotherX64Word);
- */
- // xor: function (word) {
- // var high = this.high ^ word.high;
- // var low = this.low ^ word.low;
- // return X64Word.create(high, low);
- // },
- /**
- * Shifts this word n bits to the left.
- *
- * @param {number} n The number of bits to shift.
- *
- * @return {X64Word} A new x64-Word object after shifting.
- *
- * @example
- *
- * var shifted = x64Word.shiftL(25);
- */
- // shiftL: function (n) {
- // if (n < 32) {
- // var high = (this.high << n) | (this.low >>> (32 - n));
- // var low = this.low << n;
- // } else {
- // var high = this.low << (n - 32);
- // var low = 0;
- // }
- // return X64Word.create(high, low);
- // },
- /**
- * Shifts this word n bits to the right.
- *
- * @param {number} n The number of bits to shift.
- *
- * @return {X64Word} A new x64-Word object after shifting.
- *
- * @example
- *
- * var shifted = x64Word.shiftR(7);
- */
- // shiftR: function (n) {
- // if (n < 32) {
- // var low = (this.low >>> n) | (this.high << (32 - n));
- // var high = this.high >>> n;
- // } else {
- // var low = this.high >>> (n - 32);
- // var high = 0;
- // }
- // return X64Word.create(high, low);
- // },
- /**
- * Rotates this word n bits to the left.
- *
- * @param {number} n The number of bits to rotate.
- *
- * @return {X64Word} A new x64-Word object after rotating.
- *
- * @example
- *
- * var rotated = x64Word.rotL(25);
- */
- // rotL: function (n) {
- // return this.shiftL(n).or(this.shiftR(64 - n));
- // },
- /**
- * Rotates this word n bits to the right.
- *
- * @param {number} n The number of bits to rotate.
- *
- * @return {X64Word} A new x64-Word object after rotating.
- *
- * @example
- *
- * var rotated = x64Word.rotR(7);
- */
- // rotR: function (n) {
- // return this.shiftR(n).or(this.shiftL(64 - n));
- // },
- /**
- * Adds this word with the passed word.
- *
- * @param {X64Word} word The x64-Word to add with this word.
- *
- * @return {X64Word} A new x64-Word object after adding.
- *
- * @example
- *
- * var added = x64Word.add(anotherX64Word);
- */
- // add: function (word) {
- // var low = (this.low + word.low) | 0;
- // var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0;
- // var high = (this.high + word.high + carry) | 0;
- // return X64Word.create(high, low);
- // }
- });
- /**
- * An array of 64-bit words.
- *
- * @property {Array} words The array of CryptoJS.x64.Word objects.
- * @property {number} sigBytes The number of significant bytes in this word array.
- */
- var X64WordArray = C_x64.WordArray = Base.extend({
- /**
- * Initializes a newly created word array.
- *
- * @param {Array} words (Optional) An array of CryptoJS.x64.Word objects.
- * @param {number} sigBytes (Optional) The number of significant bytes in the words.
- *
- * @example
- *
- * var wordArray = CryptoJS.x64.WordArray.create();
- *
- * var wordArray = CryptoJS.x64.WordArray.create([
- * CryptoJS.x64.Word.create(0x00010203, 0x04050607),
- * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
- * ]);
- *
- * var wordArray = CryptoJS.x64.WordArray.create([
- * CryptoJS.x64.Word.create(0x00010203, 0x04050607),
- * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
- * ], 10);
- */
- init: function init(words, sigBytes) {
- words = this.words = words || [];
- if (sigBytes != undefined) {
- this.sigBytes = sigBytes;
- } else {
- this.sigBytes = words.length * 8;
- }
- },
- /**
- * Converts this 64-bit word array to a 32-bit word array.
- *
- * @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array.
- *
- * @example
- *
- * var x32WordArray = x64WordArray.toX32();
- */
- toX32: function toX32() {
- // Shortcuts
- var x64Words = this.words;
- var x64WordsLength = x64Words.length;
- // Convert
- var x32Words = [];
- for (var i = 0; i < x64WordsLength; i++) {
- var x64Word = x64Words[i];
- x32Words.push(x64Word.high);
- x32Words.push(x64Word.low);
- }
- return X32WordArray.create(x32Words, this.sigBytes);
- },
- /**
- * Creates a copy of this word array.
- *
- * @return {X64WordArray} The clone.
- *
- * @example
- *
- * var clone = x64WordArray.clone();
- */
- clone: function clone() {
- var clone = Base.clone.call(this);
- // Clone "words" array
- var words = clone.words = this.words.slice(0);
- // Clone each X64Word object
- var wordsLength = words.length;
- for (var i = 0; i < wordsLength; i++) {
- words[i] = words[i].clone();
- }
- return clone;
- }
- });
- })();
- (function () {
- // Check if typed arrays are supported
- if (typeof ArrayBuffer != 'function') {
- return;
- }
- // Shortcuts
- var C = CryptoJS;
- var C_lib = C.lib;
- var WordArray = C_lib.WordArray;
- // Reference original init
- var superInit = WordArray.init;
- // Augment WordArray.init to handle typed arrays
- var subInit = WordArray.init = function (typedArray) {
- // Convert buffers to uint8
- if (typedArray instanceof ArrayBuffer) {
- typedArray = new Uint8Array(typedArray);
- }
- // Convert other array views to uint8
- if (typedArray instanceof Int8Array || typeof Uint8ClampedArray !== "undefined" && typedArray instanceof Uint8ClampedArray || typedArray instanceof Int16Array || typedArray instanceof Uint16Array || typedArray instanceof Int32Array || typedArray instanceof Uint32Array || typedArray instanceof Float32Array || typedArray instanceof Float64Array) {
- typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength);
- }
- // Handle Uint8Array
- if (typedArray instanceof Uint8Array) {
- // Shortcut
- var typedArrayByteLength = typedArray.byteLength;
- // Extract bytes
- var words = [];
- for (var i = 0; i < typedArrayByteLength; i++) {
- words[i >>> 2] |= typedArray[i] << 24 - i % 4 * 8;
- }
- // Initialize this word array
- superInit.call(this, words, typedArrayByteLength);
- } else {
- // Else call normal init
- superInit.apply(this, arguments);
- }
- };
- subInit.prototype = WordArray;
- })();
- (function () {
- // Shortcuts
- var C = CryptoJS;
- var C_lib = C.lib;
- var WordArray = C_lib.WordArray;
- var C_enc = C.enc;
- /**
- * UTF-16 BE encoding strategy.
- */
- var Utf16BE = C_enc.Utf16 = C_enc.Utf16BE = {
- /**
- * Converts a word array to a UTF-16 BE string.
- *
- * @param {WordArray} wordArray The word array.
- *
- * @return {string} The UTF-16 BE string.
- *
- * @static
- *
- * @example
- *
- * var utf16String = CryptoJS.enc.Utf16.stringify(wordArray);
- */
- stringify: function stringify(wordArray) {
- // Shortcuts
- var words = wordArray.words;
- var sigBytes = wordArray.sigBytes;
- // Convert
- var utf16Chars = [];
- for (var i = 0; i < sigBytes; i += 2) {
- var codePoint = words[i >>> 2] >>> 16 - i % 4 * 8 & 0xffff;
- utf16Chars.push(String.fromCharCode(codePoint));
- }
- return utf16Chars.join('');
- },
- /**
- * Converts a UTF-16 BE string to a word array.
- *
- * @param {string} utf16Str The UTF-16 BE string.
- *
- * @return {WordArray} The word array.
- *
- * @static
- *
- * @example
- *
- * var wordArray = CryptoJS.enc.Utf16.parse(utf16String);
- */
- parse: function parse(utf16Str) {
- // Shortcut
- var utf16StrLength = utf16Str.length;
- // Convert
- var words = [];
- for (var i = 0; i < utf16StrLength; i++) {
- words[i >>> 1] |= utf16Str.charCodeAt(i) << 16 - i % 2 * 16;
- }
- return WordArray.create(words, utf16StrLength * 2);
- }
- };
- /**
- * UTF-16 LE encoding strategy.
- */
- C_enc.Utf16LE = {
- /**
- * Converts a word array to a UTF-16 LE string.
- *
- * @param {WordArray} wordArray The word array.
- *
- * @return {string} The UTF-16 LE string.
- *
- * @static
- *
- * @example
- *
- * var utf16Str = CryptoJS.enc.Utf16LE.stringify(wordArray);
- */
- stringify: function stringify(wordArray) {
- // Shortcuts
- var words = wordArray.words;
- var sigBytes = wordArray.sigBytes;
- // Convert
- var utf16Chars = [];
- for (var i = 0; i < sigBytes; i += 2) {
- var codePoint = swapEndian(words[i >>> 2] >>> 16 - i % 4 * 8 & 0xffff);
- utf16Chars.push(String.fromCharCode(codePoint));
- }
- return utf16Chars.join('');
- },
- /**
- * Converts a UTF-16 LE string to a word array.
- *
- * @param {string} utf16Str The UTF-16 LE string.
- *
- * @return {WordArray} The word array.
- *
- * @static
- *
- * @example
- *
- * var wordArray = CryptoJS.enc.Utf16LE.parse(utf16Str);
- */
- parse: function parse(utf16Str) {
- // Shortcut
- var utf16StrLength = utf16Str.length;
- // Convert
- var words = [];
- for (var i = 0; i < utf16StrLength; i++) {
- words[i >>> 1] |= swapEndian(utf16Str.charCodeAt(i) << 16 - i % 2 * 16);
- }
- return WordArray.create(words, utf16StrLength * 2);
- }
- };
- function swapEndian(word) {
- return word << 8 & 0xff00ff00 | word >>> 8 & 0x00ff00ff;
- }
- })();
- (function () {
- // Shortcuts
- var C = CryptoJS;
- var C_lib = C.lib;
- var WordArray = C_lib.WordArray;
- var C_enc = C.enc;
- /**
- * Base64 encoding strategy.
- */
- var Base64 = C_enc.Base64 = {
- /**
- * Converts a word array to a Base64 string.
- *
- * @param {WordArray} wordArray The word array.
- *
- * @return {string} The Base64 string.
- *
- * @static
- *
- * @example
- *
- * var base64String = CryptoJS.enc.Base64.stringify(wordArray);
- */
- stringify: function stringify(wordArray) {
- // Shortcuts
- var words = wordArray.words;
- var sigBytes = wordArray.sigBytes;
- var map = this._map;
- // Clamp excess bits
- wordArray.clamp();
- // Convert
- var base64Chars = [];
- for (var i = 0; i < sigBytes; i += 3) {
- var byte1 = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff;
- var byte2 = words[i + 1 >>> 2] >>> 24 - (i + 1) % 4 * 8 & 0xff;
- var byte3 = words[i + 2 >>> 2] >>> 24 - (i + 2) % 4 * 8 & 0xff;
- var triplet = byte1 << 16 | byte2 << 8 | byte3;
- for (var j = 0; j < 4 && i + j * 0.75 < sigBytes; j++) {
- base64Chars.push(map.charAt(triplet >>> 6 * (3 - j) & 0x3f));
- }
- }
- // Add padding
- var paddingChar = map.charAt(64);
- if (paddingChar) {
- while (base64Chars.length % 4) {
- base64Chars.push(paddingChar);
- }
- }
- return base64Chars.join('');
- },
- /**
- * Converts a Base64 string to a word array.
- *
- * @param {string} base64Str The Base64 string.
- *
- * @return {WordArray} The word array.
- *
- * @static
- *
- * @example
- *
- * var wordArray = CryptoJS.enc.Base64.parse(base64String);
- */
- parse: function parse(base64Str) {
- // Shortcuts
- var base64StrLength = base64Str.length;
- var map = this._map;
- var reverseMap = this._reverseMap;
- if (!reverseMap) {
- reverseMap = this._reverseMap = [];
- for (var j = 0; j < map.length; j++) {
- reverseMap[map.charCodeAt(j)] = j;
- }
- }
- // Ignore padding
- var paddingChar = map.charAt(64);
- if (paddingChar) {
- var paddingIndex = base64Str.indexOf(paddingChar);
- if (paddingIndex !== -1) {
- base64StrLength = paddingIndex;
- }
- }
- // Convert
- return parseLoop(base64Str, base64StrLength, reverseMap);
- },
- _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
- };
- function parseLoop(base64Str, base64StrLength, reverseMap) {
- var words = [];
- var nBytes = 0;
- for (var i = 0; i < base64StrLength; i++) {
- if (i % 4) {
- var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << i % 4 * 2;
- var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> 6 - i % 4 * 2;
- var bitsCombined = bits1 | bits2;
- words[nBytes >>> 2] |= bitsCombined << 24 - nBytes % 4 * 8;
- nBytes++;
- }
- }
- return WordArray.create(words, nBytes);
- }
- })();
- (function () {
- // Shortcuts
- var C = CryptoJS;
- var C_lib = C.lib;
- var WordArray = C_lib.WordArray;
- var C_enc = C.enc;
- /**
- * Base64url encoding strategy.
- */
- var Base64url = C_enc.Base64url = {
- /**
- * Converts a word array to a Base64url string.
- *
- * @param {WordArray} wordArray The word array.
- *
- * @param {boolean} urlSafe Whether to use url safe
- *
- * @return {string} The Base64url string.
- *
- * @static
- *
- * @example
- *
- * var base64String = CryptoJS.enc.Base64url.stringify(wordArray);
- */
- stringify: function stringify(wordArray) {
- var urlSafe = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
- // Shortcuts
- var words = wordArray.words;
- var sigBytes = wordArray.sigBytes;
- var map = urlSafe ? this._safe_map : this._map;
- // Clamp excess bits
- wordArray.clamp();
- // Convert
- var base64Chars = [];
- for (var i = 0; i < sigBytes; i += 3) {
- var byte1 = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff;
- var byte2 = words[i + 1 >>> 2] >>> 24 - (i + 1) % 4 * 8 & 0xff;
- var byte3 = words[i + 2 >>> 2] >>> 24 - (i + 2) % 4 * 8 & 0xff;
- var triplet = byte1 << 16 | byte2 << 8 | byte3;
- for (var j = 0; j < 4 && i + j * 0.75 < sigBytes; j++) {
- base64Chars.push(map.charAt(triplet >>> 6 * (3 - j) & 0x3f));
- }
- }
- // Add padding
- var paddingChar = map.charAt(64);
- if (paddingChar) {
- while (base64Chars.length % 4) {
- base64Chars.push(paddingChar);
- }
- }
- return base64Chars.join('');
- },
- /**
- * Converts a Base64url string to a word array.
- *
- * @param {string} base64Str The Base64url string.
- *
- * @param {boolean} urlSafe Whether to use url safe
- *
- * @return {WordArray} The word array.
- *
- * @static
- *
- * @example
- *
- * var wordArray = CryptoJS.enc.Base64url.parse(base64String);
- */
- parse: function parse(base64Str) {
- var urlSafe = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
- // Shortcuts
- var base64StrLength = base64Str.length;
- var map = urlSafe ? this._safe_map : this._map;
- var reverseMap = this._reverseMap;
- if (!reverseMap) {
- reverseMap = this._reverseMap = [];
- for (var j = 0; j < map.length; j++) {
- reverseMap[map.charCodeAt(j)] = j;
- }
- }
- // Ignore padding
- var paddingChar = map.charAt(64);
- if (paddingChar) {
- var paddingIndex = base64Str.indexOf(paddingChar);
- if (paddingIndex !== -1) {
- base64StrLength = paddingIndex;
- }
- }
- // Convert
- return parseLoop(base64Str, base64StrLength, reverseMap);
- },
- _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
- _safe_map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'
- };
- function parseLoop(base64Str, base64StrLength, reverseMap) {
- var words = [];
- var nBytes = 0;
- for (var i = 0; i < base64StrLength; i++) {
- if (i % 4) {
- var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << i % 4 * 2;
- var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> 6 - i % 4 * 2;
- var bitsCombined = bits1 | bits2;
- words[nBytes >>> 2] |= bitsCombined << 24 - nBytes % 4 * 8;
- nBytes++;
- }
- }
- return WordArray.create(words, nBytes);
- }
- })();
- (function (Math) {
- // Shortcuts
- var C = CryptoJS;
- var C_lib = C.lib;
- var WordArray = C_lib.WordArray;
- var Hasher = C_lib.Hasher;
- var C_algo = C.algo;
- // Constants table
- var T = [];
- // Compute constants
- (function () {
- for (var i = 0; i < 64; i++) {
- T[i] = Math.abs(Math.sin(i + 1)) * 0x100000000 | 0;
- }
- })();
- /**
- * MD5 hash algorithm.
- */
- var MD5 = C_algo.MD5 = Hasher.extend({
- _doReset: function _doReset() {
- this._hash = new WordArray.init([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476]);
- },
- _doProcessBlock: function _doProcessBlock(M, offset) {
- // Swap endian
- for (var i = 0; i < 16; i++) {
- // Shortcuts
- var offset_i = offset + i;
- var M_offset_i = M[offset_i];
- M[offset_i] = (M_offset_i << 8 | M_offset_i >>> 24) & 0x00ff00ff | (M_offset_i << 24 | M_offset_i >>> 8) & 0xff00ff00;
- }
- // Shortcuts
- var H = this._hash.words;
- var M_offset_0 = M[offset + 0];
- var M_offset_1 = M[offset + 1];
- var M_offset_2 = M[offset + 2];
- var M_offset_3 = M[offset + 3];
- var M_offset_4 = M[offset + 4];
- var M_offset_5 = M[offset + 5];
- var M_offset_6 = M[offset + 6];
- var M_offset_7 = M[offset + 7];
- var M_offset_8 = M[offset + 8];
- var M_offset_9 = M[offset + 9];
- var M_offset_10 = M[offset + 10];
- var M_offset_11 = M[offset + 11];
- var M_offset_12 = M[offset + 12];
- var M_offset_13 = M[offset + 13];
- var M_offset_14 = M[offset + 14];
- var M_offset_15 = M[offset + 15];
- // Working varialbes
- var a = H[0];
- var b = H[1];
- var c = H[2];
- var d = H[3];
- // Computation
- a = FF(a, b, c, d, M_offset_0, 7, T[0]);
- d = FF(d, a, b, c, M_offset_1, 12, T[1]);
- c = FF(c, d, a, b, M_offset_2, 17, T[2]);
- b = FF(b, c, d, a, M_offset_3, 22, T[3]);
- a = FF(a, b, c, d, M_offset_4, 7, T[4]);
- d = FF(d, a, b, c, M_offset_5, 12, T[5]);
- c = FF(c, d, a, b, M_offset_6, 17, T[6]);
- b = FF(b, c, d, a, M_offset_7, 22, T[7]);
- a = FF(a, b, c, d, M_offset_8, 7, T[8]);
- d = FF(d, a, b, c, M_offset_9, 12, T[9]);
- c = FF(c, d, a, b, M_offset_10, 17, T[10]);
- b = FF(b, c, d, a, M_offset_11, 22, T[11]);
- a = FF(a, b, c, d, M_offset_12, 7, T[12]);
- d = FF(d, a, b, c, M_offset_13, 12, T[13]);
- c = FF(c, d, a, b, M_offset_14, 17, T[14]);
- b = FF(b, c, d, a, M_offset_15, 22, T[15]);
- a = GG(a, b, c, d, M_offset_1, 5, T[16]);
- d = GG(d, a, b, c, M_offset_6, 9, T[17]);
- c = GG(c, d, a, b, M_offset_11, 14, T[18]);
- b = GG(b, c, d, a, M_offset_0, 20, T[19]);
- a = GG(a, b, c, d, M_offset_5, 5, T[20]);
- d = GG(d, a, b, c, M_offset_10, 9, T[21]);
- c = GG(c, d, a, b, M_offset_15, 14, T[22]);
- b = GG(b, c, d, a, M_offset_4, 20, T[23]);
- a = GG(a, b, c, d, M_offset_9, 5, T[24]);
- d = GG(d, a, b, c, M_offset_14, 9, T[25]);
- c = GG(c, d, a, b, M_offset_3, 14, T[26]);
- b = GG(b, c, d, a, M_offset_8, 20, T[27]);
- a = GG(a, b, c, d, M_offset_13, 5, T[28]);
- d = GG(d, a, b, c, M_offset_2, 9, T[29]);
- c = GG(c, d, a, b, M_offset_7, 14, T[30]);
- b = GG(b, c, d, a, M_offset_12, 20, T[31]);
- a = HH(a, b, c, d, M_offset_5, 4, T[32]);
- d = HH(d, a, b, c, M_offset_8, 11, T[33]);
- c = HH(c, d, a, b, M_offset_11, 16, T[34]);
- b = HH(b, c, d, a, M_offset_14, 23, T[35]);
- a = HH(a, b, c, d, M_offset_1, 4, T[36]);
- d = HH(d, a, b, c, M_offset_4, 11, T[37]);
- c = HH(c, d, a, b, M_offset_7, 16, T[38]);
- b = HH(b, c, d, a, M_offset_10, 23, T[39]);
- a = HH(a, b, c, d, M_offset_13, 4, T[40]);
- d = HH(d, a, b, c, M_offset_0, 11, T[41]);
- c = HH(c, d, a, b, M_offset_3, 16, T[42]);
- b = HH(b, c, d, a, M_offset_6, 23, T[43]);
- a = HH(a, b, c, d, M_offset_9, 4, T[44]);
- d = HH(d, a, b, c, M_offset_12, 11, T[45]);
- c = HH(c, d, a, b, M_offset_15, 16, T[46]);
- b = HH(b, c, d, a, M_offset_2, 23, T[47]);
- a = II(a, b, c, d, M_offset_0, 6, T[48]);
- d = II(d, a, b, c, M_offset_7, 10, T[49]);
- c = II(c, d, a, b, M_offset_14, 15, T[50]);
- b = II(b, c, d, a, M_offset_5, 21, T[51]);
- a = II(a, b, c, d, M_offset_12, 6, T[52]);
- d = II(d, a, b, c, M_offset_3, 10, T[53]);
- c = II(c, d, a, b, M_offset_10, 15, T[54]);
- b = II(b, c, d, a, M_offset_1, 21, T[55]);
- a = II(a, b, c, d, M_offset_8, 6, T[56]);
- d = II(d, a, b, c, M_offset_15, 10, T[57]);
- c = II(c, d, a, b, M_offset_6, 15, T[58]);
- b = II(b, c, d, a, M_offset_13, 21, T[59]);
- a = II(a, b, c, d, M_offset_4, 6, T[60]);
- d = II(d, a, b, c, M_offset_11, 10, T[61]);
- c = II(c, d, a, b, M_offset_2, 15, T[62]);
- b = II(b, c, d, a, M_offset_9, 21, T[63]);
- // Intermediate hash value
- H[0] = H[0] + a | 0;
- H[1] = H[1] + b | 0;
- H[2] = H[2] + c | 0;
- H[3] = H[3] + d | 0;
- },
- _doFinalize: function _doFinalize() {
- // Shortcuts
- var data = this._data;
- var dataWords = data.words;
- var nBitsTotal = this._nDataBytes * 8;
- var nBitsLeft = data.sigBytes * 8;
- // Add padding
- dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32;
- var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000);
- var nBitsTotalL = nBitsTotal;
- dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = (nBitsTotalH << 8 | nBitsTotalH >>> 24) & 0x00ff00ff | (nBitsTotalH << 24 | nBitsTotalH >>> 8) & 0xff00ff00;
- dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = (nBitsTotalL << 8 | nBitsTotalL >>> 24) & 0x00ff00ff | (nBitsTotalL << 24 | nBitsTotalL >>> 8) & 0xff00ff00;
- data.sigBytes = (dataWords.length + 1) * 4;
- // Hash final blocks
- this._process();
- // Shortcuts
- var hash = this._hash;
- var H = hash.words;
- // Swap endian
- for (var i = 0; i < 4; i++) {
- // Shortcut
- var H_i = H[i];
- H[i] = (H_i << 8 | H_i >>> 24) & 0x00ff00ff | (H_i << 24 | H_i >>> 8) & 0xff00ff00;
- }
- // Return final computed hash
- return hash;
- },
- clone: function clone() {
- var clone = Hasher.clone.call(this);
- clone._hash = this._hash.clone();
- return clone;
- }
- });
- function FF(a, b, c, d, x, s, t) {
- var n = a + (b & c | ~b & d) + x + t;
- return (n << s | n >>> 32 - s) + b;
- }
- function GG(a, b, c, d, x, s, t) {
- var n = a + (b & d | c & ~d) + x + t;
- return (n << s | n >>> 32 - s) + b;
- }
- function HH(a, b, c, d, x, s, t) {
- var n = a + (b ^ c ^ d) + x + t;
- return (n << s | n >>> 32 - s) + b;
- }
- function II(a, b, c, d, x, s, t) {
- var n = a + (c ^ (b | ~d)) + x + t;
- return (n << s | n >>> 32 - s) + b;
- }
- /**
- * Shortcut function to the hasher's object interface.
- *
- * @param {WordArray|string} message The message to hash.
- *
- * @return {WordArray} The hash.
- *
- * @static
- *
- * @example
- *
- * var hash = CryptoJS.MD5('message');
- * var hash = CryptoJS.MD5(wordArray);
- */
- C.MD5 = Hasher._createHelper(MD5);
- /**
- * Shortcut function to the HMAC's object interface.
- *
- * @param {WordArray|string} message The message to hash.
- * @param {WordArray|string} key The secret key.
- *
- * @return {WordArray} The HMAC.
- *
- * @static
- *
- * @example
- *
- * var hmac = CryptoJS.HmacMD5(message, key);
- */
- C.HmacMD5 = Hasher._createHmacHelper(MD5);
- })(Math);
- (function () {
- // Shortcuts
- var C = CryptoJS;
- var C_lib = C.lib;
- var WordArray = C_lib.WordArray;
- var Hasher = C_lib.Hasher;
- var C_algo = C.algo;
- // Reusable object
- var W = [];
- /**
- * SHA-1 hash algorithm.
- */
- var SHA1 = C_algo.SHA1 = Hasher.extend({
- _doReset: function _doReset() {
- this._hash = new WordArray.init([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0]);
- },
- _doProcessBlock: function _doProcessBlock(M, offset) {
- // Shortcut
- var H = this._hash.words;
- // Working variables
- var a = H[0];
- var b = H[1];
- var c = H[2];
- var d = H[3];
- var e = H[4];
- // Computation
- for (var i = 0; i < 80; i++) {
- if (i < 16) {
- W[i] = M[offset + i] | 0;
- } else {
- var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];
- W[i] = n << 1 | n >>> 31;
- }
- var t = (a << 5 | a >>> 27) + e + W[i];
- if (i < 20) {
- t += (b & c | ~b & d) + 0x5a827999;
- } else if (i < 40) {
- t += (b ^ c ^ d) + 0x6ed9eba1;
- } else if (i < 60) {
- t += (b & c | b & d | c & d) - 0x70e44324;
- } else /* if (i < 80) */{
- t += (b ^ c ^ d) - 0x359d3e2a;
- }
- e = d;
- d = c;
- c = b << 30 | b >>> 2;
- b = a;
- a = t;
- }
- // Intermediate hash value
- H[0] = H[0] + a | 0;
- H[1] = H[1] + b | 0;
- H[2] = H[2] + c | 0;
- H[3] = H[3] + d | 0;
- H[4] = H[4] + e | 0;
- },
- _doFinalize: function _doFinalize() {
- // Shortcuts
- var data = this._data;
- var dataWords = data.words;
- var nBitsTotal = this._nDataBytes * 8;
- var nBitsLeft = data.sigBytes * 8;
- // Add padding
- dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32;
- dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
- dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = nBitsTotal;
- data.sigBytes = dataWords.length * 4;
- // Hash final blocks
- this._process();
- // Return final computed hash
- return this._hash;
- },
- clone: function clone() {
- var clone = Hasher.clone.call(this);
- clone._hash = this._hash.clone();
- return clone;
- }
- });
- /**
- * Shortcut function to the hasher's object interface.
- *
- * @param {WordArray|string} message The message to hash.
- *
- * @return {WordArray} The hash.
- *
- * @static
- *
- * @example
- *
- * var hash = CryptoJS.SHA1('message');
- * var hash = CryptoJS.SHA1(wordArray);
- */
- C.SHA1 = Hasher._createHelper(SHA1);
- /**
- * Shortcut function to the HMAC's object interface.
- *
- * @param {WordArray|string} message The message to hash.
- * @param {WordArray|string} key The secret key.
- *
- * @return {WordArray} The HMAC.
- *
- * @static
- *
- * @example
- *
- * var hmac = CryptoJS.HmacSHA1(message, key);
- */
- C.HmacSHA1 = Hasher._createHmacHelper(SHA1);
- })();
- (function (Math) {
- // Shortcuts
- var C = CryptoJS;
- var C_lib = C.lib;
- var WordArray = C_lib.WordArray;
- var Hasher = C_lib.Hasher;
- var C_algo = C.algo;
- // Initialization and round constants tables
- var H = [];
- var K = [];
- // Compute constants
- (function () {
- function isPrime(n) {
- var sqrtN = Math.sqrt(n);
- for (var factor = 2; factor <= sqrtN; factor++) {
- if (!(n % factor)) {
- return false;
- }
- }
- return true;
- }
- function getFractionalBits(n) {
- return (n - (n | 0)) * 0x100000000 | 0;
- }
- var n = 2;
- var nPrime = 0;
- while (nPrime < 64) {
- if (isPrime(n)) {
- if (nPrime < 8) {
- H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2));
- }
- K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3));
- nPrime++;
- }
- n++;
- }
- })();
- // Reusable object
- var W = [];
- /**
- * SHA-256 hash algorithm.
- */
- var SHA256 = C_algo.SHA256 = Hasher.extend({
- _doReset: function _doReset() {
- this._hash = new WordArray.init(H.slice(0));
- },
- _doProcessBlock: function _doProcessBlock(M, offset) {
- // Shortcut
- var H = this._hash.words;
- // Working variables
- var a = H[0];
- var b = H[1];
- var c = H[2];
- var d = H[3];
- var e = H[4];
- var f = H[5];
- var g = H[6];
- var h = H[7];
- // Computation
- for (var i = 0; i < 64; i++) {
- if (i < 16) {
- W[i] = M[offset + i] | 0;
- } else {
- var gamma0x = W[i - 15];
- var gamma0 = (gamma0x << 25 | gamma0x >>> 7) ^ (gamma0x << 14 | gamma0x >>> 18) ^ gamma0x >>> 3;
- var gamma1x = W[i - 2];
- var gamma1 = (gamma1x << 15 | gamma1x >>> 17) ^ (gamma1x << 13 | gamma1x >>> 19) ^ gamma1x >>> 10;
- W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];
- }
- var ch = e & f ^ ~e & g;
- var maj = a & b ^ a & c ^ b & c;
- var sigma0 = (a << 30 | a >>> 2) ^ (a << 19 | a >>> 13) ^ (a << 10 | a >>> 22);
- var sigma1 = (e << 26 | e >>> 6) ^ (e << 21 | e >>> 11) ^ (e << 7 | e >>> 25);
- var t1 = h + sigma1 + ch + K[i] + W[i];
- var t2 = sigma0 + maj;
- h = g;
- g = f;
- f = e;
- e = d + t1 | 0;
- d = c;
- c = b;
- b = a;
- a = t1 + t2 | 0;
- }
- // Intermediate hash value
- H[0] = H[0] + a | 0;
- H[1] = H[1] + b | 0;
- H[2] = H[2] + c | 0;
- H[3] = H[3] + d | 0;
- H[4] = H[4] + e | 0;
- H[5] = H[5] + f | 0;
- H[6] = H[6] + g | 0;
- H[7] = H[7] + h | 0;
- },
- _doFinalize: function _doFinalize() {
- // Shortcuts
- var data = this._data;
- var dataWords = data.words;
- var nBitsTotal = this._nDataBytes * 8;
- var nBitsLeft = data.sigBytes * 8;
- // Add padding
- dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32;
- dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
- dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = nBitsTotal;
- data.sigBytes = dataWords.length * 4;
- // Hash final blocks
- this._process();
- // Return final computed hash
- return this._hash;
- },
- clone: function clone() {
- var clone = Hasher.clone.call(this);
- clone._hash = this._hash.clone();
- return clone;
- }
- });
- /**
- * Shortcut function to the hasher's object interface.
- *
- * @param {WordArray|string} message The message to hash.
- *
- * @return {WordArray} The hash.
- *
- * @static
- *
- * @example
- *
- * var hash = CryptoJS.SHA256('message');
- * var hash = CryptoJS.SHA256(wordArray);
- */
- C.SHA256 = Hasher._createHelper(SHA256);
- /**
- * Shortcut function to the HMAC's object interface.
- *
- * @param {WordArray|string} message The message to hash.
- * @param {WordArray|string} key The secret key.
- *
- * @return {WordArray} The HMAC.
- *
- * @static
- *
- * @example
- *
- * var hmac = CryptoJS.HmacSHA256(message, key);
- */
- C.HmacSHA256 = Hasher._createHmacHelper(SHA256);
- })(Math);
- (function () {
- // Shortcuts
- var C = CryptoJS;
- var C_lib = C.lib;
- var WordArray = C_lib.WordArray;
- var C_algo = C.algo;
- var SHA256 = C_algo.SHA256;
- /**
- * SHA-224 hash algorithm.
- */
- var SHA224 = C_algo.SHA224 = SHA256.extend({
- _doReset: function _doReset() {
- this._hash = new WordArray.init([0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4]);
- },
- _doFinalize: function _doFinalize() {
- var hash = SHA256._doFinalize.call(this);
- hash.sigBytes -= 4;
- return hash;
- }
- });
- /**
- * Shortcut function to the hasher's object interface.
- *
- * @param {WordArray|string} message The message to hash.
- *
- * @return {WordArray} The hash.
- *
- * @static
- *
- * @example
- *
- * var hash = CryptoJS.SHA224('message');
- * var hash = CryptoJS.SHA224(wordArray);
- */
- C.SHA224 = SHA256._createHelper(SHA224);
- /**
- * Shortcut function to the HMAC's object interface.
- *
- * @param {WordArray|string} message The message to hash.
- * @param {WordArray|string} key The secret key.
- *
- * @return {WordArray} The HMAC.
- *
- * @static
- *
- * @example
- *
- * var hmac = CryptoJS.HmacSHA224(message, key);
- */
- C.HmacSHA224 = SHA256._createHmacHelper(SHA224);
- })();
- (function () {
- // Shortcuts
- var C = CryptoJS;
- var C_lib = C.lib;
- var Hasher = C_lib.Hasher;
- var C_x64 = C.x64;
- var X64Word = C_x64.Word;
- var X64WordArray = C_x64.WordArray;
- var C_algo = C.algo;
- function X64Word_create() {
- return X64Word.create.apply(X64Word, arguments);
- }
- // Constants
- var K = [X64Word_create(0x428a2f98, 0xd728ae22), X64Word_create(0x71374491, 0x23ef65cd), X64Word_create(0xb5c0fbcf, 0xec4d3b2f), X64Word_create(0xe9b5dba5, 0x8189dbbc), X64Word_create(0x3956c25b, 0xf348b538), X64Word_create(0x59f111f1, 0xb605d019), X64Word_create(0x923f82a4, 0xaf194f9b), X64Word_create(0xab1c5ed5, 0xda6d8118), X64Word_create(0xd807aa98, 0xa3030242), X64Word_create(0x12835b01, 0x45706fbe), X64Word_create(0x243185be, 0x4ee4b28c), X64Word_create(0x550c7dc3, 0xd5ffb4e2), X64Word_create(0x72be5d74, 0xf27b896f), X64Word_create(0x80deb1fe, 0x3b1696b1), X64Word_create(0x9bdc06a7, 0x25c71235), X64Word_create(0xc19bf174, 0xcf692694), X64Word_create(0xe49b69c1, 0x9ef14ad2), X64Word_create(0xefbe4786, 0x384f25e3), X64Word_create(0x0fc19dc6, 0x8b8cd5b5), X64Word_create(0x240ca1cc, 0x77ac9c65), X64Word_create(0x2de92c6f, 0x592b0275), X64Word_create(0x4a7484aa, 0x6ea6e483), X64Word_create(0x5cb0a9dc, 0xbd41fbd4), X64Word_create(0x76f988da, 0x831153b5), X64Word_create(0x983e5152, 0xee66dfab), X64Word_create(0xa831c66d, 0x2db43210), X64Word_create(0xb00327c8, 0x98fb213f), X64Word_create(0xbf597fc7, 0xbeef0ee4), X64Word_create(0xc6e00bf3, 0x3da88fc2), X64Word_create(0xd5a79147, 0x930aa725), X64Word_create(0x06ca6351, 0xe003826f), X64Word_create(0x14292967, 0x0a0e6e70), X64Word_create(0x27b70a85, 0x46d22ffc), X64Word_create(0x2e1b2138, 0x5c26c926), X64Word_create(0x4d2c6dfc, 0x5ac42aed), X64Word_create(0x53380d13, 0x9d95b3df), X64Word_create(0x650a7354, 0x8baf63de), X64Word_create(0x766a0abb, 0x3c77b2a8), X64Word_create(0x81c2c92e, 0x47edaee6), X64Word_create(0x92722c85, 0x1482353b), X64Word_create(0xa2bfe8a1, 0x4cf10364), X64Word_create(0xa81a664b, 0xbc423001), X64Word_create(0xc24b8b70, 0xd0f89791), X64Word_create(0xc76c51a3, 0x0654be30), X64Word_create(0xd192e819, 0xd6ef5218), X64Word_create(0xd6990624, 0x5565a910), X64Word_create(0xf40e3585, 0x5771202a), X64Word_create(0x106aa070, 0x32bbd1b8), X64Word_create(0x19a4c116, 0xb8d2d0c8), X64Word_create(0x1e376c08, 0x5141ab53), X64Word_create(0x2748774c, 0xdf8eeb99), X64Word_create(0x34b0bcb5, 0xe19b48a8), X64Word_create(0x391c0cb3, 0xc5c95a63), X64Word_create(0x4ed8aa4a, 0xe3418acb), X64Word_create(0x5b9cca4f, 0x7763e373), X64Word_create(0x682e6ff3, 0xd6b2b8a3), X64Word_create(0x748f82ee, 0x5defb2fc), X64Word_create(0x78a5636f, 0x43172f60), X64Word_create(0x84c87814, 0xa1f0ab72), X64Word_create(0x8cc70208, 0x1a6439ec), X64Word_create(0x90befffa, 0x23631e28), X64Word_create(0xa4506ceb, 0xde82bde9), X64Word_create(0xbef9a3f7, 0xb2c67915), X64Word_create(0xc67178f2, 0xe372532b), X64Word_create(0xca273ece, 0xea26619c), X64Word_create(0xd186b8c7, 0x21c0c207), X64Word_create(0xeada7dd6, 0xcde0eb1e), X64Word_create(0xf57d4f7f, 0xee6ed178), X64Word_create(0x06f067aa, 0x72176fba), X64Word_create(0x0a637dc5, 0xa2c898a6), X64Word_create(0x113f9804, 0xbef90dae), X64Word_create(0x1b710b35, 0x131c471b), X64Word_create(0x28db77f5, 0x23047d84), X64Word_create(0x32caab7b, 0x40c72493), X64Word_create(0x3c9ebe0a, 0x15c9bebc), X64Word_create(0x431d67c4, 0x9c100d4c), X64Word_create(0x4cc5d4be, 0xcb3e42b6), X64Word_create(0x597f299c, 0xfc657e2a), X64Word_create(0x5fcb6fab, 0x3ad6faec), X64Word_create(0x6c44198c, 0x4a475817)];
- // Reusable objects
- var W = [];
- (function () {
- for (var i = 0; i < 80; i++) {
- W[i] = X64Word_create();
- }
- })();
- /**
- * SHA-512 hash algorithm.
- */
- var SHA512 = C_algo.SHA512 = Hasher.extend({
- _doReset: function _doReset() {
- this._hash = new X64WordArray.init([new X64Word.init(0x6a09e667, 0xf3bcc908), new X64Word.init(0xbb67ae85, 0x84caa73b), new X64Word.init(0x3c6ef372, 0xfe94f82b), new X64Word.init(0xa54ff53a, 0x5f1d36f1), new X64Word.init(0x510e527f, 0xade682d1), new X64Word.init(0x9b05688c, 0x2b3e6c1f), new X64Word.init(0x1f83d9ab, 0xfb41bd6b), new X64Word.init(0x5be0cd19, 0x137e2179)]);
- },
- _doProcessBlock: function _doProcessBlock(M, offset) {
- // Shortcuts
- var H = this._hash.words;
- var H0 = H[0];
- var H1 = H[1];
- var H2 = H[2];
- var H3 = H[3];
- var H4 = H[4];
- var H5 = H[5];
- var H6 = H[6];
- var H7 = H[7];
- var H0h = H0.high;
- var H0l = H0.low;
- var H1h = H1.high;
- var H1l = H1.low;
- var H2h = H2.high;
- var H2l = H2.low;
- var H3h = H3.high;
- var H3l = H3.low;
- var H4h = H4.high;
- var H4l = H4.low;
- var H5h = H5.high;
- var H5l = H5.low;
- var H6h = H6.high;
- var H6l = H6.low;
- var H7h = H7.high;
- var H7l = H7.low;
- // Working variables
- var ah = H0h;
- var al = H0l;
- var bh = H1h;
- var bl = H1l;
- var ch = H2h;
- var cl = H2l;
- var dh = H3h;
- var dl = H3l;
- var eh = H4h;
- var el = H4l;
- var fh = H5h;
- var fl = H5l;
- var gh = H6h;
- var gl = H6l;
- var hh = H7h;
- var hl = H7l;
- // Rounds
- for (var i = 0; i < 80; i++) {
- var Wil;
- var Wih;
- // Shortcut
- var Wi = W[i];
- // Extend message
- if (i < 16) {
- Wih = Wi.high = M[offset + i * 2] | 0;
- Wil = Wi.low = M[offset + i * 2 + 1] | 0;
- } else {
- // Gamma0
- var gamma0x = W[i - 15];
- var gamma0xh = gamma0x.high;
- var gamma0xl = gamma0x.low;
- var gamma0h = (gamma0xh >>> 1 | gamma0xl << 31) ^ (gamma0xh >>> 8 | gamma0xl << 24) ^ gamma0xh >>> 7;
- var gamma0l = (gamma0xl >>> 1 | gamma0xh << 31) ^ (gamma0xl >>> 8 | gamma0xh << 24) ^ (gamma0xl >>> 7 | gamma0xh << 25);
- // Gamma1
- var gamma1x = W[i - 2];
- var gamma1xh = gamma1x.high;
- var gamma1xl = gamma1x.low;
- var gamma1h = (gamma1xh >>> 19 | gamma1xl << 13) ^ (gamma1xh << 3 | gamma1xl >>> 29) ^ gamma1xh >>> 6;
- var gamma1l = (gamma1xl >>> 19 | gamma1xh << 13) ^ (gamma1xl << 3 | gamma1xh >>> 29) ^ (gamma1xl >>> 6 | gamma1xh << 26);
- // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]
- var Wi7 = W[i - 7];
- var Wi7h = Wi7.high;
- var Wi7l = Wi7.low;
- var Wi16 = W[i - 16];
- var Wi16h = Wi16.high;
- var Wi16l = Wi16.low;
- Wil = gamma0l + Wi7l;
- Wih = gamma0h + Wi7h + (Wil >>> 0 < gamma0l >>> 0 ? 1 : 0);
- Wil = Wil + gamma1l;
- Wih = Wih + gamma1h + (Wil >>> 0 < gamma1l >>> 0 ? 1 : 0);
- Wil = Wil + Wi16l;
- Wih = Wih + Wi16h + (Wil >>> 0 < Wi16l >>> 0 ? 1 : 0);
- Wi.high = Wih;
- Wi.low = Wil;
- }
- var chh = eh & fh ^ ~eh & gh;
- var chl = el & fl ^ ~el & gl;
- var majh = ah & bh ^ ah & ch ^ bh & ch;
- var majl = al & bl ^ al & cl ^ bl & cl;
- var sigma0h = (ah >>> 28 | al << 4) ^ (ah << 30 | al >>> 2) ^ (ah << 25 | al >>> 7);
- var sigma0l = (al >>> 28 | ah << 4) ^ (al << 30 | ah >>> 2) ^ (al << 25 | ah >>> 7);
- var sigma1h = (eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9);
- var sigma1l = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9);
- // t1 = h + sigma1 + ch + K[i] + W[i]
- var Ki = K[i];
- var Kih = Ki.high;
- var Kil = Ki.low;
- var t1l = hl + sigma1l;
- var t1h = hh + sigma1h + (t1l >>> 0 < hl >>> 0 ? 1 : 0);
- var t1l = t1l + chl;
- var t1h = t1h + chh + (t1l >>> 0 < chl >>> 0 ? 1 : 0);
- var t1l = t1l + Kil;
- var t1h = t1h + Kih + (t1l >>> 0 < Kil >>> 0 ? 1 : 0);
- var t1l = t1l + Wil;
- var t1h = t1h + Wih + (t1l >>> 0 < Wil >>> 0 ? 1 : 0);
- // t2 = sigma0 + maj
- var t2l = sigma0l + majl;
- var t2h = sigma0h + majh + (t2l >>> 0 < sigma0l >>> 0 ? 1 : 0);
- // Update working variables
- hh = gh;
- hl = gl;
- gh = fh;
- gl = fl;
- fh = eh;
- fl = el;
- el = dl + t1l | 0;
- eh = dh + t1h + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0;
- dh = ch;
- dl = cl;
- ch = bh;
- cl = bl;
- bh = ah;
- bl = al;
- al = t1l + t2l | 0;
- ah = t1h + t2h + (al >>> 0 < t1l >>> 0 ? 1 : 0) | 0;
- }
- // Intermediate hash value
- H0l = H0.low = H0l + al;
- H0.high = H0h + ah + (H0l >>> 0 < al >>> 0 ? 1 : 0);
- H1l = H1.low = H1l + bl;
- H1.high = H1h + bh + (H1l >>> 0 < bl >>> 0 ? 1 : 0);
- H2l = H2.low = H2l + cl;
- H2.high = H2h + ch + (H2l >>> 0 < cl >>> 0 ? 1 : 0);
- H3l = H3.low = H3l + dl;
- H3.high = H3h + dh + (H3l >>> 0 < dl >>> 0 ? 1 : 0);
- H4l = H4.low = H4l + el;
- H4.high = H4h + eh + (H4l >>> 0 < el >>> 0 ? 1 : 0);
- H5l = H5.low = H5l + fl;
- H5.high = H5h + fh + (H5l >>> 0 < fl >>> 0 ? 1 : 0);
- H6l = H6.low = H6l + gl;
- H6.high = H6h + gh + (H6l >>> 0 < gl >>> 0 ? 1 : 0);
- H7l = H7.low = H7l + hl;
- H7.high = H7h + hh + (H7l >>> 0 < hl >>> 0 ? 1 : 0);
- },
- _doFinalize: function _doFinalize() {
- // Shortcuts
- var data = this._data;
- var dataWords = data.words;
- var nBitsTotal = this._nDataBytes * 8;
- var nBitsLeft = data.sigBytes * 8;
- // Add padding
- dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32;
- dataWords[(nBitsLeft + 128 >>> 10 << 5) + 30] = Math.floor(nBitsTotal / 0x100000000);
- dataWords[(nBitsLeft + 128 >>> 10 << 5) + 31] = nBitsTotal;
- data.sigBytes = dataWords.length * 4;
- // Hash final blocks
- this._process();
- // Convert hash to 32-bit word array before returning
- var hash = this._hash.toX32();
- // Return final computed hash
- return hash;
- },
- clone: function clone() {
- var clone = Hasher.clone.call(this);
- clone._hash = this._hash.clone();
- return clone;
- },
- blockSize: 1024 / 32
- });
- /**
- * Shortcut function to the hasher's object interface.
- *
- * @param {WordArray|string} message The message to hash.
- *
- * @return {WordArray} The hash.
- *
- * @static
- *
- * @example
- *
- * var hash = CryptoJS.SHA512('message');
- * var hash = CryptoJS.SHA512(wordArray);
- */
- C.SHA512 = Hasher._createHelper(SHA512);
- /**
- * Shortcut function to the HMAC's object interface.
- *
- * @param {WordArray|string} message The message to hash.
- * @param {WordArray|string} key The secret key.
- *
- * @return {WordArray} The HMAC.
- *
- * @static
- *
- * @example
- *
- * var hmac = CryptoJS.HmacSHA512(message, key);
- */
- C.HmacSHA512 = Hasher._createHmacHelper(SHA512);
- })();
- (function () {
- // Shortcuts
- var C = CryptoJS;
- var C_x64 = C.x64;
- var X64Word = C_x64.Word;
- var X64WordArray = C_x64.WordArray;
- var C_algo = C.algo;
- var SHA512 = C_algo.SHA512;
- /**
- * SHA-384 hash algorithm.
- */
- var SHA384 = C_algo.SHA384 = SHA512.extend({
- _doReset: function _doReset() {
- this._hash = new X64WordArray.init([new X64Word.init(0xcbbb9d5d, 0xc1059ed8), new X64Word.init(0x629a292a, 0x367cd507), new X64Word.init(0x9159015a, 0x3070dd17), new X64Word.init(0x152fecd8, 0xf70e5939), new X64Word.init(0x67332667, 0xffc00b31), new X64Word.init(0x8eb44a87, 0x68581511), new X64Word.init(0xdb0c2e0d, 0x64f98fa7), new X64Word.init(0x47b5481d, 0xbefa4fa4)]);
- },
- _doFinalize: function _doFinalize() {
- var hash = SHA512._doFinalize.call(this);
- hash.sigBytes -= 16;
- return hash;
- }
- });
- /**
- * Shortcut function to the hasher's object interface.
- *
- * @param {WordArray|string} message The message to hash.
- *
- * @return {WordArray} The hash.
- *
- * @static
- *
- * @example
- *
- * var hash = CryptoJS.SHA384('message');
- * var hash = CryptoJS.SHA384(wordArray);
- */
- C.SHA384 = SHA512._createHelper(SHA384);
- /**
- * Shortcut function to the HMAC's object interface.
- *
- * @param {WordArray|string} message The message to hash.
- * @param {WordArray|string} key The secret key.
- *
- * @return {WordArray} The HMAC.
- *
- * @static
- *
- * @example
- *
- * var hmac = CryptoJS.HmacSHA384(message, key);
- */
- C.HmacSHA384 = SHA512._createHmacHelper(SHA384);
- })();
- (function (Math) {
- // Shortcuts
- var C = CryptoJS;
- var C_lib = C.lib;
- var WordArray = C_lib.WordArray;
- var Hasher = C_lib.Hasher;
- var C_x64 = C.x64;
- var X64Word = C_x64.Word;
- var C_algo = C.algo;
- // Constants tables
- var RHO_OFFSETS = [];
- var PI_INDEXES = [];
- var ROUND_CONSTANTS = [];
- // Compute Constants
- (function () {
- // Compute rho offset constants
- var x = 1,
- y = 0;
- for (var t = 0; t < 24; t++) {
- RHO_OFFSETS[x + 5 * y] = (t + 1) * (t + 2) / 2 % 64;
- var newX = y % 5;
- var newY = (2 * x + 3 * y) % 5;
- x = newX;
- y = newY;
- }
- // Compute pi index constants
- for (var x = 0; x < 5; x++) {
- for (var y = 0; y < 5; y++) {
- PI_INDEXES[x + 5 * y] = y + (2 * x + 3 * y) % 5 * 5;
- }
- }
- // Compute round constants
- var LFSR = 0x01;
- for (var i = 0; i < 24; i++) {
- var roundConstantMsw = 0;
- var roundConstantLsw = 0;
- for (var j = 0; j < 7; j++) {
- if (LFSR & 0x01) {
- var bitPosition = (1 << j) - 1;
- if (bitPosition < 32) {
- roundConstantLsw ^= 1 << bitPosition;
- } else /* if (bitPosition >= 32) */{
- roundConstantMsw ^= 1 << bitPosition - 32;
- }
- }
- // Compute next LFSR
- if (LFSR & 0x80) {
- // Primitive polynomial over GF(2): x^8 + x^6 + x^5 + x^4 + 1
- LFSR = LFSR << 1 ^ 0x71;
- } else {
- LFSR <<= 1;
- }
- }
- ROUND_CONSTANTS[i] = X64Word.create(roundConstantMsw, roundConstantLsw);
- }
- })();
- // Reusable objects for temporary values
- var T = [];
- (function () {
- for (var i = 0; i < 25; i++) {
- T[i] = X64Word.create();
- }
- })();
- /**
- * SHA-3 hash algorithm.
- */
- var SHA3 = C_algo.SHA3 = Hasher.extend({
- /**
- * Configuration options.
- *
- * @property {number} outputLength
- * The desired number of bits in the output hash.
- * Only values permitted are: 224, 256, 384, 512.
- * Default: 512
- */
- cfg: Hasher.cfg.extend({
- outputLength: 512
- }),
- _doReset: function _doReset() {
- var state = this._state = [];
- for (var i = 0; i < 25; i++) {
- state[i] = new X64Word.init();
- }
- this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32;
- },
- _doProcessBlock: function _doProcessBlock(M, offset) {
- // Shortcuts
- var state = this._state;
- var nBlockSizeLanes = this.blockSize / 2;
- // Absorb
- for (var i = 0; i < nBlockSizeLanes; i++) {
- // Shortcuts
- var M2i = M[offset + 2 * i];
- var M2i1 = M[offset + 2 * i + 1];
- // Swap endian
- M2i = (M2i << 8 | M2i >>> 24) & 0x00ff00ff | (M2i << 24 | M2i >>> 8) & 0xff00ff00;
- M2i1 = (M2i1 << 8 | M2i1 >>> 24) & 0x00ff00ff | (M2i1 << 24 | M2i1 >>> 8) & 0xff00ff00;
- // Absorb message into state
- var lane = state[i];
- lane.high ^= M2i1;
- lane.low ^= M2i;
- }
- // Rounds
- for (var round = 0; round < 24; round++) {
- // Theta
- for (var x = 0; x < 5; x++) {
- // Mix column lanes
- var tMsw = 0,
- tLsw = 0;
- for (var y = 0; y < 5; y++) {
- var lane = state[x + 5 * y];
- tMsw ^= lane.high;
- tLsw ^= lane.low;
- }
- // Temporary values
- var Tx = T[x];
- Tx.high = tMsw;
- Tx.low = tLsw;
- }
- for (var x = 0; x < 5; x++) {
- // Shortcuts
- var Tx4 = T[(x + 4) % 5];
- var Tx1 = T[(x + 1) % 5];
- var Tx1Msw = Tx1.high;
- var Tx1Lsw = Tx1.low;
- // Mix surrounding columns
- var tMsw = Tx4.high ^ (Tx1Msw << 1 | Tx1Lsw >>> 31);
- var tLsw = Tx4.low ^ (Tx1Lsw << 1 | Tx1Msw >>> 31);
- for (var y = 0; y < 5; y++) {
- var lane = state[x + 5 * y];
- lane.high ^= tMsw;
- lane.low ^= tLsw;
- }
- }
- // Rho Pi
- for (var laneIndex = 1; laneIndex < 25; laneIndex++) {
- var tMsw;
- var tLsw;
- // Shortcuts
- var lane = state[laneIndex];
- var laneMsw = lane.high;
- var laneLsw = lane.low;
- var rhoOffset = RHO_OFFSETS[laneIndex];
- // Rotate lanes
- if (rhoOffset < 32) {
- tMsw = laneMsw << rhoOffset | laneLsw >>> 32 - rhoOffset;
- tLsw = laneLsw << rhoOffset | laneMsw >>> 32 - rhoOffset;
- } else /* if (rhoOffset >= 32) */{
- tMsw = laneLsw << rhoOffset - 32 | laneMsw >>> 64 - rhoOffset;
- tLsw = laneMsw << rhoOffset - 32 | laneLsw >>> 64 - rhoOffset;
- }
- // Transpose lanes
- var TPiLane = T[PI_INDEXES[laneIndex]];
- TPiLane.high = tMsw;
- TPiLane.low = tLsw;
- }
- // Rho pi at x = y = 0
- var T0 = T[0];
- var state0 = state[0];
- T0.high = state0.high;
- T0.low = state0.low;
- // Chi
- for (var x = 0; x < 5; x++) {
- for (var y = 0; y < 5; y++) {
- // Shortcuts
- var laneIndex = x + 5 * y;
- var lane = state[laneIndex];
- var TLane = T[laneIndex];
- var Tx1Lane = T[(x + 1) % 5 + 5 * y];
- var Tx2Lane = T[(x + 2) % 5 + 5 * y];
- // Mix rows
- lane.high = TLane.high ^ ~Tx1Lane.high & Tx2Lane.high;
- lane.low = TLane.low ^ ~Tx1Lane.low & Tx2Lane.low;
- }
- }
- // Iota
- var lane = state[0];
- var roundConstant = ROUND_CONSTANTS[round];
- lane.high ^= roundConstant.high;
- lane.low ^= roundConstant.low;
- }
- },
- _doFinalize: function _doFinalize() {
- // Shortcuts
- var data = this._data;
- var dataWords = data.words;
- var nBitsTotal = this._nDataBytes * 8;
- var nBitsLeft = data.sigBytes * 8;
- var blockSizeBits = this.blockSize * 32;
- // Add padding
- dataWords[nBitsLeft >>> 5] |= 0x1 << 24 - nBitsLeft % 32;
- dataWords[(Math.ceil((nBitsLeft + 1) / blockSizeBits) * blockSizeBits >>> 5) - 1] |= 0x80;
- data.sigBytes = dataWords.length * 4;
- // Hash final blocks
- this._process();
- // Shortcuts
- var state = this._state;
- var outputLengthBytes = this.cfg.outputLength / 8;
- var outputLengthLanes = outputLengthBytes / 8;
- // Squeeze
- var hashWords = [];
- for (var i = 0; i < outputLengthLanes; i++) {
- // Shortcuts
- var lane = state[i];
- var laneMsw = lane.high;
- var laneLsw = lane.low;
- // Swap endian
- laneMsw = (laneMsw << 8 | laneMsw >>> 24) & 0x00ff00ff | (laneMsw << 24 | laneMsw >>> 8) & 0xff00ff00;
- laneLsw = (laneLsw << 8 | laneLsw >>> 24) & 0x00ff00ff | (laneLsw << 24 | laneLsw >>> 8) & 0xff00ff00;
- // Squeeze state to retrieve hash
- hashWords.push(laneLsw);
- hashWords.push(laneMsw);
- }
- // Return final computed hash
- return new WordArray.init(hashWords, outputLengthBytes);
- },
- clone: function clone() {
- var clone = Hasher.clone.call(this);
- var state = clone._state = this._state.slice(0);
- for (var i = 0; i < 25; i++) {
- state[i] = state[i].clone();
- }
- return clone;
- }
- });
- /**
- * Shortcut function to the hasher's object interface.
- *
- * @param {WordArray|string} message The message to hash.
- *
- * @return {WordArray} The hash.
- *
- * @static
- *
- * @example
- *
- * var hash = CryptoJS.SHA3('message');
- * var hash = CryptoJS.SHA3(wordArray);
- */
- C.SHA3 = Hasher._createHelper(SHA3);
- /**
- * Shortcut function to the HMAC's object interface.
- *
- * @param {WordArray|string} message The message to hash.
- * @param {WordArray|string} key The secret key.
- *
- * @return {WordArray} The HMAC.
- *
- * @static
- *
- * @example
- *
- * var hmac = CryptoJS.HmacSHA3(message, key);
- */
- C.HmacSHA3 = Hasher._createHmacHelper(SHA3);
- })(Math);
- /** @preserve
- (c) 2012 by Cédric Mesnil. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
- - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- (function (Math) {
- // Shortcuts
- var C = CryptoJS;
- var C_lib = C.lib;
- var WordArray = C_lib.WordArray;
- var Hasher = C_lib.Hasher;
- var C_algo = C.algo;
- // Constants table
- var _zl = WordArray.create([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]);
- var _zr = WordArray.create([5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]);
- var _sl = WordArray.create([11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6]);
- var _sr = WordArray.create([8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11]);
- var _hl = WordArray.create([0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]);
- var _hr = WordArray.create([0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]);
- /**
- * RIPEMD160 hash algorithm.
- */
- var RIPEMD160 = C_algo.RIPEMD160 = Hasher.extend({
- _doReset: function _doReset() {
- this._hash = WordArray.create([0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]);
- },
- _doProcessBlock: function _doProcessBlock(M, offset) {
- // Swap endian
- for (var i = 0; i < 16; i++) {
- // Shortcuts
- var offset_i = offset + i;
- var M_offset_i = M[offset_i];
- // Swap
- M[offset_i] = (M_offset_i << 8 | M_offset_i >>> 24) & 0x00ff00ff | (M_offset_i << 24 | M_offset_i >>> 8) & 0xff00ff00;
- }
- // Shortcut
- var H = this._hash.words;
- var hl = _hl.words;
- var hr = _hr.words;
- var zl = _zl.words;
- var zr = _zr.words;
- var sl = _sl.words;
- var sr = _sr.words;
- // Working variables
- var al, bl, cl, dl, el;
- var ar, br, cr, dr, er;
- ar = al = H[0];
- br = bl = H[1];
- cr = cl = H[2];
- dr = dl = H[3];
- er = el = H[4];
- // Computation
- var t;
- for (var i = 0; i < 80; i += 1) {
- t = al + M[offset + zl[i]] | 0;
- if (i < 16) {
- t += f1(bl, cl, dl) + hl[0];
- } else if (i < 32) {
- t += f2(bl, cl, dl) + hl[1];
- } else if (i < 48) {
- t += f3(bl, cl, dl) + hl[2];
- } else if (i < 64) {
- t += f4(bl, cl, dl) + hl[3];
- } else {
- // if (i<80) {
- t += f5(bl, cl, dl) + hl[4];
- }
- t = t | 0;
- t = rotl(t, sl[i]);
- t = t + el | 0;
- al = el;
- el = dl;
- dl = rotl(cl, 10);
- cl = bl;
- bl = t;
- t = ar + M[offset + zr[i]] | 0;
- if (i < 16) {
- t += f5(br, cr, dr) + hr[0];
- } else if (i < 32) {
- t += f4(br, cr, dr) + hr[1];
- } else if (i < 48) {
- t += f3(br, cr, dr) + hr[2];
- } else if (i < 64) {
- t += f2(br, cr, dr) + hr[3];
- } else {
- // if (i<80) {
- t += f1(br, cr, dr) + hr[4];
- }
- t = t | 0;
- t = rotl(t, sr[i]);
- t = t + er | 0;
- ar = er;
- er = dr;
- dr = rotl(cr, 10);
- cr = br;
- br = t;
- }
- // Intermediate hash value
- t = H[1] + cl + dr | 0;
- H[1] = H[2] + dl + er | 0;
- H[2] = H[3] + el + ar | 0;
- H[3] = H[4] + al + br | 0;
- H[4] = H[0] + bl + cr | 0;
- H[0] = t;
- },
- _doFinalize: function _doFinalize() {
- // Shortcuts
- var data = this._data;
- var dataWords = data.words;
- var nBitsTotal = this._nDataBytes * 8;
- var nBitsLeft = data.sigBytes * 8;
- // Add padding
- dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32;
- dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = (nBitsTotal << 8 | nBitsTotal >>> 24) & 0x00ff00ff | (nBitsTotal << 24 | nBitsTotal >>> 8) & 0xff00ff00;
- data.sigBytes = (dataWords.length + 1) * 4;
- // Hash final blocks
- this._process();
- // Shortcuts
- var hash = this._hash;
- var H = hash.words;
- // Swap endian
- for (var i = 0; i < 5; i++) {
- // Shortcut
- var H_i = H[i];
- // Swap
- H[i] = (H_i << 8 | H_i >>> 24) & 0x00ff00ff | (H_i << 24 | H_i >>> 8) & 0xff00ff00;
- }
- // Return final computed hash
- return hash;
- },
- clone: function clone() {
- var clone = Hasher.clone.call(this);
- clone._hash = this._hash.clone();
- return clone;
- }
- });
- function f1(x, y, z) {
- return x ^ y ^ z;
- }
- function f2(x, y, z) {
- return x & y | ~x & z;
- }
- function f3(x, y, z) {
- return (x | ~y) ^ z;
- }
- function f4(x, y, z) {
- return x & z | y & ~z;
- }
- function f5(x, y, z) {
- return x ^ (y | ~z);
- }
- function rotl(x, n) {
- return x << n | x >>> 32 - n;
- }
- /**
- * Shortcut function to the hasher's object interface.
- *
- * @param {WordArray|string} message The message to hash.
- *
- * @return {WordArray} The hash.
- *
- * @static
- *
- * @example
- *
- * var hash = CryptoJS.RIPEMD160('message');
- * var hash = CryptoJS.RIPEMD160(wordArray);
- */
- C.RIPEMD160 = Hasher._createHelper(RIPEMD160);
- /**
- * Shortcut function to the HMAC's object interface.
- *
- * @param {WordArray|string} message The message to hash.
- * @param {WordArray|string} key The secret key.
- *
- * @return {WordArray} The HMAC.
- *
- * @static
- *
- * @example
- *
- * var hmac = CryptoJS.HmacRIPEMD160(message, key);
- */
- C.HmacRIPEMD160 = Hasher._createHmacHelper(RIPEMD160);
- })(Math);
- (function () {
- // Shortcuts
- var C = CryptoJS;
- var C_lib = C.lib;
- var Base = C_lib.Base;
- var C_enc = C.enc;
- var Utf8 = C_enc.Utf8;
- var C_algo = C.algo;
- /**
- * HMAC algorithm.
- */
- var HMAC = C_algo.HMAC = Base.extend({
- /**
- * Initializes a newly created HMAC.
- *
- * @param {Hasher} hasher The hash algorithm to use.
- * @param {WordArray|string} key The secret key.
- *
- * @example
- *
- * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);
- */
- init: function init(hasher, key) {
- // Init hasher
- hasher = this._hasher = new hasher.init();
- // Convert string to WordArray, else assume WordArray already
- if (typeof key == 'string') {
- key = Utf8.parse(key);
- }
- // Shortcuts
- var hasherBlockSize = hasher.blockSize;
- var hasherBlockSizeBytes = hasherBlockSize * 4;
- // Allow arbitrary length keys
- if (key.sigBytes > hasherBlockSizeBytes) {
- key = hasher.finalize(key);
- }
- // Clamp excess bits
- key.clamp();
- // Clone key for inner and outer pads
- var oKey = this._oKey = key.clone();
- var iKey = this._iKey = key.clone();
- // Shortcuts
- var oKeyWords = oKey.words;
- var iKeyWords = iKey.words;
- // XOR keys with pad constants
- for (var i = 0; i < hasherBlockSize; i++) {
- oKeyWords[i] ^= 0x5c5c5c5c;
- iKeyWords[i] ^= 0x36363636;
- }
- oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;
- // Set initial values
- this.reset();
- },
- /**
- * Resets this HMAC to its initial state.
- *
- * @example
- *
- * hmacHasher.reset();
- */
- reset: function reset() {
- // Shortcut
- var hasher = this._hasher;
- // Reset
- hasher.reset();
- hasher.update(this._iKey);
- },
- /**
- * Updates this HMAC with a message.
- *
- * @param {WordArray|string} messageUpdate The message to append.
- *
- * @return {HMAC} This HMAC instance.
- *
- * @example
- *
- * hmacHasher.update('message');
- * hmacHasher.update(wordArray);
- */
- update: function update(messageUpdate) {
- this._hasher.update(messageUpdate);
- // Chainable
- return this;
- },
- /**
- * Finalizes the HMAC computation.
- * Note that the finalize operation is effectively a destructive, read-once operation.
- *
- * @param {WordArray|string} messageUpdate (Optional) A final message update.
- *
- * @return {WordArray} The HMAC.
- *
- * @example
- *
- * var hmac = hmacHasher.finalize();
- * var hmac = hmacHasher.finalize('message');
- * var hmac = hmacHasher.finalize(wordArray);
- */
- finalize: function finalize(messageUpdate) {
- // Shortcut
- var hasher = this._hasher;
- // Compute HMAC
- var innerHash = hasher.finalize(messageUpdate);
- hasher.reset();
- var hmac = hasher.finalize(this._oKey.clone().concat(innerHash));
- return hmac;
- }
- });
- })();
- (function () {
- // Shortcuts
- var C = CryptoJS;
- var C_lib = C.lib;
- var Base = C_lib.Base;
- var WordArray = C_lib.WordArray;
- var C_algo = C.algo;
- var SHA1 = C_algo.SHA1;
- var HMAC = C_algo.HMAC;
- /**
- * Password-Based Key Derivation Function 2 algorithm.
- */
- var PBKDF2 = C_algo.PBKDF2 = Base.extend({
- /**
- * Configuration options.
- *
- * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
- * @property {Hasher} hasher The hasher to use. Default: SHA1
- * @property {number} iterations The number of iterations to perform. Default: 1
- */
- cfg: Base.extend({
- keySize: 128 / 32,
- hasher: SHA1,
- iterations: 1
- }),
- /**
- * Initializes a newly created key derivation function.
- *
- * @param {Object} cfg (Optional) The configuration options to use for the derivation.
- *
- * @example
- *
- * var kdf = CryptoJS.algo.PBKDF2.create();
- * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8 });
- * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8, iterations: 1000 });
- */
- init: function init(cfg) {
- this.cfg = this.cfg.extend(cfg);
- },
- /**
- * Computes the Password-Based Key Derivation Function 2.
- *
- * @param {WordArray|string} password The password.
- * @param {WordArray|string} salt A salt.
- *
- * @return {WordArray} The derived key.
- *
- * @example
- *
- * var key = kdf.compute(password, salt);
- */
- compute: function compute(password, salt) {
- // Shortcut
- var cfg = this.cfg;
- // Init HMAC
- var hmac = HMAC.create(cfg.hasher, password);
- // Initial values
- var derivedKey = WordArray.create();
- var blockIndex = WordArray.create([0x00000001]);
- // Shortcuts
- var derivedKeyWords = derivedKey.words;
- var blockIndexWords = blockIndex.words;
- var keySize = cfg.keySize;
- var iterations = cfg.iterations;
- // Generate key
- while (derivedKeyWords.length < keySize) {
- var block = hmac.update(salt).finalize(blockIndex);
- hmac.reset();
- // Shortcuts
- var blockWords = block.words;
- var blockWordsLength = blockWords.length;
- // Iterations
- var intermediate = block;
- for (var i = 1; i < iterations; i++) {
- intermediate = hmac.finalize(intermediate);
- hmac.reset();
- // Shortcut
- var intermediateWords = intermediate.words;
- // XOR intermediate with block
- for (var j = 0; j < blockWordsLength; j++) {
- blockWords[j] ^= intermediateWords[j];
- }
- }
- derivedKey.concat(block);
- blockIndexWords[0]++;
- }
- derivedKey.sigBytes = keySize * 4;
- return derivedKey;
- }
- });
- /**
- * Computes the Password-Based Key Derivation Function 2.
- *
- * @param {WordArray|string} password The password.
- * @param {WordArray|string} salt A salt.
- * @param {Object} cfg (Optional) The configuration options to use for this computation.
- *
- * @return {WordArray} The derived key.
- *
- * @static
- *
- * @example
- *
- * var key = CryptoJS.PBKDF2(password, salt);
- * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8 });
- * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 });
- */
- C.PBKDF2 = function (password, salt, cfg) {
- return PBKDF2.create(cfg).compute(password, salt);
- };
- })();
- (function () {
- // Shortcuts
- var C = CryptoJS;
- var C_lib = C.lib;
- var Base = C_lib.Base;
- var WordArray = C_lib.WordArray;
- var C_algo = C.algo;
- var MD5 = C_algo.MD5;
- /**
- * This key derivation function is meant to conform with EVP_BytesToKey.
- * www.openssl.org/docs/crypto/EVP_BytesToKey.html
- */
- var EvpKDF = C_algo.EvpKDF = Base.extend({
- /**
- * Configuration options.
- *
- * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
- * @property {Hasher} hasher The hash algorithm to use. Default: MD5
- * @property {number} iterations The number of iterations to perform. Default: 1
- */
- cfg: Base.extend({
- keySize: 128 / 32,
- hasher: MD5,
- iterations: 1
- }),
- /**
- * Initializes a newly created key derivation function.
- *
- * @param {Object} cfg (Optional) The configuration options to use for the derivation.
- *
- * @example
- *
- * var kdf = CryptoJS.algo.EvpKDF.create();
- * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 });
- * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 });
- */
- init: function init(cfg) {
- this.cfg = this.cfg.extend(cfg);
- },
- /**
- * Derives a key from a password.
- *
- * @param {WordArray|string} password The password.
- * @param {WordArray|string} salt A salt.
- *
- * @return {WordArray} The derived key.
- *
- * @example
- *
- * var key = kdf.compute(password, salt);
- */
- compute: function compute(password, salt) {
- var block;
- // Shortcut
- var cfg = this.cfg;
- // Init hasher
- var hasher = cfg.hasher.create();
- // Initial values
- var derivedKey = WordArray.create();
- // Shortcuts
- var derivedKeyWords = derivedKey.words;
- var keySize = cfg.keySize;
- var iterations = cfg.iterations;
- // Generate key
- while (derivedKeyWords.length < keySize) {
- if (block) {
- hasher.update(block);
- }
- block = hasher.update(password).finalize(salt);
- hasher.reset();
- // Iterations
- for (var i = 1; i < iterations; i++) {
- block = hasher.finalize(block);
- hasher.reset();
- }
- derivedKey.concat(block);
- }
- derivedKey.sigBytes = keySize * 4;
- return derivedKey;
- }
- });
- /**
- * Derives a key from a password.
- *
- * @param {WordArray|string} password The password.
- * @param {WordArray|string} salt A salt.
- * @param {Object} cfg (Optional) The configuration options to use for this computation.
- *
- * @return {WordArray} The derived key.
- *
- * @static
- *
- * @example
- *
- * var key = CryptoJS.EvpKDF(password, salt);
- * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 });
- * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 });
- */
- C.EvpKDF = function (password, salt, cfg) {
- return EvpKDF.create(cfg).compute(password, salt);
- };
- })();
- /**
- * Cipher core components.
- */
- CryptoJS.lib.Cipher || function (undefined) {
- // Shortcuts
- var C = CryptoJS;
- var C_lib = C.lib;
- var Base = C_lib.Base;
- var WordArray = C_lib.WordArray;
- var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm;
- var C_enc = C.enc;
- var Utf8 = C_enc.Utf8;
- var Base64 = C_enc.Base64;
- var C_algo = C.algo;
- var EvpKDF = C_algo.EvpKDF;
- /**
- * Abstract base cipher template.
- *
- * @property {number} keySize This cipher's key size. Default: 4 (128 bits)
- * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits)
- * @property {number} _ENC_XFORM_MODE A constant representing encryption mode.
- * @property {number} _DEC_XFORM_MODE A constant representing decryption mode.
- */
- var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({
- /**
- * Configuration options.
- *
- * @property {WordArray} iv The IV to use for this operation.
- */
- cfg: Base.extend(),
- /**
- * Creates this cipher in encryption mode.
- *
- * @param {WordArray} key The key.
- * @param {Object} cfg (Optional) The configuration options to use for this operation.
- *
- * @return {Cipher} A cipher instance.
- *
- * @static
- *
- * @example
- *
- * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });
- */
- createEncryptor: function createEncryptor(key, cfg) {
- return this.create(this._ENC_XFORM_MODE, key, cfg);
- },
- /**
- * Creates this cipher in decryption mode.
- *
- * @param {WordArray} key The key.
- * @param {Object} cfg (Optional) The configuration options to use for this operation.
- *
- * @return {Cipher} A cipher instance.
- *
- * @static
- *
- * @example
- *
- * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });
- */
- createDecryptor: function createDecryptor(key, cfg) {
- return this.create(this._DEC_XFORM_MODE, key, cfg);
- },
- /**
- * Initializes a newly created cipher.
- *
- * @param {number} xformMode Either the encryption or decryption transormation mode constant.
- * @param {WordArray} key The key.
- * @param {Object} cfg (Optional) The configuration options to use for this operation.
- *
- * @example
- *
- * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray });
- */
- init: function init(xformMode, key, cfg) {
- // Apply config defaults
- this.cfg = this.cfg.extend(cfg);
- // Store transform mode and key
- this._xformMode = xformMode;
- this._key = key;
- // Set initial values
- this.reset();
- },
- /**
- * Resets this cipher to its initial state.
- *
- * @example
- *
- * cipher.reset();
- */
- reset: function reset() {
- // Reset data buffer
- BufferedBlockAlgorithm.reset.call(this);
- // Perform concrete-cipher logic
- this._doReset();
- },
- /**
- * Adds data to be encrypted or decrypted.
- *
- * @param {WordArray|string} dataUpdate The data to encrypt or decrypt.
- *
- * @return {WordArray} The data after processing.
- *
- * @example
- *
- * var encrypted = cipher.process('data');
- * var encrypted = cipher.process(wordArray);
- */
- process: function process(dataUpdate) {
- // Append
- this._append(dataUpdate);
- // Process available blocks
- return this._process();
- },
- /**
- * Finalizes the encryption or decryption process.
- * Note that the finalize operation is effectively a destructive, read-once operation.
- *
- * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt.
- *
- * @return {WordArray} The data after final processing.
- *
- * @example
- *
- * var encrypted = cipher.finalize();
- * var encrypted = cipher.finalize('data');
- * var encrypted = cipher.finalize(wordArray);
- */
- finalize: function finalize(dataUpdate) {
- // Final data update
- if (dataUpdate) {
- this._append(dataUpdate);
- }
- // Perform concrete-cipher logic
- var finalProcessedData = this._doFinalize();
- return finalProcessedData;
- },
- keySize: 128 / 32,
- ivSize: 128 / 32,
- _ENC_XFORM_MODE: 1,
- _DEC_XFORM_MODE: 2,
- /**
- * Creates shortcut functions to a cipher's object interface.
- *
- * @param {Cipher} cipher The cipher to create a helper for.
- *
- * @return {Object} An object with encrypt and decrypt shortcut functions.
- *
- * @static
- *
- * @example
- *
- * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);
- */
- _createHelper: function () {
- function selectCipherStrategy(key) {
- if (typeof key == 'string') {
- return PasswordBasedCipher;
- } else {
- return SerializableCipher;
- }
- }
- return function (cipher) {
- return {
- encrypt: function encrypt(message, key, cfg) {
- return selectCipherStrategy(key).encrypt(cipher, message, key, cfg);
- },
- decrypt: function decrypt(ciphertext, key, cfg) {
- return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg);
- }
- };
- };
- }()
- });
- /**
- * Abstract base stream cipher template.
- *
- * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits)
- */
- var StreamCipher = C_lib.StreamCipher = Cipher.extend({
- _doFinalize: function _doFinalize() {
- // Process partial blocks
- var finalProcessedBlocks = this._process(!!'flush');
- return finalProcessedBlocks;
- },
- blockSize: 1
- });
- /**
- * Mode namespace.
- */
- var C_mode = C.mode = {};
- /**
- * Abstract base block cipher mode template.
- */
- var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({
- /**
- * Creates this mode for encryption.
- *
- * @param {Cipher} cipher A block cipher instance.
- * @param {Array} iv The IV words.
- *
- * @static
- *
- * @example
- *
- * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);
- */
- createEncryptor: function createEncryptor(cipher, iv) {
- return this.Encryptor.create(cipher, iv);
- },
- /**
- * Creates this mode for decryption.
- *
- * @param {Cipher} cipher A block cipher instance.
- * @param {Array} iv The IV words.
- *
- * @static
- *
- * @example
- *
- * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);
- */
- createDecryptor: function createDecryptor(cipher, iv) {
- return this.Decryptor.create(cipher, iv);
- },
- /**
- * Initializes a newly created mode.
- *
- * @param {Cipher} cipher A block cipher instance.
- * @param {Array} iv The IV words.
- *
- * @example
- *
- * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words);
- */
- init: function init(cipher, iv) {
- this._cipher = cipher;
- this._iv = iv;
- }
- });
- /**
- * Cipher Block Chaining mode.
- */
- var CBC = C_mode.CBC = function () {
- /**
- * Abstract base CBC mode.
- */
- var CBC = BlockCipherMode.extend();
- /**
- * CBC encryptor.
- */
- CBC.Encryptor = CBC.extend({
- /**
- * Processes the data block at offset.
- *
- * @param {Array} words The data words to operate on.
- * @param {number} offset The offset where the block starts.
- *
- * @example
- *
- * mode.processBlock(data.words, offset);
- */
- processBlock: function processBlock(words, offset) {
- // Shortcuts
- var cipher = this._cipher;
- var blockSize = cipher.blockSize;
- // XOR and encrypt
- xorBlock.call(this, words, offset, blockSize);
- cipher.encryptBlock(words, offset);
- // Remember this block to use with next block
- this._prevBlock = words.slice(offset, offset + blockSize);
- }
- });
- /**
- * CBC decryptor.
- */
- CBC.Decryptor = CBC.extend({
- /**
- * Processes the data block at offset.
- *
- * @param {Array} words The data words to operate on.
- * @param {number} offset The offset where the block starts.
- *
- * @example
- *
- * mode.processBlock(data.words, offset);
- */
- processBlock: function processBlock(words, offset) {
- // Shortcuts
- var cipher = this._cipher;
- var blockSize = cipher.blockSize;
- // Remember this block to use with next block
- var thisBlock = words.slice(offset, offset + blockSize);
- // Decrypt and XOR
- cipher.decryptBlock(words, offset);
- xorBlock.call(this, words, offset, blockSize);
- // This block becomes the previous block
- this._prevBlock = thisBlock;
- }
- });
- function xorBlock(words, offset, blockSize) {
- var block;
- // Shortcut
- var iv = this._iv;
- // Choose mixing block
- if (iv) {
- block = iv;
- // Remove IV for subsequent blocks
- this._iv = undefined;
- } else {
- block = this._prevBlock;
- }
- // XOR blocks
- for (var i = 0; i < blockSize; i++) {
- words[offset + i] ^= block[i];
- }
- }
- return CBC;
- }();
- /**
- * Padding namespace.
- */
- var C_pad = C.pad = {};
- /**
- * PKCS #5/7 padding strategy.
- */
- var Pkcs7 = C_pad.Pkcs7 = {
- /**
- * Pads data using the algorithm defined in PKCS #5/7.
- *
- * @param {WordArray} data The data to pad.
- * @param {number} blockSize The multiple that the data should be padded to.
- *
- * @static
- *
- * @example
- *
- * CryptoJS.pad.Pkcs7.pad(wordArray, 4);
- */
- pad: function pad(data, blockSize) {
- // Shortcut
- var blockSizeBytes = blockSize * 4;
- // Count padding bytes
- var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
- // Create padding word
- var paddingWord = nPaddingBytes << 24 | nPaddingBytes << 16 | nPaddingBytes << 8 | nPaddingBytes;
- // Create padding
- var paddingWords = [];
- for (var i = 0; i < nPaddingBytes; i += 4) {
- paddingWords.push(paddingWord);
- }
- var padding = WordArray.create(paddingWords, nPaddingBytes);
- // Add padding
- data.concat(padding);
- },
- /**
- * Unpads data that had been padded using the algorithm defined in PKCS #5/7.
- *
- * @param {WordArray} data The data to unpad.
- *
- * @static
- *
- * @example
- *
- * CryptoJS.pad.Pkcs7.unpad(wordArray);
- */
- unpad: function unpad(data) {
- // Get number of padding bytes from last byte
- var nPaddingBytes = data.words[data.sigBytes - 1 >>> 2] & 0xff;
- // Remove padding
- data.sigBytes -= nPaddingBytes;
- }
- };
- /**
- * Abstract base block cipher template.
- *
- * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits)
- */
- var BlockCipher = C_lib.BlockCipher = Cipher.extend({
- /**
- * Configuration options.
- *
- * @property {Mode} mode The block mode to use. Default: CBC
- * @property {Padding} padding The padding strategy to use. Default: Pkcs7
- */
- cfg: Cipher.cfg.extend({
- mode: CBC,
- padding: Pkcs7
- }),
- reset: function reset() {
- var modeCreator;
- // Reset cipher
- Cipher.reset.call(this);
- // Shortcuts
- var cfg = this.cfg;
- var iv = cfg.iv;
- var mode = cfg.mode;
- // Reset block mode
- if (this._xformMode == this._ENC_XFORM_MODE) {
- modeCreator = mode.createEncryptor;
- } else /* if (this._xformMode == this._DEC_XFORM_MODE) */{
- modeCreator = mode.createDecryptor;
- // Keep at least one block in the buffer for unpadding
- this._minBufferSize = 1;
- }
- if (this._mode && this._mode.__creator == modeCreator) {
- this._mode.init(this, iv && iv.words);
- } else {
- this._mode = modeCreator.call(mode, this, iv && iv.words);
- this._mode.__creator = modeCreator;
- }
- },
- _doProcessBlock: function _doProcessBlock(words, offset) {
- this._mode.processBlock(words, offset);
- },
- _doFinalize: function _doFinalize() {
- var finalProcessedBlocks;
- // Shortcut
- var padding = this.cfg.padding;
- // Finalize
- if (this._xformMode == this._ENC_XFORM_MODE) {
- // Pad data
- padding.pad(this._data, this.blockSize);
- // Process final blocks
- finalProcessedBlocks = this._process(!!'flush');
- } else /* if (this._xformMode == this._DEC_XFORM_MODE) */{
- // Process final blocks
- finalProcessedBlocks = this._process(!!'flush');
- // Unpad data
- padding.unpad(finalProcessedBlocks);
- }
- return finalProcessedBlocks;
- },
- blockSize: 128 / 32
- });
- /**
- * A collection of cipher parameters.
- *
- * @property {WordArray} ciphertext The raw ciphertext.
- * @property {WordArray} key The key to this ciphertext.
- * @property {WordArray} iv The IV used in the ciphering operation.
- * @property {WordArray} salt The salt used with a key derivation function.
- * @property {Cipher} algorithm The cipher algorithm.
- * @property {Mode} mode The block mode used in the ciphering operation.
- * @property {Padding} padding The padding scheme used in the ciphering operation.
- * @property {number} blockSize The block size of the cipher.
- * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string.
- */
- var CipherParams = C_lib.CipherParams = Base.extend({
- /**
- * Initializes a newly created cipher params object.
- *
- * @param {Object} cipherParams An object with any of the possible cipher parameters.
- *
- * @example
- *
- * var cipherParams = CryptoJS.lib.CipherParams.create({
- * ciphertext: ciphertextWordArray,
- * key: keyWordArray,
- * iv: ivWordArray,
- * salt: saltWordArray,
- * algorithm: CryptoJS.algo.AES,
- * mode: CryptoJS.mode.CBC,
- * padding: CryptoJS.pad.PKCS7,
- * blockSize: 4,
- * formatter: CryptoJS.format.OpenSSL
- * });
- */
- init: function init(cipherParams) {
- this.mixIn(cipherParams);
- },
- /**
- * Converts this cipher params object to a string.
- *
- * @param {Format} formatter (Optional) The formatting strategy to use.
- *
- * @return {string} The stringified cipher params.
- *
- * @throws Error If neither the formatter nor the default formatter is set.
- *
- * @example
- *
- * var string = cipherParams + '';
- * var string = cipherParams.toString();
- * var string = cipherParams.toString(CryptoJS.format.OpenSSL);
- */
- toString: function toString(formatter) {
- return (formatter || this.formatter).stringify(this);
- }
- });
- /**
- * Format namespace.
- */
- var C_format = C.format = {};
- /**
- * OpenSSL formatting strategy.
- */
- var OpenSSLFormatter = C_format.OpenSSL = {
- /**
- * Converts a cipher params object to an OpenSSL-compatible string.
- *
- * @param {CipherParams} cipherParams The cipher params object.
- *
- * @return {string} The OpenSSL-compatible string.
- *
- * @static
- *
- * @example
- *
- * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);
- */
- stringify: function stringify(cipherParams) {
- var wordArray;
- // Shortcuts
- var ciphertext = cipherParams.ciphertext;
- var salt = cipherParams.salt;
- // Format
- if (salt) {
- wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext);
- } else {
- wordArray = ciphertext;
- }
- return wordArray.toString(Base64);
- },
- /**
- * Converts an OpenSSL-compatible string to a cipher params object.
- *
- * @param {string} openSSLStr The OpenSSL-compatible string.
- *
- * @return {CipherParams} The cipher params object.
- *
- * @static
- *
- * @example
- *
- * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);
- */
- parse: function parse(openSSLStr) {
- var salt;
- // Parse base64
- var ciphertext = Base64.parse(openSSLStr);
- // Shortcut
- var ciphertextWords = ciphertext.words;
- // Test for salt
- if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) {
- // Extract salt
- salt = WordArray.create(ciphertextWords.slice(2, 4));
- // Remove salt from ciphertext
- ciphertextWords.splice(0, 4);
- ciphertext.sigBytes -= 16;
- }
- return CipherParams.create({
- ciphertext: ciphertext,
- salt: salt
- });
- }
- };
- /**
- * A cipher wrapper that returns ciphertext as a serializable cipher params object.
- */
- var SerializableCipher = C_lib.SerializableCipher = Base.extend({
- /**
- * Configuration options.
- *
- * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL
- */
- cfg: Base.extend({
- format: OpenSSLFormatter
- }),
- /**
- * Encrypts a message.
- *
- * @param {Cipher} cipher The cipher algorithm to use.
- * @param {WordArray|string} message The message to encrypt.
- * @param {WordArray} key The key.
- * @param {Object} cfg (Optional) The configuration options to use for this operation.
- *
- * @return {CipherParams} A cipher params object.
- *
- * @static
- *
- * @example
- *
- * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key);
- * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv });
- * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });
- */
- encrypt: function encrypt(cipher, message, key, cfg) {
- // Apply config defaults
- cfg = this.cfg.extend(cfg);
- // Encrypt
- var encryptor = cipher.createEncryptor(key, cfg);
- var ciphertext = encryptor.finalize(message);
- // Shortcut
- var cipherCfg = encryptor.cfg;
- // Create and return serializable cipher params
- return CipherParams.create({
- ciphertext: ciphertext,
- key: key,
- iv: cipherCfg.iv,
- algorithm: cipher,
- mode: cipherCfg.mode,
- padding: cipherCfg.padding,
- blockSize: cipher.blockSize,
- formatter: cfg.format
- });
- },
- /**
- * Decrypts serialized ciphertext.
- *
- * @param {Cipher} cipher The cipher algorithm to use.
- * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
- * @param {WordArray} key The key.
- * @param {Object} cfg (Optional) The configuration options to use for this operation.
- *
- * @return {WordArray} The plaintext.
- *
- * @static
- *
- * @example
- *
- * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL });
- * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL });
- */
- decrypt: function decrypt(cipher, ciphertext, key, cfg) {
- // Apply config defaults
- cfg = this.cfg.extend(cfg);
- // Convert string to CipherParams
- ciphertext = this._parse(ciphertext, cfg.format);
- // Decrypt
- var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext);
- return plaintext;
- },
- /**
- * Converts serialized ciphertext to CipherParams,
- * else assumed CipherParams already and returns ciphertext unchanged.
- *
- * @param {CipherParams|string} ciphertext The ciphertext.
- * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext.
- *
- * @return {CipherParams} The unserialized ciphertext.
- *
- * @static
- *
- * @example
- *
- * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format);
- */
- _parse: function _parse(ciphertext, format) {
- if (typeof ciphertext == 'string') {
- return format.parse(ciphertext, this);
- } else {
- return ciphertext;
- }
- }
- });
- /**
- * Key derivation function namespace.
- */
- var C_kdf = C.kdf = {};
- /**
- * OpenSSL key derivation function.
- */
- var OpenSSLKdf = C_kdf.OpenSSL = {
- /**
- * Derives a key and IV from a password.
- *
- * @param {string} password The password to derive from.
- * @param {number} keySize The size in words of the key to generate.
- * @param {number} ivSize The size in words of the IV to generate.
- * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly.
- *
- * @return {CipherParams} A cipher params object with the key, IV, and salt.
- *
- * @static
- *
- * @example
- *
- * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);
- * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');
- */
- execute: function execute(password, keySize, ivSize, salt) {
- // Generate random salt
- if (!salt) {
- salt = WordArray.random(64 / 8);
- }
- // Derive key and IV
- var key = EvpKDF.create({
- keySize: keySize + ivSize
- }).compute(password, salt);
- // Separate key and IV
- var iv = WordArray.create(key.words.slice(keySize), ivSize * 4);
- key.sigBytes = keySize * 4;
- // Return params
- return CipherParams.create({
- key: key,
- iv: iv,
- salt: salt
- });
- }
- };
- /**
- * A serializable cipher wrapper that derives the key from a password,
- * and returns ciphertext as a serializable cipher params object.
- */
- var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({
- /**
- * Configuration options.
- *
- * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL
- */
- cfg: SerializableCipher.cfg.extend({
- kdf: OpenSSLKdf
- }),
- /**
- * Encrypts a message using a password.
- *
- * @param {Cipher} cipher The cipher algorithm to use.
- * @param {WordArray|string} message The message to encrypt.
- * @param {string} password The password.
- * @param {Object} cfg (Optional) The configuration options to use for this operation.
- *
- * @return {CipherParams} A cipher params object.
- *
- * @static
- *
- * @example
- *
- * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password');
- * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });
- */
- encrypt: function encrypt(cipher, message, password, cfg) {
- // Apply config defaults
- cfg = this.cfg.extend(cfg);
- // Derive key and other params
- var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize);
- // Add IV to config
- cfg.iv = derivedParams.iv;
- // Encrypt
- var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg);
- // Mix in derived params
- ciphertext.mixIn(derivedParams);
- return ciphertext;
- },
- /**
- * Decrypts serialized ciphertext using a password.
- *
- * @param {Cipher} cipher The cipher algorithm to use.
- * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
- * @param {string} password The password.
- * @param {Object} cfg (Optional) The configuration options to use for this operation.
- *
- * @return {WordArray} The plaintext.
- *
- * @static
- *
- * @example
- *
- * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL });
- * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL });
- */
- decrypt: function decrypt(cipher, ciphertext, password, cfg) {
- // Apply config defaults
- cfg = this.cfg.extend(cfg);
- // Convert string to CipherParams
- ciphertext = this._parse(ciphertext, cfg.format);
- // Derive key and other params
- var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt);
- // Add IV to config
- cfg.iv = derivedParams.iv;
- // Decrypt
- var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg);
- return plaintext;
- }
- });
- }();
- /**
- * Cipher Feedback block mode.
- */
- CryptoJS.mode.CFB = function () {
- var CFB = CryptoJS.lib.BlockCipherMode.extend();
- CFB.Encryptor = CFB.extend({
- processBlock: function processBlock(words, offset) {
- // Shortcuts
- var cipher = this._cipher;
- var blockSize = cipher.blockSize;
- generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher);
- // Remember this block to use with next block
- this._prevBlock = words.slice(offset, offset + blockSize);
- }
- });
- CFB.Decryptor = CFB.extend({
- processBlock: function processBlock(words, offset) {
- // Shortcuts
- var cipher = this._cipher;
- var blockSize = cipher.blockSize;
- // Remember this block to use with next block
- var thisBlock = words.slice(offset, offset + blockSize);
- generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher);
- // This block becomes the previous block
- this._prevBlock = thisBlock;
- }
- });
- function generateKeystreamAndEncrypt(words, offset, blockSize, cipher) {
- var keystream;
- // Shortcut
- var iv = this._iv;
- // Generate keystream
- if (iv) {
- keystream = iv.slice(0);
- // Remove IV for subsequent blocks
- this._iv = undefined;
- } else {
- keystream = this._prevBlock;
- }
- cipher.encryptBlock(keystream, 0);
- // Encrypt
- for (var i = 0; i < blockSize; i++) {
- words[offset + i] ^= keystream[i];
- }
- }
- return CFB;
- }();
- /**
- * Counter block mode.
- */
- CryptoJS.mode.CTR = function () {
- var CTR = CryptoJS.lib.BlockCipherMode.extend();
- var Encryptor = CTR.Encryptor = CTR.extend({
- processBlock: function processBlock(words, offset) {
- // Shortcuts
- var cipher = this._cipher;
- var blockSize = cipher.blockSize;
- var iv = this._iv;
- var counter = this._counter;
- // Generate keystream
- if (iv) {
- counter = this._counter = iv.slice(0);
- // Remove IV for subsequent blocks
- this._iv = undefined;
- }
- var keystream = counter.slice(0);
- cipher.encryptBlock(keystream, 0);
- // Increment counter
- counter[blockSize - 1] = counter[blockSize - 1] + 1 | 0;
- // Encrypt
- for (var i = 0; i < blockSize; i++) {
- words[offset + i] ^= keystream[i];
- }
- }
- });
- CTR.Decryptor = Encryptor;
- return CTR;
- }();
- /** @preserve
- * Counter block mode compatible with Dr Brian Gladman fileenc.c
- * derived from CryptoJS.mode.CTR
- * Jan Hruby jhruby.web@gmail.com
- */
- CryptoJS.mode.CTRGladman = function () {
- var CTRGladman = CryptoJS.lib.BlockCipherMode.extend();
- function incWord(word) {
- if ((word >> 24 & 0xff) === 0xff) {
- //overflow
- var b1 = word >> 16 & 0xff;
- var b2 = word >> 8 & 0xff;
- var b3 = word & 0xff;
- if (b1 === 0xff)
- // overflow b1
- {
- b1 = 0;
- if (b2 === 0xff) {
- b2 = 0;
- if (b3 === 0xff) {
- b3 = 0;
- } else {
- ++b3;
- }
- } else {
- ++b2;
- }
- } else {
- ++b1;
- }
- word = 0;
- word += b1 << 16;
- word += b2 << 8;
- word += b3;
- } else {
- word += 0x01 << 24;
- }
- return word;
- }
- function incCounter(counter) {
- if ((counter[0] = incWord(counter[0])) === 0) {
- // encr_data in fileenc.c from Dr Brian Gladman's counts only with DWORD j < 8
- counter[1] = incWord(counter[1]);
- }
- return counter;
- }
- var Encryptor = CTRGladman.Encryptor = CTRGladman.extend({
- processBlock: function processBlock(words, offset) {
- // Shortcuts
- var cipher = this._cipher;
- var blockSize = cipher.blockSize;
- var iv = this._iv;
- var counter = this._counter;
- // Generate keystream
- if (iv) {
- counter = this._counter = iv.slice(0);
- // Remove IV for subsequent blocks
- this._iv = undefined;
- }
- incCounter(counter);
- var keystream = counter.slice(0);
- cipher.encryptBlock(keystream, 0);
- // Encrypt
- for (var i = 0; i < blockSize; i++) {
- words[offset + i] ^= keystream[i];
- }
- }
- });
- CTRGladman.Decryptor = Encryptor;
- return CTRGladman;
- }();
- /**
- * Output Feedback block mode.
- */
- CryptoJS.mode.OFB = function () {
- var OFB = CryptoJS.lib.BlockCipherMode.extend();
- var Encryptor = OFB.Encryptor = OFB.extend({
- processBlock: function processBlock(words, offset) {
- // Shortcuts
- var cipher = this._cipher;
- var blockSize = cipher.blockSize;
- var iv = this._iv;
- var keystream = this._keystream;
- // Generate keystream
- if (iv) {
- keystream = this._keystream = iv.slice(0);
- // Remove IV for subsequent blocks
- this._iv = undefined;
- }
- cipher.encryptBlock(keystream, 0);
- // Encrypt
- for (var i = 0; i < blockSize; i++) {
- words[offset + i] ^= keystream[i];
- }
- }
- });
- OFB.Decryptor = Encryptor;
- return OFB;
- }();
- /**
- * Electronic Codebook block mode.
- */
- CryptoJS.mode.ECB = function () {
- var ECB = CryptoJS.lib.BlockCipherMode.extend();
- ECB.Encryptor = ECB.extend({
- processBlock: function processBlock(words, offset) {
- this._cipher.encryptBlock(words, offset);
- }
- });
- ECB.Decryptor = ECB.extend({
- processBlock: function processBlock(words, offset) {
- this._cipher.decryptBlock(words, offset);
- }
- });
- return ECB;
- }();
- /**
- * ANSI X.923 padding strategy.
- */
- CryptoJS.pad.AnsiX923 = {
- pad: function pad(data, blockSize) {
- // Shortcuts
- var dataSigBytes = data.sigBytes;
- var blockSizeBytes = blockSize * 4;
- // Count padding bytes
- var nPaddingBytes = blockSizeBytes - dataSigBytes % blockSizeBytes;
- // Compute last byte position
- var lastBytePos = dataSigBytes + nPaddingBytes - 1;
- // Pad
- data.clamp();
- data.words[lastBytePos >>> 2] |= nPaddingBytes << 24 - lastBytePos % 4 * 8;
- data.sigBytes += nPaddingBytes;
- },
- unpad: function unpad(data) {
- // Get number of padding bytes from last byte
- var nPaddingBytes = data.words[data.sigBytes - 1 >>> 2] & 0xff;
- // Remove padding
- data.sigBytes -= nPaddingBytes;
- }
- };
- /**
- * ISO 10126 padding strategy.
- */
- CryptoJS.pad.Iso10126 = {
- pad: function pad(data, blockSize) {
- // Shortcut
- var blockSizeBytes = blockSize * 4;
- // Count padding bytes
- var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
- // Pad
- data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes - 1)).concat(CryptoJS.lib.WordArray.create([nPaddingBytes << 24], 1));
- },
- unpad: function unpad(data) {
- // Get number of padding bytes from last byte
- var nPaddingBytes = data.words[data.sigBytes - 1 >>> 2] & 0xff;
- // Remove padding
- data.sigBytes -= nPaddingBytes;
- }
- };
- /**
- * ISO/IEC 9797-1 Padding Method 2.
- */
- CryptoJS.pad.Iso97971 = {
- pad: function pad(data, blockSize) {
- // Add 0x80 byte
- data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1));
- // Zero pad the rest
- CryptoJS.pad.ZeroPadding.pad(data, blockSize);
- },
- unpad: function unpad(data) {
- // Remove zero padding
- CryptoJS.pad.ZeroPadding.unpad(data);
- // Remove one more byte -- the 0x80 byte
- data.sigBytes--;
- }
- };
- /**
- * Zero padding strategy.
- */
- CryptoJS.pad.ZeroPadding = {
- pad: function pad(data, blockSize) {
- // Shortcut
- var blockSizeBytes = blockSize * 4;
- // Pad
- data.clamp();
- data.sigBytes += blockSizeBytes - (data.sigBytes % blockSizeBytes || blockSizeBytes);
- },
- unpad: function unpad(data) {
- // Shortcut
- var dataWords = data.words;
- // Unpad
- var i = data.sigBytes - 1;
- for (var i = data.sigBytes - 1; i >= 0; i--) {
- if (dataWords[i >>> 2] >>> 24 - i % 4 * 8 & 0xff) {
- data.sigBytes = i + 1;
- break;
- }
- }
- }
- };
- /**
- * A noop padding strategy.
- */
- CryptoJS.pad.NoPadding = {
- pad: function pad() {},
- unpad: function unpad() {}
- };
- (function (undefined) {
- // Shortcuts
- var C = CryptoJS;
- var C_lib = C.lib;
- var CipherParams = C_lib.CipherParams;
- var C_enc = C.enc;
- var Hex = C_enc.Hex;
- var C_format = C.format;
- var HexFormatter = C_format.Hex = {
- /**
- * Converts the ciphertext of a cipher params object to a hexadecimally encoded string.
- *
- * @param {CipherParams} cipherParams The cipher params object.
- *
- * @return {string} The hexadecimally encoded string.
- *
- * @static
- *
- * @example
- *
- * var hexString = CryptoJS.format.Hex.stringify(cipherParams);
- */
- stringify: function stringify(cipherParams) {
- return cipherParams.ciphertext.toString(Hex);
- },
- /**
- * Converts a hexadecimally encoded ciphertext string to a cipher params object.
- *
- * @param {string} input The hexadecimally encoded string.
- *
- * @return {CipherParams} The cipher params object.
- *
- * @static
- *
- * @example
- *
- * var cipherParams = CryptoJS.format.Hex.parse(hexString);
- */
- parse: function parse(input) {
- var ciphertext = Hex.parse(input);
- return CipherParams.create({
- ciphertext: ciphertext
- });
- }
- };
- })();
- (function () {
- // Shortcuts
- var C = CryptoJS;
- var C_lib = C.lib;
- var BlockCipher = C_lib.BlockCipher;
- var C_algo = C.algo;
- // Lookup tables
- var SBOX = [];
- var INV_SBOX = [];
- var SUB_MIX_0 = [];
- var SUB_MIX_1 = [];
- var SUB_MIX_2 = [];
- var SUB_MIX_3 = [];
- var INV_SUB_MIX_0 = [];
- var INV_SUB_MIX_1 = [];
- var INV_SUB_MIX_2 = [];
- var INV_SUB_MIX_3 = [];
- // Compute lookup tables
- (function () {
- // Compute double table
- var d = [];
- for (var i = 0; i < 256; i++) {
- if (i < 128) {
- d[i] = i << 1;
- } else {
- d[i] = i << 1 ^ 0x11b;
- }
- }
- // Walk GF(2^8)
- var x = 0;
- var xi = 0;
- for (var i = 0; i < 256; i++) {
- // Compute sbox
- var sx = xi ^ xi << 1 ^ xi << 2 ^ xi << 3 ^ xi << 4;
- sx = sx >>> 8 ^ sx & 0xff ^ 0x63;
- SBOX[x] = sx;
- INV_SBOX[sx] = x;
- // Compute multiplication
- var x2 = d[x];
- var x4 = d[x2];
- var x8 = d[x4];
- // Compute sub bytes, mix columns tables
- var t = d[sx] * 0x101 ^ sx * 0x1010100;
- SUB_MIX_0[x] = t << 24 | t >>> 8;
- SUB_MIX_1[x] = t << 16 | t >>> 16;
- SUB_MIX_2[x] = t << 8 | t >>> 24;
- SUB_MIX_3[x] = t;
- // Compute inv sub bytes, inv mix columns tables
- var t = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100;
- INV_SUB_MIX_0[sx] = t << 24 | t >>> 8;
- INV_SUB_MIX_1[sx] = t << 16 | t >>> 16;
- INV_SUB_MIX_2[sx] = t << 8 | t >>> 24;
- INV_SUB_MIX_3[sx] = t;
- // Compute next counter
- if (!x) {
- x = xi = 1;
- } else {
- x = x2 ^ d[d[d[x8 ^ x2]]];
- xi ^= d[d[xi]];
- }
- }
- })();
- // Precomputed Rcon lookup
- var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];
- /**
- * AES block cipher algorithm.
- */
- var AES = C_algo.AES = BlockCipher.extend({
- _doReset: function _doReset() {
- var t;
- // Skip reset of nRounds has been set before and key did not change
- if (this._nRounds && this._keyPriorReset === this._key) {
- return;
- }
- // Shortcuts
- var key = this._keyPriorReset = this._key;
- var keyWords = key.words;
- var keySize = key.sigBytes / 4;
- // Compute number of rounds
- var nRounds = this._nRounds = keySize + 6;
- // Compute number of key schedule rows
- var ksRows = (nRounds + 1) * 4;
- // Compute key schedule
- var keySchedule = this._keySchedule = [];
- for (var ksRow = 0; ksRow < ksRows; ksRow++) {
- if (ksRow < keySize) {
- keySchedule[ksRow] = keyWords[ksRow];
- } else {
- t = keySchedule[ksRow - 1];
- if (!(ksRow % keySize)) {
- // Rot word
- t = t << 8 | t >>> 24;
- // Sub word
- t = SBOX[t >>> 24] << 24 | SBOX[t >>> 16 & 0xff] << 16 | SBOX[t >>> 8 & 0xff] << 8 | SBOX[t & 0xff];
- // Mix Rcon
- t ^= RCON[ksRow / keySize | 0] << 24;
- } else if (keySize > 6 && ksRow % keySize == 4) {
- // Sub word
- t = SBOX[t >>> 24] << 24 | SBOX[t >>> 16 & 0xff] << 16 | SBOX[t >>> 8 & 0xff] << 8 | SBOX[t & 0xff];
- }
- keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t;
- }
- }
- // Compute inv key schedule
- var invKeySchedule = this._invKeySchedule = [];
- for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) {
- var ksRow = ksRows - invKsRow;
- if (invKsRow % 4) {
- var t = keySchedule[ksRow];
- } else {
- var t = keySchedule[ksRow - 4];
- }
- if (invKsRow < 4 || ksRow <= 4) {
- invKeySchedule[invKsRow] = t;
- } else {
- invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[t >>> 16 & 0xff]] ^ INV_SUB_MIX_2[SBOX[t >>> 8 & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]];
- }
- }
- },
- encryptBlock: function encryptBlock(M, offset) {
- this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX);
- },
- decryptBlock: function decryptBlock(M, offset) {
- // Swap 2nd and 4th rows
- var t = M[offset + 1];
- M[offset + 1] = M[offset + 3];
- M[offset + 3] = t;
- this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX);
- // Inv swap 2nd and 4th rows
- var t = M[offset + 1];
- M[offset + 1] = M[offset + 3];
- M[offset + 3] = t;
- },
- _doCryptBlock: function _doCryptBlock(M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) {
- // Shortcut
- var nRounds = this._nRounds;
- // Get input, add round key
- var s0 = M[offset] ^ keySchedule[0];
- var s1 = M[offset + 1] ^ keySchedule[1];
- var s2 = M[offset + 2] ^ keySchedule[2];
- var s3 = M[offset + 3] ^ keySchedule[3];
- // Key schedule row counter
- var ksRow = 4;
- // Rounds
- for (var round = 1; round < nRounds; round++) {
- // Shift rows, sub bytes, mix columns, add round key
- var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[s1 >>> 16 & 0xff] ^ SUB_MIX_2[s2 >>> 8 & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++];
- var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[s2 >>> 16 & 0xff] ^ SUB_MIX_2[s3 >>> 8 & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++];
- var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[s3 >>> 16 & 0xff] ^ SUB_MIX_2[s0 >>> 8 & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++];
- var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[s0 >>> 16 & 0xff] ^ SUB_MIX_2[s1 >>> 8 & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++];
- // Update state
- s0 = t0;
- s1 = t1;
- s2 = t2;
- s3 = t3;
- }
- // Shift rows, sub bytes, add round key
- var t0 = (SBOX[s0 >>> 24] << 24 | SBOX[s1 >>> 16 & 0xff] << 16 | SBOX[s2 >>> 8 & 0xff] << 8 | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++];
- var t1 = (SBOX[s1 >>> 24] << 24 | SBOX[s2 >>> 16 & 0xff] << 16 | SBOX[s3 >>> 8 & 0xff] << 8 | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++];
- var t2 = (SBOX[s2 >>> 24] << 24 | SBOX[s3 >>> 16 & 0xff] << 16 | SBOX[s0 >>> 8 & 0xff] << 8 | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++];
- var t3 = (SBOX[s3 >>> 24] << 24 | SBOX[s0 >>> 16 & 0xff] << 16 | SBOX[s1 >>> 8 & 0xff] << 8 | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++];
- // Set output
- M[offset] = t0;
- M[offset + 1] = t1;
- M[offset + 2] = t2;
- M[offset + 3] = t3;
- },
- keySize: 256 / 32
- });
- /**
- * Shortcut functions to the cipher's object interface.
- *
- * @example
- *
- * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg);
- * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg);
- */
- C.AES = BlockCipher._createHelper(AES);
- })();
- (function () {
- // Shortcuts
- var C = CryptoJS;
- var C_lib = C.lib;
- var WordArray = C_lib.WordArray;
- var BlockCipher = C_lib.BlockCipher;
- var C_algo = C.algo;
- // Permuted Choice 1 constants
- var PC1 = [57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36, 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4];
- // Permuted Choice 2 constants
- var PC2 = [14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10, 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2, 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48, 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32];
- // Cumulative bit shift constants
- var BIT_SHIFTS = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28];
- // SBOXes and round permutation constants
- var SBOX_P = [{
- 0x0: 0x808200,
- 0x10000000: 0x8000,
- 0x20000000: 0x808002,
- 0x30000000: 0x2,
- 0x40000000: 0x200,
- 0x50000000: 0x808202,
- 0x60000000: 0x800202,
- 0x70000000: 0x800000,
- 0x80000000: 0x202,
- 0x90000000: 0x800200,
- 0xa0000000: 0x8200,
- 0xb0000000: 0x808000,
- 0xc0000000: 0x8002,
- 0xd0000000: 0x800002,
- 0xe0000000: 0x0,
- 0xf0000000: 0x8202,
- 0x8000000: 0x0,
- 0x18000000: 0x808202,
- 0x28000000: 0x8202,
- 0x38000000: 0x8000,
- 0x48000000: 0x808200,
- 0x58000000: 0x200,
- 0x68000000: 0x808002,
- 0x78000000: 0x2,
- 0x88000000: 0x800200,
- 0x98000000: 0x8200,
- 0xa8000000: 0x808000,
- 0xb8000000: 0x800202,
- 0xc8000000: 0x800002,
- 0xd8000000: 0x8002,
- 0xe8000000: 0x202,
- 0xf8000000: 0x800000,
- 0x1: 0x8000,
- 0x10000001: 0x2,
- 0x20000001: 0x808200,
- 0x30000001: 0x800000,
- 0x40000001: 0x808002,
- 0x50000001: 0x8200,
- 0x60000001: 0x200,
- 0x70000001: 0x800202,
- 0x80000001: 0x808202,
- 0x90000001: 0x808000,
- 0xa0000001: 0x800002,
- 0xb0000001: 0x8202,
- 0xc0000001: 0x202,
- 0xd0000001: 0x800200,
- 0xe0000001: 0x8002,
- 0xf0000001: 0x0,
- 0x8000001: 0x808202,
- 0x18000001: 0x808000,
- 0x28000001: 0x800000,
- 0x38000001: 0x200,
- 0x48000001: 0x8000,
- 0x58000001: 0x800002,
- 0x68000001: 0x2,
- 0x78000001: 0x8202,
- 0x88000001: 0x8002,
- 0x98000001: 0x800202,
- 0xa8000001: 0x202,
- 0xb8000001: 0x808200,
- 0xc8000001: 0x800200,
- 0xd8000001: 0x0,
- 0xe8000001: 0x8200,
- 0xf8000001: 0x808002
- }, {
- 0x0: 0x40084010,
- 0x1000000: 0x4000,
- 0x2000000: 0x80000,
- 0x3000000: 0x40080010,
- 0x4000000: 0x40000010,
- 0x5000000: 0x40084000,
- 0x6000000: 0x40004000,
- 0x7000000: 0x10,
- 0x8000000: 0x84000,
- 0x9000000: 0x40004010,
- 0xa000000: 0x40000000,
- 0xb000000: 0x84010,
- 0xc000000: 0x80010,
- 0xd000000: 0x0,
- 0xe000000: 0x4010,
- 0xf000000: 0x40080000,
- 0x800000: 0x40004000,
- 0x1800000: 0x84010,
- 0x2800000: 0x10,
- 0x3800000: 0x40004010,
- 0x4800000: 0x40084010,
- 0x5800000: 0x40000000,
- 0x6800000: 0x80000,
- 0x7800000: 0x40080010,
- 0x8800000: 0x80010,
- 0x9800000: 0x0,
- 0xa800000: 0x4000,
- 0xb800000: 0x40080000,
- 0xc800000: 0x40000010,
- 0xd800000: 0x84000,
- 0xe800000: 0x40084000,
- 0xf800000: 0x4010,
- 0x10000000: 0x0,
- 0x11000000: 0x40080010,
- 0x12000000: 0x40004010,
- 0x13000000: 0x40084000,
- 0x14000000: 0x40080000,
- 0x15000000: 0x10,
- 0x16000000: 0x84010,
- 0x17000000: 0x4000,
- 0x18000000: 0x4010,
- 0x19000000: 0x80000,
- 0x1a000000: 0x80010,
- 0x1b000000: 0x40000010,
- 0x1c000000: 0x84000,
- 0x1d000000: 0x40004000,
- 0x1e000000: 0x40000000,
- 0x1f000000: 0x40084010,
- 0x10800000: 0x84010,
- 0x11800000: 0x80000,
- 0x12800000: 0x40080000,
- 0x13800000: 0x4000,
- 0x14800000: 0x40004000,
- 0x15800000: 0x40084010,
- 0x16800000: 0x10,
- 0x17800000: 0x40000000,
- 0x18800000: 0x40084000,
- 0x19800000: 0x40000010,
- 0x1a800000: 0x40004010,
- 0x1b800000: 0x80010,
- 0x1c800000: 0x0,
- 0x1d800000: 0x4010,
- 0x1e800000: 0x40080010,
- 0x1f800000: 0x84000
- }, {
- 0x0: 0x104,
- 0x100000: 0x0,
- 0x200000: 0x4000100,
- 0x300000: 0x10104,
- 0x400000: 0x10004,
- 0x500000: 0x4000004,
- 0x600000: 0x4010104,
- 0x700000: 0x4010000,
- 0x800000: 0x4000000,
- 0x900000: 0x4010100,
- 0xa00000: 0x10100,
- 0xb00000: 0x4010004,
- 0xc00000: 0x4000104,
- 0xd00000: 0x10000,
- 0xe00000: 0x4,
- 0xf00000: 0x100,
- 0x80000: 0x4010100,
- 0x180000: 0x4010004,
- 0x280000: 0x0,
- 0x380000: 0x4000100,
- 0x480000: 0x4000004,
- 0x580000: 0x10000,
- 0x680000: 0x10004,
- 0x780000: 0x104,
- 0x880000: 0x4,
- 0x980000: 0x100,
- 0xa80000: 0x4010000,
- 0xb80000: 0x10104,
- 0xc80000: 0x10100,
- 0xd80000: 0x4000104,
- 0xe80000: 0x4010104,
- 0xf80000: 0x4000000,
- 0x1000000: 0x4010100,
- 0x1100000: 0x10004,
- 0x1200000: 0x10000,
- 0x1300000: 0x4000100,
- 0x1400000: 0x100,
- 0x1500000: 0x4010104,
- 0x1600000: 0x4000004,
- 0x1700000: 0x0,
- 0x1800000: 0x4000104,
- 0x1900000: 0x4000000,
- 0x1a00000: 0x4,
- 0x1b00000: 0x10100,
- 0x1c00000: 0x4010000,
- 0x1d00000: 0x104,
- 0x1e00000: 0x10104,
- 0x1f00000: 0x4010004,
- 0x1080000: 0x4000000,
- 0x1180000: 0x104,
- 0x1280000: 0x4010100,
- 0x1380000: 0x0,
- 0x1480000: 0x10004,
- 0x1580000: 0x4000100,
- 0x1680000: 0x100,
- 0x1780000: 0x4010004,
- 0x1880000: 0x10000,
- 0x1980000: 0x4010104,
- 0x1a80000: 0x10104,
- 0x1b80000: 0x4000004,
- 0x1c80000: 0x4000104,
- 0x1d80000: 0x4010000,
- 0x1e80000: 0x4,
- 0x1f80000: 0x10100
- }, {
- 0x0: 0x80401000,
- 0x10000: 0x80001040,
- 0x20000: 0x401040,
- 0x30000: 0x80400000,
- 0x40000: 0x0,
- 0x50000: 0x401000,
- 0x60000: 0x80000040,
- 0x70000: 0x400040,
- 0x80000: 0x80000000,
- 0x90000: 0x400000,
- 0xa0000: 0x40,
- 0xb0000: 0x80001000,
- 0xc0000: 0x80400040,
- 0xd0000: 0x1040,
- 0xe0000: 0x1000,
- 0xf0000: 0x80401040,
- 0x8000: 0x80001040,
- 0x18000: 0x40,
- 0x28000: 0x80400040,
- 0x38000: 0x80001000,
- 0x48000: 0x401000,
- 0x58000: 0x80401040,
- 0x68000: 0x0,
- 0x78000: 0x80400000,
- 0x88000: 0x1000,
- 0x98000: 0x80401000,
- 0xa8000: 0x400000,
- 0xb8000: 0x1040,
- 0xc8000: 0x80000000,
- 0xd8000: 0x400040,
- 0xe8000: 0x401040,
- 0xf8000: 0x80000040,
- 0x100000: 0x400040,
- 0x110000: 0x401000,
- 0x120000: 0x80000040,
- 0x130000: 0x0,
- 0x140000: 0x1040,
- 0x150000: 0x80400040,
- 0x160000: 0x80401000,
- 0x170000: 0x80001040,
- 0x180000: 0x80401040,
- 0x190000: 0x80000000,
- 0x1a0000: 0x80400000,
- 0x1b0000: 0x401040,
- 0x1c0000: 0x80001000,
- 0x1d0000: 0x400000,
- 0x1e0000: 0x40,
- 0x1f0000: 0x1000,
- 0x108000: 0x80400000,
- 0x118000: 0x80401040,
- 0x128000: 0x0,
- 0x138000: 0x401000,
- 0x148000: 0x400040,
- 0x158000: 0x80000000,
- 0x168000: 0x80001040,
- 0x178000: 0x40,
- 0x188000: 0x80000040,
- 0x198000: 0x1000,
- 0x1a8000: 0x80001000,
- 0x1b8000: 0x80400040,
- 0x1c8000: 0x1040,
- 0x1d8000: 0x80401000,
- 0x1e8000: 0x400000,
- 0x1f8000: 0x401040
- }, {
- 0x0: 0x80,
- 0x1000: 0x1040000,
- 0x2000: 0x40000,
- 0x3000: 0x20000000,
- 0x4000: 0x20040080,
- 0x5000: 0x1000080,
- 0x6000: 0x21000080,
- 0x7000: 0x40080,
- 0x8000: 0x1000000,
- 0x9000: 0x20040000,
- 0xa000: 0x20000080,
- 0xb000: 0x21040080,
- 0xc000: 0x21040000,
- 0xd000: 0x0,
- 0xe000: 0x1040080,
- 0xf000: 0x21000000,
- 0x800: 0x1040080,
- 0x1800: 0x21000080,
- 0x2800: 0x80,
- 0x3800: 0x1040000,
- 0x4800: 0x40000,
- 0x5800: 0x20040080,
- 0x6800: 0x21040000,
- 0x7800: 0x20000000,
- 0x8800: 0x20040000,
- 0x9800: 0x0,
- 0xa800: 0x21040080,
- 0xb800: 0x1000080,
- 0xc800: 0x20000080,
- 0xd800: 0x21000000,
- 0xe800: 0x1000000,
- 0xf800: 0x40080,
- 0x10000: 0x40000,
- 0x11000: 0x80,
- 0x12000: 0x20000000,
- 0x13000: 0x21000080,
- 0x14000: 0x1000080,
- 0x15000: 0x21040000,
- 0x16000: 0x20040080,
- 0x17000: 0x1000000,
- 0x18000: 0x21040080,
- 0x19000: 0x21000000,
- 0x1a000: 0x1040000,
- 0x1b000: 0x20040000,
- 0x1c000: 0x40080,
- 0x1d000: 0x20000080,
- 0x1e000: 0x0,
- 0x1f000: 0x1040080,
- 0x10800: 0x21000080,
- 0x11800: 0x1000000,
- 0x12800: 0x1040000,
- 0x13800: 0x20040080,
- 0x14800: 0x20000000,
- 0x15800: 0x1040080,
- 0x16800: 0x80,
- 0x17800: 0x21040000,
- 0x18800: 0x40080,
- 0x19800: 0x21040080,
- 0x1a800: 0x0,
- 0x1b800: 0x21000000,
- 0x1c800: 0x1000080,
- 0x1d800: 0x40000,
- 0x1e800: 0x20040000,
- 0x1f800: 0x20000080
- }, {
- 0x0: 0x10000008,
- 0x100: 0x2000,
- 0x200: 0x10200000,
- 0x300: 0x10202008,
- 0x400: 0x10002000,
- 0x500: 0x200000,
- 0x600: 0x200008,
- 0x700: 0x10000000,
- 0x800: 0x0,
- 0x900: 0x10002008,
- 0xa00: 0x202000,
- 0xb00: 0x8,
- 0xc00: 0x10200008,
- 0xd00: 0x202008,
- 0xe00: 0x2008,
- 0xf00: 0x10202000,
- 0x80: 0x10200000,
- 0x180: 0x10202008,
- 0x280: 0x8,
- 0x380: 0x200000,
- 0x480: 0x202008,
- 0x580: 0x10000008,
- 0x680: 0x10002000,
- 0x780: 0x2008,
- 0x880: 0x200008,
- 0x980: 0x2000,
- 0xa80: 0x10002008,
- 0xb80: 0x10200008,
- 0xc80: 0x0,
- 0xd80: 0x10202000,
- 0xe80: 0x202000,
- 0xf80: 0x10000000,
- 0x1000: 0x10002000,
- 0x1100: 0x10200008,
- 0x1200: 0x10202008,
- 0x1300: 0x2008,
- 0x1400: 0x200000,
- 0x1500: 0x10000000,
- 0x1600: 0x10000008,
- 0x1700: 0x202000,
- 0x1800: 0x202008,
- 0x1900: 0x0,
- 0x1a00: 0x8,
- 0x1b00: 0x10200000,
- 0x1c00: 0x2000,
- 0x1d00: 0x10002008,
- 0x1e00: 0x10202000,
- 0x1f00: 0x200008,
- 0x1080: 0x8,
- 0x1180: 0x202000,
- 0x1280: 0x200000,
- 0x1380: 0x10000008,
- 0x1480: 0x10002000,
- 0x1580: 0x2008,
- 0x1680: 0x10202008,
- 0x1780: 0x10200000,
- 0x1880: 0x10202000,
- 0x1980: 0x10200008,
- 0x1a80: 0x2000,
- 0x1b80: 0x202008,
- 0x1c80: 0x200008,
- 0x1d80: 0x0,
- 0x1e80: 0x10000000,
- 0x1f80: 0x10002008
- }, {
- 0x0: 0x100000,
- 0x10: 0x2000401,
- 0x20: 0x400,
- 0x30: 0x100401,
- 0x40: 0x2100401,
- 0x50: 0x0,
- 0x60: 0x1,
- 0x70: 0x2100001,
- 0x80: 0x2000400,
- 0x90: 0x100001,
- 0xa0: 0x2000001,
- 0xb0: 0x2100400,
- 0xc0: 0x2100000,
- 0xd0: 0x401,
- 0xe0: 0x100400,
- 0xf0: 0x2000000,
- 0x8: 0x2100001,
- 0x18: 0x0,
- 0x28: 0x2000401,
- 0x38: 0x2100400,
- 0x48: 0x100000,
- 0x58: 0x2000001,
- 0x68: 0x2000000,
- 0x78: 0x401,
- 0x88: 0x100401,
- 0x98: 0x2000400,
- 0xa8: 0x2100000,
- 0xb8: 0x100001,
- 0xc8: 0x400,
- 0xd8: 0x2100401,
- 0xe8: 0x1,
- 0xf8: 0x100400,
- 0x100: 0x2000000,
- 0x110: 0x100000,
- 0x120: 0x2000401,
- 0x130: 0x2100001,
- 0x140: 0x100001,
- 0x150: 0x2000400,
- 0x160: 0x2100400,
- 0x170: 0x100401,
- 0x180: 0x401,
- 0x190: 0x2100401,
- 0x1a0: 0x100400,
- 0x1b0: 0x1,
- 0x1c0: 0x0,
- 0x1d0: 0x2100000,
- 0x1e0: 0x2000001,
- 0x1f0: 0x400,
- 0x108: 0x100400,
- 0x118: 0x2000401,
- 0x128: 0x2100001,
- 0x138: 0x1,
- 0x148: 0x2000000,
- 0x158: 0x100000,
- 0x168: 0x401,
- 0x178: 0x2100400,
- 0x188: 0x2000001,
- 0x198: 0x2100000,
- 0x1a8: 0x0,
- 0x1b8: 0x2100401,
- 0x1c8: 0x100401,
- 0x1d8: 0x400,
- 0x1e8: 0x2000400,
- 0x1f8: 0x100001
- }, {
- 0x0: 0x8000820,
- 0x1: 0x20000,
- 0x2: 0x8000000,
- 0x3: 0x20,
- 0x4: 0x20020,
- 0x5: 0x8020820,
- 0x6: 0x8020800,
- 0x7: 0x800,
- 0x8: 0x8020000,
- 0x9: 0x8000800,
- 0xa: 0x20800,
- 0xb: 0x8020020,
- 0xc: 0x820,
- 0xd: 0x0,
- 0xe: 0x8000020,
- 0xf: 0x20820,
- 0x80000000: 0x800,
- 0x80000001: 0x8020820,
- 0x80000002: 0x8000820,
- 0x80000003: 0x8000000,
- 0x80000004: 0x8020000,
- 0x80000005: 0x20800,
- 0x80000006: 0x20820,
- 0x80000007: 0x20,
- 0x80000008: 0x8000020,
- 0x80000009: 0x820,
- 0x8000000a: 0x20020,
- 0x8000000b: 0x8020800,
- 0x8000000c: 0x0,
- 0x8000000d: 0x8020020,
- 0x8000000e: 0x8000800,
- 0x8000000f: 0x20000,
- 0x10: 0x20820,
- 0x11: 0x8020800,
- 0x12: 0x20,
- 0x13: 0x800,
- 0x14: 0x8000800,
- 0x15: 0x8000020,
- 0x16: 0x8020020,
- 0x17: 0x20000,
- 0x18: 0x0,
- 0x19: 0x20020,
- 0x1a: 0x8020000,
- 0x1b: 0x8000820,
- 0x1c: 0x8020820,
- 0x1d: 0x20800,
- 0x1e: 0x820,
- 0x1f: 0x8000000,
- 0x80000010: 0x20000,
- 0x80000011: 0x800,
- 0x80000012: 0x8020020,
- 0x80000013: 0x20820,
- 0x80000014: 0x20,
- 0x80000015: 0x8020000,
- 0x80000016: 0x8000000,
- 0x80000017: 0x8000820,
- 0x80000018: 0x8020820,
- 0x80000019: 0x8000020,
- 0x8000001a: 0x8000800,
- 0x8000001b: 0x0,
- 0x8000001c: 0x20800,
- 0x8000001d: 0x820,
- 0x8000001e: 0x20020,
- 0x8000001f: 0x8020800
- }];
- // Masks that select the SBOX input
- var SBOX_MASK = [0xf8000001, 0x1f800000, 0x01f80000, 0x001f8000, 0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f];
- /**
- * DES block cipher algorithm.
- */
- var DES = C_algo.DES = BlockCipher.extend({
- _doReset: function _doReset() {
- // Shortcuts
- var key = this._key;
- var keyWords = key.words;
- // Select 56 bits according to PC1
- var keyBits = [];
- for (var i = 0; i < 56; i++) {
- var keyBitPos = PC1[i] - 1;
- keyBits[i] = keyWords[keyBitPos >>> 5] >>> 31 - keyBitPos % 32 & 1;
- }
- // Assemble 16 subkeys
- var subKeys = this._subKeys = [];
- for (var nSubKey = 0; nSubKey < 16; nSubKey++) {
- // Create subkey
- var subKey = subKeys[nSubKey] = [];
- // Shortcut
- var bitShift = BIT_SHIFTS[nSubKey];
- // Select 48 bits according to PC2
- for (var i = 0; i < 24; i++) {
- // Select from the left 28 key bits
- subKey[i / 6 | 0] |= keyBits[(PC2[i] - 1 + bitShift) % 28] << 31 - i % 6;
- // Select from the right 28 key bits
- subKey[4 + (i / 6 | 0)] |= keyBits[28 + (PC2[i + 24] - 1 + bitShift) % 28] << 31 - i % 6;
- }
- // Since each subkey is applied to an expanded 32-bit input,
- // the subkey can be broken into 8 values scaled to 32-bits,
- // which allows the key to be used without expansion
- subKey[0] = subKey[0] << 1 | subKey[0] >>> 31;
- for (var i = 1; i < 7; i++) {
- subKey[i] = subKey[i] >>> (i - 1) * 4 + 3;
- }
- subKey[7] = subKey[7] << 5 | subKey[7] >>> 27;
- }
- // Compute inverse subkeys
- var invSubKeys = this._invSubKeys = [];
- for (var i = 0; i < 16; i++) {
- invSubKeys[i] = subKeys[15 - i];
- }
- },
- encryptBlock: function encryptBlock(M, offset) {
- this._doCryptBlock(M, offset, this._subKeys);
- },
- decryptBlock: function decryptBlock(M, offset) {
- this._doCryptBlock(M, offset, this._invSubKeys);
- },
- _doCryptBlock: function _doCryptBlock(M, offset, subKeys) {
- // Get input
- this._lBlock = M[offset];
- this._rBlock = M[offset + 1];
- // Initial permutation
- exchangeLR.call(this, 4, 0x0f0f0f0f);
- exchangeLR.call(this, 16, 0x0000ffff);
- exchangeRL.call(this, 2, 0x33333333);
- exchangeRL.call(this, 8, 0x00ff00ff);
- exchangeLR.call(this, 1, 0x55555555);
- // Rounds
- for (var round = 0; round < 16; round++) {
- // Shortcuts
- var subKey = subKeys[round];
- var lBlock = this._lBlock;
- var rBlock = this._rBlock;
- // Feistel function
- var f = 0;
- for (var i = 0; i < 8; i++) {
- f |= SBOX_P[i][((rBlock ^ subKey[i]) & SBOX_MASK[i]) >>> 0];
- }
- this._lBlock = rBlock;
- this._rBlock = lBlock ^ f;
- }
- // Undo swap from last round
- var t = this._lBlock;
- this._lBlock = this._rBlock;
- this._rBlock = t;
- // Final permutation
- exchangeLR.call(this, 1, 0x55555555);
- exchangeRL.call(this, 8, 0x00ff00ff);
- exchangeRL.call(this, 2, 0x33333333);
- exchangeLR.call(this, 16, 0x0000ffff);
- exchangeLR.call(this, 4, 0x0f0f0f0f);
- // Set output
- M[offset] = this._lBlock;
- M[offset + 1] = this._rBlock;
- },
- keySize: 64 / 32,
- ivSize: 64 / 32,
- blockSize: 64 / 32
- });
- // Swap bits across the left and right words
- function exchangeLR(offset, mask) {
- var t = (this._lBlock >>> offset ^ this._rBlock) & mask;
- this._rBlock ^= t;
- this._lBlock ^= t << offset;
- }
- function exchangeRL(offset, mask) {
- var t = (this._rBlock >>> offset ^ this._lBlock) & mask;
- this._lBlock ^= t;
- this._rBlock ^= t << offset;
- }
- /**
- * Shortcut functions to the cipher's object interface.
- *
- * @example
- *
- * var ciphertext = CryptoJS.DES.encrypt(message, key, cfg);
- * var plaintext = CryptoJS.DES.decrypt(ciphertext, key, cfg);
- */
- C.DES = BlockCipher._createHelper(DES);
- /**
- * Triple-DES block cipher algorithm.
- */
- var TripleDES = C_algo.TripleDES = BlockCipher.extend({
- _doReset: function _doReset() {
- // Shortcuts
- var key = this._key;
- var keyWords = key.words;
- // Make sure the key length is valid (64, 128 or >= 192 bit)
- if (keyWords.length !== 2 && keyWords.length !== 4 && keyWords.length < 6) {
- throw new Error('Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.');
- }
- // Extend the key according to the keying options defined in 3DES standard
- var key1 = keyWords.slice(0, 2);
- var key2 = keyWords.length < 4 ? keyWords.slice(0, 2) : keyWords.slice(2, 4);
- var key3 = keyWords.length < 6 ? keyWords.slice(0, 2) : keyWords.slice(4, 6);
- // Create DES instances
- this._des1 = DES.createEncryptor(WordArray.create(key1));
- this._des2 = DES.createEncryptor(WordArray.create(key2));
- this._des3 = DES.createEncryptor(WordArray.create(key3));
- },
- encryptBlock: function encryptBlock(M, offset) {
- this._des1.encryptBlock(M, offset);
- this._des2.decryptBlock(M, offset);
- this._des3.encryptBlock(M, offset);
- },
- decryptBlock: function decryptBlock(M, offset) {
- this._des3.decryptBlock(M, offset);
- this._des2.encryptBlock(M, offset);
- this._des1.decryptBlock(M, offset);
- },
- keySize: 192 / 32,
- ivSize: 64 / 32,
- blockSize: 64 / 32
- });
- /**
- * Shortcut functions to the cipher's object interface.
- *
- * @example
- *
- * var ciphertext = CryptoJS.TripleDES.encrypt(message, key, cfg);
- * var plaintext = CryptoJS.TripleDES.decrypt(ciphertext, key, cfg);
- */
- C.TripleDES = BlockCipher._createHelper(TripleDES);
- })();
- (function () {
- // Shortcuts
- var C = CryptoJS;
- var C_lib = C.lib;
- var StreamCipher = C_lib.StreamCipher;
- var C_algo = C.algo;
- /**
- * RC4 stream cipher algorithm.
- */
- var RC4 = C_algo.RC4 = StreamCipher.extend({
- _doReset: function _doReset() {
- // Shortcuts
- var key = this._key;
- var keyWords = key.words;
- var keySigBytes = key.sigBytes;
- // Init sbox
- var S = this._S = [];
- for (var i = 0; i < 256; i++) {
- S[i] = i;
- }
- // Key setup
- for (var i = 0, j = 0; i < 256; i++) {
- var keyByteIndex = i % keySigBytes;
- var keyByte = keyWords[keyByteIndex >>> 2] >>> 24 - keyByteIndex % 4 * 8 & 0xff;
- j = (j + S[i] + keyByte) % 256;
- // Swap
- var t = S[i];
- S[i] = S[j];
- S[j] = t;
- }
- // Counters
- this._i = this._j = 0;
- },
- _doProcessBlock: function _doProcessBlock(M, offset) {
- M[offset] ^= generateKeystreamWord.call(this);
- },
- keySize: 256 / 32,
- ivSize: 0
- });
- function generateKeystreamWord() {
- // Shortcuts
- var S = this._S;
- var i = this._i;
- var j = this._j;
- // Generate keystream word
- var keystreamWord = 0;
- for (var n = 0; n < 4; n++) {
- i = (i + 1) % 256;
- j = (j + S[i]) % 256;
- // Swap
- var t = S[i];
- S[i] = S[j];
- S[j] = t;
- keystreamWord |= S[(S[i] + S[j]) % 256] << 24 - n * 8;
- }
- // Update counters
- this._i = i;
- this._j = j;
- return keystreamWord;
- }
- /**
- * Shortcut functions to the cipher's object interface.
- *
- * @example
- *
- * var ciphertext = CryptoJS.RC4.encrypt(message, key, cfg);
- * var plaintext = CryptoJS.RC4.decrypt(ciphertext, key, cfg);
- */
- C.RC4 = StreamCipher._createHelper(RC4);
- /**
- * Modified RC4 stream cipher algorithm.
- */
- var RC4Drop = C_algo.RC4Drop = RC4.extend({
- /**
- * Configuration options.
- *
- * @property {number} drop The number of keystream words to drop. Default 192
- */
- cfg: RC4.cfg.extend({
- drop: 192
- }),
- _doReset: function _doReset() {
- RC4._doReset.call(this);
- // Drop
- for (var i = this.cfg.drop; i > 0; i--) {
- generateKeystreamWord.call(this);
- }
- }
- });
- /**
- * Shortcut functions to the cipher's object interface.
- *
- * @example
- *
- * var ciphertext = CryptoJS.RC4Drop.encrypt(message, key, cfg);
- * var plaintext = CryptoJS.RC4Drop.decrypt(ciphertext, key, cfg);
- */
- C.RC4Drop = StreamCipher._createHelper(RC4Drop);
- })();
- (function () {
- // Shortcuts
- var C = CryptoJS;
- var C_lib = C.lib;
- var StreamCipher = C_lib.StreamCipher;
- var C_algo = C.algo;
- // Reusable objects
- var S = [];
- var C_ = [];
- var G = [];
- /**
- * Rabbit stream cipher algorithm
- */
- var Rabbit = C_algo.Rabbit = StreamCipher.extend({
- _doReset: function _doReset() {
- // Shortcuts
- var K = this._key.words;
- var iv = this.cfg.iv;
- // Swap endian
- for (var i = 0; i < 4; i++) {
- K[i] = (K[i] << 8 | K[i] >>> 24) & 0x00ff00ff | (K[i] << 24 | K[i] >>> 8) & 0xff00ff00;
- }
- // Generate initial state values
- var X = this._X = [K[0], K[3] << 16 | K[2] >>> 16, K[1], K[0] << 16 | K[3] >>> 16, K[2], K[1] << 16 | K[0] >>> 16, K[3], K[2] << 16 | K[1] >>> 16];
- // Generate initial counter values
- var C = this._C = [K[2] << 16 | K[2] >>> 16, K[0] & 0xffff0000 | K[1] & 0x0000ffff, K[3] << 16 | K[3] >>> 16, K[1] & 0xffff0000 | K[2] & 0x0000ffff, K[0] << 16 | K[0] >>> 16, K[2] & 0xffff0000 | K[3] & 0x0000ffff, K[1] << 16 | K[1] >>> 16, K[3] & 0xffff0000 | K[0] & 0x0000ffff];
- // Carry bit
- this._b = 0;
- // Iterate the system four times
- for (var i = 0; i < 4; i++) {
- nextState.call(this);
- }
- // Modify the counters
- for (var i = 0; i < 8; i++) {
- C[i] ^= X[i + 4 & 7];
- }
- // IV setup
- if (iv) {
- // Shortcuts
- var IV = iv.words;
- var IV_0 = IV[0];
- var IV_1 = IV[1];
- // Generate four subvectors
- var i0 = (IV_0 << 8 | IV_0 >>> 24) & 0x00ff00ff | (IV_0 << 24 | IV_0 >>> 8) & 0xff00ff00;
- var i2 = (IV_1 << 8 | IV_1 >>> 24) & 0x00ff00ff | (IV_1 << 24 | IV_1 >>> 8) & 0xff00ff00;
- var i1 = i0 >>> 16 | i2 & 0xffff0000;
- var i3 = i2 << 16 | i0 & 0x0000ffff;
- // Modify counter values
- C[0] ^= i0;
- C[1] ^= i1;
- C[2] ^= i2;
- C[3] ^= i3;
- C[4] ^= i0;
- C[5] ^= i1;
- C[6] ^= i2;
- C[7] ^= i3;
- // Iterate the system four times
- for (var i = 0; i < 4; i++) {
- nextState.call(this);
- }
- }
- },
- _doProcessBlock: function _doProcessBlock(M, offset) {
- // Shortcut
- var X = this._X;
- // Iterate the system
- nextState.call(this);
- // Generate four keystream words
- S[0] = X[0] ^ X[5] >>> 16 ^ X[3] << 16;
- S[1] = X[2] ^ X[7] >>> 16 ^ X[5] << 16;
- S[2] = X[4] ^ X[1] >>> 16 ^ X[7] << 16;
- S[3] = X[6] ^ X[3] >>> 16 ^ X[1] << 16;
- for (var i = 0; i < 4; i++) {
- // Swap endian
- S[i] = (S[i] << 8 | S[i] >>> 24) & 0x00ff00ff | (S[i] << 24 | S[i] >>> 8) & 0xff00ff00;
- // Encrypt
- M[offset + i] ^= S[i];
- }
- },
- blockSize: 128 / 32,
- ivSize: 64 / 32
- });
- function nextState() {
- // Shortcuts
- var X = this._X;
- var C = this._C;
- // Save old counter values
- for (var i = 0; i < 8; i++) {
- C_[i] = C[i];
- }
- // Calculate new counter values
- C[0] = C[0] + 0x4d34d34d + this._b | 0;
- C[1] = C[1] + 0xd34d34d3 + (C[0] >>> 0 < C_[0] >>> 0 ? 1 : 0) | 0;
- C[2] = C[2] + 0x34d34d34 + (C[1] >>> 0 < C_[1] >>> 0 ? 1 : 0) | 0;
- C[3] = C[3] + 0x4d34d34d + (C[2] >>> 0 < C_[2] >>> 0 ? 1 : 0) | 0;
- C[4] = C[4] + 0xd34d34d3 + (C[3] >>> 0 < C_[3] >>> 0 ? 1 : 0) | 0;
- C[5] = C[5] + 0x34d34d34 + (C[4] >>> 0 < C_[4] >>> 0 ? 1 : 0) | 0;
- C[6] = C[6] + 0x4d34d34d + (C[5] >>> 0 < C_[5] >>> 0 ? 1 : 0) | 0;
- C[7] = C[7] + 0xd34d34d3 + (C[6] >>> 0 < C_[6] >>> 0 ? 1 : 0) | 0;
- this._b = C[7] >>> 0 < C_[7] >>> 0 ? 1 : 0;
- // Calculate the g-values
- for (var i = 0; i < 8; i++) {
- var gx = X[i] + C[i];
- // Construct high and low argument for squaring
- var ga = gx & 0xffff;
- var gb = gx >>> 16;
- // Calculate high and low result of squaring
- var gh = ((ga * ga >>> 17) + ga * gb >>> 15) + gb * gb;
- var gl = ((gx & 0xffff0000) * gx | 0) + ((gx & 0x0000ffff) * gx | 0);
- // High XOR low
- G[i] = gh ^ gl;
- }
- // Calculate new state values
- X[0] = G[0] + (G[7] << 16 | G[7] >>> 16) + (G[6] << 16 | G[6] >>> 16) | 0;
- X[1] = G[1] + (G[0] << 8 | G[0] >>> 24) + G[7] | 0;
- X[2] = G[2] + (G[1] << 16 | G[1] >>> 16) + (G[0] << 16 | G[0] >>> 16) | 0;
- X[3] = G[3] + (G[2] << 8 | G[2] >>> 24) + G[1] | 0;
- X[4] = G[4] + (G[3] << 16 | G[3] >>> 16) + (G[2] << 16 | G[2] >>> 16) | 0;
- X[5] = G[5] + (G[4] << 8 | G[4] >>> 24) + G[3] | 0;
- X[6] = G[6] + (G[5] << 16 | G[5] >>> 16) + (G[4] << 16 | G[4] >>> 16) | 0;
- X[7] = G[7] + (G[6] << 8 | G[6] >>> 24) + G[5] | 0;
- }
- /**
- * Shortcut functions to the cipher's object interface.
- *
- * @example
- *
- * var ciphertext = CryptoJS.Rabbit.encrypt(message, key, cfg);
- * var plaintext = CryptoJS.Rabbit.decrypt(ciphertext, key, cfg);
- */
- C.Rabbit = StreamCipher._createHelper(Rabbit);
- })();
- (function () {
- // Shortcuts
- var C = CryptoJS;
- var C_lib = C.lib;
- var StreamCipher = C_lib.StreamCipher;
- var C_algo = C.algo;
- // Reusable objects
- var S = [];
- var C_ = [];
- var G = [];
- /**
- * Rabbit stream cipher algorithm.
- *
- * This is a legacy version that neglected to convert the key to little-endian.
- * This error doesn't affect the cipher's security,
- * but it does affect its compatibility with other implementations.
- */
- var RabbitLegacy = C_algo.RabbitLegacy = StreamCipher.extend({
- _doReset: function _doReset() {
- // Shortcuts
- var K = this._key.words;
- var iv = this.cfg.iv;
- // Generate initial state values
- var X = this._X = [K[0], K[3] << 16 | K[2] >>> 16, K[1], K[0] << 16 | K[3] >>> 16, K[2], K[1] << 16 | K[0] >>> 16, K[3], K[2] << 16 | K[1] >>> 16];
- // Generate initial counter values
- var C = this._C = [K[2] << 16 | K[2] >>> 16, K[0] & 0xffff0000 | K[1] & 0x0000ffff, K[3] << 16 | K[3] >>> 16, K[1] & 0xffff0000 | K[2] & 0x0000ffff, K[0] << 16 | K[0] >>> 16, K[2] & 0xffff0000 | K[3] & 0x0000ffff, K[1] << 16 | K[1] >>> 16, K[3] & 0xffff0000 | K[0] & 0x0000ffff];
- // Carry bit
- this._b = 0;
- // Iterate the system four times
- for (var i = 0; i < 4; i++) {
- nextState.call(this);
- }
- // Modify the counters
- for (var i = 0; i < 8; i++) {
- C[i] ^= X[i + 4 & 7];
- }
- // IV setup
- if (iv) {
- // Shortcuts
- var IV = iv.words;
- var IV_0 = IV[0];
- var IV_1 = IV[1];
- // Generate four subvectors
- var i0 = (IV_0 << 8 | IV_0 >>> 24) & 0x00ff00ff | (IV_0 << 24 | IV_0 >>> 8) & 0xff00ff00;
- var i2 = (IV_1 << 8 | IV_1 >>> 24) & 0x00ff00ff | (IV_1 << 24 | IV_1 >>> 8) & 0xff00ff00;
- var i1 = i0 >>> 16 | i2 & 0xffff0000;
- var i3 = i2 << 16 | i0 & 0x0000ffff;
- // Modify counter values
- C[0] ^= i0;
- C[1] ^= i1;
- C[2] ^= i2;
- C[3] ^= i3;
- C[4] ^= i0;
- C[5] ^= i1;
- C[6] ^= i2;
- C[7] ^= i3;
- // Iterate the system four times
- for (var i = 0; i < 4; i++) {
- nextState.call(this);
- }
- }
- },
- _doProcessBlock: function _doProcessBlock(M, offset) {
- // Shortcut
- var X = this._X;
- // Iterate the system
- nextState.call(this);
- // Generate four keystream words
- S[0] = X[0] ^ X[5] >>> 16 ^ X[3] << 16;
- S[1] = X[2] ^ X[7] >>> 16 ^ X[5] << 16;
- S[2] = X[4] ^ X[1] >>> 16 ^ X[7] << 16;
- S[3] = X[6] ^ X[3] >>> 16 ^ X[1] << 16;
- for (var i = 0; i < 4; i++) {
- // Swap endian
- S[i] = (S[i] << 8 | S[i] >>> 24) & 0x00ff00ff | (S[i] << 24 | S[i] >>> 8) & 0xff00ff00;
- // Encrypt
- M[offset + i] ^= S[i];
- }
- },
- blockSize: 128 / 32,
- ivSize: 64 / 32
- });
- function nextState() {
- // Shortcuts
- var X = this._X;
- var C = this._C;
- // Save old counter values
- for (var i = 0; i < 8; i++) {
- C_[i] = C[i];
- }
- // Calculate new counter values
- C[0] = C[0] + 0x4d34d34d + this._b | 0;
- C[1] = C[1] + 0xd34d34d3 + (C[0] >>> 0 < C_[0] >>> 0 ? 1 : 0) | 0;
- C[2] = C[2] + 0x34d34d34 + (C[1] >>> 0 < C_[1] >>> 0 ? 1 : 0) | 0;
- C[3] = C[3] + 0x4d34d34d + (C[2] >>> 0 < C_[2] >>> 0 ? 1 : 0) | 0;
- C[4] = C[4] + 0xd34d34d3 + (C[3] >>> 0 < C_[3] >>> 0 ? 1 : 0) | 0;
- C[5] = C[5] + 0x34d34d34 + (C[4] >>> 0 < C_[4] >>> 0 ? 1 : 0) | 0;
- C[6] = C[6] + 0x4d34d34d + (C[5] >>> 0 < C_[5] >>> 0 ? 1 : 0) | 0;
- C[7] = C[7] + 0xd34d34d3 + (C[6] >>> 0 < C_[6] >>> 0 ? 1 : 0) | 0;
- this._b = C[7] >>> 0 < C_[7] >>> 0 ? 1 : 0;
- // Calculate the g-values
- for (var i = 0; i < 8; i++) {
- var gx = X[i] + C[i];
- // Construct high and low argument for squaring
- var ga = gx & 0xffff;
- var gb = gx >>> 16;
- // Calculate high and low result of squaring
- var gh = ((ga * ga >>> 17) + ga * gb >>> 15) + gb * gb;
- var gl = ((gx & 0xffff0000) * gx | 0) + ((gx & 0x0000ffff) * gx | 0);
- // High XOR low
- G[i] = gh ^ gl;
- }
- // Calculate new state values
- X[0] = G[0] + (G[7] << 16 | G[7] >>> 16) + (G[6] << 16 | G[6] >>> 16) | 0;
- X[1] = G[1] + (G[0] << 8 | G[0] >>> 24) + G[7] | 0;
- X[2] = G[2] + (G[1] << 16 | G[1] >>> 16) + (G[0] << 16 | G[0] >>> 16) | 0;
- X[3] = G[3] + (G[2] << 8 | G[2] >>> 24) + G[1] | 0;
- X[4] = G[4] + (G[3] << 16 | G[3] >>> 16) + (G[2] << 16 | G[2] >>> 16) | 0;
- X[5] = G[5] + (G[4] << 8 | G[4] >>> 24) + G[3] | 0;
- X[6] = G[6] + (G[5] << 16 | G[5] >>> 16) + (G[4] << 16 | G[4] >>> 16) | 0;
- X[7] = G[7] + (G[6] << 8 | G[6] >>> 24) + G[5] | 0;
- }
- /**
- * Shortcut functions to the cipher's object interface.
- *
- * @example
- *
- * var ciphertext = CryptoJS.RabbitLegacy.encrypt(message, key, cfg);
- * var plaintext = CryptoJS.RabbitLegacy.decrypt(ciphertext, key, cfg);
- */
- C.RabbitLegacy = StreamCipher._createHelper(RabbitLegacy);
- })();
- return CryptoJS;
- });
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! (webpack)/buildin/global.js */ 3)))
- /***/ }),
- /* 111 */
- /*!*************************************************!*\
- !*** ./node_modules/crypto-browserify/index.js ***!
- \*************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = __webpack_require__(/*! randombytes */ 112)
- exports.createHash = exports.Hash = __webpack_require__(/*! create-hash */ 120)
- exports.createHmac = exports.Hmac = __webpack_require__(/*! create-hmac */ 155)
- var algos = __webpack_require__(/*! browserify-sign/algos */ 158)
- var algoKeys = Object.keys(algos)
- var hashes = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'].concat(algoKeys)
- exports.getHashes = function () {
- return hashes
- }
- var p = __webpack_require__(/*! pbkdf2 */ 160)
- exports.pbkdf2 = p.pbkdf2
- exports.pbkdf2Sync = p.pbkdf2Sync
- var aes = __webpack_require__(/*! browserify-cipher */ 166)
- exports.Cipher = aes.Cipher
- exports.createCipher = aes.createCipher
- exports.Cipheriv = aes.Cipheriv
- exports.createCipheriv = aes.createCipheriv
- exports.Decipher = aes.Decipher
- exports.createDecipher = aes.createDecipher
- exports.Decipheriv = aes.Decipheriv
- exports.createDecipheriv = aes.createDecipheriv
- exports.getCiphers = aes.getCiphers
- exports.listCiphers = aes.listCiphers
- var dh = __webpack_require__(/*! diffie-hellman */ 195)
- exports.DiffieHellmanGroup = dh.DiffieHellmanGroup
- exports.createDiffieHellmanGroup = dh.createDiffieHellmanGroup
- exports.getDiffieHellman = dh.getDiffieHellman
- exports.createDiffieHellman = dh.createDiffieHellman
- exports.DiffieHellman = dh.DiffieHellman
- var sign = __webpack_require__(/*! browserify-sign */ 205)
- exports.createSign = sign.createSign
- exports.Sign = sign.Sign
- exports.createVerify = sign.createVerify
- exports.Verify = sign.Verify
- exports.createECDH = __webpack_require__(/*! create-ecdh */ 260)
- var publicEncrypt = __webpack_require__(/*! public-encrypt */ 261)
- exports.publicEncrypt = publicEncrypt.publicEncrypt
- exports.privateEncrypt = publicEncrypt.privateEncrypt
- exports.publicDecrypt = publicEncrypt.publicDecrypt
- exports.privateDecrypt = publicEncrypt.privateDecrypt
- // the least I can do is make error messages for the rest of the node.js/crypto api.
- // ;[
- // 'createCredentials'
- // ].forEach(function (name) {
- // exports[name] = function () {
- // throw new Error([
- // 'sorry, ' + name + ' is not implemented yet',
- // 'we accept pull requests',
- // 'https://github.com/crypto-browserify/crypto-browserify'
- // ].join('\n'))
- // }
- // })
- var rf = __webpack_require__(/*! randomfill */ 267)
- exports.randomFill = rf.randomFill
- exports.randomFillSync = rf.randomFillSync
- exports.createCredentials = function () {
- throw new Error([
- 'sorry, createCredentials is not implemented yet',
- 'we accept pull requests',
- 'https://github.com/crypto-browserify/crypto-browserify'
- ].join('\n'))
- }
- exports.constants = {
- 'DH_CHECK_P_NOT_SAFE_PRIME': 2,
- 'DH_CHECK_P_NOT_PRIME': 1,
- 'DH_UNABLE_TO_CHECK_GENERATOR': 4,
- 'DH_NOT_SUITABLE_GENERATOR': 8,
- 'NPN_ENABLED': 1,
- 'ALPN_ENABLED': 1,
- 'RSA_PKCS1_PADDING': 1,
- 'RSA_SSLV23_PADDING': 2,
- 'RSA_NO_PADDING': 3,
- 'RSA_PKCS1_OAEP_PADDING': 4,
- 'RSA_X931_PADDING': 5,
- 'RSA_PKCS1_PSS_PADDING': 6,
- 'POINT_CONVERSION_COMPRESSED': 2,
- 'POINT_CONVERSION_UNCOMPRESSED': 4,
- 'POINT_CONVERSION_HYBRID': 6
- }
- /***/ }),
- /* 112 */
- /*!*********************************************!*\
- !*** ./node_modules/randombytes/browser.js ***!
- \*********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(global, process) {
- // limit of Crypto.getRandomValues()
- // https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues
- var MAX_BYTES = 65536
- // Node supports requesting up to this number of bytes
- // https://github.com/nodejs/node/blob/master/lib/internal/crypto/random.js#L48
- var MAX_UINT32 = 4294967295
- function oldBrowser () {
- throw new Error('Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11')
- }
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- var crypto = global.crypto || global.msCrypto
- if (crypto && crypto.getRandomValues) {
- module.exports = randomBytes
- } else {
- module.exports = oldBrowser
- }
- function randomBytes (size, cb) {
- // phantomjs needs to throw
- if (size > MAX_UINT32) throw new RangeError('requested too many random bytes')
- var bytes = Buffer.allocUnsafe(size)
- if (size > 0) { // getRandomValues fails on IE if size == 0
- if (size > MAX_BYTES) { // this is the max bytes crypto.getRandomValues
- // can do at once see https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues
- for (var generated = 0; generated < size; generated += MAX_BYTES) {
- // buffer.slice automatically checks if the end is past the end of
- // the buffer so we don't have to here
- crypto.getRandomValues(bytes.slice(generated, generated + MAX_BYTES))
- }
- } else {
- crypto.getRandomValues(bytes)
- }
- }
- if (typeof cb === 'function') {
- return process.nextTick(function () {
- cb(null, bytes)
- })
- }
- return bytes
- }
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ 3), __webpack_require__(/*! ./../node-libs-browser/mock/process.js */ 113)))
- /***/ }),
- /* 113 */
- /*!********************************************************!*\
- !*** ./node_modules/node-libs-browser/mock/process.js ***!
- \********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- exports.nextTick = function nextTick(fn) {
- var args = Array.prototype.slice.call(arguments);
- args.shift();
- setTimeout(function () {
- fn.apply(null, args);
- }, 0);
- };
- exports.platform = exports.arch =
- exports.execPath = exports.title = 'browser';
- exports.pid = 1;
- exports.browser = true;
- exports.env = {};
- exports.argv = [];
- exports.binding = function (name) {
- throw new Error('No such module. (Possibly not yet loaded)')
- };
- (function () {
- var cwd = '/';
- var path;
- exports.cwd = function () { return cwd };
- exports.chdir = function (dir) {
- if (!path) path = __webpack_require__(/*! path */ 114);
- cwd = path.resolve(dir, cwd);
- };
- })();
- exports.exit = exports.kill =
- exports.umask = exports.dlopen =
- exports.uptime = exports.memoryUsage =
- exports.uvCounters = function() {};
- exports.features = {};
- /***/ }),
- /* 114 */
- /*!***********************************************!*\
- !*** ./node_modules/path-browserify/index.js ***!
- \***********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- /* WEBPACK VAR INJECTION */(function(process) {// .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1,
- // backported and transplited with Babel, with backwards-compat fixes
- // Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
- // resolves . and .. elements in a path array with directory names there
- // must be no slashes, empty elements, or device names (c:\) in the array
- // (so also no leading and trailing slashes - it does not distinguish
- // relative and absolute paths)
- function normalizeArray(parts, allowAboveRoot) {
- // if the path tries to go above the root, `up` ends up > 0
- var up = 0;
- for (var i = parts.length - 1; i >= 0; i--) {
- var last = parts[i];
- if (last === '.') {
- parts.splice(i, 1);
- } else if (last === '..') {
- parts.splice(i, 1);
- up++;
- } else if (up) {
- parts.splice(i, 1);
- up--;
- }
- }
- // if the path is allowed to go above the root, restore leading ..s
- if (allowAboveRoot) {
- for (; up--; up) {
- parts.unshift('..');
- }
- }
- return parts;
- }
- // path.resolve([from ...], to)
- // posix version
- exports.resolve = function() {
- var resolvedPath = '',
- resolvedAbsolute = false;
- for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
- var path = (i >= 0) ? arguments[i] : process.cwd();
- // Skip empty and invalid entries
- if (typeof path !== 'string') {
- throw new TypeError('Arguments to path.resolve must be strings');
- } else if (!path) {
- continue;
- }
- resolvedPath = path + '/' + resolvedPath;
- resolvedAbsolute = path.charAt(0) === '/';
- }
- // At this point the path should be resolved to a full absolute path, but
- // handle relative paths to be safe (might happen when process.cwd() fails)
- // Normalize the path
- resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
- return !!p;
- }), !resolvedAbsolute).join('/');
- return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
- };
- // path.normalize(path)
- // posix version
- exports.normalize = function(path) {
- var isAbsolute = exports.isAbsolute(path),
- trailingSlash = substr(path, -1) === '/';
- // Normalize the path
- path = normalizeArray(filter(path.split('/'), function(p) {
- return !!p;
- }), !isAbsolute).join('/');
- if (!path && !isAbsolute) {
- path = '.';
- }
- if (path && trailingSlash) {
- path += '/';
- }
- return (isAbsolute ? '/' : '') + path;
- };
- // posix version
- exports.isAbsolute = function(path) {
- return path.charAt(0) === '/';
- };
- // posix version
- exports.join = function() {
- var paths = Array.prototype.slice.call(arguments, 0);
- return exports.normalize(filter(paths, function(p, index) {
- if (typeof p !== 'string') {
- throw new TypeError('Arguments to path.join must be strings');
- }
- return p;
- }).join('/'));
- };
- // path.relative(from, to)
- // posix version
- exports.relative = function(from, to) {
- from = exports.resolve(from).substr(1);
- to = exports.resolve(to).substr(1);
- function trim(arr) {
- var start = 0;
- for (; start < arr.length; start++) {
- if (arr[start] !== '') break;
- }
- var end = arr.length - 1;
- for (; end >= 0; end--) {
- if (arr[end] !== '') break;
- }
- if (start > end) return [];
- return arr.slice(start, end - start + 1);
- }
- var fromParts = trim(from.split('/'));
- var toParts = trim(to.split('/'));
- var length = Math.min(fromParts.length, toParts.length);
- var samePartsLength = length;
- for (var i = 0; i < length; i++) {
- if (fromParts[i] !== toParts[i]) {
- samePartsLength = i;
- break;
- }
- }
- var outputParts = [];
- for (var i = samePartsLength; i < fromParts.length; i++) {
- outputParts.push('..');
- }
- outputParts = outputParts.concat(toParts.slice(samePartsLength));
- return outputParts.join('/');
- };
- exports.sep = '/';
- exports.delimiter = ':';
- exports.dirname = function (path) {
- if (typeof path !== 'string') path = path + '';
- if (path.length === 0) return '.';
- var code = path.charCodeAt(0);
- var hasRoot = code === 47 /*/*/;
- var end = -1;
- var matchedSlash = true;
- for (var i = path.length - 1; i >= 1; --i) {
- code = path.charCodeAt(i);
- if (code === 47 /*/*/) {
- if (!matchedSlash) {
- end = i;
- break;
- }
- } else {
- // We saw the first non-path separator
- matchedSlash = false;
- }
- }
- if (end === -1) return hasRoot ? '/' : '.';
- if (hasRoot && end === 1) {
- // return '//';
- // Backwards-compat fix:
- return '/';
- }
- return path.slice(0, end);
- };
- function basename(path) {
- if (typeof path !== 'string') path = path + '';
- var start = 0;
- var end = -1;
- var matchedSlash = true;
- var i;
- for (i = path.length - 1; i >= 0; --i) {
- if (path.charCodeAt(i) === 47 /*/*/) {
- // If we reached a path separator that was not part of a set of path
- // separators at the end of the string, stop now
- if (!matchedSlash) {
- start = i + 1;
- break;
- }
- } else if (end === -1) {
- // We saw the first non-path separator, mark this as the end of our
- // path component
- matchedSlash = false;
- end = i + 1;
- }
- }
- if (end === -1) return '';
- return path.slice(start, end);
- }
- // Uses a mixed approach for backwards-compatibility, as ext behavior changed
- // in new Node.js versions, so only basename() above is backported here
- exports.basename = function (path, ext) {
- var f = basename(path);
- if (ext && f.substr(-1 * ext.length) === ext) {
- f = f.substr(0, f.length - ext.length);
- }
- return f;
- };
- exports.extname = function (path) {
- if (typeof path !== 'string') path = path + '';
- var startDot = -1;
- var startPart = 0;
- var end = -1;
- var matchedSlash = true;
- // Track the state of characters (if any) we see before our first dot and
- // after any path separator we find
- var preDotState = 0;
- for (var i = path.length - 1; i >= 0; --i) {
- var code = path.charCodeAt(i);
- if (code === 47 /*/*/) {
- // If we reached a path separator that was not part of a set of path
- // separators at the end of the string, stop now
- if (!matchedSlash) {
- startPart = i + 1;
- break;
- }
- continue;
- }
- if (end === -1) {
- // We saw the first non-path separator, mark this as the end of our
- // extension
- matchedSlash = false;
- end = i + 1;
- }
- if (code === 46 /*.*/) {
- // If this is our first dot, mark it as the start of our extension
- if (startDot === -1)
- startDot = i;
- else if (preDotState !== 1)
- preDotState = 1;
- } else if (startDot !== -1) {
- // We saw a non-dot and non-path separator before our dot, so we should
- // have a good chance at having a non-empty extension
- preDotState = -1;
- }
- }
- if (startDot === -1 || end === -1 ||
- // We saw a non-dot character immediately before the dot
- preDotState === 0 ||
- // The (right-most) trimmed path component is exactly '..'
- preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
- return '';
- }
- return path.slice(startDot, end);
- };
- function filter (xs, f) {
- if (xs.filter) return xs.filter(f);
- var res = [];
- for (var i = 0; i < xs.length; i++) {
- if (f(xs[i], i, xs)) res.push(xs[i]);
- }
- return res;
- }
- // String.prototype.substr - negative index don't work in IE8
- var substr = 'ab'.substr(-1) === 'b'
- ? function (str, start, len) { return str.substr(start, len) }
- : function (str, start, len) {
- if (start < 0) start = str.length + start;
- return str.substr(start, len);
- }
- ;
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../node-libs-browser/mock/process.js */ 113)))
- /***/ }),
- /* 115 */
- /*!*******************************************!*\
- !*** ./node_modules/safe-buffer/index.js ***!
- \*******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
- /* eslint-disable node/no-deprecated-api */
- var buffer = __webpack_require__(/*! buffer */ 116)
- var Buffer = buffer.Buffer
- // alternative to using Object.keys for old browsers
- function copyProps (src, dst) {
- for (var key in src) {
- dst[key] = src[key]
- }
- }
- if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
- module.exports = buffer
- } else {
- // Copy properties from require('buffer')
- copyProps(buffer, exports)
- exports.Buffer = SafeBuffer
- }
- function SafeBuffer (arg, encodingOrOffset, length) {
- return Buffer(arg, encodingOrOffset, length)
- }
- SafeBuffer.prototype = Object.create(Buffer.prototype)
- // Copy static methods from Buffer
- copyProps(Buffer, SafeBuffer)
- SafeBuffer.from = function (arg, encodingOrOffset, length) {
- if (typeof arg === 'number') {
- throw new TypeError('Argument must not be a number')
- }
- return Buffer(arg, encodingOrOffset, length)
- }
- SafeBuffer.alloc = function (size, fill, encoding) {
- if (typeof size !== 'number') {
- throw new TypeError('Argument must be a number')
- }
- var buf = Buffer(size)
- if (fill !== undefined) {
- if (typeof encoding === 'string') {
- buf.fill(fill, encoding)
- } else {
- buf.fill(fill)
- }
- } else {
- buf.fill(0)
- }
- return buf
- }
- SafeBuffer.allocUnsafe = function (size) {
- if (typeof size !== 'number') {
- throw new TypeError('Argument must be a number')
- }
- return Buffer(size)
- }
- SafeBuffer.allocUnsafeSlow = function (size) {
- if (typeof size !== 'number') {
- throw new TypeError('Argument must be a number')
- }
- return buffer.SlowBuffer(size)
- }
- /***/ }),
- /* 116 */
- /*!**************************************!*\
- !*** ./node_modules/buffer/index.js ***!
- \**************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(global) {/*!
- * The buffer module from node.js, for the browser.
- *
- * @author Feross Aboukhadijeh <http://feross.org>
- * @license MIT
- */
- /* eslint-disable no-proto */
- var base64 = __webpack_require__(/*! base64-js */ 117)
- var ieee754 = __webpack_require__(/*! ieee754 */ 118)
- var isArray = __webpack_require__(/*! isarray */ 119)
- exports.Buffer = Buffer
- exports.SlowBuffer = SlowBuffer
- exports.INSPECT_MAX_BYTES = 50
- /**
- * If `Buffer.TYPED_ARRAY_SUPPORT`:
- * === true Use Uint8Array implementation (fastest)
- * === false Use Object implementation (most compatible, even IE6)
- *
- * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
- * Opera 11.6+, iOS 4.2+.
- *
- * Due to various browser bugs, sometimes the Object implementation will be used even
- * when the browser supports typed arrays.
- *
- * Note:
- *
- * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
- * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
- *
- * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
- *
- * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
- * incorrect length in some situations.
- * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
- * get the Object implementation, which is slower but behaves correctly.
- */
- Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
- ? global.TYPED_ARRAY_SUPPORT
- : typedArraySupport()
- /*
- * Export kMaxLength after typed array support is determined.
- */
- exports.kMaxLength = kMaxLength()
- function typedArraySupport () {
- try {
- var arr = new Uint8Array(1)
- arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
- return arr.foo() === 42 && // typed array instances can be augmented
- typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
- arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
- } catch (e) {
- return false
- }
- }
- function kMaxLength () {
- return Buffer.TYPED_ARRAY_SUPPORT
- ? 0x7fffffff
- : 0x3fffffff
- }
- function createBuffer (that, length) {
- if (kMaxLength() < length) {
- throw new RangeError('Invalid typed array length')
- }
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- // Return an augmented `Uint8Array` instance, for best performance
- that = new Uint8Array(length)
- that.__proto__ = Buffer.prototype
- } else {
- // Fallback: Return an object instance of the Buffer class
- if (that === null) {
- that = new Buffer(length)
- }
- that.length = length
- }
- return that
- }
- /**
- * The Buffer constructor returns instances of `Uint8Array` that have their
- * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
- * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
- * and the `Uint8Array` methods. Square bracket notation works as expected -- it
- * returns a single octet.
- *
- * The `Uint8Array` prototype remains unmodified.
- */
- function Buffer (arg, encodingOrOffset, length) {
- if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
- return new Buffer(arg, encodingOrOffset, length)
- }
- // Common case.
- if (typeof arg === 'number') {
- if (typeof encodingOrOffset === 'string') {
- throw new Error(
- 'If encoding is specified then the first argument must be a string'
- )
- }
- return allocUnsafe(this, arg)
- }
- return from(this, arg, encodingOrOffset, length)
- }
- Buffer.poolSize = 8192 // not used by this implementation
- // TODO: Legacy, not needed anymore. Remove in next major version.
- Buffer._augment = function (arr) {
- arr.__proto__ = Buffer.prototype
- return arr
- }
- function from (that, value, encodingOrOffset, length) {
- if (typeof value === 'number') {
- throw new TypeError('"value" argument must not be a number')
- }
- if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
- return fromArrayBuffer(that, value, encodingOrOffset, length)
- }
- if (typeof value === 'string') {
- return fromString(that, value, encodingOrOffset)
- }
- return fromObject(that, value)
- }
- /**
- * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
- * if value is a number.
- * Buffer.from(str[, encoding])
- * Buffer.from(array)
- * Buffer.from(buffer)
- * Buffer.from(arrayBuffer[, byteOffset[, length]])
- **/
- Buffer.from = function (value, encodingOrOffset, length) {
- return from(null, value, encodingOrOffset, length)
- }
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- Buffer.prototype.__proto__ = Uint8Array.prototype
- Buffer.__proto__ = Uint8Array
- if (typeof Symbol !== 'undefined' && Symbol.species &&
- Buffer[Symbol.species] === Buffer) {
- // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
- Object.defineProperty(Buffer, Symbol.species, {
- value: null,
- configurable: true
- })
- }
- }
- function assertSize (size) {
- if (typeof size !== 'number') {
- throw new TypeError('"size" argument must be a number')
- } else if (size < 0) {
- throw new RangeError('"size" argument must not be negative')
- }
- }
- function alloc (that, size, fill, encoding) {
- assertSize(size)
- if (size <= 0) {
- return createBuffer(that, size)
- }
- if (fill !== undefined) {
- // Only pay attention to encoding if it's a string. This
- // prevents accidentally sending in a number that would
- // be interpretted as a start offset.
- return typeof encoding === 'string'
- ? createBuffer(that, size).fill(fill, encoding)
- : createBuffer(that, size).fill(fill)
- }
- return createBuffer(that, size)
- }
- /**
- * Creates a new filled Buffer instance.
- * alloc(size[, fill[, encoding]])
- **/
- Buffer.alloc = function (size, fill, encoding) {
- return alloc(null, size, fill, encoding)
- }
- function allocUnsafe (that, size) {
- assertSize(size)
- that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
- if (!Buffer.TYPED_ARRAY_SUPPORT) {
- for (var i = 0; i < size; ++i) {
- that[i] = 0
- }
- }
- return that
- }
- /**
- * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
- * */
- Buffer.allocUnsafe = function (size) {
- return allocUnsafe(null, size)
- }
- /**
- * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
- */
- Buffer.allocUnsafeSlow = function (size) {
- return allocUnsafe(null, size)
- }
- function fromString (that, string, encoding) {
- if (typeof encoding !== 'string' || encoding === '') {
- encoding = 'utf8'
- }
- if (!Buffer.isEncoding(encoding)) {
- throw new TypeError('"encoding" must be a valid string encoding')
- }
- var length = byteLength(string, encoding) | 0
- that = createBuffer(that, length)
- var actual = that.write(string, encoding)
- if (actual !== length) {
- // Writing a hex string, for example, that contains invalid characters will
- // cause everything after the first invalid character to be ignored. (e.g.
- // 'abxxcd' will be treated as 'ab')
- that = that.slice(0, actual)
- }
- return that
- }
- function fromArrayLike (that, array) {
- var length = array.length < 0 ? 0 : checked(array.length) | 0
- that = createBuffer(that, length)
- for (var i = 0; i < length; i += 1) {
- that[i] = array[i] & 255
- }
- return that
- }
- function fromArrayBuffer (that, array, byteOffset, length) {
- array.byteLength // this throws if `array` is not a valid ArrayBuffer
- if (byteOffset < 0 || array.byteLength < byteOffset) {
- throw new RangeError('\'offset\' is out of bounds')
- }
- if (array.byteLength < byteOffset + (length || 0)) {
- throw new RangeError('\'length\' is out of bounds')
- }
- if (byteOffset === undefined && length === undefined) {
- array = new Uint8Array(array)
- } else if (length === undefined) {
- array = new Uint8Array(array, byteOffset)
- } else {
- array = new Uint8Array(array, byteOffset, length)
- }
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- // Return an augmented `Uint8Array` instance, for best performance
- that = array
- that.__proto__ = Buffer.prototype
- } else {
- // Fallback: Return an object instance of the Buffer class
- that = fromArrayLike(that, array)
- }
- return that
- }
- function fromObject (that, obj) {
- if (Buffer.isBuffer(obj)) {
- var len = checked(obj.length) | 0
- that = createBuffer(that, len)
- if (that.length === 0) {
- return that
- }
- obj.copy(that, 0, 0, len)
- return that
- }
- if (obj) {
- if ((typeof ArrayBuffer !== 'undefined' &&
- obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
- if (typeof obj.length !== 'number' || isnan(obj.length)) {
- return createBuffer(that, 0)
- }
- return fromArrayLike(that, obj)
- }
- if (obj.type === 'Buffer' && isArray(obj.data)) {
- return fromArrayLike(that, obj.data)
- }
- }
- throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
- }
- function checked (length) {
- // Note: cannot use `length < kMaxLength()` here because that fails when
- // length is NaN (which is otherwise coerced to zero.)
- if (length >= kMaxLength()) {
- throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
- 'size: 0x' + kMaxLength().toString(16) + ' bytes')
- }
- return length | 0
- }
- function SlowBuffer (length) {
- if (+length != length) { // eslint-disable-line eqeqeq
- length = 0
- }
- return Buffer.alloc(+length)
- }
- Buffer.isBuffer = function isBuffer (b) {
- return !!(b != null && b._isBuffer)
- }
- Buffer.compare = function compare (a, b) {
- if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
- throw new TypeError('Arguments must be Buffers')
- }
- if (a === b) return 0
- var x = a.length
- var y = b.length
- for (var i = 0, len = Math.min(x, y); i < len; ++i) {
- if (a[i] !== b[i]) {
- x = a[i]
- y = b[i]
- break
- }
- }
- if (x < y) return -1
- if (y < x) return 1
- return 0
- }
- Buffer.isEncoding = function isEncoding (encoding) {
- switch (String(encoding).toLowerCase()) {
- case 'hex':
- case 'utf8':
- case 'utf-8':
- case 'ascii':
- case 'latin1':
- case 'binary':
- case 'base64':
- case 'ucs2':
- case 'ucs-2':
- case 'utf16le':
- case 'utf-16le':
- return true
- default:
- return false
- }
- }
- Buffer.concat = function concat (list, length) {
- if (!isArray(list)) {
- throw new TypeError('"list" argument must be an Array of Buffers')
- }
- if (list.length === 0) {
- return Buffer.alloc(0)
- }
- var i
- if (length === undefined) {
- length = 0
- for (i = 0; i < list.length; ++i) {
- length += list[i].length
- }
- }
- var buffer = Buffer.allocUnsafe(length)
- var pos = 0
- for (i = 0; i < list.length; ++i) {
- var buf = list[i]
- if (!Buffer.isBuffer(buf)) {
- throw new TypeError('"list" argument must be an Array of Buffers')
- }
- buf.copy(buffer, pos)
- pos += buf.length
- }
- return buffer
- }
- function byteLength (string, encoding) {
- if (Buffer.isBuffer(string)) {
- return string.length
- }
- if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
- (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
- return string.byteLength
- }
- if (typeof string !== 'string') {
- string = '' + string
- }
- var len = string.length
- if (len === 0) return 0
- // Use a for loop to avoid recursion
- var loweredCase = false
- for (;;) {
- switch (encoding) {
- case 'ascii':
- case 'latin1':
- case 'binary':
- return len
- case 'utf8':
- case 'utf-8':
- case undefined:
- return utf8ToBytes(string).length
- case 'ucs2':
- case 'ucs-2':
- case 'utf16le':
- case 'utf-16le':
- return len * 2
- case 'hex':
- return len >>> 1
- case 'base64':
- return base64ToBytes(string).length
- default:
- if (loweredCase) return utf8ToBytes(string).length // assume utf8
- encoding = ('' + encoding).toLowerCase()
- loweredCase = true
- }
- }
- }
- Buffer.byteLength = byteLength
- function slowToString (encoding, start, end) {
- var loweredCase = false
- // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
- // property of a typed array.
- // This behaves neither like String nor Uint8Array in that we set start/end
- // to their upper/lower bounds if the value passed is out of range.
- // undefined is handled specially as per ECMA-262 6th Edition,
- // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
- if (start === undefined || start < 0) {
- start = 0
- }
- // Return early if start > this.length. Done here to prevent potential uint32
- // coercion fail below.
- if (start > this.length) {
- return ''
- }
- if (end === undefined || end > this.length) {
- end = this.length
- }
- if (end <= 0) {
- return ''
- }
- // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
- end >>>= 0
- start >>>= 0
- if (end <= start) {
- return ''
- }
- if (!encoding) encoding = 'utf8'
- while (true) {
- switch (encoding) {
- case 'hex':
- return hexSlice(this, start, end)
- case 'utf8':
- case 'utf-8':
- return utf8Slice(this, start, end)
- case 'ascii':
- return asciiSlice(this, start, end)
- case 'latin1':
- case 'binary':
- return latin1Slice(this, start, end)
- case 'base64':
- return base64Slice(this, start, end)
- case 'ucs2':
- case 'ucs-2':
- case 'utf16le':
- case 'utf-16le':
- return utf16leSlice(this, start, end)
- default:
- if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
- encoding = (encoding + '').toLowerCase()
- loweredCase = true
- }
- }
- }
- // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
- // Buffer instances.
- Buffer.prototype._isBuffer = true
- function swap (b, n, m) {
- var i = b[n]
- b[n] = b[m]
- b[m] = i
- }
- Buffer.prototype.swap16 = function swap16 () {
- var len = this.length
- if (len % 2 !== 0) {
- throw new RangeError('Buffer size must be a multiple of 16-bits')
- }
- for (var i = 0; i < len; i += 2) {
- swap(this, i, i + 1)
- }
- return this
- }
- Buffer.prototype.swap32 = function swap32 () {
- var len = this.length
- if (len % 4 !== 0) {
- throw new RangeError('Buffer size must be a multiple of 32-bits')
- }
- for (var i = 0; i < len; i += 4) {
- swap(this, i, i + 3)
- swap(this, i + 1, i + 2)
- }
- return this
- }
- Buffer.prototype.swap64 = function swap64 () {
- var len = this.length
- if (len % 8 !== 0) {
- throw new RangeError('Buffer size must be a multiple of 64-bits')
- }
- for (var i = 0; i < len; i += 8) {
- swap(this, i, i + 7)
- swap(this, i + 1, i + 6)
- swap(this, i + 2, i + 5)
- swap(this, i + 3, i + 4)
- }
- return this
- }
- Buffer.prototype.toString = function toString () {
- var length = this.length | 0
- if (length === 0) return ''
- if (arguments.length === 0) return utf8Slice(this, 0, length)
- return slowToString.apply(this, arguments)
- }
- Buffer.prototype.equals = function equals (b) {
- if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
- if (this === b) return true
- return Buffer.compare(this, b) === 0
- }
- Buffer.prototype.inspect = function inspect () {
- var str = ''
- var max = exports.INSPECT_MAX_BYTES
- if (this.length > 0) {
- str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
- if (this.length > max) str += ' ... '
- }
- return '<Buffer ' + str + '>'
- }
- Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
- if (!Buffer.isBuffer(target)) {
- throw new TypeError('Argument must be a Buffer')
- }
- if (start === undefined) {
- start = 0
- }
- if (end === undefined) {
- end = target ? target.length : 0
- }
- if (thisStart === undefined) {
- thisStart = 0
- }
- if (thisEnd === undefined) {
- thisEnd = this.length
- }
- if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
- throw new RangeError('out of range index')
- }
- if (thisStart >= thisEnd && start >= end) {
- return 0
- }
- if (thisStart >= thisEnd) {
- return -1
- }
- if (start >= end) {
- return 1
- }
- start >>>= 0
- end >>>= 0
- thisStart >>>= 0
- thisEnd >>>= 0
- if (this === target) return 0
- var x = thisEnd - thisStart
- var y = end - start
- var len = Math.min(x, y)
- var thisCopy = this.slice(thisStart, thisEnd)
- var targetCopy = target.slice(start, end)
- for (var i = 0; i < len; ++i) {
- if (thisCopy[i] !== targetCopy[i]) {
- x = thisCopy[i]
- y = targetCopy[i]
- break
- }
- }
- if (x < y) return -1
- if (y < x) return 1
- return 0
- }
- // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
- // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
- //
- // Arguments:
- // - buffer - a Buffer to search
- // - val - a string, Buffer, or number
- // - byteOffset - an index into `buffer`; will be clamped to an int32
- // - encoding - an optional encoding, relevant is val is a string
- // - dir - true for indexOf, false for lastIndexOf
- function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
- // Empty buffer means no match
- if (buffer.length === 0) return -1
- // Normalize byteOffset
- if (typeof byteOffset === 'string') {
- encoding = byteOffset
- byteOffset = 0
- } else if (byteOffset > 0x7fffffff) {
- byteOffset = 0x7fffffff
- } else if (byteOffset < -0x80000000) {
- byteOffset = -0x80000000
- }
- byteOffset = +byteOffset // Coerce to Number.
- if (isNaN(byteOffset)) {
- // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
- byteOffset = dir ? 0 : (buffer.length - 1)
- }
- // Normalize byteOffset: negative offsets start from the end of the buffer
- if (byteOffset < 0) byteOffset = buffer.length + byteOffset
- if (byteOffset >= buffer.length) {
- if (dir) return -1
- else byteOffset = buffer.length - 1
- } else if (byteOffset < 0) {
- if (dir) byteOffset = 0
- else return -1
- }
- // Normalize val
- if (typeof val === 'string') {
- val = Buffer.from(val, encoding)
- }
- // Finally, search either indexOf (if dir is true) or lastIndexOf
- if (Buffer.isBuffer(val)) {
- // Special case: looking for empty string/buffer always fails
- if (val.length === 0) {
- return -1
- }
- return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
- } else if (typeof val === 'number') {
- val = val & 0xFF // Search for a byte value [0-255]
- if (Buffer.TYPED_ARRAY_SUPPORT &&
- typeof Uint8Array.prototype.indexOf === 'function') {
- if (dir) {
- return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
- } else {
- return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
- }
- }
- return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
- }
- throw new TypeError('val must be string, number or Buffer')
- }
- function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
- var indexSize = 1
- var arrLength = arr.length
- var valLength = val.length
- if (encoding !== undefined) {
- encoding = String(encoding).toLowerCase()
- if (encoding === 'ucs2' || encoding === 'ucs-2' ||
- encoding === 'utf16le' || encoding === 'utf-16le') {
- if (arr.length < 2 || val.length < 2) {
- return -1
- }
- indexSize = 2
- arrLength /= 2
- valLength /= 2
- byteOffset /= 2
- }
- }
- function read (buf, i) {
- if (indexSize === 1) {
- return buf[i]
- } else {
- return buf.readUInt16BE(i * indexSize)
- }
- }
- var i
- if (dir) {
- var foundIndex = -1
- for (i = byteOffset; i < arrLength; i++) {
- if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
- if (foundIndex === -1) foundIndex = i
- if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
- } else {
- if (foundIndex !== -1) i -= i - foundIndex
- foundIndex = -1
- }
- }
- } else {
- if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
- for (i = byteOffset; i >= 0; i--) {
- var found = true
- for (var j = 0; j < valLength; j++) {
- if (read(arr, i + j) !== read(val, j)) {
- found = false
- break
- }
- }
- if (found) return i
- }
- }
- return -1
- }
- Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
- return this.indexOf(val, byteOffset, encoding) !== -1
- }
- Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
- return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
- }
- Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
- return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
- }
- function hexWrite (buf, string, offset, length) {
- offset = Number(offset) || 0
- var remaining = buf.length - offset
- if (!length) {
- length = remaining
- } else {
- length = Number(length)
- if (length > remaining) {
- length = remaining
- }
- }
- // must be an even number of digits
- var strLen = string.length
- if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
- if (length > strLen / 2) {
- length = strLen / 2
- }
- for (var i = 0; i < length; ++i) {
- var parsed = parseInt(string.substr(i * 2, 2), 16)
- if (isNaN(parsed)) return i
- buf[offset + i] = parsed
- }
- return i
- }
- function utf8Write (buf, string, offset, length) {
- return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
- }
- function asciiWrite (buf, string, offset, length) {
- return blitBuffer(asciiToBytes(string), buf, offset, length)
- }
- function latin1Write (buf, string, offset, length) {
- return asciiWrite(buf, string, offset, length)
- }
- function base64Write (buf, string, offset, length) {
- return blitBuffer(base64ToBytes(string), buf, offset, length)
- }
- function ucs2Write (buf, string, offset, length) {
- return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
- }
- Buffer.prototype.write = function write (string, offset, length, encoding) {
- // Buffer#write(string)
- if (offset === undefined) {
- encoding = 'utf8'
- length = this.length
- offset = 0
- // Buffer#write(string, encoding)
- } else if (length === undefined && typeof offset === 'string') {
- encoding = offset
- length = this.length
- offset = 0
- // Buffer#write(string, offset[, length][, encoding])
- } else if (isFinite(offset)) {
- offset = offset | 0
- if (isFinite(length)) {
- length = length | 0
- if (encoding === undefined) encoding = 'utf8'
- } else {
- encoding = length
- length = undefined
- }
- // legacy write(string, encoding, offset, length) - remove in v0.13
- } else {
- throw new Error(
- 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
- )
- }
- var remaining = this.length - offset
- if (length === undefined || length > remaining) length = remaining
- if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
- throw new RangeError('Attempt to write outside buffer bounds')
- }
- if (!encoding) encoding = 'utf8'
- var loweredCase = false
- for (;;) {
- switch (encoding) {
- case 'hex':
- return hexWrite(this, string, offset, length)
- case 'utf8':
- case 'utf-8':
- return utf8Write(this, string, offset, length)
- case 'ascii':
- return asciiWrite(this, string, offset, length)
- case 'latin1':
- case 'binary':
- return latin1Write(this, string, offset, length)
- case 'base64':
- // Warning: maxLength not taken into account in base64Write
- return base64Write(this, string, offset, length)
- case 'ucs2':
- case 'ucs-2':
- case 'utf16le':
- case 'utf-16le':
- return ucs2Write(this, string, offset, length)
- default:
- if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
- encoding = ('' + encoding).toLowerCase()
- loweredCase = true
- }
- }
- }
- Buffer.prototype.toJSON = function toJSON () {
- return {
- type: 'Buffer',
- data: Array.prototype.slice.call(this._arr || this, 0)
- }
- }
- function base64Slice (buf, start, end) {
- if (start === 0 && end === buf.length) {
- return base64.fromByteArray(buf)
- } else {
- return base64.fromByteArray(buf.slice(start, end))
- }
- }
- function utf8Slice (buf, start, end) {
- end = Math.min(buf.length, end)
- var res = []
- var i = start
- while (i < end) {
- var firstByte = buf[i]
- var codePoint = null
- var bytesPerSequence = (firstByte > 0xEF) ? 4
- : (firstByte > 0xDF) ? 3
- : (firstByte > 0xBF) ? 2
- : 1
- if (i + bytesPerSequence <= end) {
- var secondByte, thirdByte, fourthByte, tempCodePoint
- switch (bytesPerSequence) {
- case 1:
- if (firstByte < 0x80) {
- codePoint = firstByte
- }
- break
- case 2:
- secondByte = buf[i + 1]
- if ((secondByte & 0xC0) === 0x80) {
- tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
- if (tempCodePoint > 0x7F) {
- codePoint = tempCodePoint
- }
- }
- break
- case 3:
- secondByte = buf[i + 1]
- thirdByte = buf[i + 2]
- if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
- tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
- if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
- codePoint = tempCodePoint
- }
- }
- break
- case 4:
- secondByte = buf[i + 1]
- thirdByte = buf[i + 2]
- fourthByte = buf[i + 3]
- if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
- tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
- if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
- codePoint = tempCodePoint
- }
- }
- }
- }
- if (codePoint === null) {
- // we did not generate a valid codePoint so insert a
- // replacement char (U+FFFD) and advance only 1 byte
- codePoint = 0xFFFD
- bytesPerSequence = 1
- } else if (codePoint > 0xFFFF) {
- // encode to utf16 (surrogate pair dance)
- codePoint -= 0x10000
- res.push(codePoint >>> 10 & 0x3FF | 0xD800)
- codePoint = 0xDC00 | codePoint & 0x3FF
- }
- res.push(codePoint)
- i += bytesPerSequence
- }
- return decodeCodePointsArray(res)
- }
- // Based on http://stackoverflow.com/a/22747272/680742, the browser with
- // the lowest limit is Chrome, with 0x10000 args.
- // We go 1 magnitude less, for safety
- var MAX_ARGUMENTS_LENGTH = 0x1000
- function decodeCodePointsArray (codePoints) {
- var len = codePoints.length
- if (len <= MAX_ARGUMENTS_LENGTH) {
- return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
- }
- // Decode in chunks to avoid "call stack size exceeded".
- var res = ''
- var i = 0
- while (i < len) {
- res += String.fromCharCode.apply(
- String,
- codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
- )
- }
- return res
- }
- function asciiSlice (buf, start, end) {
- var ret = ''
- end = Math.min(buf.length, end)
- for (var i = start; i < end; ++i) {
- ret += String.fromCharCode(buf[i] & 0x7F)
- }
- return ret
- }
- function latin1Slice (buf, start, end) {
- var ret = ''
- end = Math.min(buf.length, end)
- for (var i = start; i < end; ++i) {
- ret += String.fromCharCode(buf[i])
- }
- return ret
- }
- function hexSlice (buf, start, end) {
- var len = buf.length
- if (!start || start < 0) start = 0
- if (!end || end < 0 || end > len) end = len
- var out = ''
- for (var i = start; i < end; ++i) {
- out += toHex(buf[i])
- }
- return out
- }
- function utf16leSlice (buf, start, end) {
- var bytes = buf.slice(start, end)
- var res = ''
- for (var i = 0; i < bytes.length; i += 2) {
- res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
- }
- return res
- }
- Buffer.prototype.slice = function slice (start, end) {
- var len = this.length
- start = ~~start
- end = end === undefined ? len : ~~end
- if (start < 0) {
- start += len
- if (start < 0) start = 0
- } else if (start > len) {
- start = len
- }
- if (end < 0) {
- end += len
- if (end < 0) end = 0
- } else if (end > len) {
- end = len
- }
- if (end < start) end = start
- var newBuf
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- newBuf = this.subarray(start, end)
- newBuf.__proto__ = Buffer.prototype
- } else {
- var sliceLen = end - start
- newBuf = new Buffer(sliceLen, undefined)
- for (var i = 0; i < sliceLen; ++i) {
- newBuf[i] = this[i + start]
- }
- }
- return newBuf
- }
- /*
- * Need to make sure that buffer isn't trying to write out of bounds.
- */
- function checkOffset (offset, ext, length) {
- if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
- if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
- }
- Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
- offset = offset | 0
- byteLength = byteLength | 0
- if (!noAssert) checkOffset(offset, byteLength, this.length)
- var val = this[offset]
- var mul = 1
- var i = 0
- while (++i < byteLength && (mul *= 0x100)) {
- val += this[offset + i] * mul
- }
- return val
- }
- Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
- offset = offset | 0
- byteLength = byteLength | 0
- if (!noAssert) {
- checkOffset(offset, byteLength, this.length)
- }
- var val = this[offset + --byteLength]
- var mul = 1
- while (byteLength > 0 && (mul *= 0x100)) {
- val += this[offset + --byteLength] * mul
- }
- return val
- }
- Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 1, this.length)
- return this[offset]
- }
- Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 2, this.length)
- return this[offset] | (this[offset + 1] << 8)
- }
- Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 2, this.length)
- return (this[offset] << 8) | this[offset + 1]
- }
- Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 4, this.length)
- return ((this[offset]) |
- (this[offset + 1] << 8) |
- (this[offset + 2] << 16)) +
- (this[offset + 3] * 0x1000000)
- }
- Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 4, this.length)
- return (this[offset] * 0x1000000) +
- ((this[offset + 1] << 16) |
- (this[offset + 2] << 8) |
- this[offset + 3])
- }
- Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
- offset = offset | 0
- byteLength = byteLength | 0
- if (!noAssert) checkOffset(offset, byteLength, this.length)
- var val = this[offset]
- var mul = 1
- var i = 0
- while (++i < byteLength && (mul *= 0x100)) {
- val += this[offset + i] * mul
- }
- mul *= 0x80
- if (val >= mul) val -= Math.pow(2, 8 * byteLength)
- return val
- }
- Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
- offset = offset | 0
- byteLength = byteLength | 0
- if (!noAssert) checkOffset(offset, byteLength, this.length)
- var i = byteLength
- var mul = 1
- var val = this[offset + --i]
- while (i > 0 && (mul *= 0x100)) {
- val += this[offset + --i] * mul
- }
- mul *= 0x80
- if (val >= mul) val -= Math.pow(2, 8 * byteLength)
- return val
- }
- Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 1, this.length)
- if (!(this[offset] & 0x80)) return (this[offset])
- return ((0xff - this[offset] + 1) * -1)
- }
- Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 2, this.length)
- var val = this[offset] | (this[offset + 1] << 8)
- return (val & 0x8000) ? val | 0xFFFF0000 : val
- }
- Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 2, this.length)
- var val = this[offset + 1] | (this[offset] << 8)
- return (val & 0x8000) ? val | 0xFFFF0000 : val
- }
- Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 4, this.length)
- return (this[offset]) |
- (this[offset + 1] << 8) |
- (this[offset + 2] << 16) |
- (this[offset + 3] << 24)
- }
- Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 4, this.length)
- return (this[offset] << 24) |
- (this[offset + 1] << 16) |
- (this[offset + 2] << 8) |
- (this[offset + 3])
- }
- Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 4, this.length)
- return ieee754.read(this, offset, true, 23, 4)
- }
- Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 4, this.length)
- return ieee754.read(this, offset, false, 23, 4)
- }
- Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 8, this.length)
- return ieee754.read(this, offset, true, 52, 8)
- }
- Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 8, this.length)
- return ieee754.read(this, offset, false, 52, 8)
- }
- function checkInt (buf, value, offset, ext, max, min) {
- if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
- if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
- if (offset + ext > buf.length) throw new RangeError('Index out of range')
- }
- Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
- value = +value
- offset = offset | 0
- byteLength = byteLength | 0
- if (!noAssert) {
- var maxBytes = Math.pow(2, 8 * byteLength) - 1
- checkInt(this, value, offset, byteLength, maxBytes, 0)
- }
- var mul = 1
- var i = 0
- this[offset] = value & 0xFF
- while (++i < byteLength && (mul *= 0x100)) {
- this[offset + i] = (value / mul) & 0xFF
- }
- return offset + byteLength
- }
- Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
- value = +value
- offset = offset | 0
- byteLength = byteLength | 0
- if (!noAssert) {
- var maxBytes = Math.pow(2, 8 * byteLength) - 1
- checkInt(this, value, offset, byteLength, maxBytes, 0)
- }
- var i = byteLength - 1
- var mul = 1
- this[offset + i] = value & 0xFF
- while (--i >= 0 && (mul *= 0x100)) {
- this[offset + i] = (value / mul) & 0xFF
- }
- return offset + byteLength
- }
- Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
- if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
- this[offset] = (value & 0xff)
- return offset + 1
- }
- function objectWriteUInt16 (buf, value, offset, littleEndian) {
- if (value < 0) value = 0xffff + value + 1
- for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
- buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
- (littleEndian ? i : 1 - i) * 8
- }
- }
- Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = (value & 0xff)
- this[offset + 1] = (value >>> 8)
- } else {
- objectWriteUInt16(this, value, offset, true)
- }
- return offset + 2
- }
- Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = (value >>> 8)
- this[offset + 1] = (value & 0xff)
- } else {
- objectWriteUInt16(this, value, offset, false)
- }
- return offset + 2
- }
- function objectWriteUInt32 (buf, value, offset, littleEndian) {
- if (value < 0) value = 0xffffffff + value + 1
- for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
- buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
- }
- }
- Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset + 3] = (value >>> 24)
- this[offset + 2] = (value >>> 16)
- this[offset + 1] = (value >>> 8)
- this[offset] = (value & 0xff)
- } else {
- objectWriteUInt32(this, value, offset, true)
- }
- return offset + 4
- }
- Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = (value >>> 24)
- this[offset + 1] = (value >>> 16)
- this[offset + 2] = (value >>> 8)
- this[offset + 3] = (value & 0xff)
- } else {
- objectWriteUInt32(this, value, offset, false)
- }
- return offset + 4
- }
- Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) {
- var limit = Math.pow(2, 8 * byteLength - 1)
- checkInt(this, value, offset, byteLength, limit - 1, -limit)
- }
- var i = 0
- var mul = 1
- var sub = 0
- this[offset] = value & 0xFF
- while (++i < byteLength && (mul *= 0x100)) {
- if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
- sub = 1
- }
- this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
- }
- return offset + byteLength
- }
- Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) {
- var limit = Math.pow(2, 8 * byteLength - 1)
- checkInt(this, value, offset, byteLength, limit - 1, -limit)
- }
- var i = byteLength - 1
- var mul = 1
- var sub = 0
- this[offset + i] = value & 0xFF
- while (--i >= 0 && (mul *= 0x100)) {
- if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
- sub = 1
- }
- this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
- }
- return offset + byteLength
- }
- Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
- if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
- if (value < 0) value = 0xff + value + 1
- this[offset] = (value & 0xff)
- return offset + 1
- }
- Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = (value & 0xff)
- this[offset + 1] = (value >>> 8)
- } else {
- objectWriteUInt16(this, value, offset, true)
- }
- return offset + 2
- }
- Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = (value >>> 8)
- this[offset + 1] = (value & 0xff)
- } else {
- objectWriteUInt16(this, value, offset, false)
- }
- return offset + 2
- }
- Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = (value & 0xff)
- this[offset + 1] = (value >>> 8)
- this[offset + 2] = (value >>> 16)
- this[offset + 3] = (value >>> 24)
- } else {
- objectWriteUInt32(this, value, offset, true)
- }
- return offset + 4
- }
- Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
- if (value < 0) value = 0xffffffff + value + 1
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = (value >>> 24)
- this[offset + 1] = (value >>> 16)
- this[offset + 2] = (value >>> 8)
- this[offset + 3] = (value & 0xff)
- } else {
- objectWriteUInt32(this, value, offset, false)
- }
- return offset + 4
- }
- function checkIEEE754 (buf, value, offset, ext, max, min) {
- if (offset + ext > buf.length) throw new RangeError('Index out of range')
- if (offset < 0) throw new RangeError('Index out of range')
- }
- function writeFloat (buf, value, offset, littleEndian, noAssert) {
- if (!noAssert) {
- checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
- }
- ieee754.write(buf, value, offset, littleEndian, 23, 4)
- return offset + 4
- }
- Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
- return writeFloat(this, value, offset, true, noAssert)
- }
- Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
- return writeFloat(this, value, offset, false, noAssert)
- }
- function writeDouble (buf, value, offset, littleEndian, noAssert) {
- if (!noAssert) {
- checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
- }
- ieee754.write(buf, value, offset, littleEndian, 52, 8)
- return offset + 8
- }
- Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
- return writeDouble(this, value, offset, true, noAssert)
- }
- Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
- return writeDouble(this, value, offset, false, noAssert)
- }
- // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
- Buffer.prototype.copy = function copy (target, targetStart, start, end) {
- if (!start) start = 0
- if (!end && end !== 0) end = this.length
- if (targetStart >= target.length) targetStart = target.length
- if (!targetStart) targetStart = 0
- if (end > 0 && end < start) end = start
- // Copy 0 bytes; we're done
- if (end === start) return 0
- if (target.length === 0 || this.length === 0) return 0
- // Fatal error conditions
- if (targetStart < 0) {
- throw new RangeError('targetStart out of bounds')
- }
- if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
- if (end < 0) throw new RangeError('sourceEnd out of bounds')
- // Are we oob?
- if (end > this.length) end = this.length
- if (target.length - targetStart < end - start) {
- end = target.length - targetStart + start
- }
- var len = end - start
- var i
- if (this === target && start < targetStart && targetStart < end) {
- // descending copy from end
- for (i = len - 1; i >= 0; --i) {
- target[i + targetStart] = this[i + start]
- }
- } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
- // ascending copy from start
- for (i = 0; i < len; ++i) {
- target[i + targetStart] = this[i + start]
- }
- } else {
- Uint8Array.prototype.set.call(
- target,
- this.subarray(start, start + len),
- targetStart
- )
- }
- return len
- }
- // Usage:
- // buffer.fill(number[, offset[, end]])
- // buffer.fill(buffer[, offset[, end]])
- // buffer.fill(string[, offset[, end]][, encoding])
- Buffer.prototype.fill = function fill (val, start, end, encoding) {
- // Handle string cases:
- if (typeof val === 'string') {
- if (typeof start === 'string') {
- encoding = start
- start = 0
- end = this.length
- } else if (typeof end === 'string') {
- encoding = end
- end = this.length
- }
- if (val.length === 1) {
- var code = val.charCodeAt(0)
- if (code < 256) {
- val = code
- }
- }
- if (encoding !== undefined && typeof encoding !== 'string') {
- throw new TypeError('encoding must be a string')
- }
- if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
- throw new TypeError('Unknown encoding: ' + encoding)
- }
- } else if (typeof val === 'number') {
- val = val & 255
- }
- // Invalid ranges are not set to a default, so can range check early.
- if (start < 0 || this.length < start || this.length < end) {
- throw new RangeError('Out of range index')
- }
- if (end <= start) {
- return this
- }
- start = start >>> 0
- end = end === undefined ? this.length : end >>> 0
- if (!val) val = 0
- var i
- if (typeof val === 'number') {
- for (i = start; i < end; ++i) {
- this[i] = val
- }
- } else {
- var bytes = Buffer.isBuffer(val)
- ? val
- : utf8ToBytes(new Buffer(val, encoding).toString())
- var len = bytes.length
- for (i = 0; i < end - start; ++i) {
- this[i + start] = bytes[i % len]
- }
- }
- return this
- }
- // HELPER FUNCTIONS
- // ================
- var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
- function base64clean (str) {
- // Node strips out invalid characters like \n and \t from the string, base64-js does not
- str = stringtrim(str).replace(INVALID_BASE64_RE, '')
- // Node converts strings with length < 2 to ''
- if (str.length < 2) return ''
- // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
- while (str.length % 4 !== 0) {
- str = str + '='
- }
- return str
- }
- function stringtrim (str) {
- if (str.trim) return str.trim()
- return str.replace(/^\s+|\s+$/g, '')
- }
- function toHex (n) {
- if (n < 16) return '0' + n.toString(16)
- return n.toString(16)
- }
- function utf8ToBytes (string, units) {
- units = units || Infinity
- var codePoint
- var length = string.length
- var leadSurrogate = null
- var bytes = []
- for (var i = 0; i < length; ++i) {
- codePoint = string.charCodeAt(i)
- // is surrogate component
- if (codePoint > 0xD7FF && codePoint < 0xE000) {
- // last char was a lead
- if (!leadSurrogate) {
- // no lead yet
- if (codePoint > 0xDBFF) {
- // unexpected trail
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
- continue
- } else if (i + 1 === length) {
- // unpaired lead
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
- continue
- }
- // valid lead
- leadSurrogate = codePoint
- continue
- }
- // 2 leads in a row
- if (codePoint < 0xDC00) {
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
- leadSurrogate = codePoint
- continue
- }
- // valid surrogate pair
- codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
- } else if (leadSurrogate) {
- // valid bmp char, but last char was a lead
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
- }
- leadSurrogate = null
- // encode utf8
- if (codePoint < 0x80) {
- if ((units -= 1) < 0) break
- bytes.push(codePoint)
- } else if (codePoint < 0x800) {
- if ((units -= 2) < 0) break
- bytes.push(
- codePoint >> 0x6 | 0xC0,
- codePoint & 0x3F | 0x80
- )
- } else if (codePoint < 0x10000) {
- if ((units -= 3) < 0) break
- bytes.push(
- codePoint >> 0xC | 0xE0,
- codePoint >> 0x6 & 0x3F | 0x80,
- codePoint & 0x3F | 0x80
- )
- } else if (codePoint < 0x110000) {
- if ((units -= 4) < 0) break
- bytes.push(
- codePoint >> 0x12 | 0xF0,
- codePoint >> 0xC & 0x3F | 0x80,
- codePoint >> 0x6 & 0x3F | 0x80,
- codePoint & 0x3F | 0x80
- )
- } else {
- throw new Error('Invalid code point')
- }
- }
- return bytes
- }
- function asciiToBytes (str) {
- var byteArray = []
- for (var i = 0; i < str.length; ++i) {
- // Node's code seems to be doing this and not & 0x7F..
- byteArray.push(str.charCodeAt(i) & 0xFF)
- }
- return byteArray
- }
- function utf16leToBytes (str, units) {
- var c, hi, lo
- var byteArray = []
- for (var i = 0; i < str.length; ++i) {
- if ((units -= 2) < 0) break
- c = str.charCodeAt(i)
- hi = c >> 8
- lo = c % 256
- byteArray.push(lo)
- byteArray.push(hi)
- }
- return byteArray
- }
- function base64ToBytes (str) {
- return base64.toByteArray(base64clean(str))
- }
- function blitBuffer (src, dst, offset, length) {
- for (var i = 0; i < length; ++i) {
- if ((i + offset >= dst.length) || (i >= src.length)) break
- dst[i + offset] = src[i]
- }
- return i
- }
- function isnan (val) {
- return val !== val // eslint-disable-line no-self-compare
- }
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ 3)))
- /***/ }),
- /* 117 */
- /*!*****************************************!*\
- !*** ./node_modules/base64-js/index.js ***!
- \*****************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- exports.byteLength = byteLength
- exports.toByteArray = toByteArray
- exports.fromByteArray = fromByteArray
- var lookup = []
- var revLookup = []
- var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
- var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
- for (var i = 0, len = code.length; i < len; ++i) {
- lookup[i] = code[i]
- revLookup[code.charCodeAt(i)] = i
- }
- // Support decoding URL-safe base64 strings, as Node.js does.
- // See: https://en.wikipedia.org/wiki/Base64#URL_applications
- revLookup['-'.charCodeAt(0)] = 62
- revLookup['_'.charCodeAt(0)] = 63
- function getLens (b64) {
- var len = b64.length
- if (len % 4 > 0) {
- throw new Error('Invalid string. Length must be a multiple of 4')
- }
- // Trim off extra bytes after placeholder bytes are found
- // See: https://github.com/beatgammit/base64-js/issues/42
- var validLen = b64.indexOf('=')
- if (validLen === -1) validLen = len
- var placeHoldersLen = validLen === len
- ? 0
- : 4 - (validLen % 4)
- return [validLen, placeHoldersLen]
- }
- // base64 is 4/3 + up to two characters of the original data
- function byteLength (b64) {
- var lens = getLens(b64)
- var validLen = lens[0]
- var placeHoldersLen = lens[1]
- return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
- }
- function _byteLength (b64, validLen, placeHoldersLen) {
- return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
- }
- function toByteArray (b64) {
- var tmp
- var lens = getLens(b64)
- var validLen = lens[0]
- var placeHoldersLen = lens[1]
- var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
- var curByte = 0
- // if there are placeholders, only get up to the last complete 4 chars
- var len = placeHoldersLen > 0
- ? validLen - 4
- : validLen
- var i
- for (i = 0; i < len; i += 4) {
- tmp =
- (revLookup[b64.charCodeAt(i)] << 18) |
- (revLookup[b64.charCodeAt(i + 1)] << 12) |
- (revLookup[b64.charCodeAt(i + 2)] << 6) |
- revLookup[b64.charCodeAt(i + 3)]
- arr[curByte++] = (tmp >> 16) & 0xFF
- arr[curByte++] = (tmp >> 8) & 0xFF
- arr[curByte++] = tmp & 0xFF
- }
- if (placeHoldersLen === 2) {
- tmp =
- (revLookup[b64.charCodeAt(i)] << 2) |
- (revLookup[b64.charCodeAt(i + 1)] >> 4)
- arr[curByte++] = tmp & 0xFF
- }
- if (placeHoldersLen === 1) {
- tmp =
- (revLookup[b64.charCodeAt(i)] << 10) |
- (revLookup[b64.charCodeAt(i + 1)] << 4) |
- (revLookup[b64.charCodeAt(i + 2)] >> 2)
- arr[curByte++] = (tmp >> 8) & 0xFF
- arr[curByte++] = tmp & 0xFF
- }
- return arr
- }
- function tripletToBase64 (num) {
- return lookup[num >> 18 & 0x3F] +
- lookup[num >> 12 & 0x3F] +
- lookup[num >> 6 & 0x3F] +
- lookup[num & 0x3F]
- }
- function encodeChunk (uint8, start, end) {
- var tmp
- var output = []
- for (var i = start; i < end; i += 3) {
- tmp =
- ((uint8[i] << 16) & 0xFF0000) +
- ((uint8[i + 1] << 8) & 0xFF00) +
- (uint8[i + 2] & 0xFF)
- output.push(tripletToBase64(tmp))
- }
- return output.join('')
- }
- function fromByteArray (uint8) {
- var tmp
- var len = uint8.length
- var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
- var parts = []
- var maxChunkLength = 16383 // must be multiple of 3
- // go through the array every three bytes, we'll deal with trailing stuff later
- for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
- parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
- }
- // pad the end with zeros, but make sure to not forget the extra bytes
- if (extraBytes === 1) {
- tmp = uint8[len - 1]
- parts.push(
- lookup[tmp >> 2] +
- lookup[(tmp << 4) & 0x3F] +
- '=='
- )
- } else if (extraBytes === 2) {
- tmp = (uint8[len - 2] << 8) + uint8[len - 1]
- parts.push(
- lookup[tmp >> 10] +
- lookup[(tmp >> 4) & 0x3F] +
- lookup[(tmp << 2) & 0x3F] +
- '='
- )
- }
- return parts.join('')
- }
- /***/ }),
- /* 118 */
- /*!***************************************!*\
- !*** ./node_modules/ieee754/index.js ***!
- \***************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
- exports.read = function (buffer, offset, isLE, mLen, nBytes) {
- var e, m
- var eLen = (nBytes * 8) - mLen - 1
- var eMax = (1 << eLen) - 1
- var eBias = eMax >> 1
- var nBits = -7
- var i = isLE ? (nBytes - 1) : 0
- var d = isLE ? -1 : 1
- var s = buffer[offset + i]
- i += d
- e = s & ((1 << (-nBits)) - 1)
- s >>= (-nBits)
- nBits += eLen
- for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
- m = e & ((1 << (-nBits)) - 1)
- e >>= (-nBits)
- nBits += mLen
- for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
- if (e === 0) {
- e = 1 - eBias
- } else if (e === eMax) {
- return m ? NaN : ((s ? -1 : 1) * Infinity)
- } else {
- m = m + Math.pow(2, mLen)
- e = e - eBias
- }
- return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
- }
- exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
- var e, m, c
- var eLen = (nBytes * 8) - mLen - 1
- var eMax = (1 << eLen) - 1
- var eBias = eMax >> 1
- var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
- var i = isLE ? 0 : (nBytes - 1)
- var d = isLE ? 1 : -1
- var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
- value = Math.abs(value)
- if (isNaN(value) || value === Infinity) {
- m = isNaN(value) ? 1 : 0
- e = eMax
- } else {
- e = Math.floor(Math.log(value) / Math.LN2)
- if (value * (c = Math.pow(2, -e)) < 1) {
- e--
- c *= 2
- }
- if (e + eBias >= 1) {
- value += rt / c
- } else {
- value += rt * Math.pow(2, 1 - eBias)
- }
- if (value * c >= 2) {
- e++
- c /= 2
- }
- if (e + eBias >= eMax) {
- m = 0
- e = eMax
- } else if (e + eBias >= 1) {
- m = ((value * c) - 1) * Math.pow(2, mLen)
- e = e + eBias
- } else {
- m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
- e = 0
- }
- }
- for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
- e = (e << mLen) | m
- eLen += mLen
- for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
- buffer[offset + i - d] |= s * 128
- }
- /***/ }),
- /* 119 */
- /*!***************************************!*\
- !*** ./node_modules/isarray/index.js ***!
- \***************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- var toString = {}.toString;
- module.exports = Array.isArray || function (arr) {
- return toString.call(arr) == '[object Array]';
- };
- /***/ }),
- /* 120 */
- /*!*********************************************!*\
- !*** ./node_modules/create-hash/browser.js ***!
- \*********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var inherits = __webpack_require__(/*! inherits */ 121)
- var MD5 = __webpack_require__(/*! md5.js */ 122)
- var RIPEMD160 = __webpack_require__(/*! ripemd160 */ 140)
- var sha = __webpack_require__(/*! sha.js */ 141)
- var Base = __webpack_require__(/*! cipher-base */ 149)
- function Hash (hash) {
- Base.call(this, 'digest')
- this._hash = hash
- }
- inherits(Hash, Base)
- Hash.prototype._update = function (data) {
- this._hash.update(data)
- }
- Hash.prototype._final = function () {
- return this._hash.digest()
- }
- module.exports = function createHash (alg) {
- alg = alg.toLowerCase()
- if (alg === 'md5') return new MD5()
- if (alg === 'rmd160' || alg === 'ripemd160') return new RIPEMD160()
- return new Hash(sha(alg))
- }
- /***/ }),
- /* 121 */
- /*!***************************************************!*\
- !*** ./node_modules/inherits/inherits_browser.js ***!
- \***************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- if (typeof Object.create === 'function') {
- // implementation from standard node.js 'util' module
- module.exports = function inherits(ctor, superCtor) {
- if (superCtor) {
- ctor.super_ = superCtor
- ctor.prototype = Object.create(superCtor.prototype, {
- constructor: {
- value: ctor,
- enumerable: false,
- writable: true,
- configurable: true
- }
- })
- }
- };
- } else {
- // old school shim for old browsers
- module.exports = function inherits(ctor, superCtor) {
- if (superCtor) {
- ctor.super_ = superCtor
- var TempCtor = function () {}
- TempCtor.prototype = superCtor.prototype
- ctor.prototype = new TempCtor()
- ctor.prototype.constructor = ctor
- }
- }
- }
- /***/ }),
- /* 122 */
- /*!**************************************!*\
- !*** ./node_modules/md5.js/index.js ***!
- \**************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var inherits = __webpack_require__(/*! inherits */ 121)
- var HashBase = __webpack_require__(/*! hash-base */ 123)
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- var ARRAY16 = new Array(16)
- function MD5 () {
- HashBase.call(this, 64)
- // state
- this._a = 0x67452301
- this._b = 0xefcdab89
- this._c = 0x98badcfe
- this._d = 0x10325476
- }
- inherits(MD5, HashBase)
- MD5.prototype._update = function () {
- var M = ARRAY16
- for (var i = 0; i < 16; ++i) M[i] = this._block.readInt32LE(i * 4)
- var a = this._a
- var b = this._b
- var c = this._c
- var d = this._d
- a = fnF(a, b, c, d, M[0], 0xd76aa478, 7)
- d = fnF(d, a, b, c, M[1], 0xe8c7b756, 12)
- c = fnF(c, d, a, b, M[2], 0x242070db, 17)
- b = fnF(b, c, d, a, M[3], 0xc1bdceee, 22)
- a = fnF(a, b, c, d, M[4], 0xf57c0faf, 7)
- d = fnF(d, a, b, c, M[5], 0x4787c62a, 12)
- c = fnF(c, d, a, b, M[6], 0xa8304613, 17)
- b = fnF(b, c, d, a, M[7], 0xfd469501, 22)
- a = fnF(a, b, c, d, M[8], 0x698098d8, 7)
- d = fnF(d, a, b, c, M[9], 0x8b44f7af, 12)
- c = fnF(c, d, a, b, M[10], 0xffff5bb1, 17)
- b = fnF(b, c, d, a, M[11], 0x895cd7be, 22)
- a = fnF(a, b, c, d, M[12], 0x6b901122, 7)
- d = fnF(d, a, b, c, M[13], 0xfd987193, 12)
- c = fnF(c, d, a, b, M[14], 0xa679438e, 17)
- b = fnF(b, c, d, a, M[15], 0x49b40821, 22)
- a = fnG(a, b, c, d, M[1], 0xf61e2562, 5)
- d = fnG(d, a, b, c, M[6], 0xc040b340, 9)
- c = fnG(c, d, a, b, M[11], 0x265e5a51, 14)
- b = fnG(b, c, d, a, M[0], 0xe9b6c7aa, 20)
- a = fnG(a, b, c, d, M[5], 0xd62f105d, 5)
- d = fnG(d, a, b, c, M[10], 0x02441453, 9)
- c = fnG(c, d, a, b, M[15], 0xd8a1e681, 14)
- b = fnG(b, c, d, a, M[4], 0xe7d3fbc8, 20)
- a = fnG(a, b, c, d, M[9], 0x21e1cde6, 5)
- d = fnG(d, a, b, c, M[14], 0xc33707d6, 9)
- c = fnG(c, d, a, b, M[3], 0xf4d50d87, 14)
- b = fnG(b, c, d, a, M[8], 0x455a14ed, 20)
- a = fnG(a, b, c, d, M[13], 0xa9e3e905, 5)
- d = fnG(d, a, b, c, M[2], 0xfcefa3f8, 9)
- c = fnG(c, d, a, b, M[7], 0x676f02d9, 14)
- b = fnG(b, c, d, a, M[12], 0x8d2a4c8a, 20)
- a = fnH(a, b, c, d, M[5], 0xfffa3942, 4)
- d = fnH(d, a, b, c, M[8], 0x8771f681, 11)
- c = fnH(c, d, a, b, M[11], 0x6d9d6122, 16)
- b = fnH(b, c, d, a, M[14], 0xfde5380c, 23)
- a = fnH(a, b, c, d, M[1], 0xa4beea44, 4)
- d = fnH(d, a, b, c, M[4], 0x4bdecfa9, 11)
- c = fnH(c, d, a, b, M[7], 0xf6bb4b60, 16)
- b = fnH(b, c, d, a, M[10], 0xbebfbc70, 23)
- a = fnH(a, b, c, d, M[13], 0x289b7ec6, 4)
- d = fnH(d, a, b, c, M[0], 0xeaa127fa, 11)
- c = fnH(c, d, a, b, M[3], 0xd4ef3085, 16)
- b = fnH(b, c, d, a, M[6], 0x04881d05, 23)
- a = fnH(a, b, c, d, M[9], 0xd9d4d039, 4)
- d = fnH(d, a, b, c, M[12], 0xe6db99e5, 11)
- c = fnH(c, d, a, b, M[15], 0x1fa27cf8, 16)
- b = fnH(b, c, d, a, M[2], 0xc4ac5665, 23)
- a = fnI(a, b, c, d, M[0], 0xf4292244, 6)
- d = fnI(d, a, b, c, M[7], 0x432aff97, 10)
- c = fnI(c, d, a, b, M[14], 0xab9423a7, 15)
- b = fnI(b, c, d, a, M[5], 0xfc93a039, 21)
- a = fnI(a, b, c, d, M[12], 0x655b59c3, 6)
- d = fnI(d, a, b, c, M[3], 0x8f0ccc92, 10)
- c = fnI(c, d, a, b, M[10], 0xffeff47d, 15)
- b = fnI(b, c, d, a, M[1], 0x85845dd1, 21)
- a = fnI(a, b, c, d, M[8], 0x6fa87e4f, 6)
- d = fnI(d, a, b, c, M[15], 0xfe2ce6e0, 10)
- c = fnI(c, d, a, b, M[6], 0xa3014314, 15)
- b = fnI(b, c, d, a, M[13], 0x4e0811a1, 21)
- a = fnI(a, b, c, d, M[4], 0xf7537e82, 6)
- d = fnI(d, a, b, c, M[11], 0xbd3af235, 10)
- c = fnI(c, d, a, b, M[2], 0x2ad7d2bb, 15)
- b = fnI(b, c, d, a, M[9], 0xeb86d391, 21)
- this._a = (this._a + a) | 0
- this._b = (this._b + b) | 0
- this._c = (this._c + c) | 0
- this._d = (this._d + d) | 0
- }
- MD5.prototype._digest = function () {
- // create padding and handle blocks
- this._block[this._blockOffset++] = 0x80
- if (this._blockOffset > 56) {
- this._block.fill(0, this._blockOffset, 64)
- this._update()
- this._blockOffset = 0
- }
- this._block.fill(0, this._blockOffset, 56)
- this._block.writeUInt32LE(this._length[0], 56)
- this._block.writeUInt32LE(this._length[1], 60)
- this._update()
- // produce result
- var buffer = Buffer.allocUnsafe(16)
- buffer.writeInt32LE(this._a, 0)
- buffer.writeInt32LE(this._b, 4)
- buffer.writeInt32LE(this._c, 8)
- buffer.writeInt32LE(this._d, 12)
- return buffer
- }
- function rotl (x, n) {
- return (x << n) | (x >>> (32 - n))
- }
- function fnF (a, b, c, d, m, k, s) {
- return (rotl((a + ((b & c) | ((~b) & d)) + m + k) | 0, s) + b) | 0
- }
- function fnG (a, b, c, d, m, k, s) {
- return (rotl((a + ((b & d) | (c & (~d))) + m + k) | 0, s) + b) | 0
- }
- function fnH (a, b, c, d, m, k, s) {
- return (rotl((a + (b ^ c ^ d) + m + k) | 0, s) + b) | 0
- }
- function fnI (a, b, c, d, m, k, s) {
- return (rotl((a + ((c ^ (b | (~d)))) + m + k) | 0, s) + b) | 0
- }
- module.exports = MD5
- /***/ }),
- /* 123 */
- /*!*****************************************!*\
- !*** ./node_modules/hash-base/index.js ***!
- \*****************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- var Transform = __webpack_require__(/*! readable-stream */ 124).Transform
- var inherits = __webpack_require__(/*! inherits */ 121)
- function throwIfNotStringOrBuffer (val, prefix) {
- if (!Buffer.isBuffer(val) && typeof val !== 'string') {
- throw new TypeError(prefix + ' must be a string or a buffer')
- }
- }
- function HashBase (blockSize) {
- Transform.call(this)
- this._block = Buffer.allocUnsafe(blockSize)
- this._blockSize = blockSize
- this._blockOffset = 0
- this._length = [0, 0, 0, 0]
- this._finalized = false
- }
- inherits(HashBase, Transform)
- HashBase.prototype._transform = function (chunk, encoding, callback) {
- var error = null
- try {
- this.update(chunk, encoding)
- } catch (err) {
- error = err
- }
- callback(error)
- }
- HashBase.prototype._flush = function (callback) {
- var error = null
- try {
- this.push(this.digest())
- } catch (err) {
- error = err
- }
- callback(error)
- }
- HashBase.prototype.update = function (data, encoding) {
- throwIfNotStringOrBuffer(data, 'Data')
- if (this._finalized) throw new Error('Digest already called')
- if (!Buffer.isBuffer(data)) data = Buffer.from(data, encoding)
- // consume data
- var block = this._block
- var offset = 0
- while (this._blockOffset + data.length - offset >= this._blockSize) {
- for (var i = this._blockOffset; i < this._blockSize;) block[i++] = data[offset++]
- this._update()
- this._blockOffset = 0
- }
- while (offset < data.length) block[this._blockOffset++] = data[offset++]
- // update length
- for (var j = 0, carry = data.length * 8; carry > 0; ++j) {
- this._length[j] += carry
- carry = (this._length[j] / 0x0100000000) | 0
- if (carry > 0) this._length[j] -= 0x0100000000 * carry
- }
- return this
- }
- HashBase.prototype._update = function () {
- throw new Error('_update is not implemented')
- }
- HashBase.prototype.digest = function (encoding) {
- if (this._finalized) throw new Error('Digest already called')
- this._finalized = true
- var digest = this._digest()
- if (encoding !== undefined) digest = digest.toString(encoding)
- // reset state
- this._block.fill(0)
- this._blockOffset = 0
- for (var i = 0; i < 4; ++i) this._length[i] = 0
- return digest
- }
- HashBase.prototype._digest = function () {
- throw new Error('_digest is not implemented')
- }
- module.exports = HashBase
- /***/ }),
- /* 124 */
- /*!**********************************************************!*\
- !*** ./node_modules/readable-stream/readable-browser.js ***!
- \**********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- exports = module.exports = __webpack_require__(/*! ./lib/_stream_readable.js */ 125);
- exports.Stream = exports;
- exports.Readable = exports;
- exports.Writable = __webpack_require__(/*! ./lib/_stream_writable.js */ 135);
- exports.Duplex = __webpack_require__(/*! ./lib/_stream_duplex.js */ 134);
- exports.Transform = __webpack_require__(/*! ./lib/_stream_transform.js */ 138);
- exports.PassThrough = __webpack_require__(/*! ./lib/_stream_passthrough.js */ 139);
- /***/ }),
- /* 125 */
- /*!**************************************************************!*\
- !*** ./node_modules/readable-stream/lib/_stream_readable.js ***!
- \**************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(global, process) {// Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
- /*<replacement>*/
- var pna = __webpack_require__(/*! process-nextick-args */ 126);
- /*</replacement>*/
- module.exports = Readable;
- /*<replacement>*/
- var isArray = __webpack_require__(/*! isarray */ 119);
- /*</replacement>*/
- /*<replacement>*/
- var Duplex;
- /*</replacement>*/
- Readable.ReadableState = ReadableState;
- /*<replacement>*/
- var EE = __webpack_require__(/*! events */ 127).EventEmitter;
- var EElistenerCount = function (emitter, type) {
- return emitter.listeners(type).length;
- };
- /*</replacement>*/
- /*<replacement>*/
- var Stream = __webpack_require__(/*! ./internal/streams/stream */ 128);
- /*</replacement>*/
- /*<replacement>*/
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer;
- var OurUint8Array = global.Uint8Array || function () {};
- function _uint8ArrayToBuffer(chunk) {
- return Buffer.from(chunk);
- }
- function _isUint8Array(obj) {
- return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
- }
- /*</replacement>*/
- /*<replacement>*/
- var util = Object.create(__webpack_require__(/*! core-util-is */ 129));
- util.inherits = __webpack_require__(/*! inherits */ 121);
- /*</replacement>*/
- /*<replacement>*/
- var debugUtil = __webpack_require__(/*! util */ 130);
- var debug = void 0;
- if (debugUtil && debugUtil.debuglog) {
- debug = debugUtil.debuglog('stream');
- } else {
- debug = function () {};
- }
- /*</replacement>*/
- var BufferList = __webpack_require__(/*! ./internal/streams/BufferList */ 131);
- var destroyImpl = __webpack_require__(/*! ./internal/streams/destroy */ 133);
- var StringDecoder;
- util.inherits(Readable, Stream);
- var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
- function prependListener(emitter, event, fn) {
- // Sadly this is not cacheable as some libraries bundle their own
- // event emitter implementation with them.
- if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
- // This is a hack to make sure that our error handler is attached before any
- // userland ones. NEVER DO THIS. This is here only because this code needs
- // to continue to work with older versions of Node.js that do not include
- // the prependListener() method. The goal is to eventually remove this hack.
- if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
- }
- function ReadableState(options, stream) {
- Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ 134);
- options = options || {};
- // Duplex streams are both readable and writable, but share
- // the same options object.
- // However, some cases require setting options to different
- // values for the readable and the writable sides of the duplex stream.
- // These options can be provided separately as readableXXX and writableXXX.
- var isDuplex = stream instanceof Duplex;
- // object stream flag. Used to make read(n) ignore n and to
- // make all the buffer merging and length checks go away
- this.objectMode = !!options.objectMode;
- if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
- // the point at which it stops calling _read() to fill the buffer
- // Note: 0 is a valid value, means "don't call _read preemptively ever"
- var hwm = options.highWaterMark;
- var readableHwm = options.readableHighWaterMark;
- var defaultHwm = this.objectMode ? 16 : 16 * 1024;
- if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;
- // cast to ints.
- this.highWaterMark = Math.floor(this.highWaterMark);
- // A linked list is used to store data chunks instead of an array because the
- // linked list can remove elements from the beginning faster than
- // array.shift()
- this.buffer = new BufferList();
- this.length = 0;
- this.pipes = null;
- this.pipesCount = 0;
- this.flowing = null;
- this.ended = false;
- this.endEmitted = false;
- this.reading = false;
- // a flag to be able to tell if the event 'readable'/'data' is emitted
- // immediately, or on a later tick. We set this to true at first, because
- // any actions that shouldn't happen until "later" should generally also
- // not happen before the first read call.
- this.sync = true;
- // whenever we return null, then we set a flag to say
- // that we're awaiting a 'readable' event emission.
- this.needReadable = false;
- this.emittedReadable = false;
- this.readableListening = false;
- this.resumeScheduled = false;
- // has it been destroyed
- this.destroyed = false;
- // Crypto is kind of old and crusty. Historically, its default string
- // encoding is 'binary' so we have to make this configurable.
- // Everything else in the universe uses 'utf8', though.
- this.defaultEncoding = options.defaultEncoding || 'utf8';
- // the number of writers that are awaiting a drain event in .pipe()s
- this.awaitDrain = 0;
- // if true, a maybeReadMore has been scheduled
- this.readingMore = false;
- this.decoder = null;
- this.encoding = null;
- if (options.encoding) {
- if (!StringDecoder) StringDecoder = __webpack_require__(/*! string_decoder/ */ 137).StringDecoder;
- this.decoder = new StringDecoder(options.encoding);
- this.encoding = options.encoding;
- }
- }
- function Readable(options) {
- Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ 134);
- if (!(this instanceof Readable)) return new Readable(options);
- this._readableState = new ReadableState(options, this);
- // legacy
- this.readable = true;
- if (options) {
- if (typeof options.read === 'function') this._read = options.read;
- if (typeof options.destroy === 'function') this._destroy = options.destroy;
- }
- Stream.call(this);
- }
- Object.defineProperty(Readable.prototype, 'destroyed', {
- get: function () {
- if (this._readableState === undefined) {
- return false;
- }
- return this._readableState.destroyed;
- },
- set: function (value) {
- // we ignore the value if the stream
- // has not been initialized yet
- if (!this._readableState) {
- return;
- }
- // backward compatibility, the user is explicitly
- // managing destroyed
- this._readableState.destroyed = value;
- }
- });
- Readable.prototype.destroy = destroyImpl.destroy;
- Readable.prototype._undestroy = destroyImpl.undestroy;
- Readable.prototype._destroy = function (err, cb) {
- this.push(null);
- cb(err);
- };
- // Manually shove something into the read() buffer.
- // This returns true if the highWaterMark has not been hit yet,
- // similar to how Writable.write() returns true if you should
- // write() some more.
- Readable.prototype.push = function (chunk, encoding) {
- var state = this._readableState;
- var skipChunkCheck;
- if (!state.objectMode) {
- if (typeof chunk === 'string') {
- encoding = encoding || state.defaultEncoding;
- if (encoding !== state.encoding) {
- chunk = Buffer.from(chunk, encoding);
- encoding = '';
- }
- skipChunkCheck = true;
- }
- } else {
- skipChunkCheck = true;
- }
- return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
- };
- // Unshift should *always* be something directly out of read()
- Readable.prototype.unshift = function (chunk) {
- return readableAddChunk(this, chunk, null, true, false);
- };
- function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
- var state = stream._readableState;
- if (chunk === null) {
- state.reading = false;
- onEofChunk(stream, state);
- } else {
- var er;
- if (!skipChunkCheck) er = chunkInvalid(state, chunk);
- if (er) {
- stream.emit('error', er);
- } else if (state.objectMode || chunk && chunk.length > 0) {
- if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
- chunk = _uint8ArrayToBuffer(chunk);
- }
- if (addToFront) {
- if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);
- } else if (state.ended) {
- stream.emit('error', new Error('stream.push() after EOF'));
- } else {
- state.reading = false;
- if (state.decoder && !encoding) {
- chunk = state.decoder.write(chunk);
- if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
- } else {
- addChunk(stream, state, chunk, false);
- }
- }
- } else if (!addToFront) {
- state.reading = false;
- }
- }
- return needMoreData(state);
- }
- function addChunk(stream, state, chunk, addToFront) {
- if (state.flowing && state.length === 0 && !state.sync) {
- stream.emit('data', chunk);
- stream.read(0);
- } else {
- // update the buffer info.
- state.length += state.objectMode ? 1 : chunk.length;
- if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
- if (state.needReadable) emitReadable(stream);
- }
- maybeReadMore(stream, state);
- }
- function chunkInvalid(state, chunk) {
- var er;
- if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
- er = new TypeError('Invalid non-string/buffer chunk');
- }
- return er;
- }
- // if it's past the high water mark, we can push in some more.
- // Also, if we have no data yet, we can stand some
- // more bytes. This is to work around cases where hwm=0,
- // such as the repl. Also, if the push() triggered a
- // readable event, and the user called read(largeNumber) such that
- // needReadable was set, then we ought to push more, so that another
- // 'readable' event will be triggered.
- function needMoreData(state) {
- return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
- }
- Readable.prototype.isPaused = function () {
- return this._readableState.flowing === false;
- };
- // backwards compatibility.
- Readable.prototype.setEncoding = function (enc) {
- if (!StringDecoder) StringDecoder = __webpack_require__(/*! string_decoder/ */ 137).StringDecoder;
- this._readableState.decoder = new StringDecoder(enc);
- this._readableState.encoding = enc;
- return this;
- };
- // Don't raise the hwm > 8MB
- var MAX_HWM = 0x800000;
- function computeNewHighWaterMark(n) {
- if (n >= MAX_HWM) {
- n = MAX_HWM;
- } else {
- // Get the next highest power of 2 to prevent increasing hwm excessively in
- // tiny amounts
- n--;
- n |= n >>> 1;
- n |= n >>> 2;
- n |= n >>> 4;
- n |= n >>> 8;
- n |= n >>> 16;
- n++;
- }
- return n;
- }
- // This function is designed to be inlinable, so please take care when making
- // changes to the function body.
- function howMuchToRead(n, state) {
- if (n <= 0 || state.length === 0 && state.ended) return 0;
- if (state.objectMode) return 1;
- if (n !== n) {
- // Only flow one buffer at a time
- if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
- }
- // If we're asking for more than the current hwm, then raise the hwm.
- if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
- if (n <= state.length) return n;
- // Don't have enough
- if (!state.ended) {
- state.needReadable = true;
- return 0;
- }
- return state.length;
- }
- // you can override either this method, or the async _read(n) below.
- Readable.prototype.read = function (n) {
- debug('read', n);
- n = parseInt(n, 10);
- var state = this._readableState;
- var nOrig = n;
- if (n !== 0) state.emittedReadable = false;
- // if we're doing read(0) to trigger a readable event, but we
- // already have a bunch of data in the buffer, then just trigger
- // the 'readable' event and move on.
- if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
- debug('read: emitReadable', state.length, state.ended);
- if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
- return null;
- }
- n = howMuchToRead(n, state);
- // if we've ended, and we're now clear, then finish it up.
- if (n === 0 && state.ended) {
- if (state.length === 0) endReadable(this);
- return null;
- }
- // All the actual chunk generation logic needs to be
- // *below* the call to _read. The reason is that in certain
- // synthetic stream cases, such as passthrough streams, _read
- // may be a completely synchronous operation which may change
- // the state of the read buffer, providing enough data when
- // before there was *not* enough.
- //
- // So, the steps are:
- // 1. Figure out what the state of things will be after we do
- // a read from the buffer.
- //
- // 2. If that resulting state will trigger a _read, then call _read.
- // Note that this may be asynchronous, or synchronous. Yes, it is
- // deeply ugly to write APIs this way, but that still doesn't mean
- // that the Readable class should behave improperly, as streams are
- // designed to be sync/async agnostic.
- // Take note if the _read call is sync or async (ie, if the read call
- // has returned yet), so that we know whether or not it's safe to emit
- // 'readable' etc.
- //
- // 3. Actually pull the requested chunks out of the buffer and return.
- // if we need a readable event, then we need to do some reading.
- var doRead = state.needReadable;
- debug('need readable', doRead);
- // if we currently have less than the highWaterMark, then also read some
- if (state.length === 0 || state.length - n < state.highWaterMark) {
- doRead = true;
- debug('length less than watermark', doRead);
- }
- // however, if we've ended, then there's no point, and if we're already
- // reading, then it's unnecessary.
- if (state.ended || state.reading) {
- doRead = false;
- debug('reading or ended', doRead);
- } else if (doRead) {
- debug('do read');
- state.reading = true;
- state.sync = true;
- // if the length is currently zero, then we *need* a readable event.
- if (state.length === 0) state.needReadable = true;
- // call internal read method
- this._read(state.highWaterMark);
- state.sync = false;
- // If _read pushed data synchronously, then `reading` will be false,
- // and we need to re-evaluate how much data we can return to the user.
- if (!state.reading) n = howMuchToRead(nOrig, state);
- }
- var ret;
- if (n > 0) ret = fromList(n, state);else ret = null;
- if (ret === null) {
- state.needReadable = true;
- n = 0;
- } else {
- state.length -= n;
- }
- if (state.length === 0) {
- // If we have nothing in the buffer, then we want to know
- // as soon as we *do* get something into the buffer.
- if (!state.ended) state.needReadable = true;
- // If we tried to read() past the EOF, then emit end on the next tick.
- if (nOrig !== n && state.ended) endReadable(this);
- }
- if (ret !== null) this.emit('data', ret);
- return ret;
- };
- function onEofChunk(stream, state) {
- if (state.ended) return;
- if (state.decoder) {
- var chunk = state.decoder.end();
- if (chunk && chunk.length) {
- state.buffer.push(chunk);
- state.length += state.objectMode ? 1 : chunk.length;
- }
- }
- state.ended = true;
- // emit 'readable' now to make sure it gets picked up.
- emitReadable(stream);
- }
- // Don't emit readable right away in sync mode, because this can trigger
- // another read() call => stack overflow. This way, it might trigger
- // a nextTick recursion warning, but that's not so bad.
- function emitReadable(stream) {
- var state = stream._readableState;
- state.needReadable = false;
- if (!state.emittedReadable) {
- debug('emitReadable', state.flowing);
- state.emittedReadable = true;
- if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);
- }
- }
- function emitReadable_(stream) {
- debug('emit readable');
- stream.emit('readable');
- flow(stream);
- }
- // at this point, the user has presumably seen the 'readable' event,
- // and called read() to consume some data. that may have triggered
- // in turn another _read(n) call, in which case reading = true if
- // it's in progress.
- // However, if we're not ended, or reading, and the length < hwm,
- // then go ahead and try to read some more preemptively.
- function maybeReadMore(stream, state) {
- if (!state.readingMore) {
- state.readingMore = true;
- pna.nextTick(maybeReadMore_, stream, state);
- }
- }
- function maybeReadMore_(stream, state) {
- var len = state.length;
- while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
- debug('maybeReadMore read 0');
- stream.read(0);
- if (len === state.length)
- // didn't get any data, stop spinning.
- break;else len = state.length;
- }
- state.readingMore = false;
- }
- // abstract method. to be overridden in specific implementation classes.
- // call cb(er, data) where data is <= n in length.
- // for virtual (non-string, non-buffer) streams, "length" is somewhat
- // arbitrary, and perhaps not very meaningful.
- Readable.prototype._read = function (n) {
- this.emit('error', new Error('_read() is not implemented'));
- };
- Readable.prototype.pipe = function (dest, pipeOpts) {
- var src = this;
- var state = this._readableState;
- switch (state.pipesCount) {
- case 0:
- state.pipes = dest;
- break;
- case 1:
- state.pipes = [state.pipes, dest];
- break;
- default:
- state.pipes.push(dest);
- break;
- }
- state.pipesCount += 1;
- debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
- var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
- var endFn = doEnd ? onend : unpipe;
- if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);
- dest.on('unpipe', onunpipe);
- function onunpipe(readable, unpipeInfo) {
- debug('onunpipe');
- if (readable === src) {
- if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
- unpipeInfo.hasUnpiped = true;
- cleanup();
- }
- }
- }
- function onend() {
- debug('onend');
- dest.end();
- }
- // when the dest drains, it reduces the awaitDrain counter
- // on the source. This would be more elegant with a .once()
- // handler in flow(), but adding and removing repeatedly is
- // too slow.
- var ondrain = pipeOnDrain(src);
- dest.on('drain', ondrain);
- var cleanedUp = false;
- function cleanup() {
- debug('cleanup');
- // cleanup event handlers once the pipe is broken
- dest.removeListener('close', onclose);
- dest.removeListener('finish', onfinish);
- dest.removeListener('drain', ondrain);
- dest.removeListener('error', onerror);
- dest.removeListener('unpipe', onunpipe);
- src.removeListener('end', onend);
- src.removeListener('end', unpipe);
- src.removeListener('data', ondata);
- cleanedUp = true;
- // if the reader is waiting for a drain event from this
- // specific writer, then it would cause it to never start
- // flowing again.
- // So, if this is awaiting a drain, then we just call it now.
- // If we don't know, then assume that we are waiting for one.
- if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
- }
- // If the user pushes more data while we're writing to dest then we'll end up
- // in ondata again. However, we only want to increase awaitDrain once because
- // dest will only emit one 'drain' event for the multiple writes.
- // => Introduce a guard on increasing awaitDrain.
- var increasedAwaitDrain = false;
- src.on('data', ondata);
- function ondata(chunk) {
- debug('ondata');
- increasedAwaitDrain = false;
- var ret = dest.write(chunk);
- if (false === ret && !increasedAwaitDrain) {
- // If the user unpiped during `dest.write()`, it is possible
- // to get stuck in a permanently paused state if that write
- // also returned false.
- // => Check whether `dest` is still a piping destination.
- if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
- debug('false write response, pause', src._readableState.awaitDrain);
- src._readableState.awaitDrain++;
- increasedAwaitDrain = true;
- }
- src.pause();
- }
- }
- // if the dest has an error, then stop piping into it.
- // however, don't suppress the throwing behavior for this.
- function onerror(er) {
- debug('onerror', er);
- unpipe();
- dest.removeListener('error', onerror);
- if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
- }
- // Make sure our error handler is attached before userland ones.
- prependListener(dest, 'error', onerror);
- // Both close and finish should trigger unpipe, but only once.
- function onclose() {
- dest.removeListener('finish', onfinish);
- unpipe();
- }
- dest.once('close', onclose);
- function onfinish() {
- debug('onfinish');
- dest.removeListener('close', onclose);
- unpipe();
- }
- dest.once('finish', onfinish);
- function unpipe() {
- debug('unpipe');
- src.unpipe(dest);
- }
- // tell the dest that it's being piped to
- dest.emit('pipe', src);
- // start the flow if it hasn't been started already.
- if (!state.flowing) {
- debug('pipe resume');
- src.resume();
- }
- return dest;
- };
- function pipeOnDrain(src) {
- return function () {
- var state = src._readableState;
- debug('pipeOnDrain', state.awaitDrain);
- if (state.awaitDrain) state.awaitDrain--;
- if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
- state.flowing = true;
- flow(src);
- }
- };
- }
- Readable.prototype.unpipe = function (dest) {
- var state = this._readableState;
- var unpipeInfo = { hasUnpiped: false };
- // if we're not piping anywhere, then do nothing.
- if (state.pipesCount === 0) return this;
- // just one destination. most common case.
- if (state.pipesCount === 1) {
- // passed in one, but it's not the right one.
- if (dest && dest !== state.pipes) return this;
- if (!dest) dest = state.pipes;
- // got a match.
- state.pipes = null;
- state.pipesCount = 0;
- state.flowing = false;
- if (dest) dest.emit('unpipe', this, unpipeInfo);
- return this;
- }
- // slow case. multiple pipe destinations.
- if (!dest) {
- // remove all.
- var dests = state.pipes;
- var len = state.pipesCount;
- state.pipes = null;
- state.pipesCount = 0;
- state.flowing = false;
- for (var i = 0; i < len; i++) {
- dests[i].emit('unpipe', this, unpipeInfo);
- }return this;
- }
- // try to find the right one.
- var index = indexOf(state.pipes, dest);
- if (index === -1) return this;
- state.pipes.splice(index, 1);
- state.pipesCount -= 1;
- if (state.pipesCount === 1) state.pipes = state.pipes[0];
- dest.emit('unpipe', this, unpipeInfo);
- return this;
- };
- // set up data events if they are asked for
- // Ensure readable listeners eventually get something
- Readable.prototype.on = function (ev, fn) {
- var res = Stream.prototype.on.call(this, ev, fn);
- if (ev === 'data') {
- // Start flowing on next tick if stream isn't explicitly paused
- if (this._readableState.flowing !== false) this.resume();
- } else if (ev === 'readable') {
- var state = this._readableState;
- if (!state.endEmitted && !state.readableListening) {
- state.readableListening = state.needReadable = true;
- state.emittedReadable = false;
- if (!state.reading) {
- pna.nextTick(nReadingNextTick, this);
- } else if (state.length) {
- emitReadable(this);
- }
- }
- }
- return res;
- };
- Readable.prototype.addListener = Readable.prototype.on;
- function nReadingNextTick(self) {
- debug('readable nexttick read 0');
- self.read(0);
- }
- // pause() and resume() are remnants of the legacy readable stream API
- // If the user uses them, then switch into old mode.
- Readable.prototype.resume = function () {
- var state = this._readableState;
- if (!state.flowing) {
- debug('resume');
- state.flowing = true;
- resume(this, state);
- }
- return this;
- };
- function resume(stream, state) {
- if (!state.resumeScheduled) {
- state.resumeScheduled = true;
- pna.nextTick(resume_, stream, state);
- }
- }
- function resume_(stream, state) {
- if (!state.reading) {
- debug('resume read 0');
- stream.read(0);
- }
- state.resumeScheduled = false;
- state.awaitDrain = 0;
- stream.emit('resume');
- flow(stream);
- if (state.flowing && !state.reading) stream.read(0);
- }
- Readable.prototype.pause = function () {
- debug('call pause flowing=%j', this._readableState.flowing);
- if (false !== this._readableState.flowing) {
- debug('pause');
- this._readableState.flowing = false;
- this.emit('pause');
- }
- return this;
- };
- function flow(stream) {
- var state = stream._readableState;
- debug('flow', state.flowing);
- while (state.flowing && stream.read() !== null) {}
- }
- // wrap an old-style stream as the async data source.
- // This is *not* part of the readable stream interface.
- // It is an ugly unfortunate mess of history.
- Readable.prototype.wrap = function (stream) {
- var _this = this;
- var state = this._readableState;
- var paused = false;
- stream.on('end', function () {
- debug('wrapped end');
- if (state.decoder && !state.ended) {
- var chunk = state.decoder.end();
- if (chunk && chunk.length) _this.push(chunk);
- }
- _this.push(null);
- });
- stream.on('data', function (chunk) {
- debug('wrapped data');
- if (state.decoder) chunk = state.decoder.write(chunk);
- // don't skip over falsy values in objectMode
- if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
- var ret = _this.push(chunk);
- if (!ret) {
- paused = true;
- stream.pause();
- }
- });
- // proxy all the other methods.
- // important when wrapping filters and duplexes.
- for (var i in stream) {
- if (this[i] === undefined && typeof stream[i] === 'function') {
- this[i] = function (method) {
- return function () {
- return stream[method].apply(stream, arguments);
- };
- }(i);
- }
- }
- // proxy certain important events.
- for (var n = 0; n < kProxyEvents.length; n++) {
- stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
- }
- // when we try to consume some more bytes, simply unpause the
- // underlying stream.
- this._read = function (n) {
- debug('wrapped _read', n);
- if (paused) {
- paused = false;
- stream.resume();
- }
- };
- return this;
- };
- Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
- // making it explicit this property is not enumerable
- // because otherwise some prototype manipulation in
- // userland will fail
- enumerable: false,
- get: function () {
- return this._readableState.highWaterMark;
- }
- });
- // exposed for testing purposes only.
- Readable._fromList = fromList;
- // Pluck off n bytes from an array of buffers.
- // Length is the combined lengths of all the buffers in the list.
- // This function is designed to be inlinable, so please take care when making
- // changes to the function body.
- function fromList(n, state) {
- // nothing buffered
- if (state.length === 0) return null;
- var ret;
- if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
- // read it all, truncate the list
- if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
- state.buffer.clear();
- } else {
- // read part of list
- ret = fromListPartial(n, state.buffer, state.decoder);
- }
- return ret;
- }
- // Extracts only enough buffered data to satisfy the amount requested.
- // This function is designed to be inlinable, so please take care when making
- // changes to the function body.
- function fromListPartial(n, list, hasStrings) {
- var ret;
- if (n < list.head.data.length) {
- // slice is the same for buffers and strings
- ret = list.head.data.slice(0, n);
- list.head.data = list.head.data.slice(n);
- } else if (n === list.head.data.length) {
- // first chunk is a perfect match
- ret = list.shift();
- } else {
- // result spans more than one buffer
- ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
- }
- return ret;
- }
- // Copies a specified amount of characters from the list of buffered data
- // chunks.
- // This function is designed to be inlinable, so please take care when making
- // changes to the function body.
- function copyFromBufferString(n, list) {
- var p = list.head;
- var c = 1;
- var ret = p.data;
- n -= ret.length;
- while (p = p.next) {
- var str = p.data;
- var nb = n > str.length ? str.length : n;
- if (nb === str.length) ret += str;else ret += str.slice(0, n);
- n -= nb;
- if (n === 0) {
- if (nb === str.length) {
- ++c;
- if (p.next) list.head = p.next;else list.head = list.tail = null;
- } else {
- list.head = p;
- p.data = str.slice(nb);
- }
- break;
- }
- ++c;
- }
- list.length -= c;
- return ret;
- }
- // Copies a specified amount of bytes from the list of buffered data chunks.
- // This function is designed to be inlinable, so please take care when making
- // changes to the function body.
- function copyFromBuffer(n, list) {
- var ret = Buffer.allocUnsafe(n);
- var p = list.head;
- var c = 1;
- p.data.copy(ret);
- n -= p.data.length;
- while (p = p.next) {
- var buf = p.data;
- var nb = n > buf.length ? buf.length : n;
- buf.copy(ret, ret.length - n, 0, nb);
- n -= nb;
- if (n === 0) {
- if (nb === buf.length) {
- ++c;
- if (p.next) list.head = p.next;else list.head = list.tail = null;
- } else {
- list.head = p;
- p.data = buf.slice(nb);
- }
- break;
- }
- ++c;
- }
- list.length -= c;
- return ret;
- }
- function endReadable(stream) {
- var state = stream._readableState;
- // If we get here before consuming all the bytes, then that is a
- // bug in node. Should never happen.
- if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
- if (!state.endEmitted) {
- state.ended = true;
- pna.nextTick(endReadableNT, state, stream);
- }
- }
- function endReadableNT(state, stream) {
- // Check that we didn't get one last unshift.
- if (!state.endEmitted && state.length === 0) {
- state.endEmitted = true;
- stream.readable = false;
- stream.emit('end');
- }
- }
- function indexOf(xs, x) {
- for (var i = 0, l = xs.length; i < l; i++) {
- if (xs[i] === x) return i;
- }
- return -1;
- }
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ 3), __webpack_require__(/*! ./../../node-libs-browser/mock/process.js */ 113)))
- /***/ }),
- /* 126 */
- /*!****************************************************!*\
- !*** ./node_modules/process-nextick-args/index.js ***!
- \****************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(process) {
- if (typeof process === 'undefined' ||
- !process.version ||
- process.version.indexOf('v0.') === 0 ||
- process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
- module.exports = { nextTick: nextTick };
- } else {
- module.exports = process
- }
- function nextTick(fn, arg1, arg2, arg3) {
- if (typeof fn !== 'function') {
- throw new TypeError('"callback" argument must be a function');
- }
- var len = arguments.length;
- var args, i;
- switch (len) {
- case 0:
- case 1:
- return process.nextTick(fn);
- case 2:
- return process.nextTick(function afterTickOne() {
- fn.call(null, arg1);
- });
- case 3:
- return process.nextTick(function afterTickTwo() {
- fn.call(null, arg1, arg2);
- });
- case 4:
- return process.nextTick(function afterTickThree() {
- fn.call(null, arg1, arg2, arg3);
- });
- default:
- args = new Array(len - 1);
- i = 0;
- while (i < args.length) {
- args[i++] = arguments[i];
- }
- return process.nextTick(function afterTick() {
- fn.apply(null, args);
- });
- }
- }
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../node-libs-browser/mock/process.js */ 113)))
- /***/ }),
- /* 127 */
- /*!***************************************!*\
- !*** ./node_modules/events/events.js ***!
- \***************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- // Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
- var R = typeof Reflect === 'object' ? Reflect : null
- var ReflectApply = R && typeof R.apply === 'function'
- ? R.apply
- : function ReflectApply(target, receiver, args) {
- return Function.prototype.apply.call(target, receiver, args);
- }
- var ReflectOwnKeys
- if (R && typeof R.ownKeys === 'function') {
- ReflectOwnKeys = R.ownKeys
- } else if (Object.getOwnPropertySymbols) {
- ReflectOwnKeys = function ReflectOwnKeys(target) {
- return Object.getOwnPropertyNames(target)
- .concat(Object.getOwnPropertySymbols(target));
- };
- } else {
- ReflectOwnKeys = function ReflectOwnKeys(target) {
- return Object.getOwnPropertyNames(target);
- };
- }
- function ProcessEmitWarning(warning) {
- if (console && console.warn) console.warn(warning);
- }
- var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {
- return value !== value;
- }
- function EventEmitter() {
- EventEmitter.init.call(this);
- }
- module.exports = EventEmitter;
- module.exports.once = once;
- // Backwards-compat with node 0.10.x
- EventEmitter.EventEmitter = EventEmitter;
- EventEmitter.prototype._events = undefined;
- EventEmitter.prototype._eventsCount = 0;
- EventEmitter.prototype._maxListeners = undefined;
- // By default EventEmitters will print a warning if more than 10 listeners are
- // added to it. This is a useful default which helps finding memory leaks.
- var defaultMaxListeners = 10;
- function checkListener(listener) {
- if (typeof listener !== 'function') {
- throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
- }
- }
- Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
- enumerable: true,
- get: function() {
- return defaultMaxListeners;
- },
- set: function(arg) {
- if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {
- throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.');
- }
- defaultMaxListeners = arg;
- }
- });
- EventEmitter.init = function() {
- if (this._events === undefined ||
- this._events === Object.getPrototypeOf(this)._events) {
- this._events = Object.create(null);
- this._eventsCount = 0;
- }
- this._maxListeners = this._maxListeners || undefined;
- };
- // Obviously not all Emitters should be limited to 10. This function allows
- // that to be increased. Set to zero for unlimited.
- EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
- if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {
- throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.');
- }
- this._maxListeners = n;
- return this;
- };
- function _getMaxListeners(that) {
- if (that._maxListeners === undefined)
- return EventEmitter.defaultMaxListeners;
- return that._maxListeners;
- }
- EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
- return _getMaxListeners(this);
- };
- EventEmitter.prototype.emit = function emit(type) {
- var args = [];
- for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
- var doError = (type === 'error');
- var events = this._events;
- if (events !== undefined)
- doError = (doError && events.error === undefined);
- else if (!doError)
- return false;
- // If there is no 'error' event listener then throw.
- if (doError) {
- var er;
- if (args.length > 0)
- er = args[0];
- if (er instanceof Error) {
- // Note: The comments on the `throw` lines are intentional, they show
- // up in Node's output if this results in an unhandled exception.
- throw er; // Unhandled 'error' event
- }
- // At least give some kind of context to the user
- var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));
- err.context = er;
- throw err; // Unhandled 'error' event
- }
- var handler = events[type];
- if (handler === undefined)
- return false;
- if (typeof handler === 'function') {
- ReflectApply(handler, this, args);
- } else {
- var len = handler.length;
- var listeners = arrayClone(handler, len);
- for (var i = 0; i < len; ++i)
- ReflectApply(listeners[i], this, args);
- }
- return true;
- };
- function _addListener(target, type, listener, prepend) {
- var m;
- var events;
- var existing;
- checkListener(listener);
- events = target._events;
- if (events === undefined) {
- events = target._events = Object.create(null);
- target._eventsCount = 0;
- } else {
- // To avoid recursion in the case that type === "newListener"! Before
- // adding it to the listeners, first emit "newListener".
- if (events.newListener !== undefined) {
- target.emit('newListener', type,
- listener.listener ? listener.listener : listener);
- // Re-assign `events` because a newListener handler could have caused the
- // this._events to be assigned to a new object
- events = target._events;
- }
- existing = events[type];
- }
- if (existing === undefined) {
- // Optimize the case of one listener. Don't need the extra array object.
- existing = events[type] = listener;
- ++target._eventsCount;
- } else {
- if (typeof existing === 'function') {
- // Adding the second element, need to change to array.
- existing = events[type] =
- prepend ? [listener, existing] : [existing, listener];
- // If we've already got an array, just append.
- } else if (prepend) {
- existing.unshift(listener);
- } else {
- existing.push(listener);
- }
- // Check for listener leak
- m = _getMaxListeners(target);
- if (m > 0 && existing.length > m && !existing.warned) {
- existing.warned = true;
- // No error code for this since it is a Warning
- // eslint-disable-next-line no-restricted-syntax
- var w = new Error('Possible EventEmitter memory leak detected. ' +
- existing.length + ' ' + String(type) + ' listeners ' +
- 'added. Use emitter.setMaxListeners() to ' +
- 'increase limit');
- w.name = 'MaxListenersExceededWarning';
- w.emitter = target;
- w.type = type;
- w.count = existing.length;
- ProcessEmitWarning(w);
- }
- }
- return target;
- }
- EventEmitter.prototype.addListener = function addListener(type, listener) {
- return _addListener(this, type, listener, false);
- };
- EventEmitter.prototype.on = EventEmitter.prototype.addListener;
- EventEmitter.prototype.prependListener =
- function prependListener(type, listener) {
- return _addListener(this, type, listener, true);
- };
- function onceWrapper() {
- if (!this.fired) {
- this.target.removeListener(this.type, this.wrapFn);
- this.fired = true;
- if (arguments.length === 0)
- return this.listener.call(this.target);
- return this.listener.apply(this.target, arguments);
- }
- }
- function _onceWrap(target, type, listener) {
- var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
- var wrapped = onceWrapper.bind(state);
- wrapped.listener = listener;
- state.wrapFn = wrapped;
- return wrapped;
- }
- EventEmitter.prototype.once = function once(type, listener) {
- checkListener(listener);
- this.on(type, _onceWrap(this, type, listener));
- return this;
- };
- EventEmitter.prototype.prependOnceListener =
- function prependOnceListener(type, listener) {
- checkListener(listener);
- this.prependListener(type, _onceWrap(this, type, listener));
- return this;
- };
- // Emits a 'removeListener' event if and only if the listener was removed.
- EventEmitter.prototype.removeListener =
- function removeListener(type, listener) {
- var list, events, position, i, originalListener;
- checkListener(listener);
- events = this._events;
- if (events === undefined)
- return this;
- list = events[type];
- if (list === undefined)
- return this;
- if (list === listener || list.listener === listener) {
- if (--this._eventsCount === 0)
- this._events = Object.create(null);
- else {
- delete events[type];
- if (events.removeListener)
- this.emit('removeListener', type, list.listener || listener);
- }
- } else if (typeof list !== 'function') {
- position = -1;
- for (i = list.length - 1; i >= 0; i--) {
- if (list[i] === listener || list[i].listener === listener) {
- originalListener = list[i].listener;
- position = i;
- break;
- }
- }
- if (position < 0)
- return this;
- if (position === 0)
- list.shift();
- else {
- spliceOne(list, position);
- }
- if (list.length === 1)
- events[type] = list[0];
- if (events.removeListener !== undefined)
- this.emit('removeListener', type, originalListener || listener);
- }
- return this;
- };
- EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
- EventEmitter.prototype.removeAllListeners =
- function removeAllListeners(type) {
- var listeners, events, i;
- events = this._events;
- if (events === undefined)
- return this;
- // not listening for removeListener, no need to emit
- if (events.removeListener === undefined) {
- if (arguments.length === 0) {
- this._events = Object.create(null);
- this._eventsCount = 0;
- } else if (events[type] !== undefined) {
- if (--this._eventsCount === 0)
- this._events = Object.create(null);
- else
- delete events[type];
- }
- return this;
- }
- // emit removeListener for all listeners on all events
- if (arguments.length === 0) {
- var keys = Object.keys(events);
- var key;
- for (i = 0; i < keys.length; ++i) {
- key = keys[i];
- if (key === 'removeListener') continue;
- this.removeAllListeners(key);
- }
- this.removeAllListeners('removeListener');
- this._events = Object.create(null);
- this._eventsCount = 0;
- return this;
- }
- listeners = events[type];
- if (typeof listeners === 'function') {
- this.removeListener(type, listeners);
- } else if (listeners !== undefined) {
- // LIFO order
- for (i = listeners.length - 1; i >= 0; i--) {
- this.removeListener(type, listeners[i]);
- }
- }
- return this;
- };
- function _listeners(target, type, unwrap) {
- var events = target._events;
- if (events === undefined)
- return [];
- var evlistener = events[type];
- if (evlistener === undefined)
- return [];
- if (typeof evlistener === 'function')
- return unwrap ? [evlistener.listener || evlistener] : [evlistener];
- return unwrap ?
- unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
- }
- EventEmitter.prototype.listeners = function listeners(type) {
- return _listeners(this, type, true);
- };
- EventEmitter.prototype.rawListeners = function rawListeners(type) {
- return _listeners(this, type, false);
- };
- EventEmitter.listenerCount = function(emitter, type) {
- if (typeof emitter.listenerCount === 'function') {
- return emitter.listenerCount(type);
- } else {
- return listenerCount.call(emitter, type);
- }
- };
- EventEmitter.prototype.listenerCount = listenerCount;
- function listenerCount(type) {
- var events = this._events;
- if (events !== undefined) {
- var evlistener = events[type];
- if (typeof evlistener === 'function') {
- return 1;
- } else if (evlistener !== undefined) {
- return evlistener.length;
- }
- }
- return 0;
- }
- EventEmitter.prototype.eventNames = function eventNames() {
- return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
- };
- function arrayClone(arr, n) {
- var copy = new Array(n);
- for (var i = 0; i < n; ++i)
- copy[i] = arr[i];
- return copy;
- }
- function spliceOne(list, index) {
- for (; index + 1 < list.length; index++)
- list[index] = list[index + 1];
- list.pop();
- }
- function unwrapListeners(arr) {
- var ret = new Array(arr.length);
- for (var i = 0; i < ret.length; ++i) {
- ret[i] = arr[i].listener || arr[i];
- }
- return ret;
- }
- function once(emitter, name) {
- return new Promise(function (resolve, reject) {
- function errorListener(err) {
- emitter.removeListener(name, resolver);
- reject(err);
- }
- function resolver() {
- if (typeof emitter.removeListener === 'function') {
- emitter.removeListener('error', errorListener);
- }
- resolve([].slice.call(arguments));
- };
- eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });
- if (name !== 'error') {
- addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });
- }
- });
- }
- function addErrorHandlerIfEventEmitter(emitter, handler, flags) {
- if (typeof emitter.on === 'function') {
- eventTargetAgnosticAddListener(emitter, 'error', handler, flags);
- }
- }
- function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
- if (typeof emitter.on === 'function') {
- if (flags.once) {
- emitter.once(name, listener);
- } else {
- emitter.on(name, listener);
- }
- } else if (typeof emitter.addEventListener === 'function') {
- // EventTarget does not have `error` event semantics like Node
- // EventEmitters, we do not listen for `error` events here.
- emitter.addEventListener(name, function wrapListener(arg) {
- // IE does not have builtin `{ once: true }` support so we
- // have to do it manually.
- if (flags.once) {
- emitter.removeEventListener(name, wrapListener);
- }
- listener(arg);
- });
- } else {
- throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
- }
- }
- /***/ }),
- /* 128 */
- /*!*****************************************************************************!*\
- !*** ./node_modules/readable-stream/lib/internal/streams/stream-browser.js ***!
- \*****************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(/*! events */ 127).EventEmitter;
- /***/ }),
- /* 129 */
- /*!***********************************************!*\
- !*** ./node_modules/core-util-is/lib/util.js ***!
- \***********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- // Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
- // NOTE: These type checking functions intentionally don't use `instanceof`
- // because it is fragile and can be easily faked with `Object.create()`.
- function isArray(arg) {
- if (Array.isArray) {
- return Array.isArray(arg);
- }
- return objectToString(arg) === '[object Array]';
- }
- exports.isArray = isArray;
- function isBoolean(arg) {
- return typeof arg === 'boolean';
- }
- exports.isBoolean = isBoolean;
- function isNull(arg) {
- return arg === null;
- }
- exports.isNull = isNull;
- function isNullOrUndefined(arg) {
- return arg == null;
- }
- exports.isNullOrUndefined = isNullOrUndefined;
- function isNumber(arg) {
- return typeof arg === 'number';
- }
- exports.isNumber = isNumber;
- function isString(arg) {
- return typeof arg === 'string';
- }
- exports.isString = isString;
- function isSymbol(arg) {
- return typeof arg === 'symbol';
- }
- exports.isSymbol = isSymbol;
- function isUndefined(arg) {
- return arg === void 0;
- }
- exports.isUndefined = isUndefined;
- function isRegExp(re) {
- return objectToString(re) === '[object RegExp]';
- }
- exports.isRegExp = isRegExp;
- function isObject(arg) {
- return typeof arg === 'object' && arg !== null;
- }
- exports.isObject = isObject;
- function isDate(d) {
- return objectToString(d) === '[object Date]';
- }
- exports.isDate = isDate;
- function isError(e) {
- return (objectToString(e) === '[object Error]' || e instanceof Error);
- }
- exports.isError = isError;
- function isFunction(arg) {
- return typeof arg === 'function';
- }
- exports.isFunction = isFunction;
- function isPrimitive(arg) {
- return arg === null ||
- typeof arg === 'boolean' ||
- typeof arg === 'number' ||
- typeof arg === 'string' ||
- typeof arg === 'symbol' || // ES6 symbol
- typeof arg === 'undefined';
- }
- exports.isPrimitive = isPrimitive;
- exports.isBuffer = __webpack_require__(/*! buffer */ 116).Buffer.isBuffer;
- function objectToString(o) {
- return Object.prototype.toString.call(o);
- }
- /***/ }),
- /* 130 */
- /*!**********************!*\
- !*** util (ignored) ***!
- \**********************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- /* (ignored) */
- /***/ }),
- /* 131 */
- /*!*************************************************************************!*\
- !*** ./node_modules/readable-stream/lib/internal/streams/BufferList.js ***!
- \*************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer;
- var util = __webpack_require__(/*! util */ 132);
- function copyBuffer(src, target, offset) {
- src.copy(target, offset);
- }
- module.exports = function () {
- function BufferList() {
- _classCallCheck(this, BufferList);
- this.head = null;
- this.tail = null;
- this.length = 0;
- }
- BufferList.prototype.push = function push(v) {
- var entry = { data: v, next: null };
- if (this.length > 0) this.tail.next = entry;else this.head = entry;
- this.tail = entry;
- ++this.length;
- };
- BufferList.prototype.unshift = function unshift(v) {
- var entry = { data: v, next: this.head };
- if (this.length === 0) this.tail = entry;
- this.head = entry;
- ++this.length;
- };
- BufferList.prototype.shift = function shift() {
- if (this.length === 0) return;
- var ret = this.head.data;
- if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
- --this.length;
- return ret;
- };
- BufferList.prototype.clear = function clear() {
- this.head = this.tail = null;
- this.length = 0;
- };
- BufferList.prototype.join = function join(s) {
- if (this.length === 0) return '';
- var p = this.head;
- var ret = '' + p.data;
- while (p = p.next) {
- ret += s + p.data;
- }return ret;
- };
- BufferList.prototype.concat = function concat(n) {
- if (this.length === 0) return Buffer.alloc(0);
- if (this.length === 1) return this.head.data;
- var ret = Buffer.allocUnsafe(n >>> 0);
- var p = this.head;
- var i = 0;
- while (p) {
- copyBuffer(p.data, ret, i);
- i += p.data.length;
- p = p.next;
- }
- return ret;
- };
- return BufferList;
- }();
- if (util && util.inspect && util.inspect.custom) {
- module.exports.prototype[util.inspect.custom] = function () {
- var obj = util.inspect({ length: this.length });
- return this.constructor.name + ' ' + obj;
- };
- }
- /***/ }),
- /* 132 */
- /*!**********************!*\
- !*** util (ignored) ***!
- \**********************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- /* (ignored) */
- /***/ }),
- /* 133 */
- /*!**********************************************************************!*\
- !*** ./node_modules/readable-stream/lib/internal/streams/destroy.js ***!
- \**********************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*<replacement>*/
- var pna = __webpack_require__(/*! process-nextick-args */ 126);
- /*</replacement>*/
- // undocumented cb() API, needed for core, not for public API
- function destroy(err, cb) {
- var _this = this;
- var readableDestroyed = this._readableState && this._readableState.destroyed;
- var writableDestroyed = this._writableState && this._writableState.destroyed;
- if (readableDestroyed || writableDestroyed) {
- if (cb) {
- cb(err);
- } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
- pna.nextTick(emitErrorNT, this, err);
- }
- return this;
- }
- // we set destroyed to true before firing error callbacks in order
- // to make it re-entrance safe in case destroy() is called within callbacks
- if (this._readableState) {
- this._readableState.destroyed = true;
- }
- // if this is a duplex stream mark the writable part as destroyed as well
- if (this._writableState) {
- this._writableState.destroyed = true;
- }
- this._destroy(err || null, function (err) {
- if (!cb && err) {
- pna.nextTick(emitErrorNT, _this, err);
- if (_this._writableState) {
- _this._writableState.errorEmitted = true;
- }
- } else if (cb) {
- cb(err);
- }
- });
- return this;
- }
- function undestroy() {
- if (this._readableState) {
- this._readableState.destroyed = false;
- this._readableState.reading = false;
- this._readableState.ended = false;
- this._readableState.endEmitted = false;
- }
- if (this._writableState) {
- this._writableState.destroyed = false;
- this._writableState.ended = false;
- this._writableState.ending = false;
- this._writableState.finished = false;
- this._writableState.errorEmitted = false;
- }
- }
- function emitErrorNT(self, err) {
- self.emit('error', err);
- }
- module.exports = {
- destroy: destroy,
- undestroy: undestroy
- };
- /***/ }),
- /* 134 */
- /*!************************************************************!*\
- !*** ./node_modules/readable-stream/lib/_stream_duplex.js ***!
- \************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- // Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
- // a duplex stream is just a stream that is both readable and writable.
- // Since JS doesn't have multiple prototypal inheritance, this class
- // prototypally inherits from Readable, and then parasitically from
- // Writable.
- /*<replacement>*/
- var pna = __webpack_require__(/*! process-nextick-args */ 126);
- /*</replacement>*/
- /*<replacement>*/
- var objectKeys = Object.keys || function (obj) {
- var keys = [];
- for (var key in obj) {
- keys.push(key);
- }return keys;
- };
- /*</replacement>*/
- module.exports = Duplex;
- /*<replacement>*/
- var util = Object.create(__webpack_require__(/*! core-util-is */ 129));
- util.inherits = __webpack_require__(/*! inherits */ 121);
- /*</replacement>*/
- var Readable = __webpack_require__(/*! ./_stream_readable */ 125);
- var Writable = __webpack_require__(/*! ./_stream_writable */ 135);
- util.inherits(Duplex, Readable);
- {
- // avoid scope creep, the keys array can then be collected
- var keys = objectKeys(Writable.prototype);
- for (var v = 0; v < keys.length; v++) {
- var method = keys[v];
- if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
- }
- }
- function Duplex(options) {
- if (!(this instanceof Duplex)) return new Duplex(options);
- Readable.call(this, options);
- Writable.call(this, options);
- if (options && options.readable === false) this.readable = false;
- if (options && options.writable === false) this.writable = false;
- this.allowHalfOpen = true;
- if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
- this.once('end', onend);
- }
- Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
- // making it explicit this property is not enumerable
- // because otherwise some prototype manipulation in
- // userland will fail
- enumerable: false,
- get: function () {
- return this._writableState.highWaterMark;
- }
- });
- // the no-half-open enforcer
- function onend() {
- // if we allow half-open state, or if the writable side ended,
- // then we're ok.
- if (this.allowHalfOpen || this._writableState.ended) return;
- // no more data can be written.
- // But allow more writes to happen in this tick.
- pna.nextTick(onEndNT, this);
- }
- function onEndNT(self) {
- self.end();
- }
- Object.defineProperty(Duplex.prototype, 'destroyed', {
- get: function () {
- if (this._readableState === undefined || this._writableState === undefined) {
- return false;
- }
- return this._readableState.destroyed && this._writableState.destroyed;
- },
- set: function (value) {
- // we ignore the value if the stream
- // has not been initialized yet
- if (this._readableState === undefined || this._writableState === undefined) {
- return;
- }
- // backward compatibility, the user is explicitly
- // managing destroyed
- this._readableState.destroyed = value;
- this._writableState.destroyed = value;
- }
- });
- Duplex.prototype._destroy = function (err, cb) {
- this.push(null);
- this.end();
- pna.nextTick(cb, err);
- };
- /***/ }),
- /* 135 */
- /*!**************************************************************!*\
- !*** ./node_modules/readable-stream/lib/_stream_writable.js ***!
- \**************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(process, global) {// Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
- // A bit simpler than readable streams.
- // Implement an async ._write(chunk, encoding, cb), and it'll handle all
- // the drain event emission and buffering.
- /*<replacement>*/
- var pna = __webpack_require__(/*! process-nextick-args */ 126);
- /*</replacement>*/
- module.exports = Writable;
- /* <replacement> */
- function WriteReq(chunk, encoding, cb) {
- this.chunk = chunk;
- this.encoding = encoding;
- this.callback = cb;
- this.next = null;
- }
- // It seems a linked list but it is not
- // there will be only 2 of these for each stream
- function CorkedRequest(state) {
- var _this = this;
- this.next = null;
- this.entry = null;
- this.finish = function () {
- onCorkedFinish(_this, state);
- };
- }
- /* </replacement> */
- /*<replacement>*/
- var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
- /*</replacement>*/
- /*<replacement>*/
- var Duplex;
- /*</replacement>*/
- Writable.WritableState = WritableState;
- /*<replacement>*/
- var util = Object.create(__webpack_require__(/*! core-util-is */ 129));
- util.inherits = __webpack_require__(/*! inherits */ 121);
- /*</replacement>*/
- /*<replacement>*/
- var internalUtil = {
- deprecate: __webpack_require__(/*! util-deprecate */ 136)
- };
- /*</replacement>*/
- /*<replacement>*/
- var Stream = __webpack_require__(/*! ./internal/streams/stream */ 128);
- /*</replacement>*/
- /*<replacement>*/
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer;
- var OurUint8Array = global.Uint8Array || function () {};
- function _uint8ArrayToBuffer(chunk) {
- return Buffer.from(chunk);
- }
- function _isUint8Array(obj) {
- return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
- }
- /*</replacement>*/
- var destroyImpl = __webpack_require__(/*! ./internal/streams/destroy */ 133);
- util.inherits(Writable, Stream);
- function nop() {}
- function WritableState(options, stream) {
- Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ 134);
- options = options || {};
- // Duplex streams are both readable and writable, but share
- // the same options object.
- // However, some cases require setting options to different
- // values for the readable and the writable sides of the duplex stream.
- // These options can be provided separately as readableXXX and writableXXX.
- var isDuplex = stream instanceof Duplex;
- // object stream flag to indicate whether or not this stream
- // contains buffers or objects.
- this.objectMode = !!options.objectMode;
- if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
- // the point at which write() starts returning false
- // Note: 0 is a valid value, means that we always return false if
- // the entire buffer is not flushed immediately on write()
- var hwm = options.highWaterMark;
- var writableHwm = options.writableHighWaterMark;
- var defaultHwm = this.objectMode ? 16 : 16 * 1024;
- if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
- // cast to ints.
- this.highWaterMark = Math.floor(this.highWaterMark);
- // if _final has been called
- this.finalCalled = false;
- // drain event flag.
- this.needDrain = false;
- // at the start of calling end()
- this.ending = false;
- // when end() has been called, and returned
- this.ended = false;
- // when 'finish' is emitted
- this.finished = false;
- // has it been destroyed
- this.destroyed = false;
- // should we decode strings into buffers before passing to _write?
- // this is here so that some node-core streams can optimize string
- // handling at a lower level.
- var noDecode = options.decodeStrings === false;
- this.decodeStrings = !noDecode;
- // Crypto is kind of old and crusty. Historically, its default string
- // encoding is 'binary' so we have to make this configurable.
- // Everything else in the universe uses 'utf8', though.
- this.defaultEncoding = options.defaultEncoding || 'utf8';
- // not an actual buffer we keep track of, but a measurement
- // of how much we're waiting to get pushed to some underlying
- // socket or file.
- this.length = 0;
- // a flag to see when we're in the middle of a write.
- this.writing = false;
- // when true all writes will be buffered until .uncork() call
- this.corked = 0;
- // a flag to be able to tell if the onwrite cb is called immediately,
- // or on a later tick. We set this to true at first, because any
- // actions that shouldn't happen until "later" should generally also
- // not happen before the first write call.
- this.sync = true;
- // a flag to know if we're processing previously buffered items, which
- // may call the _write() callback in the same tick, so that we don't
- // end up in an overlapped onwrite situation.
- this.bufferProcessing = false;
- // the callback that's passed to _write(chunk,cb)
- this.onwrite = function (er) {
- onwrite(stream, er);
- };
- // the callback that the user supplies to write(chunk,encoding,cb)
- this.writecb = null;
- // the amount that is being written when _write is called.
- this.writelen = 0;
- this.bufferedRequest = null;
- this.lastBufferedRequest = null;
- // number of pending user-supplied write callbacks
- // this must be 0 before 'finish' can be emitted
- this.pendingcb = 0;
- // emit prefinish if the only thing we're waiting for is _write cbs
- // This is relevant for synchronous Transform streams
- this.prefinished = false;
- // True if the error was already emitted and should not be thrown again
- this.errorEmitted = false;
- // count buffered requests
- this.bufferedRequestCount = 0;
- // allocate the first CorkedRequest, there is always
- // one allocated and free to use, and we maintain at most two
- this.corkedRequestsFree = new CorkedRequest(this);
- }
- WritableState.prototype.getBuffer = function getBuffer() {
- var current = this.bufferedRequest;
- var out = [];
- while (current) {
- out.push(current);
- current = current.next;
- }
- return out;
- };
- (function () {
- try {
- Object.defineProperty(WritableState.prototype, 'buffer', {
- get: internalUtil.deprecate(function () {
- return this.getBuffer();
- }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
- });
- } catch (_) {}
- })();
- // Test _writableState for inheritance to account for Duplex streams,
- // whose prototype chain only points to Readable.
- var realHasInstance;
- if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
- realHasInstance = Function.prototype[Symbol.hasInstance];
- Object.defineProperty(Writable, Symbol.hasInstance, {
- value: function (object) {
- if (realHasInstance.call(this, object)) return true;
- if (this !== Writable) return false;
- return object && object._writableState instanceof WritableState;
- }
- });
- } else {
- realHasInstance = function (object) {
- return object instanceof this;
- };
- }
- function Writable(options) {
- Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ 134);
- // Writable ctor is applied to Duplexes, too.
- // `realHasInstance` is necessary because using plain `instanceof`
- // would return false, as no `_writableState` property is attached.
- // Trying to use the custom `instanceof` for Writable here will also break the
- // Node.js LazyTransform implementation, which has a non-trivial getter for
- // `_writableState` that would lead to infinite recursion.
- if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
- return new Writable(options);
- }
- this._writableState = new WritableState(options, this);
- // legacy.
- this.writable = true;
- if (options) {
- if (typeof options.write === 'function') this._write = options.write;
- if (typeof options.writev === 'function') this._writev = options.writev;
- if (typeof options.destroy === 'function') this._destroy = options.destroy;
- if (typeof options.final === 'function') this._final = options.final;
- }
- Stream.call(this);
- }
- // Otherwise people can pipe Writable streams, which is just wrong.
- Writable.prototype.pipe = function () {
- this.emit('error', new Error('Cannot pipe, not readable'));
- };
- function writeAfterEnd(stream, cb) {
- var er = new Error('write after end');
- // TODO: defer error events consistently everywhere, not just the cb
- stream.emit('error', er);
- pna.nextTick(cb, er);
- }
- // Checks that a user-supplied chunk is valid, especially for the particular
- // mode the stream is in. Currently this means that `null` is never accepted
- // and undefined/non-string values are only allowed in object mode.
- function validChunk(stream, state, chunk, cb) {
- var valid = true;
- var er = false;
- if (chunk === null) {
- er = new TypeError('May not write null values to stream');
- } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
- er = new TypeError('Invalid non-string/buffer chunk');
- }
- if (er) {
- stream.emit('error', er);
- pna.nextTick(cb, er);
- valid = false;
- }
- return valid;
- }
- Writable.prototype.write = function (chunk, encoding, cb) {
- var state = this._writableState;
- var ret = false;
- var isBuf = !state.objectMode && _isUint8Array(chunk);
- if (isBuf && !Buffer.isBuffer(chunk)) {
- chunk = _uint8ArrayToBuffer(chunk);
- }
- if (typeof encoding === 'function') {
- cb = encoding;
- encoding = null;
- }
- if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
- if (typeof cb !== 'function') cb = nop;
- if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
- state.pendingcb++;
- ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
- }
- return ret;
- };
- Writable.prototype.cork = function () {
- var state = this._writableState;
- state.corked++;
- };
- Writable.prototype.uncork = function () {
- var state = this._writableState;
- if (state.corked) {
- state.corked--;
- if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
- }
- };
- Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
- // node::ParseEncoding() requires lower case.
- if (typeof encoding === 'string') encoding = encoding.toLowerCase();
- if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
- this._writableState.defaultEncoding = encoding;
- return this;
- };
- function decodeChunk(state, chunk, encoding) {
- if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
- chunk = Buffer.from(chunk, encoding);
- }
- return chunk;
- }
- Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
- // making it explicit this property is not enumerable
- // because otherwise some prototype manipulation in
- // userland will fail
- enumerable: false,
- get: function () {
- return this._writableState.highWaterMark;
- }
- });
- // if we're already writing something, then just put this
- // in the queue, and wait our turn. Otherwise, call _write
- // If we return false, then we need a drain event, so set that flag.
- function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
- if (!isBuf) {
- var newChunk = decodeChunk(state, chunk, encoding);
- if (chunk !== newChunk) {
- isBuf = true;
- encoding = 'buffer';
- chunk = newChunk;
- }
- }
- var len = state.objectMode ? 1 : chunk.length;
- state.length += len;
- var ret = state.length < state.highWaterMark;
- // we must ensure that previous needDrain will not be reset to false.
- if (!ret) state.needDrain = true;
- if (state.writing || state.corked) {
- var last = state.lastBufferedRequest;
- state.lastBufferedRequest = {
- chunk: chunk,
- encoding: encoding,
- isBuf: isBuf,
- callback: cb,
- next: null
- };
- if (last) {
- last.next = state.lastBufferedRequest;
- } else {
- state.bufferedRequest = state.lastBufferedRequest;
- }
- state.bufferedRequestCount += 1;
- } else {
- doWrite(stream, state, false, len, chunk, encoding, cb);
- }
- return ret;
- }
- function doWrite(stream, state, writev, len, chunk, encoding, cb) {
- state.writelen = len;
- state.writecb = cb;
- state.writing = true;
- state.sync = true;
- if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
- state.sync = false;
- }
- function onwriteError(stream, state, sync, er, cb) {
- --state.pendingcb;
- if (sync) {
- // defer the callback if we are being called synchronously
- // to avoid piling up things on the stack
- pna.nextTick(cb, er);
- // this can emit finish, and it will always happen
- // after error
- pna.nextTick(finishMaybe, stream, state);
- stream._writableState.errorEmitted = true;
- stream.emit('error', er);
- } else {
- // the caller expect this to happen before if
- // it is async
- cb(er);
- stream._writableState.errorEmitted = true;
- stream.emit('error', er);
- // this can emit finish, but finish must
- // always follow error
- finishMaybe(stream, state);
- }
- }
- function onwriteStateUpdate(state) {
- state.writing = false;
- state.writecb = null;
- state.length -= state.writelen;
- state.writelen = 0;
- }
- function onwrite(stream, er) {
- var state = stream._writableState;
- var sync = state.sync;
- var cb = state.writecb;
- onwriteStateUpdate(state);
- if (er) onwriteError(stream, state, sync, er, cb);else {
- // Check if we're actually ready to finish, but don't emit yet
- var finished = needFinish(state);
- if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
- clearBuffer(stream, state);
- }
- if (sync) {
- /*<replacement>*/
- asyncWrite(afterWrite, stream, state, finished, cb);
- /*</replacement>*/
- } else {
- afterWrite(stream, state, finished, cb);
- }
- }
- }
- function afterWrite(stream, state, finished, cb) {
- if (!finished) onwriteDrain(stream, state);
- state.pendingcb--;
- cb();
- finishMaybe(stream, state);
- }
- // Must force callback to be called on nextTick, so that we don't
- // emit 'drain' before the write() consumer gets the 'false' return
- // value, and has a chance to attach a 'drain' listener.
- function onwriteDrain(stream, state) {
- if (state.length === 0 && state.needDrain) {
- state.needDrain = false;
- stream.emit('drain');
- }
- }
- // if there's something in the buffer waiting, then process it
- function clearBuffer(stream, state) {
- state.bufferProcessing = true;
- var entry = state.bufferedRequest;
- if (stream._writev && entry && entry.next) {
- // Fast case, write everything using _writev()
- var l = state.bufferedRequestCount;
- var buffer = new Array(l);
- var holder = state.corkedRequestsFree;
- holder.entry = entry;
- var count = 0;
- var allBuffers = true;
- while (entry) {
- buffer[count] = entry;
- if (!entry.isBuf) allBuffers = false;
- entry = entry.next;
- count += 1;
- }
- buffer.allBuffers = allBuffers;
- doWrite(stream, state, true, state.length, buffer, '', holder.finish);
- // doWrite is almost always async, defer these to save a bit of time
- // as the hot path ends with doWrite
- state.pendingcb++;
- state.lastBufferedRequest = null;
- if (holder.next) {
- state.corkedRequestsFree = holder.next;
- holder.next = null;
- } else {
- state.corkedRequestsFree = new CorkedRequest(state);
- }
- state.bufferedRequestCount = 0;
- } else {
- // Slow case, write chunks one-by-one
- while (entry) {
- var chunk = entry.chunk;
- var encoding = entry.encoding;
- var cb = entry.callback;
- var len = state.objectMode ? 1 : chunk.length;
- doWrite(stream, state, false, len, chunk, encoding, cb);
- entry = entry.next;
- state.bufferedRequestCount--;
- // if we didn't call the onwrite immediately, then
- // it means that we need to wait until it does.
- // also, that means that the chunk and cb are currently
- // being processed, so move the buffer counter past them.
- if (state.writing) {
- break;
- }
- }
- if (entry === null) state.lastBufferedRequest = null;
- }
- state.bufferedRequest = entry;
- state.bufferProcessing = false;
- }
- Writable.prototype._write = function (chunk, encoding, cb) {
- cb(new Error('_write() is not implemented'));
- };
- Writable.prototype._writev = null;
- Writable.prototype.end = function (chunk, encoding, cb) {
- var state = this._writableState;
- if (typeof chunk === 'function') {
- cb = chunk;
- chunk = null;
- encoding = null;
- } else if (typeof encoding === 'function') {
- cb = encoding;
- encoding = null;
- }
- if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
- // .end() fully uncorks
- if (state.corked) {
- state.corked = 1;
- this.uncork();
- }
- // ignore unnecessary end() calls.
- if (!state.ending && !state.finished) endWritable(this, state, cb);
- };
- function needFinish(state) {
- return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
- }
- function callFinal(stream, state) {
- stream._final(function (err) {
- state.pendingcb--;
- if (err) {
- stream.emit('error', err);
- }
- state.prefinished = true;
- stream.emit('prefinish');
- finishMaybe(stream, state);
- });
- }
- function prefinish(stream, state) {
- if (!state.prefinished && !state.finalCalled) {
- if (typeof stream._final === 'function') {
- state.pendingcb++;
- state.finalCalled = true;
- pna.nextTick(callFinal, stream, state);
- } else {
- state.prefinished = true;
- stream.emit('prefinish');
- }
- }
- }
- function finishMaybe(stream, state) {
- var need = needFinish(state);
- if (need) {
- prefinish(stream, state);
- if (state.pendingcb === 0) {
- state.finished = true;
- stream.emit('finish');
- }
- }
- return need;
- }
- function endWritable(stream, state, cb) {
- state.ending = true;
- finishMaybe(stream, state);
- if (cb) {
- if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);
- }
- state.ended = true;
- stream.writable = false;
- }
- function onCorkedFinish(corkReq, state, err) {
- var entry = corkReq.entry;
- corkReq.entry = null;
- while (entry) {
- var cb = entry.callback;
- state.pendingcb--;
- cb(err);
- entry = entry.next;
- }
- if (state.corkedRequestsFree) {
- state.corkedRequestsFree.next = corkReq;
- } else {
- state.corkedRequestsFree = corkReq;
- }
- }
- Object.defineProperty(Writable.prototype, 'destroyed', {
- get: function () {
- if (this._writableState === undefined) {
- return false;
- }
- return this._writableState.destroyed;
- },
- set: function (value) {
- // we ignore the value if the stream
- // has not been initialized yet
- if (!this._writableState) {
- return;
- }
- // backward compatibility, the user is explicitly
- // managing destroyed
- this._writableState.destroyed = value;
- }
- });
- Writable.prototype.destroy = destroyImpl.destroy;
- Writable.prototype._undestroy = destroyImpl.undestroy;
- Writable.prototype._destroy = function (err, cb) {
- this.end();
- cb(err);
- };
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node-libs-browser/mock/process.js */ 113), __webpack_require__(/*! ./../../webpack/buildin/global.js */ 3)))
- /***/ }),
- /* 136 */
- /*!************************************************!*\
- !*** ./node_modules/util-deprecate/browser.js ***!
- \************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- /* WEBPACK VAR INJECTION */(function(global) {
- /**
- * Module exports.
- */
- module.exports = deprecate;
- /**
- * Mark that a method should not be used.
- * Returns a modified function which warns once by default.
- *
- * If `localStorage.noDeprecation = true` is set, then it is a no-op.
- *
- * If `localStorage.throwDeprecation = true` is set, then deprecated functions
- * will throw an Error when invoked.
- *
- * If `localStorage.traceDeprecation = true` is set, then deprecated functions
- * will invoke `console.trace()` instead of `console.error()`.
- *
- * @param {Function} fn - the function to deprecate
- * @param {String} msg - the string to print to the console when `fn` is invoked
- * @returns {Function} a new "deprecated" version of `fn`
- * @api public
- */
- function deprecate (fn, msg) {
- if (config('noDeprecation')) {
- return fn;
- }
- var warned = false;
- function deprecated() {
- if (!warned) {
- if (config('throwDeprecation')) {
- throw new Error(msg);
- } else if (config('traceDeprecation')) {
- console.trace(msg);
- } else {
- console.warn(msg);
- }
- warned = true;
- }
- return fn.apply(this, arguments);
- }
- return deprecated;
- }
- /**
- * Checks `localStorage` for boolean values for the given `name`.
- *
- * @param {String} name
- * @returns {Boolean}
- * @api private
- */
- function config (name) {
- // accessing global.localStorage can trigger a DOMException in sandboxed iframes
- try {
- if (!global.localStorage) return false;
- } catch (_) {
- return false;
- }
- var val = global.localStorage[name];
- if (null == val) return false;
- return String(val).toLowerCase() === 'true';
- }
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ 3)))
- /***/ }),
- /* 137 */
- /*!***********************************************************!*\
- !*** ./node_modules/string_decoder/lib/string_decoder.js ***!
- \***********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- // Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
- /*<replacement>*/
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer;
- /*</replacement>*/
- var isEncoding = Buffer.isEncoding || function (encoding) {
- encoding = '' + encoding;
- switch (encoding && encoding.toLowerCase()) {
- case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':
- return true;
- default:
- return false;
- }
- };
- function _normalizeEncoding(enc) {
- if (!enc) return 'utf8';
- var retried;
- while (true) {
- switch (enc) {
- case 'utf8':
- case 'utf-8':
- return 'utf8';
- case 'ucs2':
- case 'ucs-2':
- case 'utf16le':
- case 'utf-16le':
- return 'utf16le';
- case 'latin1':
- case 'binary':
- return 'latin1';
- case 'base64':
- case 'ascii':
- case 'hex':
- return enc;
- default:
- if (retried) return; // undefined
- enc = ('' + enc).toLowerCase();
- retried = true;
- }
- }
- };
- // Do not cache `Buffer.isEncoding` when checking encoding names as some
- // modules monkey-patch it to support additional encodings
- function normalizeEncoding(enc) {
- var nenc = _normalizeEncoding(enc);
- if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
- return nenc || enc;
- }
- // StringDecoder provides an interface for efficiently splitting a series of
- // buffers into a series of JS strings without breaking apart multi-byte
- // characters.
- exports.StringDecoder = StringDecoder;
- function StringDecoder(encoding) {
- this.encoding = normalizeEncoding(encoding);
- var nb;
- switch (this.encoding) {
- case 'utf16le':
- this.text = utf16Text;
- this.end = utf16End;
- nb = 4;
- break;
- case 'utf8':
- this.fillLast = utf8FillLast;
- nb = 4;
- break;
- case 'base64':
- this.text = base64Text;
- this.end = base64End;
- nb = 3;
- break;
- default:
- this.write = simpleWrite;
- this.end = simpleEnd;
- return;
- }
- this.lastNeed = 0;
- this.lastTotal = 0;
- this.lastChar = Buffer.allocUnsafe(nb);
- }
- StringDecoder.prototype.write = function (buf) {
- if (buf.length === 0) return '';
- var r;
- var i;
- if (this.lastNeed) {
- r = this.fillLast(buf);
- if (r === undefined) return '';
- i = this.lastNeed;
- this.lastNeed = 0;
- } else {
- i = 0;
- }
- if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
- return r || '';
- };
- StringDecoder.prototype.end = utf8End;
- // Returns only complete characters in a Buffer
- StringDecoder.prototype.text = utf8Text;
- // Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
- StringDecoder.prototype.fillLast = function (buf) {
- if (this.lastNeed <= buf.length) {
- buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
- return this.lastChar.toString(this.encoding, 0, this.lastTotal);
- }
- buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
- this.lastNeed -= buf.length;
- };
- // Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
- // continuation byte. If an invalid byte is detected, -2 is returned.
- function utf8CheckByte(byte) {
- if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;
- return byte >> 6 === 0x02 ? -1 : -2;
- }
- // Checks at most 3 bytes at the end of a Buffer in order to detect an
- // incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
- // needed to complete the UTF-8 character (if applicable) are returned.
- function utf8CheckIncomplete(self, buf, i) {
- var j = buf.length - 1;
- if (j < i) return 0;
- var nb = utf8CheckByte(buf[j]);
- if (nb >= 0) {
- if (nb > 0) self.lastNeed = nb - 1;
- return nb;
- }
- if (--j < i || nb === -2) return 0;
- nb = utf8CheckByte(buf[j]);
- if (nb >= 0) {
- if (nb > 0) self.lastNeed = nb - 2;
- return nb;
- }
- if (--j < i || nb === -2) return 0;
- nb = utf8CheckByte(buf[j]);
- if (nb >= 0) {
- if (nb > 0) {
- if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
- }
- return nb;
- }
- return 0;
- }
- // Validates as many continuation bytes for a multi-byte UTF-8 character as
- // needed or are available. If we see a non-continuation byte where we expect
- // one, we "replace" the validated continuation bytes we've seen so far with
- // a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding
- // behavior. The continuation byte check is included three times in the case
- // where all of the continuation bytes for a character exist in the same buffer.
- // It is also done this way as a slight performance increase instead of using a
- // loop.
- function utf8CheckExtraBytes(self, buf, p) {
- if ((buf[0] & 0xC0) !== 0x80) {
- self.lastNeed = 0;
- return '\ufffd';
- }
- if (self.lastNeed > 1 && buf.length > 1) {
- if ((buf[1] & 0xC0) !== 0x80) {
- self.lastNeed = 1;
- return '\ufffd';
- }
- if (self.lastNeed > 2 && buf.length > 2) {
- if ((buf[2] & 0xC0) !== 0x80) {
- self.lastNeed = 2;
- return '\ufffd';
- }
- }
- }
- }
- // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
- function utf8FillLast(buf) {
- var p = this.lastTotal - this.lastNeed;
- var r = utf8CheckExtraBytes(this, buf, p);
- if (r !== undefined) return r;
- if (this.lastNeed <= buf.length) {
- buf.copy(this.lastChar, p, 0, this.lastNeed);
- return this.lastChar.toString(this.encoding, 0, this.lastTotal);
- }
- buf.copy(this.lastChar, p, 0, buf.length);
- this.lastNeed -= buf.length;
- }
- // Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
- // partial character, the character's bytes are buffered until the required
- // number of bytes are available.
- function utf8Text(buf, i) {
- var total = utf8CheckIncomplete(this, buf, i);
- if (!this.lastNeed) return buf.toString('utf8', i);
- this.lastTotal = total;
- var end = buf.length - (total - this.lastNeed);
- buf.copy(this.lastChar, 0, end);
- return buf.toString('utf8', i, end);
- }
- // For UTF-8, a replacement character is added when ending on a partial
- // character.
- function utf8End(buf) {
- var r = buf && buf.length ? this.write(buf) : '';
- if (this.lastNeed) return r + '\ufffd';
- return r;
- }
- // UTF-16LE typically needs two bytes per character, but even if we have an even
- // number of bytes available, we need to check if we end on a leading/high
- // surrogate. In that case, we need to wait for the next two bytes in order to
- // decode the last character properly.
- function utf16Text(buf, i) {
- if ((buf.length - i) % 2 === 0) {
- var r = buf.toString('utf16le', i);
- if (r) {
- var c = r.charCodeAt(r.length - 1);
- if (c >= 0xD800 && c <= 0xDBFF) {
- this.lastNeed = 2;
- this.lastTotal = 4;
- this.lastChar[0] = buf[buf.length - 2];
- this.lastChar[1] = buf[buf.length - 1];
- return r.slice(0, -1);
- }
- }
- return r;
- }
- this.lastNeed = 1;
- this.lastTotal = 2;
- this.lastChar[0] = buf[buf.length - 1];
- return buf.toString('utf16le', i, buf.length - 1);
- }
- // For UTF-16LE we do not explicitly append special replacement characters if we
- // end on a partial character, we simply let v8 handle that.
- function utf16End(buf) {
- var r = buf && buf.length ? this.write(buf) : '';
- if (this.lastNeed) {
- var end = this.lastTotal - this.lastNeed;
- return r + this.lastChar.toString('utf16le', 0, end);
- }
- return r;
- }
- function base64Text(buf, i) {
- var n = (buf.length - i) % 3;
- if (n === 0) return buf.toString('base64', i);
- this.lastNeed = 3 - n;
- this.lastTotal = 3;
- if (n === 1) {
- this.lastChar[0] = buf[buf.length - 1];
- } else {
- this.lastChar[0] = buf[buf.length - 2];
- this.lastChar[1] = buf[buf.length - 1];
- }
- return buf.toString('base64', i, buf.length - n);
- }
- function base64End(buf) {
- var r = buf && buf.length ? this.write(buf) : '';
- if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
- return r;
- }
- // Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
- function simpleWrite(buf) {
- return buf.toString(this.encoding);
- }
- function simpleEnd(buf) {
- return buf && buf.length ? this.write(buf) : '';
- }
- /***/ }),
- /* 138 */
- /*!***************************************************************!*\
- !*** ./node_modules/readable-stream/lib/_stream_transform.js ***!
- \***************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- // Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
- // a transform stream is a readable/writable stream where you do
- // something with the data. Sometimes it's called a "filter",
- // but that's not a great name for it, since that implies a thing where
- // some bits pass through, and others are simply ignored. (That would
- // be a valid example of a transform, of course.)
- //
- // While the output is causally related to the input, it's not a
- // necessarily symmetric or synchronous transformation. For example,
- // a zlib stream might take multiple plain-text writes(), and then
- // emit a single compressed chunk some time in the future.
- //
- // Here's how this works:
- //
- // The Transform stream has all the aspects of the readable and writable
- // stream classes. When you write(chunk), that calls _write(chunk,cb)
- // internally, and returns false if there's a lot of pending writes
- // buffered up. When you call read(), that calls _read(n) until
- // there's enough pending readable data buffered up.
- //
- // In a transform stream, the written data is placed in a buffer. When
- // _read(n) is called, it transforms the queued up data, calling the
- // buffered _write cb's as it consumes chunks. If consuming a single
- // written chunk would result in multiple output chunks, then the first
- // outputted bit calls the readcb, and subsequent chunks just go into
- // the read buffer, and will cause it to emit 'readable' if necessary.
- //
- // This way, back-pressure is actually determined by the reading side,
- // since _read has to be called to start processing a new chunk. However,
- // a pathological inflate type of transform can cause excessive buffering
- // here. For example, imagine a stream where every byte of input is
- // interpreted as an integer from 0-255, and then results in that many
- // bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
- // 1kb of data being output. In this case, you could write a very small
- // amount of input, and end up with a very large amount of output. In
- // such a pathological inflating mechanism, there'd be no way to tell
- // the system to stop doing the transform. A single 4MB write could
- // cause the system to run out of memory.
- //
- // However, even in such a pathological case, only a single written chunk
- // would be consumed, and then the rest would wait (un-transformed) until
- // the results of the previous transformed chunk were consumed.
- module.exports = Transform;
- var Duplex = __webpack_require__(/*! ./_stream_duplex */ 134);
- /*<replacement>*/
- var util = Object.create(__webpack_require__(/*! core-util-is */ 129));
- util.inherits = __webpack_require__(/*! inherits */ 121);
- /*</replacement>*/
- util.inherits(Transform, Duplex);
- function afterTransform(er, data) {
- var ts = this._transformState;
- ts.transforming = false;
- var cb = ts.writecb;
- if (!cb) {
- return this.emit('error', new Error('write callback called multiple times'));
- }
- ts.writechunk = null;
- ts.writecb = null;
- if (data != null) // single equals check for both `null` and `undefined`
- this.push(data);
- cb(er);
- var rs = this._readableState;
- rs.reading = false;
- if (rs.needReadable || rs.length < rs.highWaterMark) {
- this._read(rs.highWaterMark);
- }
- }
- function Transform(options) {
- if (!(this instanceof Transform)) return new Transform(options);
- Duplex.call(this, options);
- this._transformState = {
- afterTransform: afterTransform.bind(this),
- needTransform: false,
- transforming: false,
- writecb: null,
- writechunk: null,
- writeencoding: null
- };
- // start out asking for a readable event once data is transformed.
- this._readableState.needReadable = true;
- // we have implemented the _read method, and done the other things
- // that Readable wants before the first _read call, so unset the
- // sync guard flag.
- this._readableState.sync = false;
- if (options) {
- if (typeof options.transform === 'function') this._transform = options.transform;
- if (typeof options.flush === 'function') this._flush = options.flush;
- }
- // When the writable side finishes, then flush out anything remaining.
- this.on('prefinish', prefinish);
- }
- function prefinish() {
- var _this = this;
- if (typeof this._flush === 'function') {
- this._flush(function (er, data) {
- done(_this, er, data);
- });
- } else {
- done(this, null, null);
- }
- }
- Transform.prototype.push = function (chunk, encoding) {
- this._transformState.needTransform = false;
- return Duplex.prototype.push.call(this, chunk, encoding);
- };
- // This is the part where you do stuff!
- // override this function in implementation classes.
- // 'chunk' is an input chunk.
- //
- // Call `push(newChunk)` to pass along transformed output
- // to the readable side. You may call 'push' zero or more times.
- //
- // Call `cb(err)` when you are done with this chunk. If you pass
- // an error, then that'll put the hurt on the whole operation. If you
- // never call cb(), then you'll never get another chunk.
- Transform.prototype._transform = function (chunk, encoding, cb) {
- throw new Error('_transform() is not implemented');
- };
- Transform.prototype._write = function (chunk, encoding, cb) {
- var ts = this._transformState;
- ts.writecb = cb;
- ts.writechunk = chunk;
- ts.writeencoding = encoding;
- if (!ts.transforming) {
- var rs = this._readableState;
- if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
- }
- };
- // Doesn't matter what the args are here.
- // _transform does all the work.
- // That we got here means that the readable side wants more data.
- Transform.prototype._read = function (n) {
- var ts = this._transformState;
- if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
- ts.transforming = true;
- this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
- } else {
- // mark that we need a transform, so that any data that comes in
- // will get processed, now that we've asked for it.
- ts.needTransform = true;
- }
- };
- Transform.prototype._destroy = function (err, cb) {
- var _this2 = this;
- Duplex.prototype._destroy.call(this, err, function (err2) {
- cb(err2);
- _this2.emit('close');
- });
- };
- function done(stream, er, data) {
- if (er) return stream.emit('error', er);
- if (data != null) // single equals check for both `null` and `undefined`
- stream.push(data);
- // if there's nothing in the write buffer, then that means
- // that nothing more will ever be provided
- if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');
- if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');
- return stream.push(null);
- }
- /***/ }),
- /* 139 */
- /*!*****************************************************************!*\
- !*** ./node_modules/readable-stream/lib/_stream_passthrough.js ***!
- \*****************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- // Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
- // a passthrough stream.
- // basically just the most minimal sort of Transform stream.
- // Every written chunk gets output as-is.
- module.exports = PassThrough;
- var Transform = __webpack_require__(/*! ./_stream_transform */ 138);
- /*<replacement>*/
- var util = Object.create(__webpack_require__(/*! core-util-is */ 129));
- util.inherits = __webpack_require__(/*! inherits */ 121);
- /*</replacement>*/
- util.inherits(PassThrough, Transform);
- function PassThrough(options) {
- if (!(this instanceof PassThrough)) return new PassThrough(options);
- Transform.call(this, options);
- }
- PassThrough.prototype._transform = function (chunk, encoding, cb) {
- cb(null, chunk);
- };
- /***/ }),
- /* 140 */
- /*!*****************************************!*\
- !*** ./node_modules/ripemd160/index.js ***!
- \*****************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var Buffer = __webpack_require__(/*! buffer */ 116).Buffer
- var inherits = __webpack_require__(/*! inherits */ 121)
- var HashBase = __webpack_require__(/*! hash-base */ 123)
- var ARRAY16 = new Array(16)
- var zl = [
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
- 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
- 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
- 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
- ]
- var zr = [
- 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
- 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
- 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
- 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
- 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
- ]
- var sl = [
- 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
- 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
- 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
- 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
- 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
- ]
- var sr = [
- 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
- 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
- 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
- 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
- 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
- ]
- var hl = [0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e]
- var hr = [0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000]
- function RIPEMD160 () {
- HashBase.call(this, 64)
- // state
- this._a = 0x67452301
- this._b = 0xefcdab89
- this._c = 0x98badcfe
- this._d = 0x10325476
- this._e = 0xc3d2e1f0
- }
- inherits(RIPEMD160, HashBase)
- RIPEMD160.prototype._update = function () {
- var words = ARRAY16
- for (var j = 0; j < 16; ++j) words[j] = this._block.readInt32LE(j * 4)
- var al = this._a | 0
- var bl = this._b | 0
- var cl = this._c | 0
- var dl = this._d | 0
- var el = this._e | 0
- var ar = this._a | 0
- var br = this._b | 0
- var cr = this._c | 0
- var dr = this._d | 0
- var er = this._e | 0
- // computation
- for (var i = 0; i < 80; i += 1) {
- var tl
- var tr
- if (i < 16) {
- tl = fn1(al, bl, cl, dl, el, words[zl[i]], hl[0], sl[i])
- tr = fn5(ar, br, cr, dr, er, words[zr[i]], hr[0], sr[i])
- } else if (i < 32) {
- tl = fn2(al, bl, cl, dl, el, words[zl[i]], hl[1], sl[i])
- tr = fn4(ar, br, cr, dr, er, words[zr[i]], hr[1], sr[i])
- } else if (i < 48) {
- tl = fn3(al, bl, cl, dl, el, words[zl[i]], hl[2], sl[i])
- tr = fn3(ar, br, cr, dr, er, words[zr[i]], hr[2], sr[i])
- } else if (i < 64) {
- tl = fn4(al, bl, cl, dl, el, words[zl[i]], hl[3], sl[i])
- tr = fn2(ar, br, cr, dr, er, words[zr[i]], hr[3], sr[i])
- } else { // if (i<80) {
- tl = fn5(al, bl, cl, dl, el, words[zl[i]], hl[4], sl[i])
- tr = fn1(ar, br, cr, dr, er, words[zr[i]], hr[4], sr[i])
- }
- al = el
- el = dl
- dl = rotl(cl, 10)
- cl = bl
- bl = tl
- ar = er
- er = dr
- dr = rotl(cr, 10)
- cr = br
- br = tr
- }
- // update state
- var t = (this._b + cl + dr) | 0
- this._b = (this._c + dl + er) | 0
- this._c = (this._d + el + ar) | 0
- this._d = (this._e + al + br) | 0
- this._e = (this._a + bl + cr) | 0
- this._a = t
- }
- RIPEMD160.prototype._digest = function () {
- // create padding and handle blocks
- this._block[this._blockOffset++] = 0x80
- if (this._blockOffset > 56) {
- this._block.fill(0, this._blockOffset, 64)
- this._update()
- this._blockOffset = 0
- }
- this._block.fill(0, this._blockOffset, 56)
- this._block.writeUInt32LE(this._length[0], 56)
- this._block.writeUInt32LE(this._length[1], 60)
- this._update()
- // produce result
- var buffer = Buffer.alloc ? Buffer.alloc(20) : new Buffer(20)
- buffer.writeInt32LE(this._a, 0)
- buffer.writeInt32LE(this._b, 4)
- buffer.writeInt32LE(this._c, 8)
- buffer.writeInt32LE(this._d, 12)
- buffer.writeInt32LE(this._e, 16)
- return buffer
- }
- function rotl (x, n) {
- return (x << n) | (x >>> (32 - n))
- }
- function fn1 (a, b, c, d, e, m, k, s) {
- return (rotl((a + (b ^ c ^ d) + m + k) | 0, s) + e) | 0
- }
- function fn2 (a, b, c, d, e, m, k, s) {
- return (rotl((a + ((b & c) | ((~b) & d)) + m + k) | 0, s) + e) | 0
- }
- function fn3 (a, b, c, d, e, m, k, s) {
- return (rotl((a + ((b | (~c)) ^ d) + m + k) | 0, s) + e) | 0
- }
- function fn4 (a, b, c, d, e, m, k, s) {
- return (rotl((a + ((b & d) | (c & (~d))) + m + k) | 0, s) + e) | 0
- }
- function fn5 (a, b, c, d, e, m, k, s) {
- return (rotl((a + (b ^ (c | (~d))) + m + k) | 0, s) + e) | 0
- }
- module.exports = RIPEMD160
- /***/ }),
- /* 141 */
- /*!**************************************!*\
- !*** ./node_modules/sha.js/index.js ***!
- \**************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var exports = module.exports = function SHA (algorithm) {
- algorithm = algorithm.toLowerCase()
- var Algorithm = exports[algorithm]
- if (!Algorithm) throw new Error(algorithm + ' is not supported (we accept pull requests)')
- return new Algorithm()
- }
- exports.sha = __webpack_require__(/*! ./sha */ 142)
- exports.sha1 = __webpack_require__(/*! ./sha1 */ 144)
- exports.sha224 = __webpack_require__(/*! ./sha224 */ 145)
- exports.sha256 = __webpack_require__(/*! ./sha256 */ 146)
- exports.sha384 = __webpack_require__(/*! ./sha384 */ 147)
- exports.sha512 = __webpack_require__(/*! ./sha512 */ 148)
- /***/ }),
- /* 142 */
- /*!************************************!*\
- !*** ./node_modules/sha.js/sha.js ***!
- \************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- /*
- * A JavaScript implementation of the Secure Hash Algorithm, SHA-0, as defined
- * in FIPS PUB 180-1
- * This source code is derived from sha1.js of the same repository.
- * The difference between SHA-0 and SHA-1 is just a bitwise rotate left
- * operation was added.
- */
- var inherits = __webpack_require__(/*! inherits */ 121)
- var Hash = __webpack_require__(/*! ./hash */ 143)
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- var K = [
- 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0
- ]
- var W = new Array(80)
- function Sha () {
- this.init()
- this._w = W
- Hash.call(this, 64, 56)
- }
- inherits(Sha, Hash)
- Sha.prototype.init = function () {
- this._a = 0x67452301
- this._b = 0xefcdab89
- this._c = 0x98badcfe
- this._d = 0x10325476
- this._e = 0xc3d2e1f0
- return this
- }
- function rotl5 (num) {
- return (num << 5) | (num >>> 27)
- }
- function rotl30 (num) {
- return (num << 30) | (num >>> 2)
- }
- function ft (s, b, c, d) {
- if (s === 0) return (b & c) | ((~b) & d)
- if (s === 2) return (b & c) | (b & d) | (c & d)
- return b ^ c ^ d
- }
- Sha.prototype._update = function (M) {
- var W = this._w
- var a = this._a | 0
- var b = this._b | 0
- var c = this._c | 0
- var d = this._d | 0
- var e = this._e | 0
- for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
- for (; i < 80; ++i) W[i] = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]
- for (var j = 0; j < 80; ++j) {
- var s = ~~(j / 20)
- var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0
- e = d
- d = c
- c = rotl30(b)
- b = a
- a = t
- }
- this._a = (a + this._a) | 0
- this._b = (b + this._b) | 0
- this._c = (c + this._c) | 0
- this._d = (d + this._d) | 0
- this._e = (e + this._e) | 0
- }
- Sha.prototype._hash = function () {
- var H = Buffer.allocUnsafe(20)
- H.writeInt32BE(this._a | 0, 0)
- H.writeInt32BE(this._b | 0, 4)
- H.writeInt32BE(this._c | 0, 8)
- H.writeInt32BE(this._d | 0, 12)
- H.writeInt32BE(this._e | 0, 16)
- return H
- }
- module.exports = Sha
- /***/ }),
- /* 143 */
- /*!*************************************!*\
- !*** ./node_modules/sha.js/hash.js ***!
- \*************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- // prototype class for hash functions
- function Hash (blockSize, finalSize) {
- this._block = Buffer.alloc(blockSize)
- this._finalSize = finalSize
- this._blockSize = blockSize
- this._len = 0
- }
- Hash.prototype.update = function (data, enc) {
- if (typeof data === 'string') {
- enc = enc || 'utf8'
- data = Buffer.from(data, enc)
- }
- var block = this._block
- var blockSize = this._blockSize
- var length = data.length
- var accum = this._len
- for (var offset = 0; offset < length;) {
- var assigned = accum % blockSize
- var remainder = Math.min(length - offset, blockSize - assigned)
- for (var i = 0; i < remainder; i++) {
- block[assigned + i] = data[offset + i]
- }
- accum += remainder
- offset += remainder
- if ((accum % blockSize) === 0) {
- this._update(block)
- }
- }
- this._len += length
- return this
- }
- Hash.prototype.digest = function (enc) {
- var rem = this._len % this._blockSize
- this._block[rem] = 0x80
- // zero (rem + 1) trailing bits, where (rem + 1) is the smallest
- // non-negative solution to the equation (length + 1 + (rem + 1)) === finalSize mod blockSize
- this._block.fill(0, rem + 1)
- if (rem >= this._finalSize) {
- this._update(this._block)
- this._block.fill(0)
- }
- var bits = this._len * 8
- // uint32
- if (bits <= 0xffffffff) {
- this._block.writeUInt32BE(bits, this._blockSize - 4)
- // uint64
- } else {
- var lowBits = (bits & 0xffffffff) >>> 0
- var highBits = (bits - lowBits) / 0x100000000
- this._block.writeUInt32BE(highBits, this._blockSize - 8)
- this._block.writeUInt32BE(lowBits, this._blockSize - 4)
- }
- this._update(this._block)
- var hash = this._hash()
- return enc ? hash.toString(enc) : hash
- }
- Hash.prototype._update = function () {
- throw new Error('_update must be implemented by subclass')
- }
- module.exports = Hash
- /***/ }),
- /* 144 */
- /*!*************************************!*\
- !*** ./node_modules/sha.js/sha1.js ***!
- \*************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- /*
- * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
- * in FIPS PUB 180-1
- * Version 2.1a Copyright Paul Johnston 2000 - 2002.
- * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
- * Distributed under the BSD License
- * See http://pajhome.org.uk/crypt/md5 for details.
- */
- var inherits = __webpack_require__(/*! inherits */ 121)
- var Hash = __webpack_require__(/*! ./hash */ 143)
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- var K = [
- 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0
- ]
- var W = new Array(80)
- function Sha1 () {
- this.init()
- this._w = W
- Hash.call(this, 64, 56)
- }
- inherits(Sha1, Hash)
- Sha1.prototype.init = function () {
- this._a = 0x67452301
- this._b = 0xefcdab89
- this._c = 0x98badcfe
- this._d = 0x10325476
- this._e = 0xc3d2e1f0
- return this
- }
- function rotl1 (num) {
- return (num << 1) | (num >>> 31)
- }
- function rotl5 (num) {
- return (num << 5) | (num >>> 27)
- }
- function rotl30 (num) {
- return (num << 30) | (num >>> 2)
- }
- function ft (s, b, c, d) {
- if (s === 0) return (b & c) | ((~b) & d)
- if (s === 2) return (b & c) | (b & d) | (c & d)
- return b ^ c ^ d
- }
- Sha1.prototype._update = function (M) {
- var W = this._w
- var a = this._a | 0
- var b = this._b | 0
- var c = this._c | 0
- var d = this._d | 0
- var e = this._e | 0
- for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
- for (; i < 80; ++i) W[i] = rotl1(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16])
- for (var j = 0; j < 80; ++j) {
- var s = ~~(j / 20)
- var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0
- e = d
- d = c
- c = rotl30(b)
- b = a
- a = t
- }
- this._a = (a + this._a) | 0
- this._b = (b + this._b) | 0
- this._c = (c + this._c) | 0
- this._d = (d + this._d) | 0
- this._e = (e + this._e) | 0
- }
- Sha1.prototype._hash = function () {
- var H = Buffer.allocUnsafe(20)
- H.writeInt32BE(this._a | 0, 0)
- H.writeInt32BE(this._b | 0, 4)
- H.writeInt32BE(this._c | 0, 8)
- H.writeInt32BE(this._d | 0, 12)
- H.writeInt32BE(this._e | 0, 16)
- return H
- }
- module.exports = Sha1
- /***/ }),
- /* 145 */
- /*!***************************************!*\
- !*** ./node_modules/sha.js/sha224.js ***!
- \***************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- /**
- * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
- * in FIPS 180-2
- * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
- * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
- *
- */
- var inherits = __webpack_require__(/*! inherits */ 121)
- var Sha256 = __webpack_require__(/*! ./sha256 */ 146)
- var Hash = __webpack_require__(/*! ./hash */ 143)
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- var W = new Array(64)
- function Sha224 () {
- this.init()
- this._w = W // new Array(64)
- Hash.call(this, 64, 56)
- }
- inherits(Sha224, Sha256)
- Sha224.prototype.init = function () {
- this._a = 0xc1059ed8
- this._b = 0x367cd507
- this._c = 0x3070dd17
- this._d = 0xf70e5939
- this._e = 0xffc00b31
- this._f = 0x68581511
- this._g = 0x64f98fa7
- this._h = 0xbefa4fa4
- return this
- }
- Sha224.prototype._hash = function () {
- var H = Buffer.allocUnsafe(28)
- H.writeInt32BE(this._a, 0)
- H.writeInt32BE(this._b, 4)
- H.writeInt32BE(this._c, 8)
- H.writeInt32BE(this._d, 12)
- H.writeInt32BE(this._e, 16)
- H.writeInt32BE(this._f, 20)
- H.writeInt32BE(this._g, 24)
- return H
- }
- module.exports = Sha224
- /***/ }),
- /* 146 */
- /*!***************************************!*\
- !*** ./node_modules/sha.js/sha256.js ***!
- \***************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- /**
- * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
- * in FIPS 180-2
- * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
- * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
- *
- */
- var inherits = __webpack_require__(/*! inherits */ 121)
- var Hash = __webpack_require__(/*! ./hash */ 143)
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- var K = [
- 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5,
- 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5,
- 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3,
- 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174,
- 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC,
- 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA,
- 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7,
- 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967,
- 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13,
- 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85,
- 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3,
- 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070,
- 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5,
- 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3,
- 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208,
- 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2
- ]
- var W = new Array(64)
- function Sha256 () {
- this.init()
- this._w = W // new Array(64)
- Hash.call(this, 64, 56)
- }
- inherits(Sha256, Hash)
- Sha256.prototype.init = function () {
- this._a = 0x6a09e667
- this._b = 0xbb67ae85
- this._c = 0x3c6ef372
- this._d = 0xa54ff53a
- this._e = 0x510e527f
- this._f = 0x9b05688c
- this._g = 0x1f83d9ab
- this._h = 0x5be0cd19
- return this
- }
- function ch (x, y, z) {
- return z ^ (x & (y ^ z))
- }
- function maj (x, y, z) {
- return (x & y) | (z & (x | y))
- }
- function sigma0 (x) {
- return (x >>> 2 | x << 30) ^ (x >>> 13 | x << 19) ^ (x >>> 22 | x << 10)
- }
- function sigma1 (x) {
- return (x >>> 6 | x << 26) ^ (x >>> 11 | x << 21) ^ (x >>> 25 | x << 7)
- }
- function gamma0 (x) {
- return (x >>> 7 | x << 25) ^ (x >>> 18 | x << 14) ^ (x >>> 3)
- }
- function gamma1 (x) {
- return (x >>> 17 | x << 15) ^ (x >>> 19 | x << 13) ^ (x >>> 10)
- }
- Sha256.prototype._update = function (M) {
- var W = this._w
- var a = this._a | 0
- var b = this._b | 0
- var c = this._c | 0
- var d = this._d | 0
- var e = this._e | 0
- var f = this._f | 0
- var g = this._g | 0
- var h = this._h | 0
- for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
- for (; i < 64; ++i) W[i] = (gamma1(W[i - 2]) + W[i - 7] + gamma0(W[i - 15]) + W[i - 16]) | 0
- for (var j = 0; j < 64; ++j) {
- var T1 = (h + sigma1(e) + ch(e, f, g) + K[j] + W[j]) | 0
- var T2 = (sigma0(a) + maj(a, b, c)) | 0
- h = g
- g = f
- f = e
- e = (d + T1) | 0
- d = c
- c = b
- b = a
- a = (T1 + T2) | 0
- }
- this._a = (a + this._a) | 0
- this._b = (b + this._b) | 0
- this._c = (c + this._c) | 0
- this._d = (d + this._d) | 0
- this._e = (e + this._e) | 0
- this._f = (f + this._f) | 0
- this._g = (g + this._g) | 0
- this._h = (h + this._h) | 0
- }
- Sha256.prototype._hash = function () {
- var H = Buffer.allocUnsafe(32)
- H.writeInt32BE(this._a, 0)
- H.writeInt32BE(this._b, 4)
- H.writeInt32BE(this._c, 8)
- H.writeInt32BE(this._d, 12)
- H.writeInt32BE(this._e, 16)
- H.writeInt32BE(this._f, 20)
- H.writeInt32BE(this._g, 24)
- H.writeInt32BE(this._h, 28)
- return H
- }
- module.exports = Sha256
- /***/ }),
- /* 147 */
- /*!***************************************!*\
- !*** ./node_modules/sha.js/sha384.js ***!
- \***************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var inherits = __webpack_require__(/*! inherits */ 121)
- var SHA512 = __webpack_require__(/*! ./sha512 */ 148)
- var Hash = __webpack_require__(/*! ./hash */ 143)
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- var W = new Array(160)
- function Sha384 () {
- this.init()
- this._w = W
- Hash.call(this, 128, 112)
- }
- inherits(Sha384, SHA512)
- Sha384.prototype.init = function () {
- this._ah = 0xcbbb9d5d
- this._bh = 0x629a292a
- this._ch = 0x9159015a
- this._dh = 0x152fecd8
- this._eh = 0x67332667
- this._fh = 0x8eb44a87
- this._gh = 0xdb0c2e0d
- this._hh = 0x47b5481d
- this._al = 0xc1059ed8
- this._bl = 0x367cd507
- this._cl = 0x3070dd17
- this._dl = 0xf70e5939
- this._el = 0xffc00b31
- this._fl = 0x68581511
- this._gl = 0x64f98fa7
- this._hl = 0xbefa4fa4
- return this
- }
- Sha384.prototype._hash = function () {
- var H = Buffer.allocUnsafe(48)
- function writeInt64BE (h, l, offset) {
- H.writeInt32BE(h, offset)
- H.writeInt32BE(l, offset + 4)
- }
- writeInt64BE(this._ah, this._al, 0)
- writeInt64BE(this._bh, this._bl, 8)
- writeInt64BE(this._ch, this._cl, 16)
- writeInt64BE(this._dh, this._dl, 24)
- writeInt64BE(this._eh, this._el, 32)
- writeInt64BE(this._fh, this._fl, 40)
- return H
- }
- module.exports = Sha384
- /***/ }),
- /* 148 */
- /*!***************************************!*\
- !*** ./node_modules/sha.js/sha512.js ***!
- \***************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var inherits = __webpack_require__(/*! inherits */ 121)
- var Hash = __webpack_require__(/*! ./hash */ 143)
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- var K = [
- 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
- 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
- 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
- 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
- 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
- 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
- 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
- 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
- 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
- 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
- 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
- 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
- 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
- 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
- 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
- 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
- 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
- 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
- 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
- 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
- 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
- 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
- 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
- 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
- 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
- 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
- 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
- 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
- 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
- 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
- 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
- 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
- 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
- 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
- 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
- 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
- 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
- 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
- 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
- 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
- ]
- var W = new Array(160)
- function Sha512 () {
- this.init()
- this._w = W
- Hash.call(this, 128, 112)
- }
- inherits(Sha512, Hash)
- Sha512.prototype.init = function () {
- this._ah = 0x6a09e667
- this._bh = 0xbb67ae85
- this._ch = 0x3c6ef372
- this._dh = 0xa54ff53a
- this._eh = 0x510e527f
- this._fh = 0x9b05688c
- this._gh = 0x1f83d9ab
- this._hh = 0x5be0cd19
- this._al = 0xf3bcc908
- this._bl = 0x84caa73b
- this._cl = 0xfe94f82b
- this._dl = 0x5f1d36f1
- this._el = 0xade682d1
- this._fl = 0x2b3e6c1f
- this._gl = 0xfb41bd6b
- this._hl = 0x137e2179
- return this
- }
- function Ch (x, y, z) {
- return z ^ (x & (y ^ z))
- }
- function maj (x, y, z) {
- return (x & y) | (z & (x | y))
- }
- function sigma0 (x, xl) {
- return (x >>> 28 | xl << 4) ^ (xl >>> 2 | x << 30) ^ (xl >>> 7 | x << 25)
- }
- function sigma1 (x, xl) {
- return (x >>> 14 | xl << 18) ^ (x >>> 18 | xl << 14) ^ (xl >>> 9 | x << 23)
- }
- function Gamma0 (x, xl) {
- return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7)
- }
- function Gamma0l (x, xl) {
- return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7 | xl << 25)
- }
- function Gamma1 (x, xl) {
- return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6)
- }
- function Gamma1l (x, xl) {
- return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6 | xl << 26)
- }
- function getCarry (a, b) {
- return (a >>> 0) < (b >>> 0) ? 1 : 0
- }
- Sha512.prototype._update = function (M) {
- var W = this._w
- var ah = this._ah | 0
- var bh = this._bh | 0
- var ch = this._ch | 0
- var dh = this._dh | 0
- var eh = this._eh | 0
- var fh = this._fh | 0
- var gh = this._gh | 0
- var hh = this._hh | 0
- var al = this._al | 0
- var bl = this._bl | 0
- var cl = this._cl | 0
- var dl = this._dl | 0
- var el = this._el | 0
- var fl = this._fl | 0
- var gl = this._gl | 0
- var hl = this._hl | 0
- for (var i = 0; i < 32; i += 2) {
- W[i] = M.readInt32BE(i * 4)
- W[i + 1] = M.readInt32BE(i * 4 + 4)
- }
- for (; i < 160; i += 2) {
- var xh = W[i - 15 * 2]
- var xl = W[i - 15 * 2 + 1]
- var gamma0 = Gamma0(xh, xl)
- var gamma0l = Gamma0l(xl, xh)
- xh = W[i - 2 * 2]
- xl = W[i - 2 * 2 + 1]
- var gamma1 = Gamma1(xh, xl)
- var gamma1l = Gamma1l(xl, xh)
- // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]
- var Wi7h = W[i - 7 * 2]
- var Wi7l = W[i - 7 * 2 + 1]
- var Wi16h = W[i - 16 * 2]
- var Wi16l = W[i - 16 * 2 + 1]
- var Wil = (gamma0l + Wi7l) | 0
- var Wih = (gamma0 + Wi7h + getCarry(Wil, gamma0l)) | 0
- Wil = (Wil + gamma1l) | 0
- Wih = (Wih + gamma1 + getCarry(Wil, gamma1l)) | 0
- Wil = (Wil + Wi16l) | 0
- Wih = (Wih + Wi16h + getCarry(Wil, Wi16l)) | 0
- W[i] = Wih
- W[i + 1] = Wil
- }
- for (var j = 0; j < 160; j += 2) {
- Wih = W[j]
- Wil = W[j + 1]
- var majh = maj(ah, bh, ch)
- var majl = maj(al, bl, cl)
- var sigma0h = sigma0(ah, al)
- var sigma0l = sigma0(al, ah)
- var sigma1h = sigma1(eh, el)
- var sigma1l = sigma1(el, eh)
- // t1 = h + sigma1 + ch + K[j] + W[j]
- var Kih = K[j]
- var Kil = K[j + 1]
- var chh = Ch(eh, fh, gh)
- var chl = Ch(el, fl, gl)
- var t1l = (hl + sigma1l) | 0
- var t1h = (hh + sigma1h + getCarry(t1l, hl)) | 0
- t1l = (t1l + chl) | 0
- t1h = (t1h + chh + getCarry(t1l, chl)) | 0
- t1l = (t1l + Kil) | 0
- t1h = (t1h + Kih + getCarry(t1l, Kil)) | 0
- t1l = (t1l + Wil) | 0
- t1h = (t1h + Wih + getCarry(t1l, Wil)) | 0
- // t2 = sigma0 + maj
- var t2l = (sigma0l + majl) | 0
- var t2h = (sigma0h + majh + getCarry(t2l, sigma0l)) | 0
- hh = gh
- hl = gl
- gh = fh
- gl = fl
- fh = eh
- fl = el
- el = (dl + t1l) | 0
- eh = (dh + t1h + getCarry(el, dl)) | 0
- dh = ch
- dl = cl
- ch = bh
- cl = bl
- bh = ah
- bl = al
- al = (t1l + t2l) | 0
- ah = (t1h + t2h + getCarry(al, t1l)) | 0
- }
- this._al = (this._al + al) | 0
- this._bl = (this._bl + bl) | 0
- this._cl = (this._cl + cl) | 0
- this._dl = (this._dl + dl) | 0
- this._el = (this._el + el) | 0
- this._fl = (this._fl + fl) | 0
- this._gl = (this._gl + gl) | 0
- this._hl = (this._hl + hl) | 0
- this._ah = (this._ah + ah + getCarry(this._al, al)) | 0
- this._bh = (this._bh + bh + getCarry(this._bl, bl)) | 0
- this._ch = (this._ch + ch + getCarry(this._cl, cl)) | 0
- this._dh = (this._dh + dh + getCarry(this._dl, dl)) | 0
- this._eh = (this._eh + eh + getCarry(this._el, el)) | 0
- this._fh = (this._fh + fh + getCarry(this._fl, fl)) | 0
- this._gh = (this._gh + gh + getCarry(this._gl, gl)) | 0
- this._hh = (this._hh + hh + getCarry(this._hl, hl)) | 0
- }
- Sha512.prototype._hash = function () {
- var H = Buffer.allocUnsafe(64)
- function writeInt64BE (h, l, offset) {
- H.writeInt32BE(h, offset)
- H.writeInt32BE(l, offset + 4)
- }
- writeInt64BE(this._ah, this._al, 0)
- writeInt64BE(this._bh, this._bl, 8)
- writeInt64BE(this._ch, this._cl, 16)
- writeInt64BE(this._dh, this._dl, 24)
- writeInt64BE(this._eh, this._el, 32)
- writeInt64BE(this._fh, this._fl, 40)
- writeInt64BE(this._gh, this._gl, 48)
- writeInt64BE(this._hh, this._hl, 56)
- return H
- }
- module.exports = Sha512
- /***/ }),
- /* 149 */
- /*!*******************************************!*\
- !*** ./node_modules/cipher-base/index.js ***!
- \*******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- var Transform = __webpack_require__(/*! stream */ 150).Transform
- var StringDecoder = __webpack_require__(/*! string_decoder */ 137).StringDecoder
- var inherits = __webpack_require__(/*! inherits */ 121)
- function CipherBase (hashMode) {
- Transform.call(this)
- this.hashMode = typeof hashMode === 'string'
- if (this.hashMode) {
- this[hashMode] = this._finalOrDigest
- } else {
- this.final = this._finalOrDigest
- }
- if (this._final) {
- this.__final = this._final
- this._final = null
- }
- this._decoder = null
- this._encoding = null
- }
- inherits(CipherBase, Transform)
- CipherBase.prototype.update = function (data, inputEnc, outputEnc) {
- if (typeof data === 'string') {
- data = Buffer.from(data, inputEnc)
- }
- var outData = this._update(data)
- if (this.hashMode) return this
- if (outputEnc) {
- outData = this._toString(outData, outputEnc)
- }
- return outData
- }
- CipherBase.prototype.setAutoPadding = function () {}
- CipherBase.prototype.getAuthTag = function () {
- throw new Error('trying to get auth tag in unsupported state')
- }
- CipherBase.prototype.setAuthTag = function () {
- throw new Error('trying to set auth tag in unsupported state')
- }
- CipherBase.prototype.setAAD = function () {
- throw new Error('trying to set aad in unsupported state')
- }
- CipherBase.prototype._transform = function (data, _, next) {
- var err
- try {
- if (this.hashMode) {
- this._update(data)
- } else {
- this.push(this._update(data))
- }
- } catch (e) {
- err = e
- } finally {
- next(err)
- }
- }
- CipherBase.prototype._flush = function (done) {
- var err
- try {
- this.push(this.__final())
- } catch (e) {
- err = e
- }
- done(err)
- }
- CipherBase.prototype._finalOrDigest = function (outputEnc) {
- var outData = this.__final() || Buffer.alloc(0)
- if (outputEnc) {
- outData = this._toString(outData, outputEnc, true)
- }
- return outData
- }
- CipherBase.prototype._toString = function (value, enc, fin) {
- if (!this._decoder) {
- this._decoder = new StringDecoder(enc)
- this._encoding = enc
- }
- if (this._encoding !== enc) throw new Error('can\'t switch encodings')
- var out = this._decoder.write(value)
- if (fin) {
- out += this._decoder.end()
- }
- return out
- }
- module.exports = CipherBase
- /***/ }),
- /* 150 */
- /*!*************************************************!*\
- !*** ./node_modules/stream-browserify/index.js ***!
- \*************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- // Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
- module.exports = Stream;
- var EE = __webpack_require__(/*! events */ 127).EventEmitter;
- var inherits = __webpack_require__(/*! inherits */ 121);
- inherits(Stream, EE);
- Stream.Readable = __webpack_require__(/*! readable-stream/readable.js */ 124);
- Stream.Writable = __webpack_require__(/*! readable-stream/writable.js */ 151);
- Stream.Duplex = __webpack_require__(/*! readable-stream/duplex.js */ 152);
- Stream.Transform = __webpack_require__(/*! readable-stream/transform.js */ 153);
- Stream.PassThrough = __webpack_require__(/*! readable-stream/passthrough.js */ 154);
- // Backwards-compat with node 0.4.x
- Stream.Stream = Stream;
- // old-style streams. Note that the pipe method (the only relevant
- // part of this class) is overridden in the Readable class.
- function Stream() {
- EE.call(this);
- }
- Stream.prototype.pipe = function(dest, options) {
- var source = this;
- function ondata(chunk) {
- if (dest.writable) {
- if (false === dest.write(chunk) && source.pause) {
- source.pause();
- }
- }
- }
- source.on('data', ondata);
- function ondrain() {
- if (source.readable && source.resume) {
- source.resume();
- }
- }
- dest.on('drain', ondrain);
- // If the 'end' option is not supplied, dest.end() will be called when
- // source gets the 'end' or 'close' events. Only dest.end() once.
- if (!dest._isStdio && (!options || options.end !== false)) {
- source.on('end', onend);
- source.on('close', onclose);
- }
- var didOnEnd = false;
- function onend() {
- if (didOnEnd) return;
- didOnEnd = true;
- dest.end();
- }
- function onclose() {
- if (didOnEnd) return;
- didOnEnd = true;
- if (typeof dest.destroy === 'function') dest.destroy();
- }
- // don't leave dangling pipes when there are errors.
- function onerror(er) {
- cleanup();
- if (EE.listenerCount(this, 'error') === 0) {
- throw er; // Unhandled stream error in pipe.
- }
- }
- source.on('error', onerror);
- dest.on('error', onerror);
- // remove all the event listeners that were added.
- function cleanup() {
- source.removeListener('data', ondata);
- dest.removeListener('drain', ondrain);
- source.removeListener('end', onend);
- source.removeListener('close', onclose);
- source.removeListener('error', onerror);
- dest.removeListener('error', onerror);
- source.removeListener('end', cleanup);
- source.removeListener('close', cleanup);
- dest.removeListener('close', cleanup);
- }
- source.on('end', cleanup);
- source.on('close', cleanup);
- dest.on('close', cleanup);
- dest.emit('pipe', source);
- // Allow for unix-like usage: A.pipe(B).pipe(C)
- return dest;
- };
- /***/ }),
- /* 151 */
- /*!**********************************************************!*\
- !*** ./node_modules/readable-stream/writable-browser.js ***!
- \**********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(/*! ./lib/_stream_writable.js */ 135);
- /***/ }),
- /* 152 */
- /*!********************************************************!*\
- !*** ./node_modules/readable-stream/duplex-browser.js ***!
- \********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(/*! ./lib/_stream_duplex.js */ 134);
- /***/ }),
- /* 153 */
- /*!***************************************************!*\
- !*** ./node_modules/readable-stream/transform.js ***!
- \***************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(/*! ./readable */ 124).Transform
- /***/ }),
- /* 154 */
- /*!*****************************************************!*\
- !*** ./node_modules/readable-stream/passthrough.js ***!
- \*****************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(/*! ./readable */ 124).PassThrough
- /***/ }),
- /* 155 */
- /*!*********************************************!*\
- !*** ./node_modules/create-hmac/browser.js ***!
- \*********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var inherits = __webpack_require__(/*! inherits */ 121)
- var Legacy = __webpack_require__(/*! ./legacy */ 156)
- var Base = __webpack_require__(/*! cipher-base */ 149)
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- var md5 = __webpack_require__(/*! create-hash/md5 */ 157)
- var RIPEMD160 = __webpack_require__(/*! ripemd160 */ 140)
- var sha = __webpack_require__(/*! sha.js */ 141)
- var ZEROS = Buffer.alloc(128)
- function Hmac (alg, key) {
- Base.call(this, 'digest')
- if (typeof key === 'string') {
- key = Buffer.from(key)
- }
- var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64
- this._alg = alg
- this._key = key
- if (key.length > blocksize) {
- var hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg)
- key = hash.update(key).digest()
- } else if (key.length < blocksize) {
- key = Buffer.concat([key, ZEROS], blocksize)
- }
- var ipad = this._ipad = Buffer.allocUnsafe(blocksize)
- var opad = this._opad = Buffer.allocUnsafe(blocksize)
- for (var i = 0; i < blocksize; i++) {
- ipad[i] = key[i] ^ 0x36
- opad[i] = key[i] ^ 0x5C
- }
- this._hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg)
- this._hash.update(ipad)
- }
- inherits(Hmac, Base)
- Hmac.prototype._update = function (data) {
- this._hash.update(data)
- }
- Hmac.prototype._final = function () {
- var h = this._hash.digest()
- var hash = this._alg === 'rmd160' ? new RIPEMD160() : sha(this._alg)
- return hash.update(this._opad).update(h).digest()
- }
- module.exports = function createHmac (alg, key) {
- alg = alg.toLowerCase()
- if (alg === 'rmd160' || alg === 'ripemd160') {
- return new Hmac('rmd160', key)
- }
- if (alg === 'md5') {
- return new Legacy(md5, key)
- }
- return new Hmac(alg, key)
- }
- /***/ }),
- /* 156 */
- /*!********************************************!*\
- !*** ./node_modules/create-hmac/legacy.js ***!
- \********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var inherits = __webpack_require__(/*! inherits */ 121)
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- var Base = __webpack_require__(/*! cipher-base */ 149)
- var ZEROS = Buffer.alloc(128)
- var blocksize = 64
- function Hmac (alg, key) {
- Base.call(this, 'digest')
- if (typeof key === 'string') {
- key = Buffer.from(key)
- }
- this._alg = alg
- this._key = key
- if (key.length > blocksize) {
- key = alg(key)
- } else if (key.length < blocksize) {
- key = Buffer.concat([key, ZEROS], blocksize)
- }
- var ipad = this._ipad = Buffer.allocUnsafe(blocksize)
- var opad = this._opad = Buffer.allocUnsafe(blocksize)
- for (var i = 0; i < blocksize; i++) {
- ipad[i] = key[i] ^ 0x36
- opad[i] = key[i] ^ 0x5C
- }
- this._hash = [ipad]
- }
- inherits(Hmac, Base)
- Hmac.prototype._update = function (data) {
- this._hash.push(data)
- }
- Hmac.prototype._final = function () {
- var h = this._alg(Buffer.concat(this._hash))
- return this._alg(Buffer.concat([this._opad, h]))
- }
- module.exports = Hmac
- /***/ }),
- /* 157 */
- /*!*****************************************!*\
- !*** ./node_modules/create-hash/md5.js ***!
- \*****************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var MD5 = __webpack_require__(/*! md5.js */ 122)
- module.exports = function (buffer) {
- return new MD5().update(buffer).digest()
- }
- /***/ }),
- /* 158 */
- /*!***********************************************!*\
- !*** ./node_modules/browserify-sign/algos.js ***!
- \***********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(/*! ./browser/algorithms.json */ 159)
- /***/ }),
- /* 159 */
- /*!**************************************************************!*\
- !*** ./node_modules/browserify-sign/browser/algorithms.json ***!
- \**************************************************************/
- /*! exports provided: sha224WithRSAEncryption, RSA-SHA224, sha256WithRSAEncryption, RSA-SHA256, sha384WithRSAEncryption, RSA-SHA384, sha512WithRSAEncryption, RSA-SHA512, RSA-SHA1, ecdsa-with-SHA1, sha256, sha224, sha384, sha512, DSA-SHA, DSA-SHA1, DSA, DSA-WITH-SHA224, DSA-SHA224, DSA-WITH-SHA256, DSA-SHA256, DSA-WITH-SHA384, DSA-SHA384, DSA-WITH-SHA512, DSA-SHA512, DSA-RIPEMD160, ripemd160WithRSA, RSA-RIPEMD160, md5WithRSAEncryption, RSA-MD5, default */
- /***/ (function(module) {
- module.exports = JSON.parse("{\"sha224WithRSAEncryption\":{\"sign\":\"rsa\",\"hash\":\"sha224\",\"id\":\"302d300d06096086480165030402040500041c\"},\"RSA-SHA224\":{\"sign\":\"ecdsa/rsa\",\"hash\":\"sha224\",\"id\":\"302d300d06096086480165030402040500041c\"},\"sha256WithRSAEncryption\":{\"sign\":\"rsa\",\"hash\":\"sha256\",\"id\":\"3031300d060960864801650304020105000420\"},\"RSA-SHA256\":{\"sign\":\"ecdsa/rsa\",\"hash\":\"sha256\",\"id\":\"3031300d060960864801650304020105000420\"},\"sha384WithRSAEncryption\":{\"sign\":\"rsa\",\"hash\":\"sha384\",\"id\":\"3041300d060960864801650304020205000430\"},\"RSA-SHA384\":{\"sign\":\"ecdsa/rsa\",\"hash\":\"sha384\",\"id\":\"3041300d060960864801650304020205000430\"},\"sha512WithRSAEncryption\":{\"sign\":\"rsa\",\"hash\":\"sha512\",\"id\":\"3051300d060960864801650304020305000440\"},\"RSA-SHA512\":{\"sign\":\"ecdsa/rsa\",\"hash\":\"sha512\",\"id\":\"3051300d060960864801650304020305000440\"},\"RSA-SHA1\":{\"sign\":\"rsa\",\"hash\":\"sha1\",\"id\":\"3021300906052b0e03021a05000414\"},\"ecdsa-with-SHA1\":{\"sign\":\"ecdsa\",\"hash\":\"sha1\",\"id\":\"\"},\"sha256\":{\"sign\":\"ecdsa\",\"hash\":\"sha256\",\"id\":\"\"},\"sha224\":{\"sign\":\"ecdsa\",\"hash\":\"sha224\",\"id\":\"\"},\"sha384\":{\"sign\":\"ecdsa\",\"hash\":\"sha384\",\"id\":\"\"},\"sha512\":{\"sign\":\"ecdsa\",\"hash\":\"sha512\",\"id\":\"\"},\"DSA-SHA\":{\"sign\":\"dsa\",\"hash\":\"sha1\",\"id\":\"\"},\"DSA-SHA1\":{\"sign\":\"dsa\",\"hash\":\"sha1\",\"id\":\"\"},\"DSA\":{\"sign\":\"dsa\",\"hash\":\"sha1\",\"id\":\"\"},\"DSA-WITH-SHA224\":{\"sign\":\"dsa\",\"hash\":\"sha224\",\"id\":\"\"},\"DSA-SHA224\":{\"sign\":\"dsa\",\"hash\":\"sha224\",\"id\":\"\"},\"DSA-WITH-SHA256\":{\"sign\":\"dsa\",\"hash\":\"sha256\",\"id\":\"\"},\"DSA-SHA256\":{\"sign\":\"dsa\",\"hash\":\"sha256\",\"id\":\"\"},\"DSA-WITH-SHA384\":{\"sign\":\"dsa\",\"hash\":\"sha384\",\"id\":\"\"},\"DSA-SHA384\":{\"sign\":\"dsa\",\"hash\":\"sha384\",\"id\":\"\"},\"DSA-WITH-SHA512\":{\"sign\":\"dsa\",\"hash\":\"sha512\",\"id\":\"\"},\"DSA-SHA512\":{\"sign\":\"dsa\",\"hash\":\"sha512\",\"id\":\"\"},\"DSA-RIPEMD160\":{\"sign\":\"dsa\",\"hash\":\"rmd160\",\"id\":\"\"},\"ripemd160WithRSA\":{\"sign\":\"rsa\",\"hash\":\"rmd160\",\"id\":\"3021300906052b2403020105000414\"},\"RSA-RIPEMD160\":{\"sign\":\"rsa\",\"hash\":\"rmd160\",\"id\":\"3021300906052b2403020105000414\"},\"md5WithRSAEncryption\":{\"sign\":\"rsa\",\"hash\":\"md5\",\"id\":\"3020300c06082a864886f70d020505000410\"},\"RSA-MD5\":{\"sign\":\"rsa\",\"hash\":\"md5\",\"id\":\"3020300c06082a864886f70d020505000410\"}}");
- /***/ }),
- /* 160 */
- /*!****************************************!*\
- !*** ./node_modules/pbkdf2/browser.js ***!
- \****************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- exports.pbkdf2 = __webpack_require__(/*! ./lib/async */ 161)
- exports.pbkdf2Sync = __webpack_require__(/*! ./lib/sync */ 164)
- /***/ }),
- /* 161 */
- /*!******************************************!*\
- !*** ./node_modules/pbkdf2/lib/async.js ***!
- \******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- /* WEBPACK VAR INJECTION */(function(global) {var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- var checkParameters = __webpack_require__(/*! ./precondition */ 162)
- var defaultEncoding = __webpack_require__(/*! ./default-encoding */ 163)
- var sync = __webpack_require__(/*! ./sync */ 164)
- var toBuffer = __webpack_require__(/*! ./to-buffer */ 165)
- var ZERO_BUF
- var subtle = global.crypto && global.crypto.subtle
- var toBrowser = {
- sha: 'SHA-1',
- 'sha-1': 'SHA-1',
- sha1: 'SHA-1',
- sha256: 'SHA-256',
- 'sha-256': 'SHA-256',
- sha384: 'SHA-384',
- 'sha-384': 'SHA-384',
- 'sha-512': 'SHA-512',
- sha512: 'SHA-512'
- }
- var checks = []
- function checkNative (algo) {
- if (global.process && !global.process.browser) {
- return Promise.resolve(false)
- }
- if (!subtle || !subtle.importKey || !subtle.deriveBits) {
- return Promise.resolve(false)
- }
- if (checks[algo] !== undefined) {
- return checks[algo]
- }
- ZERO_BUF = ZERO_BUF || Buffer.alloc(8)
- var prom = browserPbkdf2(ZERO_BUF, ZERO_BUF, 10, 128, algo)
- .then(function () {
- return true
- }).catch(function () {
- return false
- })
- checks[algo] = prom
- return prom
- }
- var nextTick
- function getNextTick () {
- if (nextTick) {
- return nextTick
- }
- if (global.process && global.process.nextTick) {
- nextTick = global.process.nextTick
- } else if (global.queueMicrotask) {
- nextTick = global.queueMicrotask
- } else if (global.setImmediate) {
- nextTick = global.setImmediate
- } else {
- nextTick = global.setTimeout
- }
- return nextTick
- }
- function browserPbkdf2 (password, salt, iterations, length, algo) {
- return subtle.importKey(
- 'raw', password, { name: 'PBKDF2' }, false, ['deriveBits']
- ).then(function (key) {
- return subtle.deriveBits({
- name: 'PBKDF2',
- salt: salt,
- iterations: iterations,
- hash: {
- name: algo
- }
- }, key, length << 3)
- }).then(function (res) {
- return Buffer.from(res)
- })
- }
- function resolvePromise (promise, callback) {
- promise.then(function (out) {
- getNextTick()(function () {
- callback(null, out)
- })
- }, function (e) {
- getNextTick()(function () {
- callback(e)
- })
- })
- }
- module.exports = function (password, salt, iterations, keylen, digest, callback) {
- if (typeof digest === 'function') {
- callback = digest
- digest = undefined
- }
- digest = digest || 'sha1'
- var algo = toBrowser[digest.toLowerCase()]
- if (!algo || typeof global.Promise !== 'function') {
- getNextTick()(function () {
- var out
- try {
- out = sync(password, salt, iterations, keylen, digest)
- } catch (e) {
- return callback(e)
- }
- callback(null, out)
- })
- return
- }
- checkParameters(iterations, keylen)
- password = toBuffer(password, defaultEncoding, 'Password')
- salt = toBuffer(salt, defaultEncoding, 'Salt')
- if (typeof callback !== 'function') throw new Error('No callback provided to pbkdf2')
- resolvePromise(checkNative(algo).then(function (resp) {
- if (resp) return browserPbkdf2(password, salt, iterations, keylen, algo)
- return sync(password, salt, iterations, keylen, digest)
- }), callback)
- }
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ 3)))
- /***/ }),
- /* 162 */
- /*!*************************************************!*\
- !*** ./node_modules/pbkdf2/lib/precondition.js ***!
- \*************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- var MAX_ALLOC = Math.pow(2, 30) - 1 // default in iojs
- module.exports = function (iterations, keylen) {
- if (typeof iterations !== 'number') {
- throw new TypeError('Iterations not a number')
- }
- if (iterations < 0) {
- throw new TypeError('Bad iterations')
- }
- if (typeof keylen !== 'number') {
- throw new TypeError('Key length not a number')
- }
- if (keylen < 0 || keylen > MAX_ALLOC || keylen !== keylen) { /* eslint no-self-compare: 0 */
- throw new TypeError('Bad key length')
- }
- }
- /***/ }),
- /* 163 */
- /*!*****************************************************!*\
- !*** ./node_modules/pbkdf2/lib/default-encoding.js ***!
- \*****************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- /* WEBPACK VAR INJECTION */(function(global, process) {var defaultEncoding
- /* istanbul ignore next */
- if (global.process && global.process.browser) {
- defaultEncoding = 'utf-8'
- } else if (global.process && global.process.version) {
- var pVersionMajor = parseInt(process.version.split('.')[0].slice(1), 10)
- defaultEncoding = pVersionMajor >= 6 ? 'utf-8' : 'binary'
- } else {
- defaultEncoding = 'utf-8'
- }
- module.exports = defaultEncoding
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ 3), __webpack_require__(/*! ./../../node-libs-browser/mock/process.js */ 113)))
- /***/ }),
- /* 164 */
- /*!*************************************************!*\
- !*** ./node_modules/pbkdf2/lib/sync-browser.js ***!
- \*************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var md5 = __webpack_require__(/*! create-hash/md5 */ 157)
- var RIPEMD160 = __webpack_require__(/*! ripemd160 */ 140)
- var sha = __webpack_require__(/*! sha.js */ 141)
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- var checkParameters = __webpack_require__(/*! ./precondition */ 162)
- var defaultEncoding = __webpack_require__(/*! ./default-encoding */ 163)
- var toBuffer = __webpack_require__(/*! ./to-buffer */ 165)
- var ZEROS = Buffer.alloc(128)
- var sizes = {
- md5: 16,
- sha1: 20,
- sha224: 28,
- sha256: 32,
- sha384: 48,
- sha512: 64,
- rmd160: 20,
- ripemd160: 20
- }
- function Hmac (alg, key, saltLen) {
- var hash = getDigest(alg)
- var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64
- if (key.length > blocksize) {
- key = hash(key)
- } else if (key.length < blocksize) {
- key = Buffer.concat([key, ZEROS], blocksize)
- }
- var ipad = Buffer.allocUnsafe(blocksize + sizes[alg])
- var opad = Buffer.allocUnsafe(blocksize + sizes[alg])
- for (var i = 0; i < blocksize; i++) {
- ipad[i] = key[i] ^ 0x36
- opad[i] = key[i] ^ 0x5C
- }
- var ipad1 = Buffer.allocUnsafe(blocksize + saltLen + 4)
- ipad.copy(ipad1, 0, 0, blocksize)
- this.ipad1 = ipad1
- this.ipad2 = ipad
- this.opad = opad
- this.alg = alg
- this.blocksize = blocksize
- this.hash = hash
- this.size = sizes[alg]
- }
- Hmac.prototype.run = function (data, ipad) {
- data.copy(ipad, this.blocksize)
- var h = this.hash(ipad)
- h.copy(this.opad, this.blocksize)
- return this.hash(this.opad)
- }
- function getDigest (alg) {
- function shaFunc (data) {
- return sha(alg).update(data).digest()
- }
- function rmd160Func (data) {
- return new RIPEMD160().update(data).digest()
- }
- if (alg === 'rmd160' || alg === 'ripemd160') return rmd160Func
- if (alg === 'md5') return md5
- return shaFunc
- }
- function pbkdf2 (password, salt, iterations, keylen, digest) {
- checkParameters(iterations, keylen)
- password = toBuffer(password, defaultEncoding, 'Password')
- salt = toBuffer(salt, defaultEncoding, 'Salt')
- digest = digest || 'sha1'
- var hmac = new Hmac(digest, password, salt.length)
- var DK = Buffer.allocUnsafe(keylen)
- var block1 = Buffer.allocUnsafe(salt.length + 4)
- salt.copy(block1, 0, 0, salt.length)
- var destPos = 0
- var hLen = sizes[digest]
- var l = Math.ceil(keylen / hLen)
- for (var i = 1; i <= l; i++) {
- block1.writeUInt32BE(i, salt.length)
- var T = hmac.run(block1, hmac.ipad1)
- var U = T
- for (var j = 1; j < iterations; j++) {
- U = hmac.run(U, hmac.ipad2)
- for (var k = 0; k < hLen; k++) T[k] ^= U[k]
- }
- T.copy(DK, destPos)
- destPos += hLen
- }
- return DK
- }
- module.exports = pbkdf2
- /***/ }),
- /* 165 */
- /*!**********************************************!*\
- !*** ./node_modules/pbkdf2/lib/to-buffer.js ***!
- \**********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- module.exports = function (thing, encoding, name) {
- if (Buffer.isBuffer(thing)) {
- return thing
- } else if (typeof thing === 'string') {
- return Buffer.from(thing, encoding)
- } else if (ArrayBuffer.isView(thing)) {
- return Buffer.from(thing.buffer)
- } else {
- throw new TypeError(name + ' must be a string, a Buffer, a typed array or a DataView')
- }
- }
- /***/ }),
- /* 166 */
- /*!***************************************************!*\
- !*** ./node_modules/browserify-cipher/browser.js ***!
- \***************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var DES = __webpack_require__(/*! browserify-des */ 167)
- var aes = __webpack_require__(/*! browserify-aes/browser */ 175)
- var aesModes = __webpack_require__(/*! browserify-aes/modes */ 177)
- var desModes = __webpack_require__(/*! browserify-des/modes */ 194)
- var ebtk = __webpack_require__(/*! evp_bytestokey */ 192)
- function createCipher (suite, password) {
- suite = suite.toLowerCase()
- var keyLen, ivLen
- if (aesModes[suite]) {
- keyLen = aesModes[suite].key
- ivLen = aesModes[suite].iv
- } else if (desModes[suite]) {
- keyLen = desModes[suite].key * 8
- ivLen = desModes[suite].iv
- } else {
- throw new TypeError('invalid suite type')
- }
- var keys = ebtk(password, false, keyLen, ivLen)
- return createCipheriv(suite, keys.key, keys.iv)
- }
- function createDecipher (suite, password) {
- suite = suite.toLowerCase()
- var keyLen, ivLen
- if (aesModes[suite]) {
- keyLen = aesModes[suite].key
- ivLen = aesModes[suite].iv
- } else if (desModes[suite]) {
- keyLen = desModes[suite].key * 8
- ivLen = desModes[suite].iv
- } else {
- throw new TypeError('invalid suite type')
- }
- var keys = ebtk(password, false, keyLen, ivLen)
- return createDecipheriv(suite, keys.key, keys.iv)
- }
- function createCipheriv (suite, key, iv) {
- suite = suite.toLowerCase()
- if (aesModes[suite]) return aes.createCipheriv(suite, key, iv)
- if (desModes[suite]) return new DES({ key: key, iv: iv, mode: suite })
- throw new TypeError('invalid suite type')
- }
- function createDecipheriv (suite, key, iv) {
- suite = suite.toLowerCase()
- if (aesModes[suite]) return aes.createDecipheriv(suite, key, iv)
- if (desModes[suite]) return new DES({ key: key, iv: iv, mode: suite, decrypt: true })
- throw new TypeError('invalid suite type')
- }
- function getCiphers () {
- return Object.keys(desModes).concat(aes.getCiphers())
- }
- exports.createCipher = exports.Cipher = createCipher
- exports.createCipheriv = exports.Cipheriv = createCipheriv
- exports.createDecipher = exports.Decipher = createDecipher
- exports.createDecipheriv = exports.Decipheriv = createDecipheriv
- exports.listCiphers = exports.getCiphers = getCiphers
- /***/ }),
- /* 167 */
- /*!**********************************************!*\
- !*** ./node_modules/browserify-des/index.js ***!
- \**********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var CipherBase = __webpack_require__(/*! cipher-base */ 149)
- var des = __webpack_require__(/*! des.js */ 168)
- var inherits = __webpack_require__(/*! inherits */ 121)
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- var modes = {
- 'des-ede3-cbc': des.CBC.instantiate(des.EDE),
- 'des-ede3': des.EDE,
- 'des-ede-cbc': des.CBC.instantiate(des.EDE),
- 'des-ede': des.EDE,
- 'des-cbc': des.CBC.instantiate(des.DES),
- 'des-ecb': des.DES
- }
- modes.des = modes['des-cbc']
- modes.des3 = modes['des-ede3-cbc']
- module.exports = DES
- inherits(DES, CipherBase)
- function DES (opts) {
- CipherBase.call(this)
- var modeName = opts.mode.toLowerCase()
- var mode = modes[modeName]
- var type
- if (opts.decrypt) {
- type = 'decrypt'
- } else {
- type = 'encrypt'
- }
- var key = opts.key
- if (!Buffer.isBuffer(key)) {
- key = Buffer.from(key)
- }
- if (modeName === 'des-ede' || modeName === 'des-ede-cbc') {
- key = Buffer.concat([key, key.slice(0, 8)])
- }
- var iv = opts.iv
- if (!Buffer.isBuffer(iv)) {
- iv = Buffer.from(iv)
- }
- this._des = mode.create({
- key: key,
- iv: iv,
- type: type
- })
- }
- DES.prototype._update = function (data) {
- return Buffer.from(this._des.update(data))
- }
- DES.prototype._final = function () {
- return Buffer.from(this._des.final())
- }
- /***/ }),
- /* 168 */
- /*!****************************************!*\
- !*** ./node_modules/des.js/lib/des.js ***!
- \****************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- exports.utils = __webpack_require__(/*! ./des/utils */ 169);
- exports.Cipher = __webpack_require__(/*! ./des/cipher */ 170);
- exports.DES = __webpack_require__(/*! ./des/des */ 172);
- exports.CBC = __webpack_require__(/*! ./des/cbc */ 173);
- exports.EDE = __webpack_require__(/*! ./des/ede */ 174);
- /***/ }),
- /* 169 */
- /*!**********************************************!*\
- !*** ./node_modules/des.js/lib/des/utils.js ***!
- \**********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- exports.readUInt32BE = function readUInt32BE(bytes, off) {
- var res = (bytes[0 + off] << 24) |
- (bytes[1 + off] << 16) |
- (bytes[2 + off] << 8) |
- bytes[3 + off];
- return res >>> 0;
- };
- exports.writeUInt32BE = function writeUInt32BE(bytes, value, off) {
- bytes[0 + off] = value >>> 24;
- bytes[1 + off] = (value >>> 16) & 0xff;
- bytes[2 + off] = (value >>> 8) & 0xff;
- bytes[3 + off] = value & 0xff;
- };
- exports.ip = function ip(inL, inR, out, off) {
- var outL = 0;
- var outR = 0;
- for (var i = 6; i >= 0; i -= 2) {
- for (var j = 0; j <= 24; j += 8) {
- outL <<= 1;
- outL |= (inR >>> (j + i)) & 1;
- }
- for (var j = 0; j <= 24; j += 8) {
- outL <<= 1;
- outL |= (inL >>> (j + i)) & 1;
- }
- }
- for (var i = 6; i >= 0; i -= 2) {
- for (var j = 1; j <= 25; j += 8) {
- outR <<= 1;
- outR |= (inR >>> (j + i)) & 1;
- }
- for (var j = 1; j <= 25; j += 8) {
- outR <<= 1;
- outR |= (inL >>> (j + i)) & 1;
- }
- }
- out[off + 0] = outL >>> 0;
- out[off + 1] = outR >>> 0;
- };
- exports.rip = function rip(inL, inR, out, off) {
- var outL = 0;
- var outR = 0;
- for (var i = 0; i < 4; i++) {
- for (var j = 24; j >= 0; j -= 8) {
- outL <<= 1;
- outL |= (inR >>> (j + i)) & 1;
- outL <<= 1;
- outL |= (inL >>> (j + i)) & 1;
- }
- }
- for (var i = 4; i < 8; i++) {
- for (var j = 24; j >= 0; j -= 8) {
- outR <<= 1;
- outR |= (inR >>> (j + i)) & 1;
- outR <<= 1;
- outR |= (inL >>> (j + i)) & 1;
- }
- }
- out[off + 0] = outL >>> 0;
- out[off + 1] = outR >>> 0;
- };
- exports.pc1 = function pc1(inL, inR, out, off) {
- var outL = 0;
- var outR = 0;
- // 7, 15, 23, 31, 39, 47, 55, 63
- // 6, 14, 22, 30, 39, 47, 55, 63
- // 5, 13, 21, 29, 39, 47, 55, 63
- // 4, 12, 20, 28
- for (var i = 7; i >= 5; i--) {
- for (var j = 0; j <= 24; j += 8) {
- outL <<= 1;
- outL |= (inR >> (j + i)) & 1;
- }
- for (var j = 0; j <= 24; j += 8) {
- outL <<= 1;
- outL |= (inL >> (j + i)) & 1;
- }
- }
- for (var j = 0; j <= 24; j += 8) {
- outL <<= 1;
- outL |= (inR >> (j + i)) & 1;
- }
- // 1, 9, 17, 25, 33, 41, 49, 57
- // 2, 10, 18, 26, 34, 42, 50, 58
- // 3, 11, 19, 27, 35, 43, 51, 59
- // 36, 44, 52, 60
- for (var i = 1; i <= 3; i++) {
- for (var j = 0; j <= 24; j += 8) {
- outR <<= 1;
- outR |= (inR >> (j + i)) & 1;
- }
- for (var j = 0; j <= 24; j += 8) {
- outR <<= 1;
- outR |= (inL >> (j + i)) & 1;
- }
- }
- for (var j = 0; j <= 24; j += 8) {
- outR <<= 1;
- outR |= (inL >> (j + i)) & 1;
- }
- out[off + 0] = outL >>> 0;
- out[off + 1] = outR >>> 0;
- };
- exports.r28shl = function r28shl(num, shift) {
- return ((num << shift) & 0xfffffff) | (num >>> (28 - shift));
- };
- var pc2table = [
- // inL => outL
- 14, 11, 17, 4, 27, 23, 25, 0,
- 13, 22, 7, 18, 5, 9, 16, 24,
- 2, 20, 12, 21, 1, 8, 15, 26,
- // inR => outR
- 15, 4, 25, 19, 9, 1, 26, 16,
- 5, 11, 23, 8, 12, 7, 17, 0,
- 22, 3, 10, 14, 6, 20, 27, 24
- ];
- exports.pc2 = function pc2(inL, inR, out, off) {
- var outL = 0;
- var outR = 0;
- var len = pc2table.length >>> 1;
- for (var i = 0; i < len; i++) {
- outL <<= 1;
- outL |= (inL >>> pc2table[i]) & 0x1;
- }
- for (var i = len; i < pc2table.length; i++) {
- outR <<= 1;
- outR |= (inR >>> pc2table[i]) & 0x1;
- }
- out[off + 0] = outL >>> 0;
- out[off + 1] = outR >>> 0;
- };
- exports.expand = function expand(r, out, off) {
- var outL = 0;
- var outR = 0;
- outL = ((r & 1) << 5) | (r >>> 27);
- for (var i = 23; i >= 15; i -= 4) {
- outL <<= 6;
- outL |= (r >>> i) & 0x3f;
- }
- for (var i = 11; i >= 3; i -= 4) {
- outR |= (r >>> i) & 0x3f;
- outR <<= 6;
- }
- outR |= ((r & 0x1f) << 1) | (r >>> 31);
- out[off + 0] = outL >>> 0;
- out[off + 1] = outR >>> 0;
- };
- var sTable = [
- 14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1,
- 3, 10, 10, 6, 6, 12, 12, 11, 5, 9, 9, 5, 0, 3, 7, 8,
- 4, 15, 1, 12, 14, 8, 8, 2, 13, 4, 6, 9, 2, 1, 11, 7,
- 15, 5, 12, 11, 9, 3, 7, 14, 3, 10, 10, 0, 5, 6, 0, 13,
- 15, 3, 1, 13, 8, 4, 14, 7, 6, 15, 11, 2, 3, 8, 4, 14,
- 9, 12, 7, 0, 2, 1, 13, 10, 12, 6, 0, 9, 5, 11, 10, 5,
- 0, 13, 14, 8, 7, 10, 11, 1, 10, 3, 4, 15, 13, 4, 1, 2,
- 5, 11, 8, 6, 12, 7, 6, 12, 9, 0, 3, 5, 2, 14, 15, 9,
- 10, 13, 0, 7, 9, 0, 14, 9, 6, 3, 3, 4, 15, 6, 5, 10,
- 1, 2, 13, 8, 12, 5, 7, 14, 11, 12, 4, 11, 2, 15, 8, 1,
- 13, 1, 6, 10, 4, 13, 9, 0, 8, 6, 15, 9, 3, 8, 0, 7,
- 11, 4, 1, 15, 2, 14, 12, 3, 5, 11, 10, 5, 14, 2, 7, 12,
- 7, 13, 13, 8, 14, 11, 3, 5, 0, 6, 6, 15, 9, 0, 10, 3,
- 1, 4, 2, 7, 8, 2, 5, 12, 11, 1, 12, 10, 4, 14, 15, 9,
- 10, 3, 6, 15, 9, 0, 0, 6, 12, 10, 11, 1, 7, 13, 13, 8,
- 15, 9, 1, 4, 3, 5, 14, 11, 5, 12, 2, 7, 8, 2, 4, 14,
- 2, 14, 12, 11, 4, 2, 1, 12, 7, 4, 10, 7, 11, 13, 6, 1,
- 8, 5, 5, 0, 3, 15, 15, 10, 13, 3, 0, 9, 14, 8, 9, 6,
- 4, 11, 2, 8, 1, 12, 11, 7, 10, 1, 13, 14, 7, 2, 8, 13,
- 15, 6, 9, 15, 12, 0, 5, 9, 6, 10, 3, 4, 0, 5, 14, 3,
- 12, 10, 1, 15, 10, 4, 15, 2, 9, 7, 2, 12, 6, 9, 8, 5,
- 0, 6, 13, 1, 3, 13, 4, 14, 14, 0, 7, 11, 5, 3, 11, 8,
- 9, 4, 14, 3, 15, 2, 5, 12, 2, 9, 8, 5, 12, 15, 3, 10,
- 7, 11, 0, 14, 4, 1, 10, 7, 1, 6, 13, 0, 11, 8, 6, 13,
- 4, 13, 11, 0, 2, 11, 14, 7, 15, 4, 0, 9, 8, 1, 13, 10,
- 3, 14, 12, 3, 9, 5, 7, 12, 5, 2, 10, 15, 6, 8, 1, 6,
- 1, 6, 4, 11, 11, 13, 13, 8, 12, 1, 3, 4, 7, 10, 14, 7,
- 10, 9, 15, 5, 6, 0, 8, 15, 0, 14, 5, 2, 9, 3, 2, 12,
- 13, 1, 2, 15, 8, 13, 4, 8, 6, 10, 15, 3, 11, 7, 1, 4,
- 10, 12, 9, 5, 3, 6, 14, 11, 5, 0, 0, 14, 12, 9, 7, 2,
- 7, 2, 11, 1, 4, 14, 1, 7, 9, 4, 12, 10, 14, 8, 2, 13,
- 0, 15, 6, 12, 10, 9, 13, 0, 15, 3, 3, 5, 5, 6, 8, 11
- ];
- exports.substitute = function substitute(inL, inR) {
- var out = 0;
- for (var i = 0; i < 4; i++) {
- var b = (inL >>> (18 - i * 6)) & 0x3f;
- var sb = sTable[i * 0x40 + b];
- out <<= 4;
- out |= sb;
- }
- for (var i = 0; i < 4; i++) {
- var b = (inR >>> (18 - i * 6)) & 0x3f;
- var sb = sTable[4 * 0x40 + i * 0x40 + b];
- out <<= 4;
- out |= sb;
- }
- return out >>> 0;
- };
- var permuteTable = [
- 16, 25, 12, 11, 3, 20, 4, 15, 31, 17, 9, 6, 27, 14, 1, 22,
- 30, 24, 8, 18, 0, 5, 29, 23, 13, 19, 2, 26, 10, 21, 28, 7
- ];
- exports.permute = function permute(num) {
- var out = 0;
- for (var i = 0; i < permuteTable.length; i++) {
- out <<= 1;
- out |= (num >>> permuteTable[i]) & 0x1;
- }
- return out >>> 0;
- };
- exports.padSplit = function padSplit(num, size, group) {
- var str = num.toString(2);
- while (str.length < size)
- str = '0' + str;
- var out = [];
- for (var i = 0; i < size; i += group)
- out.push(str.slice(i, i + group));
- return out.join(' ');
- };
- /***/ }),
- /* 170 */
- /*!***********************************************!*\
- !*** ./node_modules/des.js/lib/des/cipher.js ***!
- \***********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var assert = __webpack_require__(/*! minimalistic-assert */ 171);
- function Cipher(options) {
- this.options = options;
- this.type = this.options.type;
- this.blockSize = 8;
- this._init();
- this.buffer = new Array(this.blockSize);
- this.bufferOff = 0;
- }
- module.exports = Cipher;
- Cipher.prototype._init = function _init() {
- // Might be overrided
- };
- Cipher.prototype.update = function update(data) {
- if (data.length === 0)
- return [];
- if (this.type === 'decrypt')
- return this._updateDecrypt(data);
- else
- return this._updateEncrypt(data);
- };
- Cipher.prototype._buffer = function _buffer(data, off) {
- // Append data to buffer
- var min = Math.min(this.buffer.length - this.bufferOff, data.length - off);
- for (var i = 0; i < min; i++)
- this.buffer[this.bufferOff + i] = data[off + i];
- this.bufferOff += min;
- // Shift next
- return min;
- };
- Cipher.prototype._flushBuffer = function _flushBuffer(out, off) {
- this._update(this.buffer, 0, out, off);
- this.bufferOff = 0;
- return this.blockSize;
- };
- Cipher.prototype._updateEncrypt = function _updateEncrypt(data) {
- var inputOff = 0;
- var outputOff = 0;
- var count = ((this.bufferOff + data.length) / this.blockSize) | 0;
- var out = new Array(count * this.blockSize);
- if (this.bufferOff !== 0) {
- inputOff += this._buffer(data, inputOff);
- if (this.bufferOff === this.buffer.length)
- outputOff += this._flushBuffer(out, outputOff);
- }
- // Write blocks
- var max = data.length - ((data.length - inputOff) % this.blockSize);
- for (; inputOff < max; inputOff += this.blockSize) {
- this._update(data, inputOff, out, outputOff);
- outputOff += this.blockSize;
- }
- // Queue rest
- for (; inputOff < data.length; inputOff++, this.bufferOff++)
- this.buffer[this.bufferOff] = data[inputOff];
- return out;
- };
- Cipher.prototype._updateDecrypt = function _updateDecrypt(data) {
- var inputOff = 0;
- var outputOff = 0;
- var count = Math.ceil((this.bufferOff + data.length) / this.blockSize) - 1;
- var out = new Array(count * this.blockSize);
- // TODO(indutny): optimize it, this is far from optimal
- for (; count > 0; count--) {
- inputOff += this._buffer(data, inputOff);
- outputOff += this._flushBuffer(out, outputOff);
- }
- // Buffer rest of the input
- inputOff += this._buffer(data, inputOff);
- return out;
- };
- Cipher.prototype.final = function final(buffer) {
- var first;
- if (buffer)
- first = this.update(buffer);
- var last;
- if (this.type === 'encrypt')
- last = this._finalEncrypt();
- else
- last = this._finalDecrypt();
- if (first)
- return first.concat(last);
- else
- return last;
- };
- Cipher.prototype._pad = function _pad(buffer, off) {
- if (off === 0)
- return false;
- while (off < buffer.length)
- buffer[off++] = 0;
- return true;
- };
- Cipher.prototype._finalEncrypt = function _finalEncrypt() {
- if (!this._pad(this.buffer, this.bufferOff))
- return [];
- var out = new Array(this.blockSize);
- this._update(this.buffer, 0, out, 0);
- return out;
- };
- Cipher.prototype._unpad = function _unpad(buffer) {
- return buffer;
- };
- Cipher.prototype._finalDecrypt = function _finalDecrypt() {
- assert.equal(this.bufferOff, this.blockSize, 'Not enough data to decrypt');
- var out = new Array(this.blockSize);
- this._flushBuffer(out, 0);
- return this._unpad(out);
- };
- /***/ }),
- /* 171 */
- /*!***************************************************!*\
- !*** ./node_modules/minimalistic-assert/index.js ***!
- \***************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- module.exports = assert;
- function assert(val, msg) {
- if (!val)
- throw new Error(msg || 'Assertion failed');
- }
- assert.equal = function assertEqual(l, r, msg) {
- if (l != r)
- throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r));
- };
- /***/ }),
- /* 172 */
- /*!********************************************!*\
- !*** ./node_modules/des.js/lib/des/des.js ***!
- \********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var assert = __webpack_require__(/*! minimalistic-assert */ 171);
- var inherits = __webpack_require__(/*! inherits */ 121);
- var utils = __webpack_require__(/*! ./utils */ 169);
- var Cipher = __webpack_require__(/*! ./cipher */ 170);
- function DESState() {
- this.tmp = new Array(2);
- this.keys = null;
- }
- function DES(options) {
- Cipher.call(this, options);
- var state = new DESState();
- this._desState = state;
- this.deriveKeys(state, options.key);
- }
- inherits(DES, Cipher);
- module.exports = DES;
- DES.create = function create(options) {
- return new DES(options);
- };
- var shiftTable = [
- 1, 1, 2, 2, 2, 2, 2, 2,
- 1, 2, 2, 2, 2, 2, 2, 1
- ];
- DES.prototype.deriveKeys = function deriveKeys(state, key) {
- state.keys = new Array(16 * 2);
- assert.equal(key.length, this.blockSize, 'Invalid key length');
- var kL = utils.readUInt32BE(key, 0);
- var kR = utils.readUInt32BE(key, 4);
- utils.pc1(kL, kR, state.tmp, 0);
- kL = state.tmp[0];
- kR = state.tmp[1];
- for (var i = 0; i < state.keys.length; i += 2) {
- var shift = shiftTable[i >>> 1];
- kL = utils.r28shl(kL, shift);
- kR = utils.r28shl(kR, shift);
- utils.pc2(kL, kR, state.keys, i);
- }
- };
- DES.prototype._update = function _update(inp, inOff, out, outOff) {
- var state = this._desState;
- var l = utils.readUInt32BE(inp, inOff);
- var r = utils.readUInt32BE(inp, inOff + 4);
- // Initial Permutation
- utils.ip(l, r, state.tmp, 0);
- l = state.tmp[0];
- r = state.tmp[1];
- if (this.type === 'encrypt')
- this._encrypt(state, l, r, state.tmp, 0);
- else
- this._decrypt(state, l, r, state.tmp, 0);
- l = state.tmp[0];
- r = state.tmp[1];
- utils.writeUInt32BE(out, l, outOff);
- utils.writeUInt32BE(out, r, outOff + 4);
- };
- DES.prototype._pad = function _pad(buffer, off) {
- var value = buffer.length - off;
- for (var i = off; i < buffer.length; i++)
- buffer[i] = value;
- return true;
- };
- DES.prototype._unpad = function _unpad(buffer) {
- var pad = buffer[buffer.length - 1];
- for (var i = buffer.length - pad; i < buffer.length; i++)
- assert.equal(buffer[i], pad);
- return buffer.slice(0, buffer.length - pad);
- };
- DES.prototype._encrypt = function _encrypt(state, lStart, rStart, out, off) {
- var l = lStart;
- var r = rStart;
- // Apply f() x16 times
- for (var i = 0; i < state.keys.length; i += 2) {
- var keyL = state.keys[i];
- var keyR = state.keys[i + 1];
- // f(r, k)
- utils.expand(r, state.tmp, 0);
- keyL ^= state.tmp[0];
- keyR ^= state.tmp[1];
- var s = utils.substitute(keyL, keyR);
- var f = utils.permute(s);
- var t = r;
- r = (l ^ f) >>> 0;
- l = t;
- }
- // Reverse Initial Permutation
- utils.rip(r, l, out, off);
- };
- DES.prototype._decrypt = function _decrypt(state, lStart, rStart, out, off) {
- var l = rStart;
- var r = lStart;
- // Apply f() x16 times
- for (var i = state.keys.length - 2; i >= 0; i -= 2) {
- var keyL = state.keys[i];
- var keyR = state.keys[i + 1];
- // f(r, k)
- utils.expand(l, state.tmp, 0);
- keyL ^= state.tmp[0];
- keyR ^= state.tmp[1];
- var s = utils.substitute(keyL, keyR);
- var f = utils.permute(s);
- var t = l;
- l = (r ^ f) >>> 0;
- r = t;
- }
- // Reverse Initial Permutation
- utils.rip(l, r, out, off);
- };
- /***/ }),
- /* 173 */
- /*!********************************************!*\
- !*** ./node_modules/des.js/lib/des/cbc.js ***!
- \********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var assert = __webpack_require__(/*! minimalistic-assert */ 171);
- var inherits = __webpack_require__(/*! inherits */ 121);
- var proto = {};
- function CBCState(iv) {
- assert.equal(iv.length, 8, 'Invalid IV length');
- this.iv = new Array(8);
- for (var i = 0; i < this.iv.length; i++)
- this.iv[i] = iv[i];
- }
- function instantiate(Base) {
- function CBC(options) {
- Base.call(this, options);
- this._cbcInit();
- }
- inherits(CBC, Base);
- var keys = Object.keys(proto);
- for (var i = 0; i < keys.length; i++) {
- var key = keys[i];
- CBC.prototype[key] = proto[key];
- }
- CBC.create = function create(options) {
- return new CBC(options);
- };
- return CBC;
- }
- exports.instantiate = instantiate;
- proto._cbcInit = function _cbcInit() {
- var state = new CBCState(this.options.iv);
- this._cbcState = state;
- };
- proto._update = function _update(inp, inOff, out, outOff) {
- var state = this._cbcState;
- var superProto = this.constructor.super_.prototype;
- var iv = state.iv;
- if (this.type === 'encrypt') {
- for (var i = 0; i < this.blockSize; i++)
- iv[i] ^= inp[inOff + i];
- superProto._update.call(this, iv, 0, out, outOff);
- for (var i = 0; i < this.blockSize; i++)
- iv[i] = out[outOff + i];
- } else {
- superProto._update.call(this, inp, inOff, out, outOff);
- for (var i = 0; i < this.blockSize; i++)
- out[outOff + i] ^= iv[i];
- for (var i = 0; i < this.blockSize; i++)
- iv[i] = inp[inOff + i];
- }
- };
- /***/ }),
- /* 174 */
- /*!********************************************!*\
- !*** ./node_modules/des.js/lib/des/ede.js ***!
- \********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var assert = __webpack_require__(/*! minimalistic-assert */ 171);
- var inherits = __webpack_require__(/*! inherits */ 121);
- var Cipher = __webpack_require__(/*! ./cipher */ 170);
- var DES = __webpack_require__(/*! ./des */ 172);
- function EDEState(type, key) {
- assert.equal(key.length, 24, 'Invalid key length');
- var k1 = key.slice(0, 8);
- var k2 = key.slice(8, 16);
- var k3 = key.slice(16, 24);
- if (type === 'encrypt') {
- this.ciphers = [
- DES.create({ type: 'encrypt', key: k1 }),
- DES.create({ type: 'decrypt', key: k2 }),
- DES.create({ type: 'encrypt', key: k3 })
- ];
- } else {
- this.ciphers = [
- DES.create({ type: 'decrypt', key: k3 }),
- DES.create({ type: 'encrypt', key: k2 }),
- DES.create({ type: 'decrypt', key: k1 })
- ];
- }
- }
- function EDE(options) {
- Cipher.call(this, options);
- var state = new EDEState(this.type, this.options.key);
- this._edeState = state;
- }
- inherits(EDE, Cipher);
- module.exports = EDE;
- EDE.create = function create(options) {
- return new EDE(options);
- };
- EDE.prototype._update = function _update(inp, inOff, out, outOff) {
- var state = this._edeState;
- state.ciphers[0]._update(inp, inOff, out, outOff);
- state.ciphers[1]._update(out, outOff, out, outOff);
- state.ciphers[2]._update(out, outOff, out, outOff);
- };
- EDE.prototype._pad = DES.prototype._pad;
- EDE.prototype._unpad = DES.prototype._unpad;
- /***/ }),
- /* 175 */
- /*!************************************************!*\
- !*** ./node_modules/browserify-aes/browser.js ***!
- \************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var ciphers = __webpack_require__(/*! ./encrypter */ 176)
- var deciphers = __webpack_require__(/*! ./decrypter */ 193)
- var modes = __webpack_require__(/*! ./modes/list.json */ 187)
- function getCiphers () {
- return Object.keys(modes)
- }
- exports.createCipher = exports.Cipher = ciphers.createCipher
- exports.createCipheriv = exports.Cipheriv = ciphers.createCipheriv
- exports.createDecipher = exports.Decipher = deciphers.createDecipher
- exports.createDecipheriv = exports.Decipheriv = deciphers.createDecipheriv
- exports.listCiphers = exports.getCiphers = getCiphers
- /***/ }),
- /* 176 */
- /*!**************************************************!*\
- !*** ./node_modules/browserify-aes/encrypter.js ***!
- \**************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var MODES = __webpack_require__(/*! ./modes */ 177)
- var AuthCipher = __webpack_require__(/*! ./authCipher */ 188)
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- var StreamCipher = __webpack_require__(/*! ./streamCipher */ 191)
- var Transform = __webpack_require__(/*! cipher-base */ 149)
- var aes = __webpack_require__(/*! ./aes */ 189)
- var ebtk = __webpack_require__(/*! evp_bytestokey */ 192)
- var inherits = __webpack_require__(/*! inherits */ 121)
- function Cipher (mode, key, iv) {
- Transform.call(this)
- this._cache = new Splitter()
- this._cipher = new aes.AES(key)
- this._prev = Buffer.from(iv)
- this._mode = mode
- this._autopadding = true
- }
- inherits(Cipher, Transform)
- Cipher.prototype._update = function (data) {
- this._cache.add(data)
- var chunk
- var thing
- var out = []
- while ((chunk = this._cache.get())) {
- thing = this._mode.encrypt(this, chunk)
- out.push(thing)
- }
- return Buffer.concat(out)
- }
- var PADDING = Buffer.alloc(16, 0x10)
- Cipher.prototype._final = function () {
- var chunk = this._cache.flush()
- if (this._autopadding) {
- chunk = this._mode.encrypt(this, chunk)
- this._cipher.scrub()
- return chunk
- }
- if (!chunk.equals(PADDING)) {
- this._cipher.scrub()
- throw new Error('data not multiple of block length')
- }
- }
- Cipher.prototype.setAutoPadding = function (setTo) {
- this._autopadding = !!setTo
- return this
- }
- function Splitter () {
- this.cache = Buffer.allocUnsafe(0)
- }
- Splitter.prototype.add = function (data) {
- this.cache = Buffer.concat([this.cache, data])
- }
- Splitter.prototype.get = function () {
- if (this.cache.length > 15) {
- var out = this.cache.slice(0, 16)
- this.cache = this.cache.slice(16)
- return out
- }
- return null
- }
- Splitter.prototype.flush = function () {
- var len = 16 - this.cache.length
- var padBuff = Buffer.allocUnsafe(len)
- var i = -1
- while (++i < len) {
- padBuff.writeUInt8(len, i)
- }
- return Buffer.concat([this.cache, padBuff])
- }
- function createCipheriv (suite, password, iv) {
- var config = MODES[suite.toLowerCase()]
- if (!config) throw new TypeError('invalid suite type')
- if (typeof password === 'string') password = Buffer.from(password)
- if (password.length !== config.key / 8) throw new TypeError('invalid key length ' + password.length)
- if (typeof iv === 'string') iv = Buffer.from(iv)
- if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length)
- if (config.type === 'stream') {
- return new StreamCipher(config.module, password, iv)
- } else if (config.type === 'auth') {
- return new AuthCipher(config.module, password, iv)
- }
- return new Cipher(config.module, password, iv)
- }
- function createCipher (suite, password) {
- var config = MODES[suite.toLowerCase()]
- if (!config) throw new TypeError('invalid suite type')
- var keys = ebtk(password, false, config.key, config.iv)
- return createCipheriv(suite, keys.key, keys.iv)
- }
- exports.createCipheriv = createCipheriv
- exports.createCipher = createCipher
- /***/ }),
- /* 177 */
- /*!****************************************************!*\
- !*** ./node_modules/browserify-aes/modes/index.js ***!
- \****************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var modeModules = {
- ECB: __webpack_require__(/*! ./ecb */ 178),
- CBC: __webpack_require__(/*! ./cbc */ 179),
- CFB: __webpack_require__(/*! ./cfb */ 181),
- CFB8: __webpack_require__(/*! ./cfb8 */ 182),
- CFB1: __webpack_require__(/*! ./cfb1 */ 183),
- OFB: __webpack_require__(/*! ./ofb */ 184),
- CTR: __webpack_require__(/*! ./ctr */ 185),
- GCM: __webpack_require__(/*! ./ctr */ 185)
- }
- var modes = __webpack_require__(/*! ./list.json */ 187)
- for (var key in modes) {
- modes[key].module = modeModules[modes[key].mode]
- }
- module.exports = modes
- /***/ }),
- /* 178 */
- /*!**************************************************!*\
- !*** ./node_modules/browserify-aes/modes/ecb.js ***!
- \**************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- exports.encrypt = function (self, block) {
- return self._cipher.encryptBlock(block)
- }
- exports.decrypt = function (self, block) {
- return self._cipher.decryptBlock(block)
- }
- /***/ }),
- /* 179 */
- /*!**************************************************!*\
- !*** ./node_modules/browserify-aes/modes/cbc.js ***!
- \**************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var xor = __webpack_require__(/*! buffer-xor */ 180)
- exports.encrypt = function (self, block) {
- var data = xor(block, self._prev)
- self._prev = self._cipher.encryptBlock(data)
- return self._prev
- }
- exports.decrypt = function (self, block) {
- var pad = self._prev
- self._prev = block
- var out = self._cipher.decryptBlock(block)
- return xor(out, pad)
- }
- /***/ }),
- /* 180 */
- /*!******************************************!*\
- !*** ./node_modules/buffer-xor/index.js ***!
- \******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- /* WEBPACK VAR INJECTION */(function(Buffer) {module.exports = function xor (a, b) {
- var length = Math.min(a.length, b.length)
- var buffer = new Buffer(length)
- for (var i = 0; i < length; ++i) {
- buffer[i] = a[i] ^ b[i]
- }
- return buffer
- }
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../buffer/index.js */ 116).Buffer))
- /***/ }),
- /* 181 */
- /*!**************************************************!*\
- !*** ./node_modules/browserify-aes/modes/cfb.js ***!
- \**************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- var xor = __webpack_require__(/*! buffer-xor */ 180)
- function encryptStart (self, data, decrypt) {
- var len = data.length
- var out = xor(data, self._cache)
- self._cache = self._cache.slice(len)
- self._prev = Buffer.concat([self._prev, decrypt ? data : out])
- return out
- }
- exports.encrypt = function (self, data, decrypt) {
- var out = Buffer.allocUnsafe(0)
- var len
- while (data.length) {
- if (self._cache.length === 0) {
- self._cache = self._cipher.encryptBlock(self._prev)
- self._prev = Buffer.allocUnsafe(0)
- }
- if (self._cache.length <= data.length) {
- len = self._cache.length
- out = Buffer.concat([out, encryptStart(self, data.slice(0, len), decrypt)])
- data = data.slice(len)
- } else {
- out = Buffer.concat([out, encryptStart(self, data, decrypt)])
- break
- }
- }
- return out
- }
- /***/ }),
- /* 182 */
- /*!***************************************************!*\
- !*** ./node_modules/browserify-aes/modes/cfb8.js ***!
- \***************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- function encryptByte (self, byteParam, decrypt) {
- var pad = self._cipher.encryptBlock(self._prev)
- var out = pad[0] ^ byteParam
- self._prev = Buffer.concat([
- self._prev.slice(1),
- Buffer.from([decrypt ? byteParam : out])
- ])
- return out
- }
- exports.encrypt = function (self, chunk, decrypt) {
- var len = chunk.length
- var out = Buffer.allocUnsafe(len)
- var i = -1
- while (++i < len) {
- out[i] = encryptByte(self, chunk[i], decrypt)
- }
- return out
- }
- /***/ }),
- /* 183 */
- /*!***************************************************!*\
- !*** ./node_modules/browserify-aes/modes/cfb1.js ***!
- \***************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- function encryptByte (self, byteParam, decrypt) {
- var pad
- var i = -1
- var len = 8
- var out = 0
- var bit, value
- while (++i < len) {
- pad = self._cipher.encryptBlock(self._prev)
- bit = (byteParam & (1 << (7 - i))) ? 0x80 : 0
- value = pad[0] ^ bit
- out += ((value & 0x80) >> (i % 8))
- self._prev = shiftIn(self._prev, decrypt ? bit : value)
- }
- return out
- }
- function shiftIn (buffer, value) {
- var len = buffer.length
- var i = -1
- var out = Buffer.allocUnsafe(buffer.length)
- buffer = Buffer.concat([buffer, Buffer.from([value])])
- while (++i < len) {
- out[i] = buffer[i] << 1 | buffer[i + 1] >> (7)
- }
- return out
- }
- exports.encrypt = function (self, chunk, decrypt) {
- var len = chunk.length
- var out = Buffer.allocUnsafe(len)
- var i = -1
- while (++i < len) {
- out[i] = encryptByte(self, chunk[i], decrypt)
- }
- return out
- }
- /***/ }),
- /* 184 */
- /*!**************************************************!*\
- !*** ./node_modules/browserify-aes/modes/ofb.js ***!
- \**************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- /* WEBPACK VAR INJECTION */(function(Buffer) {var xor = __webpack_require__(/*! buffer-xor */ 180)
- function getBlock (self) {
- self._prev = self._cipher.encryptBlock(self._prev)
- return self._prev
- }
- exports.encrypt = function (self, chunk) {
- while (self._cache.length < chunk.length) {
- self._cache = Buffer.concat([self._cache, getBlock(self)])
- }
- var pad = self._cache.slice(0, chunk.length)
- self._cache = self._cache.slice(chunk.length)
- return xor(chunk, pad)
- }
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../buffer/index.js */ 116).Buffer))
- /***/ }),
- /* 185 */
- /*!**************************************************!*\
- !*** ./node_modules/browserify-aes/modes/ctr.js ***!
- \**************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var xor = __webpack_require__(/*! buffer-xor */ 180)
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- var incr32 = __webpack_require__(/*! ../incr32 */ 186)
- function getBlock (self) {
- var out = self._cipher.encryptBlockRaw(self._prev)
- incr32(self._prev)
- return out
- }
- var blockSize = 16
- exports.encrypt = function (self, chunk) {
- var chunkNum = Math.ceil(chunk.length / blockSize)
- var start = self._cache.length
- self._cache = Buffer.concat([
- self._cache,
- Buffer.allocUnsafe(chunkNum * blockSize)
- ])
- for (var i = 0; i < chunkNum; i++) {
- var out = getBlock(self)
- var offset = start + i * blockSize
- self._cache.writeUInt32BE(out[0], offset + 0)
- self._cache.writeUInt32BE(out[1], offset + 4)
- self._cache.writeUInt32BE(out[2], offset + 8)
- self._cache.writeUInt32BE(out[3], offset + 12)
- }
- var pad = self._cache.slice(0, chunk.length)
- self._cache = self._cache.slice(chunk.length)
- return xor(chunk, pad)
- }
- /***/ }),
- /* 186 */
- /*!***********************************************!*\
- !*** ./node_modules/browserify-aes/incr32.js ***!
- \***********************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- function incr32 (iv) {
- var len = iv.length
- var item
- while (len--) {
- item = iv.readUInt8(len)
- if (item === 255) {
- iv.writeUInt8(0, len)
- } else {
- item++
- iv.writeUInt8(item, len)
- break
- }
- }
- }
- module.exports = incr32
- /***/ }),
- /* 187 */
- /*!*****************************************************!*\
- !*** ./node_modules/browserify-aes/modes/list.json ***!
- \*****************************************************/
- /*! exports provided: aes-128-ecb, aes-192-ecb, aes-256-ecb, aes-128-cbc, aes-192-cbc, aes-256-cbc, aes128, aes192, aes256, aes-128-cfb, aes-192-cfb, aes-256-cfb, aes-128-cfb8, aes-192-cfb8, aes-256-cfb8, aes-128-cfb1, aes-192-cfb1, aes-256-cfb1, aes-128-ofb, aes-192-ofb, aes-256-ofb, aes-128-ctr, aes-192-ctr, aes-256-ctr, aes-128-gcm, aes-192-gcm, aes-256-gcm, default */
- /***/ (function(module) {
- module.exports = JSON.parse("{\"aes-128-ecb\":{\"cipher\":\"AES\",\"key\":128,\"iv\":0,\"mode\":\"ECB\",\"type\":\"block\"},\"aes-192-ecb\":{\"cipher\":\"AES\",\"key\":192,\"iv\":0,\"mode\":\"ECB\",\"type\":\"block\"},\"aes-256-ecb\":{\"cipher\":\"AES\",\"key\":256,\"iv\":0,\"mode\":\"ECB\",\"type\":\"block\"},\"aes-128-cbc\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"CBC\",\"type\":\"block\"},\"aes-192-cbc\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"CBC\",\"type\":\"block\"},\"aes-256-cbc\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"CBC\",\"type\":\"block\"},\"aes128\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"CBC\",\"type\":\"block\"},\"aes192\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"CBC\",\"type\":\"block\"},\"aes256\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"CBC\",\"type\":\"block\"},\"aes-128-cfb\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"CFB\",\"type\":\"stream\"},\"aes-192-cfb\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"CFB\",\"type\":\"stream\"},\"aes-256-cfb\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"CFB\",\"type\":\"stream\"},\"aes-128-cfb8\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"CFB8\",\"type\":\"stream\"},\"aes-192-cfb8\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"CFB8\",\"type\":\"stream\"},\"aes-256-cfb8\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"CFB8\",\"type\":\"stream\"},\"aes-128-cfb1\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"CFB1\",\"type\":\"stream\"},\"aes-192-cfb1\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"CFB1\",\"type\":\"stream\"},\"aes-256-cfb1\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"CFB1\",\"type\":\"stream\"},\"aes-128-ofb\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"OFB\",\"type\":\"stream\"},\"aes-192-ofb\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"OFB\",\"type\":\"stream\"},\"aes-256-ofb\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"OFB\",\"type\":\"stream\"},\"aes-128-ctr\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"CTR\",\"type\":\"stream\"},\"aes-192-ctr\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"CTR\",\"type\":\"stream\"},\"aes-256-ctr\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"CTR\",\"type\":\"stream\"},\"aes-128-gcm\":{\"cipher\":\"AES\",\"key\":128,\"iv\":12,\"mode\":\"GCM\",\"type\":\"auth\"},\"aes-192-gcm\":{\"cipher\":\"AES\",\"key\":192,\"iv\":12,\"mode\":\"GCM\",\"type\":\"auth\"},\"aes-256-gcm\":{\"cipher\":\"AES\",\"key\":256,\"iv\":12,\"mode\":\"GCM\",\"type\":\"auth\"}}");
- /***/ }),
- /* 188 */
- /*!***************************************************!*\
- !*** ./node_modules/browserify-aes/authCipher.js ***!
- \***************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var aes = __webpack_require__(/*! ./aes */ 189)
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- var Transform = __webpack_require__(/*! cipher-base */ 149)
- var inherits = __webpack_require__(/*! inherits */ 121)
- var GHASH = __webpack_require__(/*! ./ghash */ 190)
- var xor = __webpack_require__(/*! buffer-xor */ 180)
- var incr32 = __webpack_require__(/*! ./incr32 */ 186)
- function xorTest (a, b) {
- var out = 0
- if (a.length !== b.length) out++
- var len = Math.min(a.length, b.length)
- for (var i = 0; i < len; ++i) {
- out += (a[i] ^ b[i])
- }
- return out
- }
- function calcIv (self, iv, ck) {
- if (iv.length === 12) {
- self._finID = Buffer.concat([iv, Buffer.from([0, 0, 0, 1])])
- return Buffer.concat([iv, Buffer.from([0, 0, 0, 2])])
- }
- var ghash = new GHASH(ck)
- var len = iv.length
- var toPad = len % 16
- ghash.update(iv)
- if (toPad) {
- toPad = 16 - toPad
- ghash.update(Buffer.alloc(toPad, 0))
- }
- ghash.update(Buffer.alloc(8, 0))
- var ivBits = len * 8
- var tail = Buffer.alloc(8)
- tail.writeUIntBE(ivBits, 0, 8)
- ghash.update(tail)
- self._finID = ghash.state
- var out = Buffer.from(self._finID)
- incr32(out)
- return out
- }
- function StreamCipher (mode, key, iv, decrypt) {
- Transform.call(this)
- var h = Buffer.alloc(4, 0)
- this._cipher = new aes.AES(key)
- var ck = this._cipher.encryptBlock(h)
- this._ghash = new GHASH(ck)
- iv = calcIv(this, iv, ck)
- this._prev = Buffer.from(iv)
- this._cache = Buffer.allocUnsafe(0)
- this._secCache = Buffer.allocUnsafe(0)
- this._decrypt = decrypt
- this._alen = 0
- this._len = 0
- this._mode = mode
- this._authTag = null
- this._called = false
- }
- inherits(StreamCipher, Transform)
- StreamCipher.prototype._update = function (chunk) {
- if (!this._called && this._alen) {
- var rump = 16 - (this._alen % 16)
- if (rump < 16) {
- rump = Buffer.alloc(rump, 0)
- this._ghash.update(rump)
- }
- }
- this._called = true
- var out = this._mode.encrypt(this, chunk)
- if (this._decrypt) {
- this._ghash.update(chunk)
- } else {
- this._ghash.update(out)
- }
- this._len += chunk.length
- return out
- }
- StreamCipher.prototype._final = function () {
- if (this._decrypt && !this._authTag) throw new Error('Unsupported state or unable to authenticate data')
- var tag = xor(this._ghash.final(this._alen * 8, this._len * 8), this._cipher.encryptBlock(this._finID))
- if (this._decrypt && xorTest(tag, this._authTag)) throw new Error('Unsupported state or unable to authenticate data')
- this._authTag = tag
- this._cipher.scrub()
- }
- StreamCipher.prototype.getAuthTag = function getAuthTag () {
- if (this._decrypt || !Buffer.isBuffer(this._authTag)) throw new Error('Attempting to get auth tag in unsupported state')
- return this._authTag
- }
- StreamCipher.prototype.setAuthTag = function setAuthTag (tag) {
- if (!this._decrypt) throw new Error('Attempting to set auth tag in unsupported state')
- this._authTag = tag
- }
- StreamCipher.prototype.setAAD = function setAAD (buf) {
- if (this._called) throw new Error('Attempting to set AAD in unsupported state')
- this._ghash.update(buf)
- this._alen += buf.length
- }
- module.exports = StreamCipher
- /***/ }),
- /* 189 */
- /*!********************************************!*\
- !*** ./node_modules/browserify-aes/aes.js ***!
- \********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- // based on the aes implimentation in triple sec
- // https://github.com/keybase/triplesec
- // which is in turn based on the one from crypto-js
- // https://code.google.com/p/crypto-js/
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- function asUInt32Array (buf) {
- if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)
- var len = (buf.length / 4) | 0
- var out = new Array(len)
- for (var i = 0; i < len; i++) {
- out[i] = buf.readUInt32BE(i * 4)
- }
- return out
- }
- function scrubVec (v) {
- for (var i = 0; i < v.length; v++) {
- v[i] = 0
- }
- }
- function cryptBlock (M, keySchedule, SUB_MIX, SBOX, nRounds) {
- var SUB_MIX0 = SUB_MIX[0]
- var SUB_MIX1 = SUB_MIX[1]
- var SUB_MIX2 = SUB_MIX[2]
- var SUB_MIX3 = SUB_MIX[3]
- var s0 = M[0] ^ keySchedule[0]
- var s1 = M[1] ^ keySchedule[1]
- var s2 = M[2] ^ keySchedule[2]
- var s3 = M[3] ^ keySchedule[3]
- var t0, t1, t2, t3
- var ksRow = 4
- for (var round = 1; round < nRounds; round++) {
- t0 = SUB_MIX0[s0 >>> 24] ^ SUB_MIX1[(s1 >>> 16) & 0xff] ^ SUB_MIX2[(s2 >>> 8) & 0xff] ^ SUB_MIX3[s3 & 0xff] ^ keySchedule[ksRow++]
- t1 = SUB_MIX0[s1 >>> 24] ^ SUB_MIX1[(s2 >>> 16) & 0xff] ^ SUB_MIX2[(s3 >>> 8) & 0xff] ^ SUB_MIX3[s0 & 0xff] ^ keySchedule[ksRow++]
- t2 = SUB_MIX0[s2 >>> 24] ^ SUB_MIX1[(s3 >>> 16) & 0xff] ^ SUB_MIX2[(s0 >>> 8) & 0xff] ^ SUB_MIX3[s1 & 0xff] ^ keySchedule[ksRow++]
- t3 = SUB_MIX0[s3 >>> 24] ^ SUB_MIX1[(s0 >>> 16) & 0xff] ^ SUB_MIX2[(s1 >>> 8) & 0xff] ^ SUB_MIX3[s2 & 0xff] ^ keySchedule[ksRow++]
- s0 = t0
- s1 = t1
- s2 = t2
- s3 = t3
- }
- t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]
- t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]
- t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]
- t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]
- t0 = t0 >>> 0
- t1 = t1 >>> 0
- t2 = t2 >>> 0
- t3 = t3 >>> 0
- return [t0, t1, t2, t3]
- }
- // AES constants
- var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]
- var G = (function () {
- // Compute double table
- var d = new Array(256)
- for (var j = 0; j < 256; j++) {
- if (j < 128) {
- d[j] = j << 1
- } else {
- d[j] = (j << 1) ^ 0x11b
- }
- }
- var SBOX = []
- var INV_SBOX = []
- var SUB_MIX = [[], [], [], []]
- var INV_SUB_MIX = [[], [], [], []]
- // Walk GF(2^8)
- var x = 0
- var xi = 0
- for (var i = 0; i < 256; ++i) {
- // Compute sbox
- var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4)
- sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63
- SBOX[x] = sx
- INV_SBOX[sx] = x
- // Compute multiplication
- var x2 = d[x]
- var x4 = d[x2]
- var x8 = d[x4]
- // Compute sub bytes, mix columns tables
- var t = (d[sx] * 0x101) ^ (sx * 0x1010100)
- SUB_MIX[0][x] = (t << 24) | (t >>> 8)
- SUB_MIX[1][x] = (t << 16) | (t >>> 16)
- SUB_MIX[2][x] = (t << 8) | (t >>> 24)
- SUB_MIX[3][x] = t
- // Compute inv sub bytes, inv mix columns tables
- t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100)
- INV_SUB_MIX[0][sx] = (t << 24) | (t >>> 8)
- INV_SUB_MIX[1][sx] = (t << 16) | (t >>> 16)
- INV_SUB_MIX[2][sx] = (t << 8) | (t >>> 24)
- INV_SUB_MIX[3][sx] = t
- if (x === 0) {
- x = xi = 1
- } else {
- x = x2 ^ d[d[d[x8 ^ x2]]]
- xi ^= d[d[xi]]
- }
- }
- return {
- SBOX: SBOX,
- INV_SBOX: INV_SBOX,
- SUB_MIX: SUB_MIX,
- INV_SUB_MIX: INV_SUB_MIX
- }
- })()
- function AES (key) {
- this._key = asUInt32Array(key)
- this._reset()
- }
- AES.blockSize = 4 * 4
- AES.keySize = 256 / 8
- AES.prototype.blockSize = AES.blockSize
- AES.prototype.keySize = AES.keySize
- AES.prototype._reset = function () {
- var keyWords = this._key
- var keySize = keyWords.length
- var nRounds = keySize + 6
- var ksRows = (nRounds + 1) * 4
- var keySchedule = []
- for (var k = 0; k < keySize; k++) {
- keySchedule[k] = keyWords[k]
- }
- for (k = keySize; k < ksRows; k++) {
- var t = keySchedule[k - 1]
- if (k % keySize === 0) {
- t = (t << 8) | (t >>> 24)
- t =
- (G.SBOX[t >>> 24] << 24) |
- (G.SBOX[(t >>> 16) & 0xff] << 16) |
- (G.SBOX[(t >>> 8) & 0xff] << 8) |
- (G.SBOX[t & 0xff])
- t ^= RCON[(k / keySize) | 0] << 24
- } else if (keySize > 6 && k % keySize === 4) {
- t =
- (G.SBOX[t >>> 24] << 24) |
- (G.SBOX[(t >>> 16) & 0xff] << 16) |
- (G.SBOX[(t >>> 8) & 0xff] << 8) |
- (G.SBOX[t & 0xff])
- }
- keySchedule[k] = keySchedule[k - keySize] ^ t
- }
- var invKeySchedule = []
- for (var ik = 0; ik < ksRows; ik++) {
- var ksR = ksRows - ik
- var tt = keySchedule[ksR - (ik % 4 ? 0 : 4)]
- if (ik < 4 || ksR <= 4) {
- invKeySchedule[ik] = tt
- } else {
- invKeySchedule[ik] =
- G.INV_SUB_MIX[0][G.SBOX[tt >>> 24]] ^
- G.INV_SUB_MIX[1][G.SBOX[(tt >>> 16) & 0xff]] ^
- G.INV_SUB_MIX[2][G.SBOX[(tt >>> 8) & 0xff]] ^
- G.INV_SUB_MIX[3][G.SBOX[tt & 0xff]]
- }
- }
- this._nRounds = nRounds
- this._keySchedule = keySchedule
- this._invKeySchedule = invKeySchedule
- }
- AES.prototype.encryptBlockRaw = function (M) {
- M = asUInt32Array(M)
- return cryptBlock(M, this._keySchedule, G.SUB_MIX, G.SBOX, this._nRounds)
- }
- AES.prototype.encryptBlock = function (M) {
- var out = this.encryptBlockRaw(M)
- var buf = Buffer.allocUnsafe(16)
- buf.writeUInt32BE(out[0], 0)
- buf.writeUInt32BE(out[1], 4)
- buf.writeUInt32BE(out[2], 8)
- buf.writeUInt32BE(out[3], 12)
- return buf
- }
- AES.prototype.decryptBlock = function (M) {
- M = asUInt32Array(M)
- // swap
- var m1 = M[1]
- M[1] = M[3]
- M[3] = m1
- var out = cryptBlock(M, this._invKeySchedule, G.INV_SUB_MIX, G.INV_SBOX, this._nRounds)
- var buf = Buffer.allocUnsafe(16)
- buf.writeUInt32BE(out[0], 0)
- buf.writeUInt32BE(out[3], 4)
- buf.writeUInt32BE(out[2], 8)
- buf.writeUInt32BE(out[1], 12)
- return buf
- }
- AES.prototype.scrub = function () {
- scrubVec(this._keySchedule)
- scrubVec(this._invKeySchedule)
- scrubVec(this._key)
- }
- module.exports.AES = AES
- /***/ }),
- /* 190 */
- /*!**********************************************!*\
- !*** ./node_modules/browserify-aes/ghash.js ***!
- \**********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- var ZEROES = Buffer.alloc(16, 0)
- function toArray (buf) {
- return [
- buf.readUInt32BE(0),
- buf.readUInt32BE(4),
- buf.readUInt32BE(8),
- buf.readUInt32BE(12)
- ]
- }
- function fromArray (out) {
- var buf = Buffer.allocUnsafe(16)
- buf.writeUInt32BE(out[0] >>> 0, 0)
- buf.writeUInt32BE(out[1] >>> 0, 4)
- buf.writeUInt32BE(out[2] >>> 0, 8)
- buf.writeUInt32BE(out[3] >>> 0, 12)
- return buf
- }
- function GHASH (key) {
- this.h = key
- this.state = Buffer.alloc(16, 0)
- this.cache = Buffer.allocUnsafe(0)
- }
- // from http://bitwiseshiftleft.github.io/sjcl/doc/symbols/src/core_gcm.js.html
- // by Juho Vähä-Herttua
- GHASH.prototype.ghash = function (block) {
- var i = -1
- while (++i < block.length) {
- this.state[i] ^= block[i]
- }
- this._multiply()
- }
- GHASH.prototype._multiply = function () {
- var Vi = toArray(this.h)
- var Zi = [0, 0, 0, 0]
- var j, xi, lsbVi
- var i = -1
- while (++i < 128) {
- xi = (this.state[~~(i / 8)] & (1 << (7 - (i % 8)))) !== 0
- if (xi) {
- // Z_i+1 = Z_i ^ V_i
- Zi[0] ^= Vi[0]
- Zi[1] ^= Vi[1]
- Zi[2] ^= Vi[2]
- Zi[3] ^= Vi[3]
- }
- // Store the value of LSB(V_i)
- lsbVi = (Vi[3] & 1) !== 0
- // V_i+1 = V_i >> 1
- for (j = 3; j > 0; j--) {
- Vi[j] = (Vi[j] >>> 1) | ((Vi[j - 1] & 1) << 31)
- }
- Vi[0] = Vi[0] >>> 1
- // If LSB(V_i) is 1, V_i+1 = (V_i >> 1) ^ R
- if (lsbVi) {
- Vi[0] = Vi[0] ^ (0xe1 << 24)
- }
- }
- this.state = fromArray(Zi)
- }
- GHASH.prototype.update = function (buf) {
- this.cache = Buffer.concat([this.cache, buf])
- var chunk
- while (this.cache.length >= 16) {
- chunk = this.cache.slice(0, 16)
- this.cache = this.cache.slice(16)
- this.ghash(chunk)
- }
- }
- GHASH.prototype.final = function (abl, bl) {
- if (this.cache.length) {
- this.ghash(Buffer.concat([this.cache, ZEROES], 16))
- }
- this.ghash(fromArray([0, abl, 0, bl]))
- return this.state
- }
- module.exports = GHASH
- /***/ }),
- /* 191 */
- /*!*****************************************************!*\
- !*** ./node_modules/browserify-aes/streamCipher.js ***!
- \*****************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var aes = __webpack_require__(/*! ./aes */ 189)
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- var Transform = __webpack_require__(/*! cipher-base */ 149)
- var inherits = __webpack_require__(/*! inherits */ 121)
- function StreamCipher (mode, key, iv, decrypt) {
- Transform.call(this)
- this._cipher = new aes.AES(key)
- this._prev = Buffer.from(iv)
- this._cache = Buffer.allocUnsafe(0)
- this._secCache = Buffer.allocUnsafe(0)
- this._decrypt = decrypt
- this._mode = mode
- }
- inherits(StreamCipher, Transform)
- StreamCipher.prototype._update = function (chunk) {
- return this._mode.encrypt(this, chunk, this._decrypt)
- }
- StreamCipher.prototype._final = function () {
- this._cipher.scrub()
- }
- module.exports = StreamCipher
- /***/ }),
- /* 192 */
- /*!**********************************************!*\
- !*** ./node_modules/evp_bytestokey/index.js ***!
- \**********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- var MD5 = __webpack_require__(/*! md5.js */ 122)
- /* eslint-disable camelcase */
- function EVP_BytesToKey (password, salt, keyBits, ivLen) {
- if (!Buffer.isBuffer(password)) password = Buffer.from(password, 'binary')
- if (salt) {
- if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, 'binary')
- if (salt.length !== 8) throw new RangeError('salt should be Buffer with 8 byte length')
- }
- var keyLen = keyBits / 8
- var key = Buffer.alloc(keyLen)
- var iv = Buffer.alloc(ivLen || 0)
- var tmp = Buffer.alloc(0)
- while (keyLen > 0 || ivLen > 0) {
- var hash = new MD5()
- hash.update(tmp)
- hash.update(password)
- if (salt) hash.update(salt)
- tmp = hash.digest()
- var used = 0
- if (keyLen > 0) {
- var keyStart = key.length - keyLen
- used = Math.min(keyLen, tmp.length)
- tmp.copy(key, keyStart, 0, used)
- keyLen -= used
- }
- if (used < tmp.length && ivLen > 0) {
- var ivStart = iv.length - ivLen
- var length = Math.min(ivLen, tmp.length - used)
- tmp.copy(iv, ivStart, used, used + length)
- ivLen -= length
- }
- }
- tmp.fill(0)
- return { key: key, iv: iv }
- }
- module.exports = EVP_BytesToKey
- /***/ }),
- /* 193 */
- /*!**************************************************!*\
- !*** ./node_modules/browserify-aes/decrypter.js ***!
- \**************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var AuthCipher = __webpack_require__(/*! ./authCipher */ 188)
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- var MODES = __webpack_require__(/*! ./modes */ 177)
- var StreamCipher = __webpack_require__(/*! ./streamCipher */ 191)
- var Transform = __webpack_require__(/*! cipher-base */ 149)
- var aes = __webpack_require__(/*! ./aes */ 189)
- var ebtk = __webpack_require__(/*! evp_bytestokey */ 192)
- var inherits = __webpack_require__(/*! inherits */ 121)
- function Decipher (mode, key, iv) {
- Transform.call(this)
- this._cache = new Splitter()
- this._last = void 0
- this._cipher = new aes.AES(key)
- this._prev = Buffer.from(iv)
- this._mode = mode
- this._autopadding = true
- }
- inherits(Decipher, Transform)
- Decipher.prototype._update = function (data) {
- this._cache.add(data)
- var chunk
- var thing
- var out = []
- while ((chunk = this._cache.get(this._autopadding))) {
- thing = this._mode.decrypt(this, chunk)
- out.push(thing)
- }
- return Buffer.concat(out)
- }
- Decipher.prototype._final = function () {
- var chunk = this._cache.flush()
- if (this._autopadding) {
- return unpad(this._mode.decrypt(this, chunk))
- } else if (chunk) {
- throw new Error('data not multiple of block length')
- }
- }
- Decipher.prototype.setAutoPadding = function (setTo) {
- this._autopadding = !!setTo
- return this
- }
- function Splitter () {
- this.cache = Buffer.allocUnsafe(0)
- }
- Splitter.prototype.add = function (data) {
- this.cache = Buffer.concat([this.cache, data])
- }
- Splitter.prototype.get = function (autoPadding) {
- var out
- if (autoPadding) {
- if (this.cache.length > 16) {
- out = this.cache.slice(0, 16)
- this.cache = this.cache.slice(16)
- return out
- }
- } else {
- if (this.cache.length >= 16) {
- out = this.cache.slice(0, 16)
- this.cache = this.cache.slice(16)
- return out
- }
- }
- return null
- }
- Splitter.prototype.flush = function () {
- if (this.cache.length) return this.cache
- }
- function unpad (last) {
- var padded = last[15]
- if (padded < 1 || padded > 16) {
- throw new Error('unable to decrypt data')
- }
- var i = -1
- while (++i < padded) {
- if (last[(i + (16 - padded))] !== padded) {
- throw new Error('unable to decrypt data')
- }
- }
- if (padded === 16) return
- return last.slice(0, 16 - padded)
- }
- function createDecipheriv (suite, password, iv) {
- var config = MODES[suite.toLowerCase()]
- if (!config) throw new TypeError('invalid suite type')
- if (typeof iv === 'string') iv = Buffer.from(iv)
- if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length)
- if (typeof password === 'string') password = Buffer.from(password)
- if (password.length !== config.key / 8) throw new TypeError('invalid key length ' + password.length)
- if (config.type === 'stream') {
- return new StreamCipher(config.module, password, iv, true)
- } else if (config.type === 'auth') {
- return new AuthCipher(config.module, password, iv, true)
- }
- return new Decipher(config.module, password, iv)
- }
- function createDecipher (suite, password) {
- var config = MODES[suite.toLowerCase()]
- if (!config) throw new TypeError('invalid suite type')
- var keys = ebtk(password, false, config.key, config.iv)
- return createDecipheriv(suite, keys.key, keys.iv)
- }
- exports.createDecipher = createDecipher
- exports.createDecipheriv = createDecipheriv
- /***/ }),
- /* 194 */
- /*!**********************************************!*\
- !*** ./node_modules/browserify-des/modes.js ***!
- \**********************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- exports['des-ecb'] = {
- key: 8,
- iv: 0
- }
- exports['des-cbc'] = exports.des = {
- key: 8,
- iv: 8
- }
- exports['des-ede3-cbc'] = exports.des3 = {
- key: 24,
- iv: 8
- }
- exports['des-ede3'] = {
- key: 24,
- iv: 0
- }
- exports['des-ede-cbc'] = {
- key: 16,
- iv: 8
- }
- exports['des-ede'] = {
- key: 16,
- iv: 0
- }
- /***/ }),
- /* 195 */
- /*!************************************************!*\
- !*** ./node_modules/diffie-hellman/browser.js ***!
- \************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- /* WEBPACK VAR INJECTION */(function(Buffer) {var generatePrime = __webpack_require__(/*! ./lib/generatePrime */ 196)
- var primes = __webpack_require__(/*! ./lib/primes.json */ 203)
- var DH = __webpack_require__(/*! ./lib/dh */ 204)
- function getDiffieHellman (mod) {
- var prime = new Buffer(primes[mod].prime, 'hex')
- var gen = new Buffer(primes[mod].gen, 'hex')
- return new DH(prime, gen)
- }
- var ENCODINGS = {
- 'binary': true, 'hex': true, 'base64': true
- }
- function createDiffieHellman (prime, enc, generator, genc) {
- if (Buffer.isBuffer(enc) || ENCODINGS[enc] === undefined) {
- return createDiffieHellman(prime, 'binary', enc, generator)
- }
- enc = enc || 'binary'
- genc = genc || 'binary'
- generator = generator || new Buffer([2])
- if (!Buffer.isBuffer(generator)) {
- generator = new Buffer(generator, genc)
- }
- if (typeof prime === 'number') {
- return new DH(generatePrime(prime, generator), generator, true)
- }
- if (!Buffer.isBuffer(prime)) {
- prime = new Buffer(prime, enc)
- }
- return new DH(prime, generator, true)
- }
- exports.DiffieHellmanGroup = exports.createDiffieHellmanGroup = exports.getDiffieHellman = getDiffieHellman
- exports.createDiffieHellman = exports.DiffieHellman = createDiffieHellman
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../buffer/index.js */ 116).Buffer))
- /***/ }),
- /* 196 */
- /*!**********************************************************!*\
- !*** ./node_modules/diffie-hellman/lib/generatePrime.js ***!
- \**********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var randomBytes = __webpack_require__(/*! randombytes */ 112);
- module.exports = findPrime;
- findPrime.simpleSieve = simpleSieve;
- findPrime.fermatTest = fermatTest;
- var BN = __webpack_require__(/*! bn.js */ 197);
- var TWENTYFOUR = new BN(24);
- var MillerRabin = __webpack_require__(/*! miller-rabin */ 200);
- var millerRabin = new MillerRabin();
- var ONE = new BN(1);
- var TWO = new BN(2);
- var FIVE = new BN(5);
- var SIXTEEN = new BN(16);
- var EIGHT = new BN(8);
- var TEN = new BN(10);
- var THREE = new BN(3);
- var SEVEN = new BN(7);
- var ELEVEN = new BN(11);
- var FOUR = new BN(4);
- var TWELVE = new BN(12);
- var primes = null;
- function _getPrimes() {
- if (primes !== null)
- return primes;
- var limit = 0x100000;
- var res = [];
- res[0] = 2;
- for (var i = 1, k = 3; k < limit; k += 2) {
- var sqrt = Math.ceil(Math.sqrt(k));
- for (var j = 0; j < i && res[j] <= sqrt; j++)
- if (k % res[j] === 0)
- break;
- if (i !== j && res[j] <= sqrt)
- continue;
- res[i++] = k;
- }
- primes = res;
- return res;
- }
- function simpleSieve(p) {
- var primes = _getPrimes();
- for (var i = 0; i < primes.length; i++)
- if (p.modn(primes[i]) === 0) {
- if (p.cmpn(primes[i]) === 0) {
- return true;
- } else {
- return false;
- }
- }
- return true;
- }
- function fermatTest(p) {
- var red = BN.mont(p);
- return TWO.toRed(red).redPow(p.subn(1)).fromRed().cmpn(1) === 0;
- }
- function findPrime(bits, gen) {
- if (bits < 16) {
- // this is what openssl does
- if (gen === 2 || gen === 5) {
- return new BN([0x8c, 0x7b]);
- } else {
- return new BN([0x8c, 0x27]);
- }
- }
- gen = new BN(gen);
- var num, n2;
- while (true) {
- num = new BN(randomBytes(Math.ceil(bits / 8)));
- while (num.bitLength() > bits) {
- num.ishrn(1);
- }
- if (num.isEven()) {
- num.iadd(ONE);
- }
- if (!num.testn(1)) {
- num.iadd(TWO);
- }
- if (!gen.cmp(TWO)) {
- while (num.mod(TWENTYFOUR).cmp(ELEVEN)) {
- num.iadd(FOUR);
- }
- } else if (!gen.cmp(FIVE)) {
- while (num.mod(TEN).cmp(THREE)) {
- num.iadd(FOUR);
- }
- }
- n2 = num.shrn(1);
- if (simpleSieve(n2) && simpleSieve(num) &&
- fermatTest(n2) && fermatTest(num) &&
- millerRabin.test(n2) && millerRabin.test(num)) {
- return num;
- }
- }
- }
- /***/ }),
- /* 197 */
- /*!**************************************!*\
- !*** ./node_modules/bn.js/lib/bn.js ***!
- \**************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- /* WEBPACK VAR INJECTION */(function(module) {(function (module, exports) {
- 'use strict';
- // Utils
- function assert (val, msg) {
- if (!val) throw new Error(msg || 'Assertion failed');
- }
- // Could use `inherits` module, but don't want to move from single file
- // architecture yet.
- function inherits (ctor, superCtor) {
- ctor.super_ = superCtor;
- var TempCtor = function () {};
- TempCtor.prototype = superCtor.prototype;
- ctor.prototype = new TempCtor();
- ctor.prototype.constructor = ctor;
- }
- // BN
- function BN (number, base, endian) {
- if (BN.isBN(number)) {
- return number;
- }
- this.negative = 0;
- this.words = null;
- this.length = 0;
- // Reduction context
- this.red = null;
- if (number !== null) {
- if (base === 'le' || base === 'be') {
- endian = base;
- base = 10;
- }
- this._init(number || 0, base || 10, endian || 'be');
- }
- }
- if (typeof module === 'object') {
- module.exports = BN;
- } else {
- exports.BN = BN;
- }
- BN.BN = BN;
- BN.wordSize = 26;
- var Buffer;
- try {
- if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') {
- Buffer = window.Buffer;
- } else {
- Buffer = __webpack_require__(/*! buffer */ 199).Buffer;
- }
- } catch (e) {
- }
- BN.isBN = function isBN (num) {
- if (num instanceof BN) {
- return true;
- }
- return num !== null && typeof num === 'object' &&
- num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);
- };
- BN.max = function max (left, right) {
- if (left.cmp(right) > 0) return left;
- return right;
- };
- BN.min = function min (left, right) {
- if (left.cmp(right) < 0) return left;
- return right;
- };
- BN.prototype._init = function init (number, base, endian) {
- if (typeof number === 'number') {
- return this._initNumber(number, base, endian);
- }
- if (typeof number === 'object') {
- return this._initArray(number, base, endian);
- }
- if (base === 'hex') {
- base = 16;
- }
- assert(base === (base | 0) && base >= 2 && base <= 36);
- number = number.toString().replace(/\s+/g, '');
- var start = 0;
- if (number[0] === '-') {
- start++;
- this.negative = 1;
- }
- if (start < number.length) {
- if (base === 16) {
- this._parseHex(number, start, endian);
- } else {
- this._parseBase(number, base, start);
- if (endian === 'le') {
- this._initArray(this.toArray(), base, endian);
- }
- }
- }
- };
- BN.prototype._initNumber = function _initNumber (number, base, endian) {
- if (number < 0) {
- this.negative = 1;
- number = -number;
- }
- if (number < 0x4000000) {
- this.words = [ number & 0x3ffffff ];
- this.length = 1;
- } else if (number < 0x10000000000000) {
- this.words = [
- number & 0x3ffffff,
- (number / 0x4000000) & 0x3ffffff
- ];
- this.length = 2;
- } else {
- assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)
- this.words = [
- number & 0x3ffffff,
- (number / 0x4000000) & 0x3ffffff,
- 1
- ];
- this.length = 3;
- }
- if (endian !== 'le') return;
- // Reverse the bytes
- this._initArray(this.toArray(), base, endian);
- };
- BN.prototype._initArray = function _initArray (number, base, endian) {
- // Perhaps a Uint8Array
- assert(typeof number.length === 'number');
- if (number.length <= 0) {
- this.words = [ 0 ];
- this.length = 1;
- return this;
- }
- this.length = Math.ceil(number.length / 3);
- this.words = new Array(this.length);
- for (var i = 0; i < this.length; i++) {
- this.words[i] = 0;
- }
- var j, w;
- var off = 0;
- if (endian === 'be') {
- for (i = number.length - 1, j = 0; i >= 0; i -= 3) {
- w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16);
- this.words[j] |= (w << off) & 0x3ffffff;
- this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;
- off += 24;
- if (off >= 26) {
- off -= 26;
- j++;
- }
- }
- } else if (endian === 'le') {
- for (i = 0, j = 0; i < number.length; i += 3) {
- w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16);
- this.words[j] |= (w << off) & 0x3ffffff;
- this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;
- off += 24;
- if (off >= 26) {
- off -= 26;
- j++;
- }
- }
- }
- return this.strip();
- };
- function parseHex4Bits (string, index) {
- var c = string.charCodeAt(index);
- // 'A' - 'F'
- if (c >= 65 && c <= 70) {
- return c - 55;
- // 'a' - 'f'
- } else if (c >= 97 && c <= 102) {
- return c - 87;
- // '0' - '9'
- } else {
- return (c - 48) & 0xf;
- }
- }
- function parseHexByte (string, lowerBound, index) {
- var r = parseHex4Bits(string, index);
- if (index - 1 >= lowerBound) {
- r |= parseHex4Bits(string, index - 1) << 4;
- }
- return r;
- }
- BN.prototype._parseHex = function _parseHex (number, start, endian) {
- // Create possibly bigger array to ensure that it fits the number
- this.length = Math.ceil((number.length - start) / 6);
- this.words = new Array(this.length);
- for (var i = 0; i < this.length; i++) {
- this.words[i] = 0;
- }
- // 24-bits chunks
- var off = 0;
- var j = 0;
- var w;
- if (endian === 'be') {
- for (i = number.length - 1; i >= start; i -= 2) {
- w = parseHexByte(number, start, i) << off;
- this.words[j] |= w & 0x3ffffff;
- if (off >= 18) {
- off -= 18;
- j += 1;
- this.words[j] |= w >>> 26;
- } else {
- off += 8;
- }
- }
- } else {
- var parseLength = number.length - start;
- for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) {
- w = parseHexByte(number, start, i) << off;
- this.words[j] |= w & 0x3ffffff;
- if (off >= 18) {
- off -= 18;
- j += 1;
- this.words[j] |= w >>> 26;
- } else {
- off += 8;
- }
- }
- }
- this.strip();
- };
- function parseBase (str, start, end, mul) {
- var r = 0;
- var len = Math.min(str.length, end);
- for (var i = start; i < len; i++) {
- var c = str.charCodeAt(i) - 48;
- r *= mul;
- // 'a'
- if (c >= 49) {
- r += c - 49 + 0xa;
- // 'A'
- } else if (c >= 17) {
- r += c - 17 + 0xa;
- // '0' - '9'
- } else {
- r += c;
- }
- }
- return r;
- }
- BN.prototype._parseBase = function _parseBase (number, base, start) {
- // Initialize as zero
- this.words = [ 0 ];
- this.length = 1;
- // Find length of limb in base
- for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) {
- limbLen++;
- }
- limbLen--;
- limbPow = (limbPow / base) | 0;
- var total = number.length - start;
- var mod = total % limbLen;
- var end = Math.min(total, total - mod) + start;
- var word = 0;
- for (var i = start; i < end; i += limbLen) {
- word = parseBase(number, i, i + limbLen, base);
- this.imuln(limbPow);
- if (this.words[0] + word < 0x4000000) {
- this.words[0] += word;
- } else {
- this._iaddn(word);
- }
- }
- if (mod !== 0) {
- var pow = 1;
- word = parseBase(number, i, number.length, base);
- for (i = 0; i < mod; i++) {
- pow *= base;
- }
- this.imuln(pow);
- if (this.words[0] + word < 0x4000000) {
- this.words[0] += word;
- } else {
- this._iaddn(word);
- }
- }
- this.strip();
- };
- BN.prototype.copy = function copy (dest) {
- dest.words = new Array(this.length);
- for (var i = 0; i < this.length; i++) {
- dest.words[i] = this.words[i];
- }
- dest.length = this.length;
- dest.negative = this.negative;
- dest.red = this.red;
- };
- BN.prototype.clone = function clone () {
- var r = new BN(null);
- this.copy(r);
- return r;
- };
- BN.prototype._expand = function _expand (size) {
- while (this.length < size) {
- this.words[this.length++] = 0;
- }
- return this;
- };
- // Remove leading `0` from `this`
- BN.prototype.strip = function strip () {
- while (this.length > 1 && this.words[this.length - 1] === 0) {
- this.length--;
- }
- return this._normSign();
- };
- BN.prototype._normSign = function _normSign () {
- // -0 = 0
- if (this.length === 1 && this.words[0] === 0) {
- this.negative = 0;
- }
- return this;
- };
- BN.prototype.inspect = function inspect () {
- return (this.red ? '<BN-R: ' : '<BN: ') + this.toString(16) + '>';
- };
- /*
- var zeros = [];
- var groupSizes = [];
- var groupBases = [];
- var s = '';
- var i = -1;
- while (++i < BN.wordSize) {
- zeros[i] = s;
- s += '0';
- }
- groupSizes[0] = 0;
- groupSizes[1] = 0;
- groupBases[0] = 0;
- groupBases[1] = 0;
- var base = 2 - 1;
- while (++base < 36 + 1) {
- var groupSize = 0;
- var groupBase = 1;
- while (groupBase < (1 << BN.wordSize) / base) {
- groupBase *= base;
- groupSize += 1;
- }
- groupSizes[base] = groupSize;
- groupBases[base] = groupBase;
- }
- */
- var zeros = [
- '',
- '0',
- '00',
- '000',
- '0000',
- '00000',
- '000000',
- '0000000',
- '00000000',
- '000000000',
- '0000000000',
- '00000000000',
- '000000000000',
- '0000000000000',
- '00000000000000',
- '000000000000000',
- '0000000000000000',
- '00000000000000000',
- '000000000000000000',
- '0000000000000000000',
- '00000000000000000000',
- '000000000000000000000',
- '0000000000000000000000',
- '00000000000000000000000',
- '000000000000000000000000',
- '0000000000000000000000000'
- ];
- var groupSizes = [
- 0, 0,
- 25, 16, 12, 11, 10, 9, 8,
- 8, 7, 7, 7, 7, 6, 6,
- 6, 6, 6, 6, 6, 5, 5,
- 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5
- ];
- var groupBases = [
- 0, 0,
- 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216,
- 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625,
- 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632,
- 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149,
- 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176
- ];
- BN.prototype.toString = function toString (base, padding) {
- base = base || 10;
- padding = padding | 0 || 1;
- var out;
- if (base === 16 || base === 'hex') {
- out = '';
- var off = 0;
- var carry = 0;
- for (var i = 0; i < this.length; i++) {
- var w = this.words[i];
- var word = (((w << off) | carry) & 0xffffff).toString(16);
- carry = (w >>> (24 - off)) & 0xffffff;
- if (carry !== 0 || i !== this.length - 1) {
- out = zeros[6 - word.length] + word + out;
- } else {
- out = word + out;
- }
- off += 2;
- if (off >= 26) {
- off -= 26;
- i--;
- }
- }
- if (carry !== 0) {
- out = carry.toString(16) + out;
- }
- while (out.length % padding !== 0) {
- out = '0' + out;
- }
- if (this.negative !== 0) {
- out = '-' + out;
- }
- return out;
- }
- if (base === (base | 0) && base >= 2 && base <= 36) {
- // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));
- var groupSize = groupSizes[base];
- // var groupBase = Math.pow(base, groupSize);
- var groupBase = groupBases[base];
- out = '';
- var c = this.clone();
- c.negative = 0;
- while (!c.isZero()) {
- var r = c.modn(groupBase).toString(base);
- c = c.idivn(groupBase);
- if (!c.isZero()) {
- out = zeros[groupSize - r.length] + r + out;
- } else {
- out = r + out;
- }
- }
- if (this.isZero()) {
- out = '0' + out;
- }
- while (out.length % padding !== 0) {
- out = '0' + out;
- }
- if (this.negative !== 0) {
- out = '-' + out;
- }
- return out;
- }
- assert(false, 'Base should be between 2 and 36');
- };
- BN.prototype.toNumber = function toNumber () {
- var ret = this.words[0];
- if (this.length === 2) {
- ret += this.words[1] * 0x4000000;
- } else if (this.length === 3 && this.words[2] === 0x01) {
- // NOTE: at this stage it is known that the top bit is set
- ret += 0x10000000000000 + (this.words[1] * 0x4000000);
- } else if (this.length > 2) {
- assert(false, 'Number can only safely store up to 53 bits');
- }
- return (this.negative !== 0) ? -ret : ret;
- };
- BN.prototype.toJSON = function toJSON () {
- return this.toString(16);
- };
- BN.prototype.toBuffer = function toBuffer (endian, length) {
- assert(typeof Buffer !== 'undefined');
- return this.toArrayLike(Buffer, endian, length);
- };
- BN.prototype.toArray = function toArray (endian, length) {
- return this.toArrayLike(Array, endian, length);
- };
- BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) {
- var byteLength = this.byteLength();
- var reqLength = length || Math.max(1, byteLength);
- assert(byteLength <= reqLength, 'byte array longer than desired length');
- assert(reqLength > 0, 'Requested array length <= 0');
- this.strip();
- var littleEndian = endian === 'le';
- var res = new ArrayType(reqLength);
- var b, i;
- var q = this.clone();
- if (!littleEndian) {
- // Assume big-endian
- for (i = 0; i < reqLength - byteLength; i++) {
- res[i] = 0;
- }
- for (i = 0; !q.isZero(); i++) {
- b = q.andln(0xff);
- q.iushrn(8);
- res[reqLength - i - 1] = b;
- }
- } else {
- for (i = 0; !q.isZero(); i++) {
- b = q.andln(0xff);
- q.iushrn(8);
- res[i] = b;
- }
- for (; i < reqLength; i++) {
- res[i] = 0;
- }
- }
- return res;
- };
- if (Math.clz32) {
- BN.prototype._countBits = function _countBits (w) {
- return 32 - Math.clz32(w);
- };
- } else {
- BN.prototype._countBits = function _countBits (w) {
- var t = w;
- var r = 0;
- if (t >= 0x1000) {
- r += 13;
- t >>>= 13;
- }
- if (t >= 0x40) {
- r += 7;
- t >>>= 7;
- }
- if (t >= 0x8) {
- r += 4;
- t >>>= 4;
- }
- if (t >= 0x02) {
- r += 2;
- t >>>= 2;
- }
- return r + t;
- };
- }
- BN.prototype._zeroBits = function _zeroBits (w) {
- // Short-cut
- if (w === 0) return 26;
- var t = w;
- var r = 0;
- if ((t & 0x1fff) === 0) {
- r += 13;
- t >>>= 13;
- }
- if ((t & 0x7f) === 0) {
- r += 7;
- t >>>= 7;
- }
- if ((t & 0xf) === 0) {
- r += 4;
- t >>>= 4;
- }
- if ((t & 0x3) === 0) {
- r += 2;
- t >>>= 2;
- }
- if ((t & 0x1) === 0) {
- r++;
- }
- return r;
- };
- // Return number of used bits in a BN
- BN.prototype.bitLength = function bitLength () {
- var w = this.words[this.length - 1];
- var hi = this._countBits(w);
- return (this.length - 1) * 26 + hi;
- };
- function toBitArray (num) {
- var w = new Array(num.bitLength());
- for (var bit = 0; bit < w.length; bit++) {
- var off = (bit / 26) | 0;
- var wbit = bit % 26;
- w[bit] = (num.words[off] & (1 << wbit)) >>> wbit;
- }
- return w;
- }
- // Number of trailing zero bits
- BN.prototype.zeroBits = function zeroBits () {
- if (this.isZero()) return 0;
- var r = 0;
- for (var i = 0; i < this.length; i++) {
- var b = this._zeroBits(this.words[i]);
- r += b;
- if (b !== 26) break;
- }
- return r;
- };
- BN.prototype.byteLength = function byteLength () {
- return Math.ceil(this.bitLength() / 8);
- };
- BN.prototype.toTwos = function toTwos (width) {
- if (this.negative !== 0) {
- return this.abs().inotn(width).iaddn(1);
- }
- return this.clone();
- };
- BN.prototype.fromTwos = function fromTwos (width) {
- if (this.testn(width - 1)) {
- return this.notn(width).iaddn(1).ineg();
- }
- return this.clone();
- };
- BN.prototype.isNeg = function isNeg () {
- return this.negative !== 0;
- };
- // Return negative clone of `this`
- BN.prototype.neg = function neg () {
- return this.clone().ineg();
- };
- BN.prototype.ineg = function ineg () {
- if (!this.isZero()) {
- this.negative ^= 1;
- }
- return this;
- };
- // Or `num` with `this` in-place
- BN.prototype.iuor = function iuor (num) {
- while (this.length < num.length) {
- this.words[this.length++] = 0;
- }
- for (var i = 0; i < num.length; i++) {
- this.words[i] = this.words[i] | num.words[i];
- }
- return this.strip();
- };
- BN.prototype.ior = function ior (num) {
- assert((this.negative | num.negative) === 0);
- return this.iuor(num);
- };
- // Or `num` with `this`
- BN.prototype.or = function or (num) {
- if (this.length > num.length) return this.clone().ior(num);
- return num.clone().ior(this);
- };
- BN.prototype.uor = function uor (num) {
- if (this.length > num.length) return this.clone().iuor(num);
- return num.clone().iuor(this);
- };
- // And `num` with `this` in-place
- BN.prototype.iuand = function iuand (num) {
- // b = min-length(num, this)
- var b;
- if (this.length > num.length) {
- b = num;
- } else {
- b = this;
- }
- for (var i = 0; i < b.length; i++) {
- this.words[i] = this.words[i] & num.words[i];
- }
- this.length = b.length;
- return this.strip();
- };
- BN.prototype.iand = function iand (num) {
- assert((this.negative | num.negative) === 0);
- return this.iuand(num);
- };
- // And `num` with `this`
- BN.prototype.and = function and (num) {
- if (this.length > num.length) return this.clone().iand(num);
- return num.clone().iand(this);
- };
- BN.prototype.uand = function uand (num) {
- if (this.length > num.length) return this.clone().iuand(num);
- return num.clone().iuand(this);
- };
- // Xor `num` with `this` in-place
- BN.prototype.iuxor = function iuxor (num) {
- // a.length > b.length
- var a;
- var b;
- if (this.length > num.length) {
- a = this;
- b = num;
- } else {
- a = num;
- b = this;
- }
- for (var i = 0; i < b.length; i++) {
- this.words[i] = a.words[i] ^ b.words[i];
- }
- if (this !== a) {
- for (; i < a.length; i++) {
- this.words[i] = a.words[i];
- }
- }
- this.length = a.length;
- return this.strip();
- };
- BN.prototype.ixor = function ixor (num) {
- assert((this.negative | num.negative) === 0);
- return this.iuxor(num);
- };
- // Xor `num` with `this`
- BN.prototype.xor = function xor (num) {
- if (this.length > num.length) return this.clone().ixor(num);
- return num.clone().ixor(this);
- };
- BN.prototype.uxor = function uxor (num) {
- if (this.length > num.length) return this.clone().iuxor(num);
- return num.clone().iuxor(this);
- };
- // Not ``this`` with ``width`` bitwidth
- BN.prototype.inotn = function inotn (width) {
- assert(typeof width === 'number' && width >= 0);
- var bytesNeeded = Math.ceil(width / 26) | 0;
- var bitsLeft = width % 26;
- // Extend the buffer with leading zeroes
- this._expand(bytesNeeded);
- if (bitsLeft > 0) {
- bytesNeeded--;
- }
- // Handle complete words
- for (var i = 0; i < bytesNeeded; i++) {
- this.words[i] = ~this.words[i] & 0x3ffffff;
- }
- // Handle the residue
- if (bitsLeft > 0) {
- this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft));
- }
- // And remove leading zeroes
- return this.strip();
- };
- BN.prototype.notn = function notn (width) {
- return this.clone().inotn(width);
- };
- // Set `bit` of `this`
- BN.prototype.setn = function setn (bit, val) {
- assert(typeof bit === 'number' && bit >= 0);
- var off = (bit / 26) | 0;
- var wbit = bit % 26;
- this._expand(off + 1);
- if (val) {
- this.words[off] = this.words[off] | (1 << wbit);
- } else {
- this.words[off] = this.words[off] & ~(1 << wbit);
- }
- return this.strip();
- };
- // Add `num` to `this` in-place
- BN.prototype.iadd = function iadd (num) {
- var r;
- // negative + positive
- if (this.negative !== 0 && num.negative === 0) {
- this.negative = 0;
- r = this.isub(num);
- this.negative ^= 1;
- return this._normSign();
- // positive + negative
- } else if (this.negative === 0 && num.negative !== 0) {
- num.negative = 0;
- r = this.isub(num);
- num.negative = 1;
- return r._normSign();
- }
- // a.length > b.length
- var a, b;
- if (this.length > num.length) {
- a = this;
- b = num;
- } else {
- a = num;
- b = this;
- }
- var carry = 0;
- for (var i = 0; i < b.length; i++) {
- r = (a.words[i] | 0) + (b.words[i] | 0) + carry;
- this.words[i] = r & 0x3ffffff;
- carry = r >>> 26;
- }
- for (; carry !== 0 && i < a.length; i++) {
- r = (a.words[i] | 0) + carry;
- this.words[i] = r & 0x3ffffff;
- carry = r >>> 26;
- }
- this.length = a.length;
- if (carry !== 0) {
- this.words[this.length] = carry;
- this.length++;
- // Copy the rest of the words
- } else if (a !== this) {
- for (; i < a.length; i++) {
- this.words[i] = a.words[i];
- }
- }
- return this;
- };
- // Add `num` to `this`
- BN.prototype.add = function add (num) {
- var res;
- if (num.negative !== 0 && this.negative === 0) {
- num.negative = 0;
- res = this.sub(num);
- num.negative ^= 1;
- return res;
- } else if (num.negative === 0 && this.negative !== 0) {
- this.negative = 0;
- res = num.sub(this);
- this.negative = 1;
- return res;
- }
- if (this.length > num.length) return this.clone().iadd(num);
- return num.clone().iadd(this);
- };
- // Subtract `num` from `this` in-place
- BN.prototype.isub = function isub (num) {
- // this - (-num) = this + num
- if (num.negative !== 0) {
- num.negative = 0;
- var r = this.iadd(num);
- num.negative = 1;
- return r._normSign();
- // -this - num = -(this + num)
- } else if (this.negative !== 0) {
- this.negative = 0;
- this.iadd(num);
- this.negative = 1;
- return this._normSign();
- }
- // At this point both numbers are positive
- var cmp = this.cmp(num);
- // Optimization - zeroify
- if (cmp === 0) {
- this.negative = 0;
- this.length = 1;
- this.words[0] = 0;
- return this;
- }
- // a > b
- var a, b;
- if (cmp > 0) {
- a = this;
- b = num;
- } else {
- a = num;
- b = this;
- }
- var carry = 0;
- for (var i = 0; i < b.length; i++) {
- r = (a.words[i] | 0) - (b.words[i] | 0) + carry;
- carry = r >> 26;
- this.words[i] = r & 0x3ffffff;
- }
- for (; carry !== 0 && i < a.length; i++) {
- r = (a.words[i] | 0) + carry;
- carry = r >> 26;
- this.words[i] = r & 0x3ffffff;
- }
- // Copy rest of the words
- if (carry === 0 && i < a.length && a !== this) {
- for (; i < a.length; i++) {
- this.words[i] = a.words[i];
- }
- }
- this.length = Math.max(this.length, i);
- if (a !== this) {
- this.negative = 1;
- }
- return this.strip();
- };
- // Subtract `num` from `this`
- BN.prototype.sub = function sub (num) {
- return this.clone().isub(num);
- };
- function smallMulTo (self, num, out) {
- out.negative = num.negative ^ self.negative;
- var len = (self.length + num.length) | 0;
- out.length = len;
- len = (len - 1) | 0;
- // Peel one iteration (compiler can't do it, because of code complexity)
- var a = self.words[0] | 0;
- var b = num.words[0] | 0;
- var r = a * b;
- var lo = r & 0x3ffffff;
- var carry = (r / 0x4000000) | 0;
- out.words[0] = lo;
- for (var k = 1; k < len; k++) {
- // Sum all words with the same `i + j = k` and accumulate `ncarry`,
- // note that ncarry could be >= 0x3ffffff
- var ncarry = carry >>> 26;
- var rword = carry & 0x3ffffff;
- var maxJ = Math.min(k, num.length - 1);
- for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {
- var i = (k - j) | 0;
- a = self.words[i] | 0;
- b = num.words[j] | 0;
- r = a * b + rword;
- ncarry += (r / 0x4000000) | 0;
- rword = r & 0x3ffffff;
- }
- out.words[k] = rword | 0;
- carry = ncarry | 0;
- }
- if (carry !== 0) {
- out.words[k] = carry | 0;
- } else {
- out.length--;
- }
- return out.strip();
- }
- // TODO(indutny): it may be reasonable to omit it for users who don't need
- // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit
- // multiplication (like elliptic secp256k1).
- var comb10MulTo = function comb10MulTo (self, num, out) {
- var a = self.words;
- var b = num.words;
- var o = out.words;
- var c = 0;
- var lo;
- var mid;
- var hi;
- var a0 = a[0] | 0;
- var al0 = a0 & 0x1fff;
- var ah0 = a0 >>> 13;
- var a1 = a[1] | 0;
- var al1 = a1 & 0x1fff;
- var ah1 = a1 >>> 13;
- var a2 = a[2] | 0;
- var al2 = a2 & 0x1fff;
- var ah2 = a2 >>> 13;
- var a3 = a[3] | 0;
- var al3 = a3 & 0x1fff;
- var ah3 = a3 >>> 13;
- var a4 = a[4] | 0;
- var al4 = a4 & 0x1fff;
- var ah4 = a4 >>> 13;
- var a5 = a[5] | 0;
- var al5 = a5 & 0x1fff;
- var ah5 = a5 >>> 13;
- var a6 = a[6] | 0;
- var al6 = a6 & 0x1fff;
- var ah6 = a6 >>> 13;
- var a7 = a[7] | 0;
- var al7 = a7 & 0x1fff;
- var ah7 = a7 >>> 13;
- var a8 = a[8] | 0;
- var al8 = a8 & 0x1fff;
- var ah8 = a8 >>> 13;
- var a9 = a[9] | 0;
- var al9 = a9 & 0x1fff;
- var ah9 = a9 >>> 13;
- var b0 = b[0] | 0;
- var bl0 = b0 & 0x1fff;
- var bh0 = b0 >>> 13;
- var b1 = b[1] | 0;
- var bl1 = b1 & 0x1fff;
- var bh1 = b1 >>> 13;
- var b2 = b[2] | 0;
- var bl2 = b2 & 0x1fff;
- var bh2 = b2 >>> 13;
- var b3 = b[3] | 0;
- var bl3 = b3 & 0x1fff;
- var bh3 = b3 >>> 13;
- var b4 = b[4] | 0;
- var bl4 = b4 & 0x1fff;
- var bh4 = b4 >>> 13;
- var b5 = b[5] | 0;
- var bl5 = b5 & 0x1fff;
- var bh5 = b5 >>> 13;
- var b6 = b[6] | 0;
- var bl6 = b6 & 0x1fff;
- var bh6 = b6 >>> 13;
- var b7 = b[7] | 0;
- var bl7 = b7 & 0x1fff;
- var bh7 = b7 >>> 13;
- var b8 = b[8] | 0;
- var bl8 = b8 & 0x1fff;
- var bh8 = b8 >>> 13;
- var b9 = b[9] | 0;
- var bl9 = b9 & 0x1fff;
- var bh9 = b9 >>> 13;
- out.negative = self.negative ^ num.negative;
- out.length = 19;
- /* k = 0 */
- lo = Math.imul(al0, bl0);
- mid = Math.imul(al0, bh0);
- mid = (mid + Math.imul(ah0, bl0)) | 0;
- hi = Math.imul(ah0, bh0);
- var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
- c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0;
- w0 &= 0x3ffffff;
- /* k = 1 */
- lo = Math.imul(al1, bl0);
- mid = Math.imul(al1, bh0);
- mid = (mid + Math.imul(ah1, bl0)) | 0;
- hi = Math.imul(ah1, bh0);
- lo = (lo + Math.imul(al0, bl1)) | 0;
- mid = (mid + Math.imul(al0, bh1)) | 0;
- mid = (mid + Math.imul(ah0, bl1)) | 0;
- hi = (hi + Math.imul(ah0, bh1)) | 0;
- var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
- c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0;
- w1 &= 0x3ffffff;
- /* k = 2 */
- lo = Math.imul(al2, bl0);
- mid = Math.imul(al2, bh0);
- mid = (mid + Math.imul(ah2, bl0)) | 0;
- hi = Math.imul(ah2, bh0);
- lo = (lo + Math.imul(al1, bl1)) | 0;
- mid = (mid + Math.imul(al1, bh1)) | 0;
- mid = (mid + Math.imul(ah1, bl1)) | 0;
- hi = (hi + Math.imul(ah1, bh1)) | 0;
- lo = (lo + Math.imul(al0, bl2)) | 0;
- mid = (mid + Math.imul(al0, bh2)) | 0;
- mid = (mid + Math.imul(ah0, bl2)) | 0;
- hi = (hi + Math.imul(ah0, bh2)) | 0;
- var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
- c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0;
- w2 &= 0x3ffffff;
- /* k = 3 */
- lo = Math.imul(al3, bl0);
- mid = Math.imul(al3, bh0);
- mid = (mid + Math.imul(ah3, bl0)) | 0;
- hi = Math.imul(ah3, bh0);
- lo = (lo + Math.imul(al2, bl1)) | 0;
- mid = (mid + Math.imul(al2, bh1)) | 0;
- mid = (mid + Math.imul(ah2, bl1)) | 0;
- hi = (hi + Math.imul(ah2, bh1)) | 0;
- lo = (lo + Math.imul(al1, bl2)) | 0;
- mid = (mid + Math.imul(al1, bh2)) | 0;
- mid = (mid + Math.imul(ah1, bl2)) | 0;
- hi = (hi + Math.imul(ah1, bh2)) | 0;
- lo = (lo + Math.imul(al0, bl3)) | 0;
- mid = (mid + Math.imul(al0, bh3)) | 0;
- mid = (mid + Math.imul(ah0, bl3)) | 0;
- hi = (hi + Math.imul(ah0, bh3)) | 0;
- var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
- c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0;
- w3 &= 0x3ffffff;
- /* k = 4 */
- lo = Math.imul(al4, bl0);
- mid = Math.imul(al4, bh0);
- mid = (mid + Math.imul(ah4, bl0)) | 0;
- hi = Math.imul(ah4, bh0);
- lo = (lo + Math.imul(al3, bl1)) | 0;
- mid = (mid + Math.imul(al3, bh1)) | 0;
- mid = (mid + Math.imul(ah3, bl1)) | 0;
- hi = (hi + Math.imul(ah3, bh1)) | 0;
- lo = (lo + Math.imul(al2, bl2)) | 0;
- mid = (mid + Math.imul(al2, bh2)) | 0;
- mid = (mid + Math.imul(ah2, bl2)) | 0;
- hi = (hi + Math.imul(ah2, bh2)) | 0;
- lo = (lo + Math.imul(al1, bl3)) | 0;
- mid = (mid + Math.imul(al1, bh3)) | 0;
- mid = (mid + Math.imul(ah1, bl3)) | 0;
- hi = (hi + Math.imul(ah1, bh3)) | 0;
- lo = (lo + Math.imul(al0, bl4)) | 0;
- mid = (mid + Math.imul(al0, bh4)) | 0;
- mid = (mid + Math.imul(ah0, bl4)) | 0;
- hi = (hi + Math.imul(ah0, bh4)) | 0;
- var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
- c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0;
- w4 &= 0x3ffffff;
- /* k = 5 */
- lo = Math.imul(al5, bl0);
- mid = Math.imul(al5, bh0);
- mid = (mid + Math.imul(ah5, bl0)) | 0;
- hi = Math.imul(ah5, bh0);
- lo = (lo + Math.imul(al4, bl1)) | 0;
- mid = (mid + Math.imul(al4, bh1)) | 0;
- mid = (mid + Math.imul(ah4, bl1)) | 0;
- hi = (hi + Math.imul(ah4, bh1)) | 0;
- lo = (lo + Math.imul(al3, bl2)) | 0;
- mid = (mid + Math.imul(al3, bh2)) | 0;
- mid = (mid + Math.imul(ah3, bl2)) | 0;
- hi = (hi + Math.imul(ah3, bh2)) | 0;
- lo = (lo + Math.imul(al2, bl3)) | 0;
- mid = (mid + Math.imul(al2, bh3)) | 0;
- mid = (mid + Math.imul(ah2, bl3)) | 0;
- hi = (hi + Math.imul(ah2, bh3)) | 0;
- lo = (lo + Math.imul(al1, bl4)) | 0;
- mid = (mid + Math.imul(al1, bh4)) | 0;
- mid = (mid + Math.imul(ah1, bl4)) | 0;
- hi = (hi + Math.imul(ah1, bh4)) | 0;
- lo = (lo + Math.imul(al0, bl5)) | 0;
- mid = (mid + Math.imul(al0, bh5)) | 0;
- mid = (mid + Math.imul(ah0, bl5)) | 0;
- hi = (hi + Math.imul(ah0, bh5)) | 0;
- var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
- c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0;
- w5 &= 0x3ffffff;
- /* k = 6 */
- lo = Math.imul(al6, bl0);
- mid = Math.imul(al6, bh0);
- mid = (mid + Math.imul(ah6, bl0)) | 0;
- hi = Math.imul(ah6, bh0);
- lo = (lo + Math.imul(al5, bl1)) | 0;
- mid = (mid + Math.imul(al5, bh1)) | 0;
- mid = (mid + Math.imul(ah5, bl1)) | 0;
- hi = (hi + Math.imul(ah5, bh1)) | 0;
- lo = (lo + Math.imul(al4, bl2)) | 0;
- mid = (mid + Math.imul(al4, bh2)) | 0;
- mid = (mid + Math.imul(ah4, bl2)) | 0;
- hi = (hi + Math.imul(ah4, bh2)) | 0;
- lo = (lo + Math.imul(al3, bl3)) | 0;
- mid = (mid + Math.imul(al3, bh3)) | 0;
- mid = (mid + Math.imul(ah3, bl3)) | 0;
- hi = (hi + Math.imul(ah3, bh3)) | 0;
- lo = (lo + Math.imul(al2, bl4)) | 0;
- mid = (mid + Math.imul(al2, bh4)) | 0;
- mid = (mid + Math.imul(ah2, bl4)) | 0;
- hi = (hi + Math.imul(ah2, bh4)) | 0;
- lo = (lo + Math.imul(al1, bl5)) | 0;
- mid = (mid + Math.imul(al1, bh5)) | 0;
- mid = (mid + Math.imul(ah1, bl5)) | 0;
- hi = (hi + Math.imul(ah1, bh5)) | 0;
- lo = (lo + Math.imul(al0, bl6)) | 0;
- mid = (mid + Math.imul(al0, bh6)) | 0;
- mid = (mid + Math.imul(ah0, bl6)) | 0;
- hi = (hi + Math.imul(ah0, bh6)) | 0;
- var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
- c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0;
- w6 &= 0x3ffffff;
- /* k = 7 */
- lo = Math.imul(al7, bl0);
- mid = Math.imul(al7, bh0);
- mid = (mid + Math.imul(ah7, bl0)) | 0;
- hi = Math.imul(ah7, bh0);
- lo = (lo + Math.imul(al6, bl1)) | 0;
- mid = (mid + Math.imul(al6, bh1)) | 0;
- mid = (mid + Math.imul(ah6, bl1)) | 0;
- hi = (hi + Math.imul(ah6, bh1)) | 0;
- lo = (lo + Math.imul(al5, bl2)) | 0;
- mid = (mid + Math.imul(al5, bh2)) | 0;
- mid = (mid + Math.imul(ah5, bl2)) | 0;
- hi = (hi + Math.imul(ah5, bh2)) | 0;
- lo = (lo + Math.imul(al4, bl3)) | 0;
- mid = (mid + Math.imul(al4, bh3)) | 0;
- mid = (mid + Math.imul(ah4, bl3)) | 0;
- hi = (hi + Math.imul(ah4, bh3)) | 0;
- lo = (lo + Math.imul(al3, bl4)) | 0;
- mid = (mid + Math.imul(al3, bh4)) | 0;
- mid = (mid + Math.imul(ah3, bl4)) | 0;
- hi = (hi + Math.imul(ah3, bh4)) | 0;
- lo = (lo + Math.imul(al2, bl5)) | 0;
- mid = (mid + Math.imul(al2, bh5)) | 0;
- mid = (mid + Math.imul(ah2, bl5)) | 0;
- hi = (hi + Math.imul(ah2, bh5)) | 0;
- lo = (lo + Math.imul(al1, bl6)) | 0;
- mid = (mid + Math.imul(al1, bh6)) | 0;
- mid = (mid + Math.imul(ah1, bl6)) | 0;
- hi = (hi + Math.imul(ah1, bh6)) | 0;
- lo = (lo + Math.imul(al0, bl7)) | 0;
- mid = (mid + Math.imul(al0, bh7)) | 0;
- mid = (mid + Math.imul(ah0, bl7)) | 0;
- hi = (hi + Math.imul(ah0, bh7)) | 0;
- var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
- c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0;
- w7 &= 0x3ffffff;
- /* k = 8 */
- lo = Math.imul(al8, bl0);
- mid = Math.imul(al8, bh0);
- mid = (mid + Math.imul(ah8, bl0)) | 0;
- hi = Math.imul(ah8, bh0);
- lo = (lo + Math.imul(al7, bl1)) | 0;
- mid = (mid + Math.imul(al7, bh1)) | 0;
- mid = (mid + Math.imul(ah7, bl1)) | 0;
- hi = (hi + Math.imul(ah7, bh1)) | 0;
- lo = (lo + Math.imul(al6, bl2)) | 0;
- mid = (mid + Math.imul(al6, bh2)) | 0;
- mid = (mid + Math.imul(ah6, bl2)) | 0;
- hi = (hi + Math.imul(ah6, bh2)) | 0;
- lo = (lo + Math.imul(al5, bl3)) | 0;
- mid = (mid + Math.imul(al5, bh3)) | 0;
- mid = (mid + Math.imul(ah5, bl3)) | 0;
- hi = (hi + Math.imul(ah5, bh3)) | 0;
- lo = (lo + Math.imul(al4, bl4)) | 0;
- mid = (mid + Math.imul(al4, bh4)) | 0;
- mid = (mid + Math.imul(ah4, bl4)) | 0;
- hi = (hi + Math.imul(ah4, bh4)) | 0;
- lo = (lo + Math.imul(al3, bl5)) | 0;
- mid = (mid + Math.imul(al3, bh5)) | 0;
- mid = (mid + Math.imul(ah3, bl5)) | 0;
- hi = (hi + Math.imul(ah3, bh5)) | 0;
- lo = (lo + Math.imul(al2, bl6)) | 0;
- mid = (mid + Math.imul(al2, bh6)) | 0;
- mid = (mid + Math.imul(ah2, bl6)) | 0;
- hi = (hi + Math.imul(ah2, bh6)) | 0;
- lo = (lo + Math.imul(al1, bl7)) | 0;
- mid = (mid + Math.imul(al1, bh7)) | 0;
- mid = (mid + Math.imul(ah1, bl7)) | 0;
- hi = (hi + Math.imul(ah1, bh7)) | 0;
- lo = (lo + Math.imul(al0, bl8)) | 0;
- mid = (mid + Math.imul(al0, bh8)) | 0;
- mid = (mid + Math.imul(ah0, bl8)) | 0;
- hi = (hi + Math.imul(ah0, bh8)) | 0;
- var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
- c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0;
- w8 &= 0x3ffffff;
- /* k = 9 */
- lo = Math.imul(al9, bl0);
- mid = Math.imul(al9, bh0);
- mid = (mid + Math.imul(ah9, bl0)) | 0;
- hi = Math.imul(ah9, bh0);
- lo = (lo + Math.imul(al8, bl1)) | 0;
- mid = (mid + Math.imul(al8, bh1)) | 0;
- mid = (mid + Math.imul(ah8, bl1)) | 0;
- hi = (hi + Math.imul(ah8, bh1)) | 0;
- lo = (lo + Math.imul(al7, bl2)) | 0;
- mid = (mid + Math.imul(al7, bh2)) | 0;
- mid = (mid + Math.imul(ah7, bl2)) | 0;
- hi = (hi + Math.imul(ah7, bh2)) | 0;
- lo = (lo + Math.imul(al6, bl3)) | 0;
- mid = (mid + Math.imul(al6, bh3)) | 0;
- mid = (mid + Math.imul(ah6, bl3)) | 0;
- hi = (hi + Math.imul(ah6, bh3)) | 0;
- lo = (lo + Math.imul(al5, bl4)) | 0;
- mid = (mid + Math.imul(al5, bh4)) | 0;
- mid = (mid + Math.imul(ah5, bl4)) | 0;
- hi = (hi + Math.imul(ah5, bh4)) | 0;
- lo = (lo + Math.imul(al4, bl5)) | 0;
- mid = (mid + Math.imul(al4, bh5)) | 0;
- mid = (mid + Math.imul(ah4, bl5)) | 0;
- hi = (hi + Math.imul(ah4, bh5)) | 0;
- lo = (lo + Math.imul(al3, bl6)) | 0;
- mid = (mid + Math.imul(al3, bh6)) | 0;
- mid = (mid + Math.imul(ah3, bl6)) | 0;
- hi = (hi + Math.imul(ah3, bh6)) | 0;
- lo = (lo + Math.imul(al2, bl7)) | 0;
- mid = (mid + Math.imul(al2, bh7)) | 0;
- mid = (mid + Math.imul(ah2, bl7)) | 0;
- hi = (hi + Math.imul(ah2, bh7)) | 0;
- lo = (lo + Math.imul(al1, bl8)) | 0;
- mid = (mid + Math.imul(al1, bh8)) | 0;
- mid = (mid + Math.imul(ah1, bl8)) | 0;
- hi = (hi + Math.imul(ah1, bh8)) | 0;
- lo = (lo + Math.imul(al0, bl9)) | 0;
- mid = (mid + Math.imul(al0, bh9)) | 0;
- mid = (mid + Math.imul(ah0, bl9)) | 0;
- hi = (hi + Math.imul(ah0, bh9)) | 0;
- var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
- c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0;
- w9 &= 0x3ffffff;
- /* k = 10 */
- lo = Math.imul(al9, bl1);
- mid = Math.imul(al9, bh1);
- mid = (mid + Math.imul(ah9, bl1)) | 0;
- hi = Math.imul(ah9, bh1);
- lo = (lo + Math.imul(al8, bl2)) | 0;
- mid = (mid + Math.imul(al8, bh2)) | 0;
- mid = (mid + Math.imul(ah8, bl2)) | 0;
- hi = (hi + Math.imul(ah8, bh2)) | 0;
- lo = (lo + Math.imul(al7, bl3)) | 0;
- mid = (mid + Math.imul(al7, bh3)) | 0;
- mid = (mid + Math.imul(ah7, bl3)) | 0;
- hi = (hi + Math.imul(ah7, bh3)) | 0;
- lo = (lo + Math.imul(al6, bl4)) | 0;
- mid = (mid + Math.imul(al6, bh4)) | 0;
- mid = (mid + Math.imul(ah6, bl4)) | 0;
- hi = (hi + Math.imul(ah6, bh4)) | 0;
- lo = (lo + Math.imul(al5, bl5)) | 0;
- mid = (mid + Math.imul(al5, bh5)) | 0;
- mid = (mid + Math.imul(ah5, bl5)) | 0;
- hi = (hi + Math.imul(ah5, bh5)) | 0;
- lo = (lo + Math.imul(al4, bl6)) | 0;
- mid = (mid + Math.imul(al4, bh6)) | 0;
- mid = (mid + Math.imul(ah4, bl6)) | 0;
- hi = (hi + Math.imul(ah4, bh6)) | 0;
- lo = (lo + Math.imul(al3, bl7)) | 0;
- mid = (mid + Math.imul(al3, bh7)) | 0;
- mid = (mid + Math.imul(ah3, bl7)) | 0;
- hi = (hi + Math.imul(ah3, bh7)) | 0;
- lo = (lo + Math.imul(al2, bl8)) | 0;
- mid = (mid + Math.imul(al2, bh8)) | 0;
- mid = (mid + Math.imul(ah2, bl8)) | 0;
- hi = (hi + Math.imul(ah2, bh8)) | 0;
- lo = (lo + Math.imul(al1, bl9)) | 0;
- mid = (mid + Math.imul(al1, bh9)) | 0;
- mid = (mid + Math.imul(ah1, bl9)) | 0;
- hi = (hi + Math.imul(ah1, bh9)) | 0;
- var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
- c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0;
- w10 &= 0x3ffffff;
- /* k = 11 */
- lo = Math.imul(al9, bl2);
- mid = Math.imul(al9, bh2);
- mid = (mid + Math.imul(ah9, bl2)) | 0;
- hi = Math.imul(ah9, bh2);
- lo = (lo + Math.imul(al8, bl3)) | 0;
- mid = (mid + Math.imul(al8, bh3)) | 0;
- mid = (mid + Math.imul(ah8, bl3)) | 0;
- hi = (hi + Math.imul(ah8, bh3)) | 0;
- lo = (lo + Math.imul(al7, bl4)) | 0;
- mid = (mid + Math.imul(al7, bh4)) | 0;
- mid = (mid + Math.imul(ah7, bl4)) | 0;
- hi = (hi + Math.imul(ah7, bh4)) | 0;
- lo = (lo + Math.imul(al6, bl5)) | 0;
- mid = (mid + Math.imul(al6, bh5)) | 0;
- mid = (mid + Math.imul(ah6, bl5)) | 0;
- hi = (hi + Math.imul(ah6, bh5)) | 0;
- lo = (lo + Math.imul(al5, bl6)) | 0;
- mid = (mid + Math.imul(al5, bh6)) | 0;
- mid = (mid + Math.imul(ah5, bl6)) | 0;
- hi = (hi + Math.imul(ah5, bh6)) | 0;
- lo = (lo + Math.imul(al4, bl7)) | 0;
- mid = (mid + Math.imul(al4, bh7)) | 0;
- mid = (mid + Math.imul(ah4, bl7)) | 0;
- hi = (hi + Math.imul(ah4, bh7)) | 0;
- lo = (lo + Math.imul(al3, bl8)) | 0;
- mid = (mid + Math.imul(al3, bh8)) | 0;
- mid = (mid + Math.imul(ah3, bl8)) | 0;
- hi = (hi + Math.imul(ah3, bh8)) | 0;
- lo = (lo + Math.imul(al2, bl9)) | 0;
- mid = (mid + Math.imul(al2, bh9)) | 0;
- mid = (mid + Math.imul(ah2, bl9)) | 0;
- hi = (hi + Math.imul(ah2, bh9)) | 0;
- var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
- c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0;
- w11 &= 0x3ffffff;
- /* k = 12 */
- lo = Math.imul(al9, bl3);
- mid = Math.imul(al9, bh3);
- mid = (mid + Math.imul(ah9, bl3)) | 0;
- hi = Math.imul(ah9, bh3);
- lo = (lo + Math.imul(al8, bl4)) | 0;
- mid = (mid + Math.imul(al8, bh4)) | 0;
- mid = (mid + Math.imul(ah8, bl4)) | 0;
- hi = (hi + Math.imul(ah8, bh4)) | 0;
- lo = (lo + Math.imul(al7, bl5)) | 0;
- mid = (mid + Math.imul(al7, bh5)) | 0;
- mid = (mid + Math.imul(ah7, bl5)) | 0;
- hi = (hi + Math.imul(ah7, bh5)) | 0;
- lo = (lo + Math.imul(al6, bl6)) | 0;
- mid = (mid + Math.imul(al6, bh6)) | 0;
- mid = (mid + Math.imul(ah6, bl6)) | 0;
- hi = (hi + Math.imul(ah6, bh6)) | 0;
- lo = (lo + Math.imul(al5, bl7)) | 0;
- mid = (mid + Math.imul(al5, bh7)) | 0;
- mid = (mid + Math.imul(ah5, bl7)) | 0;
- hi = (hi + Math.imul(ah5, bh7)) | 0;
- lo = (lo + Math.imul(al4, bl8)) | 0;
- mid = (mid + Math.imul(al4, bh8)) | 0;
- mid = (mid + Math.imul(ah4, bl8)) | 0;
- hi = (hi + Math.imul(ah4, bh8)) | 0;
- lo = (lo + Math.imul(al3, bl9)) | 0;
- mid = (mid + Math.imul(al3, bh9)) | 0;
- mid = (mid + Math.imul(ah3, bl9)) | 0;
- hi = (hi + Math.imul(ah3, bh9)) | 0;
- var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
- c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0;
- w12 &= 0x3ffffff;
- /* k = 13 */
- lo = Math.imul(al9, bl4);
- mid = Math.imul(al9, bh4);
- mid = (mid + Math.imul(ah9, bl4)) | 0;
- hi = Math.imul(ah9, bh4);
- lo = (lo + Math.imul(al8, bl5)) | 0;
- mid = (mid + Math.imul(al8, bh5)) | 0;
- mid = (mid + Math.imul(ah8, bl5)) | 0;
- hi = (hi + Math.imul(ah8, bh5)) | 0;
- lo = (lo + Math.imul(al7, bl6)) | 0;
- mid = (mid + Math.imul(al7, bh6)) | 0;
- mid = (mid + Math.imul(ah7, bl6)) | 0;
- hi = (hi + Math.imul(ah7, bh6)) | 0;
- lo = (lo + Math.imul(al6, bl7)) | 0;
- mid = (mid + Math.imul(al6, bh7)) | 0;
- mid = (mid + Math.imul(ah6, bl7)) | 0;
- hi = (hi + Math.imul(ah6, bh7)) | 0;
- lo = (lo + Math.imul(al5, bl8)) | 0;
- mid = (mid + Math.imul(al5, bh8)) | 0;
- mid = (mid + Math.imul(ah5, bl8)) | 0;
- hi = (hi + Math.imul(ah5, bh8)) | 0;
- lo = (lo + Math.imul(al4, bl9)) | 0;
- mid = (mid + Math.imul(al4, bh9)) | 0;
- mid = (mid + Math.imul(ah4, bl9)) | 0;
- hi = (hi + Math.imul(ah4, bh9)) | 0;
- var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
- c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0;
- w13 &= 0x3ffffff;
- /* k = 14 */
- lo = Math.imul(al9, bl5);
- mid = Math.imul(al9, bh5);
- mid = (mid + Math.imul(ah9, bl5)) | 0;
- hi = Math.imul(ah9, bh5);
- lo = (lo + Math.imul(al8, bl6)) | 0;
- mid = (mid + Math.imul(al8, bh6)) | 0;
- mid = (mid + Math.imul(ah8, bl6)) | 0;
- hi = (hi + Math.imul(ah8, bh6)) | 0;
- lo = (lo + Math.imul(al7, bl7)) | 0;
- mid = (mid + Math.imul(al7, bh7)) | 0;
- mid = (mid + Math.imul(ah7, bl7)) | 0;
- hi = (hi + Math.imul(ah7, bh7)) | 0;
- lo = (lo + Math.imul(al6, bl8)) | 0;
- mid = (mid + Math.imul(al6, bh8)) | 0;
- mid = (mid + Math.imul(ah6, bl8)) | 0;
- hi = (hi + Math.imul(ah6, bh8)) | 0;
- lo = (lo + Math.imul(al5, bl9)) | 0;
- mid = (mid + Math.imul(al5, bh9)) | 0;
- mid = (mid + Math.imul(ah5, bl9)) | 0;
- hi = (hi + Math.imul(ah5, bh9)) | 0;
- var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
- c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0;
- w14 &= 0x3ffffff;
- /* k = 15 */
- lo = Math.imul(al9, bl6);
- mid = Math.imul(al9, bh6);
- mid = (mid + Math.imul(ah9, bl6)) | 0;
- hi = Math.imul(ah9, bh6);
- lo = (lo + Math.imul(al8, bl7)) | 0;
- mid = (mid + Math.imul(al8, bh7)) | 0;
- mid = (mid + Math.imul(ah8, bl7)) | 0;
- hi = (hi + Math.imul(ah8, bh7)) | 0;
- lo = (lo + Math.imul(al7, bl8)) | 0;
- mid = (mid + Math.imul(al7, bh8)) | 0;
- mid = (mid + Math.imul(ah7, bl8)) | 0;
- hi = (hi + Math.imul(ah7, bh8)) | 0;
- lo = (lo + Math.imul(al6, bl9)) | 0;
- mid = (mid + Math.imul(al6, bh9)) | 0;
- mid = (mid + Math.imul(ah6, bl9)) | 0;
- hi = (hi + Math.imul(ah6, bh9)) | 0;
- var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
- c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0;
- w15 &= 0x3ffffff;
- /* k = 16 */
- lo = Math.imul(al9, bl7);
- mid = Math.imul(al9, bh7);
- mid = (mid + Math.imul(ah9, bl7)) | 0;
- hi = Math.imul(ah9, bh7);
- lo = (lo + Math.imul(al8, bl8)) | 0;
- mid = (mid + Math.imul(al8, bh8)) | 0;
- mid = (mid + Math.imul(ah8, bl8)) | 0;
- hi = (hi + Math.imul(ah8, bh8)) | 0;
- lo = (lo + Math.imul(al7, bl9)) | 0;
- mid = (mid + Math.imul(al7, bh9)) | 0;
- mid = (mid + Math.imul(ah7, bl9)) | 0;
- hi = (hi + Math.imul(ah7, bh9)) | 0;
- var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
- c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0;
- w16 &= 0x3ffffff;
- /* k = 17 */
- lo = Math.imul(al9, bl8);
- mid = Math.imul(al9, bh8);
- mid = (mid + Math.imul(ah9, bl8)) | 0;
- hi = Math.imul(ah9, bh8);
- lo = (lo + Math.imul(al8, bl9)) | 0;
- mid = (mid + Math.imul(al8, bh9)) | 0;
- mid = (mid + Math.imul(ah8, bl9)) | 0;
- hi = (hi + Math.imul(ah8, bh9)) | 0;
- var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
- c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0;
- w17 &= 0x3ffffff;
- /* k = 18 */
- lo = Math.imul(al9, bl9);
- mid = Math.imul(al9, bh9);
- mid = (mid + Math.imul(ah9, bl9)) | 0;
- hi = Math.imul(ah9, bh9);
- var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
- c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0;
- w18 &= 0x3ffffff;
- o[0] = w0;
- o[1] = w1;
- o[2] = w2;
- o[3] = w3;
- o[4] = w4;
- o[5] = w5;
- o[6] = w6;
- o[7] = w7;
- o[8] = w8;
- o[9] = w9;
- o[10] = w10;
- o[11] = w11;
- o[12] = w12;
- o[13] = w13;
- o[14] = w14;
- o[15] = w15;
- o[16] = w16;
- o[17] = w17;
- o[18] = w18;
- if (c !== 0) {
- o[19] = c;
- out.length++;
- }
- return out;
- };
- // Polyfill comb
- if (!Math.imul) {
- comb10MulTo = smallMulTo;
- }
- function bigMulTo (self, num, out) {
- out.negative = num.negative ^ self.negative;
- out.length = self.length + num.length;
- var carry = 0;
- var hncarry = 0;
- for (var k = 0; k < out.length - 1; k++) {
- // Sum all words with the same `i + j = k` and accumulate `ncarry`,
- // note that ncarry could be >= 0x3ffffff
- var ncarry = hncarry;
- hncarry = 0;
- var rword = carry & 0x3ffffff;
- var maxJ = Math.min(k, num.length - 1);
- for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {
- var i = k - j;
- var a = self.words[i] | 0;
- var b = num.words[j] | 0;
- var r = a * b;
- var lo = r & 0x3ffffff;
- ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0;
- lo = (lo + rword) | 0;
- rword = lo & 0x3ffffff;
- ncarry = (ncarry + (lo >>> 26)) | 0;
- hncarry += ncarry >>> 26;
- ncarry &= 0x3ffffff;
- }
- out.words[k] = rword;
- carry = ncarry;
- ncarry = hncarry;
- }
- if (carry !== 0) {
- out.words[k] = carry;
- } else {
- out.length--;
- }
- return out.strip();
- }
- function jumboMulTo (self, num, out) {
- var fftm = new FFTM();
- return fftm.mulp(self, num, out);
- }
- BN.prototype.mulTo = function mulTo (num, out) {
- var res;
- var len = this.length + num.length;
- if (this.length === 10 && num.length === 10) {
- res = comb10MulTo(this, num, out);
- } else if (len < 63) {
- res = smallMulTo(this, num, out);
- } else if (len < 1024) {
- res = bigMulTo(this, num, out);
- } else {
- res = jumboMulTo(this, num, out);
- }
- return res;
- };
- // Cooley-Tukey algorithm for FFT
- // slightly revisited to rely on looping instead of recursion
- function FFTM (x, y) {
- this.x = x;
- this.y = y;
- }
- FFTM.prototype.makeRBT = function makeRBT (N) {
- var t = new Array(N);
- var l = BN.prototype._countBits(N) - 1;
- for (var i = 0; i < N; i++) {
- t[i] = this.revBin(i, l, N);
- }
- return t;
- };
- // Returns binary-reversed representation of `x`
- FFTM.prototype.revBin = function revBin (x, l, N) {
- if (x === 0 || x === N - 1) return x;
- var rb = 0;
- for (var i = 0; i < l; i++) {
- rb |= (x & 1) << (l - i - 1);
- x >>= 1;
- }
- return rb;
- };
- // Performs "tweedling" phase, therefore 'emulating'
- // behaviour of the recursive algorithm
- FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) {
- for (var i = 0; i < N; i++) {
- rtws[i] = rws[rbt[i]];
- itws[i] = iws[rbt[i]];
- }
- };
- FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) {
- this.permute(rbt, rws, iws, rtws, itws, N);
- for (var s = 1; s < N; s <<= 1) {
- var l = s << 1;
- var rtwdf = Math.cos(2 * Math.PI / l);
- var itwdf = Math.sin(2 * Math.PI / l);
- for (var p = 0; p < N; p += l) {
- var rtwdf_ = rtwdf;
- var itwdf_ = itwdf;
- for (var j = 0; j < s; j++) {
- var re = rtws[p + j];
- var ie = itws[p + j];
- var ro = rtws[p + j + s];
- var io = itws[p + j + s];
- var rx = rtwdf_ * ro - itwdf_ * io;
- io = rtwdf_ * io + itwdf_ * ro;
- ro = rx;
- rtws[p + j] = re + ro;
- itws[p + j] = ie + io;
- rtws[p + j + s] = re - ro;
- itws[p + j + s] = ie - io;
- /* jshint maxdepth : false */
- if (j !== l) {
- rx = rtwdf * rtwdf_ - itwdf * itwdf_;
- itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;
- rtwdf_ = rx;
- }
- }
- }
- }
- };
- FFTM.prototype.guessLen13b = function guessLen13b (n, m) {
- var N = Math.max(m, n) | 1;
- var odd = N & 1;
- var i = 0;
- for (N = N / 2 | 0; N; N = N >>> 1) {
- i++;
- }
- return 1 << i + 1 + odd;
- };
- FFTM.prototype.conjugate = function conjugate (rws, iws, N) {
- if (N <= 1) return;
- for (var i = 0; i < N / 2; i++) {
- var t = rws[i];
- rws[i] = rws[N - i - 1];
- rws[N - i - 1] = t;
- t = iws[i];
- iws[i] = -iws[N - i - 1];
- iws[N - i - 1] = -t;
- }
- };
- FFTM.prototype.normalize13b = function normalize13b (ws, N) {
- var carry = 0;
- for (var i = 0; i < N / 2; i++) {
- var w = Math.round(ws[2 * i + 1] / N) * 0x2000 +
- Math.round(ws[2 * i] / N) +
- carry;
- ws[i] = w & 0x3ffffff;
- if (w < 0x4000000) {
- carry = 0;
- } else {
- carry = w / 0x4000000 | 0;
- }
- }
- return ws;
- };
- FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) {
- var carry = 0;
- for (var i = 0; i < len; i++) {
- carry = carry + (ws[i] | 0);
- rws[2 * i] = carry & 0x1fff; carry = carry >>> 13;
- rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13;
- }
- // Pad with zeroes
- for (i = 2 * len; i < N; ++i) {
- rws[i] = 0;
- }
- assert(carry === 0);
- assert((carry & ~0x1fff) === 0);
- };
- FFTM.prototype.stub = function stub (N) {
- var ph = new Array(N);
- for (var i = 0; i < N; i++) {
- ph[i] = 0;
- }
- return ph;
- };
- FFTM.prototype.mulp = function mulp (x, y, out) {
- var N = 2 * this.guessLen13b(x.length, y.length);
- var rbt = this.makeRBT(N);
- var _ = this.stub(N);
- var rws = new Array(N);
- var rwst = new Array(N);
- var iwst = new Array(N);
- var nrws = new Array(N);
- var nrwst = new Array(N);
- var niwst = new Array(N);
- var rmws = out.words;
- rmws.length = N;
- this.convert13b(x.words, x.length, rws, N);
- this.convert13b(y.words, y.length, nrws, N);
- this.transform(rws, _, rwst, iwst, N, rbt);
- this.transform(nrws, _, nrwst, niwst, N, rbt);
- for (var i = 0; i < N; i++) {
- var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];
- iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];
- rwst[i] = rx;
- }
- this.conjugate(rwst, iwst, N);
- this.transform(rwst, iwst, rmws, _, N, rbt);
- this.conjugate(rmws, _, N);
- this.normalize13b(rmws, N);
- out.negative = x.negative ^ y.negative;
- out.length = x.length + y.length;
- return out.strip();
- };
- // Multiply `this` by `num`
- BN.prototype.mul = function mul (num) {
- var out = new BN(null);
- out.words = new Array(this.length + num.length);
- return this.mulTo(num, out);
- };
- // Multiply employing FFT
- BN.prototype.mulf = function mulf (num) {
- var out = new BN(null);
- out.words = new Array(this.length + num.length);
- return jumboMulTo(this, num, out);
- };
- // In-place Multiplication
- BN.prototype.imul = function imul (num) {
- return this.clone().mulTo(num, this);
- };
- BN.prototype.imuln = function imuln (num) {
- assert(typeof num === 'number');
- assert(num < 0x4000000);
- // Carry
- var carry = 0;
- for (var i = 0; i < this.length; i++) {
- var w = (this.words[i] | 0) * num;
- var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);
- carry >>= 26;
- carry += (w / 0x4000000) | 0;
- // NOTE: lo is 27bit maximum
- carry += lo >>> 26;
- this.words[i] = lo & 0x3ffffff;
- }
- if (carry !== 0) {
- this.words[i] = carry;
- this.length++;
- }
- return this;
- };
- BN.prototype.muln = function muln (num) {
- return this.clone().imuln(num);
- };
- // `this` * `this`
- BN.prototype.sqr = function sqr () {
- return this.mul(this);
- };
- // `this` * `this` in-place
- BN.prototype.isqr = function isqr () {
- return this.imul(this.clone());
- };
- // Math.pow(`this`, `num`)
- BN.prototype.pow = function pow (num) {
- var w = toBitArray(num);
- if (w.length === 0) return new BN(1);
- // Skip leading zeroes
- var res = this;
- for (var i = 0; i < w.length; i++, res = res.sqr()) {
- if (w[i] !== 0) break;
- }
- if (++i < w.length) {
- for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {
- if (w[i] === 0) continue;
- res = res.mul(q);
- }
- }
- return res;
- };
- // Shift-left in-place
- BN.prototype.iushln = function iushln (bits) {
- assert(typeof bits === 'number' && bits >= 0);
- var r = bits % 26;
- var s = (bits - r) / 26;
- var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r);
- var i;
- if (r !== 0) {
- var carry = 0;
- for (i = 0; i < this.length; i++) {
- var newCarry = this.words[i] & carryMask;
- var c = ((this.words[i] | 0) - newCarry) << r;
- this.words[i] = c | carry;
- carry = newCarry >>> (26 - r);
- }
- if (carry) {
- this.words[i] = carry;
- this.length++;
- }
- }
- if (s !== 0) {
- for (i = this.length - 1; i >= 0; i--) {
- this.words[i + s] = this.words[i];
- }
- for (i = 0; i < s; i++) {
- this.words[i] = 0;
- }
- this.length += s;
- }
- return this.strip();
- };
- BN.prototype.ishln = function ishln (bits) {
- // TODO(indutny): implement me
- assert(this.negative === 0);
- return this.iushln(bits);
- };
- // Shift-right in-place
- // NOTE: `hint` is a lowest bit before trailing zeroes
- // NOTE: if `extended` is present - it will be filled with destroyed bits
- BN.prototype.iushrn = function iushrn (bits, hint, extended) {
- assert(typeof bits === 'number' && bits >= 0);
- var h;
- if (hint) {
- h = (hint - (hint % 26)) / 26;
- } else {
- h = 0;
- }
- var r = bits % 26;
- var s = Math.min((bits - r) / 26, this.length);
- var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);
- var maskedWords = extended;
- h -= s;
- h = Math.max(0, h);
- // Extended mode, copy masked part
- if (maskedWords) {
- for (var i = 0; i < s; i++) {
- maskedWords.words[i] = this.words[i];
- }
- maskedWords.length = s;
- }
- if (s === 0) {
- // No-op, we should not move anything at all
- } else if (this.length > s) {
- this.length -= s;
- for (i = 0; i < this.length; i++) {
- this.words[i] = this.words[i + s];
- }
- } else {
- this.words[0] = 0;
- this.length = 1;
- }
- var carry = 0;
- for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {
- var word = this.words[i] | 0;
- this.words[i] = (carry << (26 - r)) | (word >>> r);
- carry = word & mask;
- }
- // Push carried bits as a mask
- if (maskedWords && carry !== 0) {
- maskedWords.words[maskedWords.length++] = carry;
- }
- if (this.length === 0) {
- this.words[0] = 0;
- this.length = 1;
- }
- return this.strip();
- };
- BN.prototype.ishrn = function ishrn (bits, hint, extended) {
- // TODO(indutny): implement me
- assert(this.negative === 0);
- return this.iushrn(bits, hint, extended);
- };
- // Shift-left
- BN.prototype.shln = function shln (bits) {
- return this.clone().ishln(bits);
- };
- BN.prototype.ushln = function ushln (bits) {
- return this.clone().iushln(bits);
- };
- // Shift-right
- BN.prototype.shrn = function shrn (bits) {
- return this.clone().ishrn(bits);
- };
- BN.prototype.ushrn = function ushrn (bits) {
- return this.clone().iushrn(bits);
- };
- // Test if n bit is set
- BN.prototype.testn = function testn (bit) {
- assert(typeof bit === 'number' && bit >= 0);
- var r = bit % 26;
- var s = (bit - r) / 26;
- var q = 1 << r;
- // Fast case: bit is much higher than all existing words
- if (this.length <= s) return false;
- // Check bit and return
- var w = this.words[s];
- return !!(w & q);
- };
- // Return only lowers bits of number (in-place)
- BN.prototype.imaskn = function imaskn (bits) {
- assert(typeof bits === 'number' && bits >= 0);
- var r = bits % 26;
- var s = (bits - r) / 26;
- assert(this.negative === 0, 'imaskn works only with positive numbers');
- if (this.length <= s) {
- return this;
- }
- if (r !== 0) {
- s++;
- }
- this.length = Math.min(s, this.length);
- if (r !== 0) {
- var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);
- this.words[this.length - 1] &= mask;
- }
- return this.strip();
- };
- // Return only lowers bits of number
- BN.prototype.maskn = function maskn (bits) {
- return this.clone().imaskn(bits);
- };
- // Add plain number `num` to `this`
- BN.prototype.iaddn = function iaddn (num) {
- assert(typeof num === 'number');
- assert(num < 0x4000000);
- if (num < 0) return this.isubn(-num);
- // Possible sign change
- if (this.negative !== 0) {
- if (this.length === 1 && (this.words[0] | 0) < num) {
- this.words[0] = num - (this.words[0] | 0);
- this.negative = 0;
- return this;
- }
- this.negative = 0;
- this.isubn(num);
- this.negative = 1;
- return this;
- }
- // Add without checks
- return this._iaddn(num);
- };
- BN.prototype._iaddn = function _iaddn (num) {
- this.words[0] += num;
- // Carry
- for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {
- this.words[i] -= 0x4000000;
- if (i === this.length - 1) {
- this.words[i + 1] = 1;
- } else {
- this.words[i + 1]++;
- }
- }
- this.length = Math.max(this.length, i + 1);
- return this;
- };
- // Subtract plain number `num` from `this`
- BN.prototype.isubn = function isubn (num) {
- assert(typeof num === 'number');
- assert(num < 0x4000000);
- if (num < 0) return this.iaddn(-num);
- if (this.negative !== 0) {
- this.negative = 0;
- this.iaddn(num);
- this.negative = 1;
- return this;
- }
- this.words[0] -= num;
- if (this.length === 1 && this.words[0] < 0) {
- this.words[0] = -this.words[0];
- this.negative = 1;
- } else {
- // Carry
- for (var i = 0; i < this.length && this.words[i] < 0; i++) {
- this.words[i] += 0x4000000;
- this.words[i + 1] -= 1;
- }
- }
- return this.strip();
- };
- BN.prototype.addn = function addn (num) {
- return this.clone().iaddn(num);
- };
- BN.prototype.subn = function subn (num) {
- return this.clone().isubn(num);
- };
- BN.prototype.iabs = function iabs () {
- this.negative = 0;
- return this;
- };
- BN.prototype.abs = function abs () {
- return this.clone().iabs();
- };
- BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) {
- var len = num.length + shift;
- var i;
- this._expand(len);
- var w;
- var carry = 0;
- for (i = 0; i < num.length; i++) {
- w = (this.words[i + shift] | 0) + carry;
- var right = (num.words[i] | 0) * mul;
- w -= right & 0x3ffffff;
- carry = (w >> 26) - ((right / 0x4000000) | 0);
- this.words[i + shift] = w & 0x3ffffff;
- }
- for (; i < this.length - shift; i++) {
- w = (this.words[i + shift] | 0) + carry;
- carry = w >> 26;
- this.words[i + shift] = w & 0x3ffffff;
- }
- if (carry === 0) return this.strip();
- // Subtraction overflow
- assert(carry === -1);
- carry = 0;
- for (i = 0; i < this.length; i++) {
- w = -(this.words[i] | 0) + carry;
- carry = w >> 26;
- this.words[i] = w & 0x3ffffff;
- }
- this.negative = 1;
- return this.strip();
- };
- BN.prototype._wordDiv = function _wordDiv (num, mode) {
- var shift = this.length - num.length;
- var a = this.clone();
- var b = num;
- // Normalize
- var bhi = b.words[b.length - 1] | 0;
- var bhiBits = this._countBits(bhi);
- shift = 26 - bhiBits;
- if (shift !== 0) {
- b = b.ushln(shift);
- a.iushln(shift);
- bhi = b.words[b.length - 1] | 0;
- }
- // Initialize quotient
- var m = a.length - b.length;
- var q;
- if (mode !== 'mod') {
- q = new BN(null);
- q.length = m + 1;
- q.words = new Array(q.length);
- for (var i = 0; i < q.length; i++) {
- q.words[i] = 0;
- }
- }
- var diff = a.clone()._ishlnsubmul(b, 1, m);
- if (diff.negative === 0) {
- a = diff;
- if (q) {
- q.words[m] = 1;
- }
- }
- for (var j = m - 1; j >= 0; j--) {
- var qj = (a.words[b.length + j] | 0) * 0x4000000 +
- (a.words[b.length + j - 1] | 0);
- // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max
- // (0x7ffffff)
- qj = Math.min((qj / bhi) | 0, 0x3ffffff);
- a._ishlnsubmul(b, qj, j);
- while (a.negative !== 0) {
- qj--;
- a.negative = 0;
- a._ishlnsubmul(b, 1, j);
- if (!a.isZero()) {
- a.negative ^= 1;
- }
- }
- if (q) {
- q.words[j] = qj;
- }
- }
- if (q) {
- q.strip();
- }
- a.strip();
- // Denormalize
- if (mode !== 'div' && shift !== 0) {
- a.iushrn(shift);
- }
- return {
- div: q || null,
- mod: a
- };
- };
- // NOTE: 1) `mode` can be set to `mod` to request mod only,
- // to `div` to request div only, or be absent to
- // request both div & mod
- // 2) `positive` is true if unsigned mod is requested
- BN.prototype.divmod = function divmod (num, mode, positive) {
- assert(!num.isZero());
- if (this.isZero()) {
- return {
- div: new BN(0),
- mod: new BN(0)
- };
- }
- var div, mod, res;
- if (this.negative !== 0 && num.negative === 0) {
- res = this.neg().divmod(num, mode);
- if (mode !== 'mod') {
- div = res.div.neg();
- }
- if (mode !== 'div') {
- mod = res.mod.neg();
- if (positive && mod.negative !== 0) {
- mod.iadd(num);
- }
- }
- return {
- div: div,
- mod: mod
- };
- }
- if (this.negative === 0 && num.negative !== 0) {
- res = this.divmod(num.neg(), mode);
- if (mode !== 'mod') {
- div = res.div.neg();
- }
- return {
- div: div,
- mod: res.mod
- };
- }
- if ((this.negative & num.negative) !== 0) {
- res = this.neg().divmod(num.neg(), mode);
- if (mode !== 'div') {
- mod = res.mod.neg();
- if (positive && mod.negative !== 0) {
- mod.isub(num);
- }
- }
- return {
- div: res.div,
- mod: mod
- };
- }
- // Both numbers are positive at this point
- // Strip both numbers to approximate shift value
- if (num.length > this.length || this.cmp(num) < 0) {
- return {
- div: new BN(0),
- mod: this
- };
- }
- // Very short reduction
- if (num.length === 1) {
- if (mode === 'div') {
- return {
- div: this.divn(num.words[0]),
- mod: null
- };
- }
- if (mode === 'mod') {
- return {
- div: null,
- mod: new BN(this.modn(num.words[0]))
- };
- }
- return {
- div: this.divn(num.words[0]),
- mod: new BN(this.modn(num.words[0]))
- };
- }
- return this._wordDiv(num, mode);
- };
- // Find `this` / `num`
- BN.prototype.div = function div (num) {
- return this.divmod(num, 'div', false).div;
- };
- // Find `this` % `num`
- BN.prototype.mod = function mod (num) {
- return this.divmod(num, 'mod', false).mod;
- };
- BN.prototype.umod = function umod (num) {
- return this.divmod(num, 'mod', true).mod;
- };
- // Find Round(`this` / `num`)
- BN.prototype.divRound = function divRound (num) {
- var dm = this.divmod(num);
- // Fast case - exact division
- if (dm.mod.isZero()) return dm.div;
- var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;
- var half = num.ushrn(1);
- var r2 = num.andln(1);
- var cmp = mod.cmp(half);
- // Round down
- if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div;
- // Round up
- return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);
- };
- BN.prototype.modn = function modn (num) {
- assert(num <= 0x3ffffff);
- var p = (1 << 26) % num;
- var acc = 0;
- for (var i = this.length - 1; i >= 0; i--) {
- acc = (p * acc + (this.words[i] | 0)) % num;
- }
- return acc;
- };
- // In-place division by number
- BN.prototype.idivn = function idivn (num) {
- assert(num <= 0x3ffffff);
- var carry = 0;
- for (var i = this.length - 1; i >= 0; i--) {
- var w = (this.words[i] | 0) + carry * 0x4000000;
- this.words[i] = (w / num) | 0;
- carry = w % num;
- }
- return this.strip();
- };
- BN.prototype.divn = function divn (num) {
- return this.clone().idivn(num);
- };
- BN.prototype.egcd = function egcd (p) {
- assert(p.negative === 0);
- assert(!p.isZero());
- var x = this;
- var y = p.clone();
- if (x.negative !== 0) {
- x = x.umod(p);
- } else {
- x = x.clone();
- }
- // A * x + B * y = x
- var A = new BN(1);
- var B = new BN(0);
- // C * x + D * y = y
- var C = new BN(0);
- var D = new BN(1);
- var g = 0;
- while (x.isEven() && y.isEven()) {
- x.iushrn(1);
- y.iushrn(1);
- ++g;
- }
- var yp = y.clone();
- var xp = x.clone();
- while (!x.isZero()) {
- for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
- if (i > 0) {
- x.iushrn(i);
- while (i-- > 0) {
- if (A.isOdd() || B.isOdd()) {
- A.iadd(yp);
- B.isub(xp);
- }
- A.iushrn(1);
- B.iushrn(1);
- }
- }
- for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
- if (j > 0) {
- y.iushrn(j);
- while (j-- > 0) {
- if (C.isOdd() || D.isOdd()) {
- C.iadd(yp);
- D.isub(xp);
- }
- C.iushrn(1);
- D.iushrn(1);
- }
- }
- if (x.cmp(y) >= 0) {
- x.isub(y);
- A.isub(C);
- B.isub(D);
- } else {
- y.isub(x);
- C.isub(A);
- D.isub(B);
- }
- }
- return {
- a: C,
- b: D,
- gcd: y.iushln(g)
- };
- };
- // This is reduced incarnation of the binary EEA
- // above, designated to invert members of the
- // _prime_ fields F(p) at a maximal speed
- BN.prototype._invmp = function _invmp (p) {
- assert(p.negative === 0);
- assert(!p.isZero());
- var a = this;
- var b = p.clone();
- if (a.negative !== 0) {
- a = a.umod(p);
- } else {
- a = a.clone();
- }
- var x1 = new BN(1);
- var x2 = new BN(0);
- var delta = b.clone();
- while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {
- for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
- if (i > 0) {
- a.iushrn(i);
- while (i-- > 0) {
- if (x1.isOdd()) {
- x1.iadd(delta);
- }
- x1.iushrn(1);
- }
- }
- for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
- if (j > 0) {
- b.iushrn(j);
- while (j-- > 0) {
- if (x2.isOdd()) {
- x2.iadd(delta);
- }
- x2.iushrn(1);
- }
- }
- if (a.cmp(b) >= 0) {
- a.isub(b);
- x1.isub(x2);
- } else {
- b.isub(a);
- x2.isub(x1);
- }
- }
- var res;
- if (a.cmpn(1) === 0) {
- res = x1;
- } else {
- res = x2;
- }
- if (res.cmpn(0) < 0) {
- res.iadd(p);
- }
- return res;
- };
- BN.prototype.gcd = function gcd (num) {
- if (this.isZero()) return num.abs();
- if (num.isZero()) return this.abs();
- var a = this.clone();
- var b = num.clone();
- a.negative = 0;
- b.negative = 0;
- // Remove common factor of two
- for (var shift = 0; a.isEven() && b.isEven(); shift++) {
- a.iushrn(1);
- b.iushrn(1);
- }
- do {
- while (a.isEven()) {
- a.iushrn(1);
- }
- while (b.isEven()) {
- b.iushrn(1);
- }
- var r = a.cmp(b);
- if (r < 0) {
- // Swap `a` and `b` to make `a` always bigger than `b`
- var t = a;
- a = b;
- b = t;
- } else if (r === 0 || b.cmpn(1) === 0) {
- break;
- }
- a.isub(b);
- } while (true);
- return b.iushln(shift);
- };
- // Invert number in the field F(num)
- BN.prototype.invm = function invm (num) {
- return this.egcd(num).a.umod(num);
- };
- BN.prototype.isEven = function isEven () {
- return (this.words[0] & 1) === 0;
- };
- BN.prototype.isOdd = function isOdd () {
- return (this.words[0] & 1) === 1;
- };
- // And first word and num
- BN.prototype.andln = function andln (num) {
- return this.words[0] & num;
- };
- // Increment at the bit position in-line
- BN.prototype.bincn = function bincn (bit) {
- assert(typeof bit === 'number');
- var r = bit % 26;
- var s = (bit - r) / 26;
- var q = 1 << r;
- // Fast case: bit is much higher than all existing words
- if (this.length <= s) {
- this._expand(s + 1);
- this.words[s] |= q;
- return this;
- }
- // Add bit and propagate, if needed
- var carry = q;
- for (var i = s; carry !== 0 && i < this.length; i++) {
- var w = this.words[i] | 0;
- w += carry;
- carry = w >>> 26;
- w &= 0x3ffffff;
- this.words[i] = w;
- }
- if (carry !== 0) {
- this.words[i] = carry;
- this.length++;
- }
- return this;
- };
- BN.prototype.isZero = function isZero () {
- return this.length === 1 && this.words[0] === 0;
- };
- BN.prototype.cmpn = function cmpn (num) {
- var negative = num < 0;
- if (this.negative !== 0 && !negative) return -1;
- if (this.negative === 0 && negative) return 1;
- this.strip();
- var res;
- if (this.length > 1) {
- res = 1;
- } else {
- if (negative) {
- num = -num;
- }
- assert(num <= 0x3ffffff, 'Number is too big');
- var w = this.words[0] | 0;
- res = w === num ? 0 : w < num ? -1 : 1;
- }
- if (this.negative !== 0) return -res | 0;
- return res;
- };
- // Compare two numbers and return:
- // 1 - if `this` > `num`
- // 0 - if `this` == `num`
- // -1 - if `this` < `num`
- BN.prototype.cmp = function cmp (num) {
- if (this.negative !== 0 && num.negative === 0) return -1;
- if (this.negative === 0 && num.negative !== 0) return 1;
- var res = this.ucmp(num);
- if (this.negative !== 0) return -res | 0;
- return res;
- };
- // Unsigned comparison
- BN.prototype.ucmp = function ucmp (num) {
- // At this point both numbers have the same sign
- if (this.length > num.length) return 1;
- if (this.length < num.length) return -1;
- var res = 0;
- for (var i = this.length - 1; i >= 0; i--) {
- var a = this.words[i] | 0;
- var b = num.words[i] | 0;
- if (a === b) continue;
- if (a < b) {
- res = -1;
- } else if (a > b) {
- res = 1;
- }
- break;
- }
- return res;
- };
- BN.prototype.gtn = function gtn (num) {
- return this.cmpn(num) === 1;
- };
- BN.prototype.gt = function gt (num) {
- return this.cmp(num) === 1;
- };
- BN.prototype.gten = function gten (num) {
- return this.cmpn(num) >= 0;
- };
- BN.prototype.gte = function gte (num) {
- return this.cmp(num) >= 0;
- };
- BN.prototype.ltn = function ltn (num) {
- return this.cmpn(num) === -1;
- };
- BN.prototype.lt = function lt (num) {
- return this.cmp(num) === -1;
- };
- BN.prototype.lten = function lten (num) {
- return this.cmpn(num) <= 0;
- };
- BN.prototype.lte = function lte (num) {
- return this.cmp(num) <= 0;
- };
- BN.prototype.eqn = function eqn (num) {
- return this.cmpn(num) === 0;
- };
- BN.prototype.eq = function eq (num) {
- return this.cmp(num) === 0;
- };
- //
- // A reduce context, could be using montgomery or something better, depending
- // on the `m` itself.
- //
- BN.red = function red (num) {
- return new Red(num);
- };
- BN.prototype.toRed = function toRed (ctx) {
- assert(!this.red, 'Already a number in reduction context');
- assert(this.negative === 0, 'red works only with positives');
- return ctx.convertTo(this)._forceRed(ctx);
- };
- BN.prototype.fromRed = function fromRed () {
- assert(this.red, 'fromRed works only with numbers in reduction context');
- return this.red.convertFrom(this);
- };
- BN.prototype._forceRed = function _forceRed (ctx) {
- this.red = ctx;
- return this;
- };
- BN.prototype.forceRed = function forceRed (ctx) {
- assert(!this.red, 'Already a number in reduction context');
- return this._forceRed(ctx);
- };
- BN.prototype.redAdd = function redAdd (num) {
- assert(this.red, 'redAdd works only with red numbers');
- return this.red.add(this, num);
- };
- BN.prototype.redIAdd = function redIAdd (num) {
- assert(this.red, 'redIAdd works only with red numbers');
- return this.red.iadd(this, num);
- };
- BN.prototype.redSub = function redSub (num) {
- assert(this.red, 'redSub works only with red numbers');
- return this.red.sub(this, num);
- };
- BN.prototype.redISub = function redISub (num) {
- assert(this.red, 'redISub works only with red numbers');
- return this.red.isub(this, num);
- };
- BN.prototype.redShl = function redShl (num) {
- assert(this.red, 'redShl works only with red numbers');
- return this.red.shl(this, num);
- };
- BN.prototype.redMul = function redMul (num) {
- assert(this.red, 'redMul works only with red numbers');
- this.red._verify2(this, num);
- return this.red.mul(this, num);
- };
- BN.prototype.redIMul = function redIMul (num) {
- assert(this.red, 'redMul works only with red numbers');
- this.red._verify2(this, num);
- return this.red.imul(this, num);
- };
- BN.prototype.redSqr = function redSqr () {
- assert(this.red, 'redSqr works only with red numbers');
- this.red._verify1(this);
- return this.red.sqr(this);
- };
- BN.prototype.redISqr = function redISqr () {
- assert(this.red, 'redISqr works only with red numbers');
- this.red._verify1(this);
- return this.red.isqr(this);
- };
- // Square root over p
- BN.prototype.redSqrt = function redSqrt () {
- assert(this.red, 'redSqrt works only with red numbers');
- this.red._verify1(this);
- return this.red.sqrt(this);
- };
- BN.prototype.redInvm = function redInvm () {
- assert(this.red, 'redInvm works only with red numbers');
- this.red._verify1(this);
- return this.red.invm(this);
- };
- // Return negative clone of `this` % `red modulo`
- BN.prototype.redNeg = function redNeg () {
- assert(this.red, 'redNeg works only with red numbers');
- this.red._verify1(this);
- return this.red.neg(this);
- };
- BN.prototype.redPow = function redPow (num) {
- assert(this.red && !num.red, 'redPow(normalNum)');
- this.red._verify1(this);
- return this.red.pow(this, num);
- };
- // Prime numbers with efficient reduction
- var primes = {
- k256: null,
- p224: null,
- p192: null,
- p25519: null
- };
- // Pseudo-Mersenne prime
- function MPrime (name, p) {
- // P = 2 ^ N - K
- this.name = name;
- this.p = new BN(p, 16);
- this.n = this.p.bitLength();
- this.k = new BN(1).iushln(this.n).isub(this.p);
- this.tmp = this._tmp();
- }
- MPrime.prototype._tmp = function _tmp () {
- var tmp = new BN(null);
- tmp.words = new Array(Math.ceil(this.n / 13));
- return tmp;
- };
- MPrime.prototype.ireduce = function ireduce (num) {
- // Assumes that `num` is less than `P^2`
- // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)
- var r = num;
- var rlen;
- do {
- this.split(r, this.tmp);
- r = this.imulK(r);
- r = r.iadd(this.tmp);
- rlen = r.bitLength();
- } while (rlen > this.n);
- var cmp = rlen < this.n ? -1 : r.ucmp(this.p);
- if (cmp === 0) {
- r.words[0] = 0;
- r.length = 1;
- } else if (cmp > 0) {
- r.isub(this.p);
- } else {
- if (r.strip !== undefined) {
- // r is BN v4 instance
- r.strip();
- } else {
- // r is BN v5 instance
- r._strip();
- }
- }
- return r;
- };
- MPrime.prototype.split = function split (input, out) {
- input.iushrn(this.n, 0, out);
- };
- MPrime.prototype.imulK = function imulK (num) {
- return num.imul(this.k);
- };
- function K256 () {
- MPrime.call(
- this,
- 'k256',
- 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');
- }
- inherits(K256, MPrime);
- K256.prototype.split = function split (input, output) {
- // 256 = 9 * 26 + 22
- var mask = 0x3fffff;
- var outLen = Math.min(input.length, 9);
- for (var i = 0; i < outLen; i++) {
- output.words[i] = input.words[i];
- }
- output.length = outLen;
- if (input.length <= 9) {
- input.words[0] = 0;
- input.length = 1;
- return;
- }
- // Shift by 9 limbs
- var prev = input.words[9];
- output.words[output.length++] = prev & mask;
- for (i = 10; i < input.length; i++) {
- var next = input.words[i] | 0;
- input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22);
- prev = next;
- }
- prev >>>= 22;
- input.words[i - 10] = prev;
- if (prev === 0 && input.length > 10) {
- input.length -= 10;
- } else {
- input.length -= 9;
- }
- };
- K256.prototype.imulK = function imulK (num) {
- // K = 0x1000003d1 = [ 0x40, 0x3d1 ]
- num.words[num.length] = 0;
- num.words[num.length + 1] = 0;
- num.length += 2;
- // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390
- var lo = 0;
- for (var i = 0; i < num.length; i++) {
- var w = num.words[i] | 0;
- lo += w * 0x3d1;
- num.words[i] = lo & 0x3ffffff;
- lo = w * 0x40 + ((lo / 0x4000000) | 0);
- }
- // Fast length reduction
- if (num.words[num.length - 1] === 0) {
- num.length--;
- if (num.words[num.length - 1] === 0) {
- num.length--;
- }
- }
- return num;
- };
- function P224 () {
- MPrime.call(
- this,
- 'p224',
- 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');
- }
- inherits(P224, MPrime);
- function P192 () {
- MPrime.call(
- this,
- 'p192',
- 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');
- }
- inherits(P192, MPrime);
- function P25519 () {
- // 2 ^ 255 - 19
- MPrime.call(
- this,
- '25519',
- '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');
- }
- inherits(P25519, MPrime);
- P25519.prototype.imulK = function imulK (num) {
- // K = 0x13
- var carry = 0;
- for (var i = 0; i < num.length; i++) {
- var hi = (num.words[i] | 0) * 0x13 + carry;
- var lo = hi & 0x3ffffff;
- hi >>>= 26;
- num.words[i] = lo;
- carry = hi;
- }
- if (carry !== 0) {
- num.words[num.length++] = carry;
- }
- return num;
- };
- // Exported mostly for testing purposes, use plain name instead
- BN._prime = function prime (name) {
- // Cached version of prime
- if (primes[name]) return primes[name];
- var prime;
- if (name === 'k256') {
- prime = new K256();
- } else if (name === 'p224') {
- prime = new P224();
- } else if (name === 'p192') {
- prime = new P192();
- } else if (name === 'p25519') {
- prime = new P25519();
- } else {
- throw new Error('Unknown prime ' + name);
- }
- primes[name] = prime;
- return prime;
- };
- //
- // Base reduction engine
- //
- function Red (m) {
- if (typeof m === 'string') {
- var prime = BN._prime(m);
- this.m = prime.p;
- this.prime = prime;
- } else {
- assert(m.gtn(1), 'modulus must be greater than 1');
- this.m = m;
- this.prime = null;
- }
- }
- Red.prototype._verify1 = function _verify1 (a) {
- assert(a.negative === 0, 'red works only with positives');
- assert(a.red, 'red works only with red numbers');
- };
- Red.prototype._verify2 = function _verify2 (a, b) {
- assert((a.negative | b.negative) === 0, 'red works only with positives');
- assert(a.red && a.red === b.red,
- 'red works only with red numbers');
- };
- Red.prototype.imod = function imod (a) {
- if (this.prime) return this.prime.ireduce(a)._forceRed(this);
- return a.umod(this.m)._forceRed(this);
- };
- Red.prototype.neg = function neg (a) {
- if (a.isZero()) {
- return a.clone();
- }
- return this.m.sub(a)._forceRed(this);
- };
- Red.prototype.add = function add (a, b) {
- this._verify2(a, b);
- var res = a.add(b);
- if (res.cmp(this.m) >= 0) {
- res.isub(this.m);
- }
- return res._forceRed(this);
- };
- Red.prototype.iadd = function iadd (a, b) {
- this._verify2(a, b);
- var res = a.iadd(b);
- if (res.cmp(this.m) >= 0) {
- res.isub(this.m);
- }
- return res;
- };
- Red.prototype.sub = function sub (a, b) {
- this._verify2(a, b);
- var res = a.sub(b);
- if (res.cmpn(0) < 0) {
- res.iadd(this.m);
- }
- return res._forceRed(this);
- };
- Red.prototype.isub = function isub (a, b) {
- this._verify2(a, b);
- var res = a.isub(b);
- if (res.cmpn(0) < 0) {
- res.iadd(this.m);
- }
- return res;
- };
- Red.prototype.shl = function shl (a, num) {
- this._verify1(a);
- return this.imod(a.ushln(num));
- };
- Red.prototype.imul = function imul (a, b) {
- this._verify2(a, b);
- return this.imod(a.imul(b));
- };
- Red.prototype.mul = function mul (a, b) {
- this._verify2(a, b);
- return this.imod(a.mul(b));
- };
- Red.prototype.isqr = function isqr (a) {
- return this.imul(a, a.clone());
- };
- Red.prototype.sqr = function sqr (a) {
- return this.mul(a, a);
- };
- Red.prototype.sqrt = function sqrt (a) {
- if (a.isZero()) return a.clone();
- var mod3 = this.m.andln(3);
- assert(mod3 % 2 === 1);
- // Fast case
- if (mod3 === 3) {
- var pow = this.m.add(new BN(1)).iushrn(2);
- return this.pow(a, pow);
- }
- // Tonelli-Shanks algorithm (Totally unoptimized and slow)
- //
- // Find Q and S, that Q * 2 ^ S = (P - 1)
- var q = this.m.subn(1);
- var s = 0;
- while (!q.isZero() && q.andln(1) === 0) {
- s++;
- q.iushrn(1);
- }
- assert(!q.isZero());
- var one = new BN(1).toRed(this);
- var nOne = one.redNeg();
- // Find quadratic non-residue
- // NOTE: Max is such because of generalized Riemann hypothesis.
- var lpow = this.m.subn(1).iushrn(1);
- var z = this.m.bitLength();
- z = new BN(2 * z * z).toRed(this);
- while (this.pow(z, lpow).cmp(nOne) !== 0) {
- z.redIAdd(nOne);
- }
- var c = this.pow(z, q);
- var r = this.pow(a, q.addn(1).iushrn(1));
- var t = this.pow(a, q);
- var m = s;
- while (t.cmp(one) !== 0) {
- var tmp = t;
- for (var i = 0; tmp.cmp(one) !== 0; i++) {
- tmp = tmp.redSqr();
- }
- assert(i < m);
- var b = this.pow(c, new BN(1).iushln(m - i - 1));
- r = r.redMul(b);
- c = b.redSqr();
- t = t.redMul(c);
- m = i;
- }
- return r;
- };
- Red.prototype.invm = function invm (a) {
- var inv = a._invmp(this.m);
- if (inv.negative !== 0) {
- inv.negative = 0;
- return this.imod(inv).redNeg();
- } else {
- return this.imod(inv);
- }
- };
- Red.prototype.pow = function pow (a, num) {
- if (num.isZero()) return new BN(1).toRed(this);
- if (num.cmpn(1) === 0) return a.clone();
- var windowSize = 4;
- var wnd = new Array(1 << windowSize);
- wnd[0] = new BN(1).toRed(this);
- wnd[1] = a;
- for (var i = 2; i < wnd.length; i++) {
- wnd[i] = this.mul(wnd[i - 1], a);
- }
- var res = wnd[0];
- var current = 0;
- var currentLen = 0;
- var start = num.bitLength() % 26;
- if (start === 0) {
- start = 26;
- }
- for (i = num.length - 1; i >= 0; i--) {
- var word = num.words[i];
- for (var j = start - 1; j >= 0; j--) {
- var bit = (word >> j) & 1;
- if (res !== wnd[0]) {
- res = this.sqr(res);
- }
- if (bit === 0 && current === 0) {
- currentLen = 0;
- continue;
- }
- current <<= 1;
- current |= bit;
- currentLen++;
- if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;
- res = this.mul(res, wnd[current]);
- currentLen = 0;
- current = 0;
- }
- start = 26;
- }
- return res;
- };
- Red.prototype.convertTo = function convertTo (num) {
- var r = num.umod(this.m);
- return r === num ? r.clone() : r;
- };
- Red.prototype.convertFrom = function convertFrom (num) {
- var res = num.clone();
- res.red = null;
- return res;
- };
- //
- // Montgomery method engine
- //
- BN.mont = function mont (num) {
- return new Mont(num);
- };
- function Mont (m) {
- Red.call(this, m);
- this.shift = this.m.bitLength();
- if (this.shift % 26 !== 0) {
- this.shift += 26 - (this.shift % 26);
- }
- this.r = new BN(1).iushln(this.shift);
- this.r2 = this.imod(this.r.sqr());
- this.rinv = this.r._invmp(this.m);
- this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);
- this.minv = this.minv.umod(this.r);
- this.minv = this.r.sub(this.minv);
- }
- inherits(Mont, Red);
- Mont.prototype.convertTo = function convertTo (num) {
- return this.imod(num.ushln(this.shift));
- };
- Mont.prototype.convertFrom = function convertFrom (num) {
- var r = this.imod(num.mul(this.rinv));
- r.red = null;
- return r;
- };
- Mont.prototype.imul = function imul (a, b) {
- if (a.isZero() || b.isZero()) {
- a.words[0] = 0;
- a.length = 1;
- return a;
- }
- var t = a.imul(b);
- var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);
- var u = t.isub(c).iushrn(this.shift);
- var res = u;
- if (u.cmp(this.m) >= 0) {
- res = u.isub(this.m);
- } else if (u.cmpn(0) < 0) {
- res = u.iadd(this.m);
- }
- return res._forceRed(this);
- };
- Mont.prototype.mul = function mul (a, b) {
- if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);
- var t = a.mul(b);
- var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);
- var u = t.isub(c).iushrn(this.shift);
- var res = u;
- if (u.cmp(this.m) >= 0) {
- res = u.isub(this.m);
- } else if (u.cmpn(0) < 0) {
- res = u.iadd(this.m);
- }
- return res._forceRed(this);
- };
- Mont.prototype.invm = function invm (a) {
- // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R
- var res = this.imod(a._invmp(this.m).mul(this.r2));
- return res._forceRed(this);
- };
- })( false || module, this);
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/module.js */ 198)(module)))
- /***/ }),
- /* 198 */
- /*!***********************************!*\
- !*** (webpack)/buildin/module.js ***!
- \***********************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- module.exports = function(module) {
- if (!module.webpackPolyfill) {
- module.deprecate = function() {};
- module.paths = [];
- // module.parent = undefined by default
- if (!module.children) module.children = [];
- Object.defineProperty(module, "loaded", {
- enumerable: true,
- get: function() {
- return module.l;
- }
- });
- Object.defineProperty(module, "id", {
- enumerable: true,
- get: function() {
- return module.i;
- }
- });
- module.webpackPolyfill = 1;
- }
- return module;
- };
- /***/ }),
- /* 199 */
- /*!************************!*\
- !*** buffer (ignored) ***!
- \************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- /* (ignored) */
- /***/ }),
- /* 200 */
- /*!*********************************************!*\
- !*** ./node_modules/miller-rabin/lib/mr.js ***!
- \*********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var bn = __webpack_require__(/*! bn.js */ 197);
- var brorand = __webpack_require__(/*! brorand */ 201);
- function MillerRabin(rand) {
- this.rand = rand || new brorand.Rand();
- }
- module.exports = MillerRabin;
- MillerRabin.create = function create(rand) {
- return new MillerRabin(rand);
- };
- MillerRabin.prototype._randbelow = function _randbelow(n) {
- var len = n.bitLength();
- var min_bytes = Math.ceil(len / 8);
- // Generage random bytes until a number less than n is found.
- // This ensures that 0..n-1 have an equal probability of being selected.
- do
- var a = new bn(this.rand.generate(min_bytes));
- while (a.cmp(n) >= 0);
- return a;
- };
- MillerRabin.prototype._randrange = function _randrange(start, stop) {
- // Generate a random number greater than or equal to start and less than stop.
- var size = stop.sub(start);
- return start.add(this._randbelow(size));
- };
- MillerRabin.prototype.test = function test(n, k, cb) {
- var len = n.bitLength();
- var red = bn.mont(n);
- var rone = new bn(1).toRed(red);
- if (!k)
- k = Math.max(1, (len / 48) | 0);
- // Find d and s, (n - 1) = (2 ^ s) * d;
- var n1 = n.subn(1);
- for (var s = 0; !n1.testn(s); s++) {}
- var d = n.shrn(s);
- var rn1 = n1.toRed(red);
- var prime = true;
- for (; k > 0; k--) {
- var a = this._randrange(new bn(2), n1);
- if (cb)
- cb(a);
- var x = a.toRed(red).redPow(d);
- if (x.cmp(rone) === 0 || x.cmp(rn1) === 0)
- continue;
- for (var i = 1; i < s; i++) {
- x = x.redSqr();
- if (x.cmp(rone) === 0)
- return false;
- if (x.cmp(rn1) === 0)
- break;
- }
- if (i === s)
- return false;
- }
- return prime;
- };
- MillerRabin.prototype.getDivisor = function getDivisor(n, k) {
- var len = n.bitLength();
- var red = bn.mont(n);
- var rone = new bn(1).toRed(red);
- if (!k)
- k = Math.max(1, (len / 48) | 0);
- // Find d and s, (n - 1) = (2 ^ s) * d;
- var n1 = n.subn(1);
- for (var s = 0; !n1.testn(s); s++) {}
- var d = n.shrn(s);
- var rn1 = n1.toRed(red);
- for (; k > 0; k--) {
- var a = this._randrange(new bn(2), n1);
- var g = n.gcd(a);
- if (g.cmpn(1) !== 0)
- return g;
- var x = a.toRed(red).redPow(d);
- if (x.cmp(rone) === 0 || x.cmp(rn1) === 0)
- continue;
- for (var i = 1; i < s; i++) {
- x = x.redSqr();
- if (x.cmp(rone) === 0)
- return x.fromRed().subn(1).gcd(n);
- if (x.cmp(rn1) === 0)
- break;
- }
- if (i === s) {
- x = x.redSqr();
- return x.fromRed().subn(1).gcd(n);
- }
- }
- return false;
- };
- /***/ }),
- /* 201 */
- /*!***************************************!*\
- !*** ./node_modules/brorand/index.js ***!
- \***************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var r;
- module.exports = function rand(len) {
- if (!r)
- r = new Rand(null);
- return r.generate(len);
- };
- function Rand(rand) {
- this.rand = rand;
- }
- module.exports.Rand = Rand;
- Rand.prototype.generate = function generate(len) {
- return this._rand(len);
- };
- // Emulate crypto API using randy
- Rand.prototype._rand = function _rand(n) {
- if (this.rand.getBytes)
- return this.rand.getBytes(n);
- var res = new Uint8Array(n);
- for (var i = 0; i < res.length; i++)
- res[i] = this.rand.getByte();
- return res;
- };
- if (typeof self === 'object') {
- if (self.crypto && self.crypto.getRandomValues) {
- // Modern browsers
- Rand.prototype._rand = function _rand(n) {
- var arr = new Uint8Array(n);
- self.crypto.getRandomValues(arr);
- return arr;
- };
- } else if (self.msCrypto && self.msCrypto.getRandomValues) {
- // IE
- Rand.prototype._rand = function _rand(n) {
- var arr = new Uint8Array(n);
- self.msCrypto.getRandomValues(arr);
- return arr;
- };
- // Safari's WebWorkers do not have `crypto`
- } else if (typeof window === 'object') {
- // Old junk
- Rand.prototype._rand = function() {
- throw new Error('Not implemented yet');
- };
- }
- } else {
- // Node.js or Web worker with no crypto support
- try {
- var crypto = __webpack_require__(/*! crypto */ 202);
- if (typeof crypto.randomBytes !== 'function')
- throw new Error('Not supported');
- Rand.prototype._rand = function _rand(n) {
- return crypto.randomBytes(n);
- };
- } catch (e) {
- }
- }
- /***/ }),
- /* 202 */
- /*!************************!*\
- !*** crypto (ignored) ***!
- \************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- /* (ignored) */
- /***/ }),
- /* 203 */
- /*!*****************************************************!*\
- !*** ./node_modules/diffie-hellman/lib/primes.json ***!
- \*****************************************************/
- /*! exports provided: modp1, modp2, modp5, modp14, modp15, modp16, modp17, modp18, default */
- /***/ (function(module) {
- module.exports = JSON.parse("{\"modp1\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff\"},\"modp2\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff\"},\"modp5\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff\"},\"modp14\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff\"},\"modp15\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff\"},\"modp16\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff\"},\"modp17\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff\"},\"modp18\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff\"}}");
- /***/ }),
- /* 204 */
- /*!***********************************************!*\
- !*** ./node_modules/diffie-hellman/lib/dh.js ***!
- \***********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- /* WEBPACK VAR INJECTION */(function(Buffer) {var BN = __webpack_require__(/*! bn.js */ 197);
- var MillerRabin = __webpack_require__(/*! miller-rabin */ 200);
- var millerRabin = new MillerRabin();
- var TWENTYFOUR = new BN(24);
- var ELEVEN = new BN(11);
- var TEN = new BN(10);
- var THREE = new BN(3);
- var SEVEN = new BN(7);
- var primes = __webpack_require__(/*! ./generatePrime */ 196);
- var randomBytes = __webpack_require__(/*! randombytes */ 112);
- module.exports = DH;
- function setPublicKey(pub, enc) {
- enc = enc || 'utf8';
- if (!Buffer.isBuffer(pub)) {
- pub = new Buffer(pub, enc);
- }
- this._pub = new BN(pub);
- return this;
- }
- function setPrivateKey(priv, enc) {
- enc = enc || 'utf8';
- if (!Buffer.isBuffer(priv)) {
- priv = new Buffer(priv, enc);
- }
- this._priv = new BN(priv);
- return this;
- }
- var primeCache = {};
- function checkPrime(prime, generator) {
- var gen = generator.toString('hex');
- var hex = [gen, prime.toString(16)].join('_');
- if (hex in primeCache) {
- return primeCache[hex];
- }
- var error = 0;
- if (prime.isEven() ||
- !primes.simpleSieve ||
- !primes.fermatTest(prime) ||
- !millerRabin.test(prime)) {
- //not a prime so +1
- error += 1;
- if (gen === '02' || gen === '05') {
- // we'd be able to check the generator
- // it would fail so +8
- error += 8;
- } else {
- //we wouldn't be able to test the generator
- // so +4
- error += 4;
- }
- primeCache[hex] = error;
- return error;
- }
- if (!millerRabin.test(prime.shrn(1))) {
- //not a safe prime
- error += 2;
- }
- var rem;
- switch (gen) {
- case '02':
- if (prime.mod(TWENTYFOUR).cmp(ELEVEN)) {
- // unsuidable generator
- error += 8;
- }
- break;
- case '05':
- rem = prime.mod(TEN);
- if (rem.cmp(THREE) && rem.cmp(SEVEN)) {
- // prime mod 10 needs to equal 3 or 7
- error += 8;
- }
- break;
- default:
- error += 4;
- }
- primeCache[hex] = error;
- return error;
- }
- function DH(prime, generator, malleable) {
- this.setGenerator(generator);
- this.__prime = new BN(prime);
- this._prime = BN.mont(this.__prime);
- this._primeLen = prime.length;
- this._pub = undefined;
- this._priv = undefined;
- this._primeCode = undefined;
- if (malleable) {
- this.setPublicKey = setPublicKey;
- this.setPrivateKey = setPrivateKey;
- } else {
- this._primeCode = 8;
- }
- }
- Object.defineProperty(DH.prototype, 'verifyError', {
- enumerable: true,
- get: function () {
- if (typeof this._primeCode !== 'number') {
- this._primeCode = checkPrime(this.__prime, this.__gen);
- }
- return this._primeCode;
- }
- });
- DH.prototype.generateKeys = function () {
- if (!this._priv) {
- this._priv = new BN(randomBytes(this._primeLen));
- }
- this._pub = this._gen.toRed(this._prime).redPow(this._priv).fromRed();
- return this.getPublicKey();
- };
- DH.prototype.computeSecret = function (other) {
- other = new BN(other);
- other = other.toRed(this._prime);
- var secret = other.redPow(this._priv).fromRed();
- var out = new Buffer(secret.toArray());
- var prime = this.getPrime();
- if (out.length < prime.length) {
- var front = new Buffer(prime.length - out.length);
- front.fill(0);
- out = Buffer.concat([front, out]);
- }
- return out;
- };
- DH.prototype.getPublicKey = function getPublicKey(enc) {
- return formatReturnValue(this._pub, enc);
- };
- DH.prototype.getPrivateKey = function getPrivateKey(enc) {
- return formatReturnValue(this._priv, enc);
- };
- DH.prototype.getPrime = function (enc) {
- return formatReturnValue(this.__prime, enc);
- };
- DH.prototype.getGenerator = function (enc) {
- return formatReturnValue(this._gen, enc);
- };
- DH.prototype.setGenerator = function (gen, enc) {
- enc = enc || 'utf8';
- if (!Buffer.isBuffer(gen)) {
- gen = new Buffer(gen, enc);
- }
- this.__gen = gen;
- this._gen = new BN(gen);
- return this;
- };
- function formatReturnValue(bn, enc) {
- var buf = new Buffer(bn.toArray());
- if (!enc) {
- return buf;
- } else {
- return buf.toString(enc);
- }
- }
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../buffer/index.js */ 116).Buffer))
- /***/ }),
- /* 205 */
- /*!*******************************************************!*\
- !*** ./node_modules/browserify-sign/browser/index.js ***!
- \*******************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- var createHash = __webpack_require__(/*! create-hash */ 120)
- var stream = __webpack_require__(/*! readable-stream */ 124)
- var inherits = __webpack_require__(/*! inherits */ 121)
- var sign = __webpack_require__(/*! ./sign */ 206)
- var verify = __webpack_require__(/*! ./verify */ 259)
- var algorithms = __webpack_require__(/*! ./algorithms.json */ 159)
- Object.keys(algorithms).forEach(function (key) {
- algorithms[key].id = Buffer.from(algorithms[key].id, 'hex')
- algorithms[key.toLowerCase()] = algorithms[key]
- })
- function Sign (algorithm) {
- stream.Writable.call(this)
- var data = algorithms[algorithm]
- if (!data) throw new Error('Unknown message digest')
- this._hashType = data.hash
- this._hash = createHash(data.hash)
- this._tag = data.id
- this._signType = data.sign
- }
- inherits(Sign, stream.Writable)
- Sign.prototype._write = function _write (data, _, done) {
- this._hash.update(data)
- done()
- }
- Sign.prototype.update = function update (data, enc) {
- if (typeof data === 'string') data = Buffer.from(data, enc)
- this._hash.update(data)
- return this
- }
- Sign.prototype.sign = function signMethod (key, enc) {
- this.end()
- var hash = this._hash.digest()
- var sig = sign(hash, key, this._hashType, this._signType, this._tag)
- return enc ? sig.toString(enc) : sig
- }
- function Verify (algorithm) {
- stream.Writable.call(this)
- var data = algorithms[algorithm]
- if (!data) throw new Error('Unknown message digest')
- this._hash = createHash(data.hash)
- this._tag = data.id
- this._signType = data.sign
- }
- inherits(Verify, stream.Writable)
- Verify.prototype._write = function _write (data, _, done) {
- this._hash.update(data)
- done()
- }
- Verify.prototype.update = function update (data, enc) {
- if (typeof data === 'string') data = Buffer.from(data, enc)
- this._hash.update(data)
- return this
- }
- Verify.prototype.verify = function verifyMethod (key, sig, enc) {
- if (typeof sig === 'string') sig = Buffer.from(sig, enc)
- this.end()
- var hash = this._hash.digest()
- return verify(sig, hash, key, this._signType, this._tag)
- }
- function createSign (algorithm) {
- return new Sign(algorithm)
- }
- function createVerify (algorithm) {
- return new Verify(algorithm)
- }
- module.exports = {
- Sign: createSign,
- Verify: createVerify,
- createSign: createSign,
- createVerify: createVerify
- }
- /***/ }),
- /* 206 */
- /*!******************************************************!*\
- !*** ./node_modules/browserify-sign/browser/sign.js ***!
- \******************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- // much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- var createHmac = __webpack_require__(/*! create-hmac */ 155)
- var crt = __webpack_require__(/*! browserify-rsa */ 207)
- var EC = __webpack_require__(/*! elliptic */ 208).ec
- var BN = __webpack_require__(/*! bn.js */ 197)
- var parseKeys = __webpack_require__(/*! parse-asn1 */ 238)
- var curves = __webpack_require__(/*! ./curves.json */ 258)
- function sign (hash, key, hashType, signType, tag) {
- var priv = parseKeys(key)
- if (priv.curve) {
- // rsa keys can be interpreted as ecdsa ones in openssl
- if (signType !== 'ecdsa' && signType !== 'ecdsa/rsa') throw new Error('wrong private key type')
- return ecSign(hash, priv)
- } else if (priv.type === 'dsa') {
- if (signType !== 'dsa') throw new Error('wrong private key type')
- return dsaSign(hash, priv, hashType)
- } else {
- if (signType !== 'rsa' && signType !== 'ecdsa/rsa') throw new Error('wrong private key type')
- }
- hash = Buffer.concat([tag, hash])
- var len = priv.modulus.byteLength()
- var pad = [0, 1]
- while (hash.length + pad.length + 1 < len) pad.push(0xff)
- pad.push(0x00)
- var i = -1
- while (++i < hash.length) pad.push(hash[i])
- var out = crt(pad, priv)
- return out
- }
- function ecSign (hash, priv) {
- var curveId = curves[priv.curve.join('.')]
- if (!curveId) throw new Error('unknown curve ' + priv.curve.join('.'))
- var curve = new EC(curveId)
- var key = curve.keyFromPrivate(priv.privateKey)
- var out = key.sign(hash)
- return Buffer.from(out.toDER())
- }
- function dsaSign (hash, priv, algo) {
- var x = priv.params.priv_key
- var p = priv.params.p
- var q = priv.params.q
- var g = priv.params.g
- var r = new BN(0)
- var k
- var H = bits2int(hash, q).mod(q)
- var s = false
- var kv = getKey(x, q, hash, algo)
- while (s === false) {
- k = makeKey(q, kv, algo)
- r = makeR(g, k, p, q)
- s = k.invm(q).imul(H.add(x.mul(r))).mod(q)
- if (s.cmpn(0) === 0) {
- s = false
- r = new BN(0)
- }
- }
- return toDER(r, s)
- }
- function toDER (r, s) {
- r = r.toArray()
- s = s.toArray()
- // Pad values
- if (r[0] & 0x80) r = [0].concat(r)
- if (s[0] & 0x80) s = [0].concat(s)
- var total = r.length + s.length + 4
- var res = [0x30, total, 0x02, r.length]
- res = res.concat(r, [0x02, s.length], s)
- return Buffer.from(res)
- }
- function getKey (x, q, hash, algo) {
- x = Buffer.from(x.toArray())
- if (x.length < q.byteLength()) {
- var zeros = Buffer.alloc(q.byteLength() - x.length)
- x = Buffer.concat([zeros, x])
- }
- var hlen = hash.length
- var hbits = bits2octets(hash, q)
- var v = Buffer.alloc(hlen)
- v.fill(1)
- var k = Buffer.alloc(hlen)
- k = createHmac(algo, k).update(v).update(Buffer.from([0])).update(x).update(hbits).digest()
- v = createHmac(algo, k).update(v).digest()
- k = createHmac(algo, k).update(v).update(Buffer.from([1])).update(x).update(hbits).digest()
- v = createHmac(algo, k).update(v).digest()
- return { k: k, v: v }
- }
- function bits2int (obits, q) {
- var bits = new BN(obits)
- var shift = (obits.length << 3) - q.bitLength()
- if (shift > 0) bits.ishrn(shift)
- return bits
- }
- function bits2octets (bits, q) {
- bits = bits2int(bits, q)
- bits = bits.mod(q)
- var out = Buffer.from(bits.toArray())
- if (out.length < q.byteLength()) {
- var zeros = Buffer.alloc(q.byteLength() - out.length)
- out = Buffer.concat([zeros, out])
- }
- return out
- }
- function makeKey (q, kv, algo) {
- var t
- var k
- do {
- t = Buffer.alloc(0)
- while (t.length * 8 < q.bitLength()) {
- kv.v = createHmac(algo, kv.k).update(kv.v).digest()
- t = Buffer.concat([t, kv.v])
- }
- k = bits2int(t, q)
- kv.k = createHmac(algo, kv.k).update(kv.v).update(Buffer.from([0])).digest()
- kv.v = createHmac(algo, kv.k).update(kv.v).digest()
- } while (k.cmp(q) !== -1)
- return k
- }
- function makeR (g, k, p, q) {
- return g.toRed(BN.mont(p)).redPow(k).fromRed().mod(q)
- }
- module.exports = sign
- module.exports.getKey = getKey
- module.exports.makeKey = makeKey
- /***/ }),
- /* 207 */
- /*!**********************************************!*\
- !*** ./node_modules/browserify-rsa/index.js ***!
- \**********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- /* WEBPACK VAR INJECTION */(function(Buffer) {var BN = __webpack_require__(/*! bn.js */ 197)
- var randomBytes = __webpack_require__(/*! randombytes */ 112)
- function blind (priv) {
- var r = getr(priv)
- var blinder = r.toRed(BN.mont(priv.modulus)).redPow(new BN(priv.publicExponent)).fromRed()
- return { blinder: blinder, unblinder: r.invm(priv.modulus) }
- }
- function getr (priv) {
- var len = priv.modulus.byteLength()
- var r
- do {
- r = new BN(randomBytes(len))
- } while (r.cmp(priv.modulus) >= 0 || !r.umod(priv.prime1) || !r.umod(priv.prime2))
- return r
- }
- function crt (msg, priv) {
- var blinds = blind(priv)
- var len = priv.modulus.byteLength()
- var blinded = new BN(msg).mul(blinds.blinder).umod(priv.modulus)
- var c1 = blinded.toRed(BN.mont(priv.prime1))
- var c2 = blinded.toRed(BN.mont(priv.prime2))
- var qinv = priv.coefficient
- var p = priv.prime1
- var q = priv.prime2
- var m1 = c1.redPow(priv.exponent1).fromRed()
- var m2 = c2.redPow(priv.exponent2).fromRed()
- var h = m1.isub(m2).imul(qinv).umod(p).imul(q)
- return m2.iadd(h).imul(blinds.unblinder).umod(priv.modulus).toArrayLike(Buffer, 'be', len)
- }
- crt.getr = getr
- module.exports = crt
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../buffer/index.js */ 116).Buffer))
- /***/ }),
- /* 208 */
- /*!***********************************************!*\
- !*** ./node_modules/elliptic/lib/elliptic.js ***!
- \***********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var elliptic = exports;
- elliptic.version = __webpack_require__(/*! ../package.json */ 209).version;
- elliptic.utils = __webpack_require__(/*! ./elliptic/utils */ 210);
- elliptic.rand = __webpack_require__(/*! brorand */ 201);
- elliptic.curve = __webpack_require__(/*! ./elliptic/curve */ 212);
- elliptic.curves = __webpack_require__(/*! ./elliptic/curves */ 217);
- // Protocols
- elliptic.ec = __webpack_require__(/*! ./elliptic/ec */ 231);
- elliptic.eddsa = __webpack_require__(/*! ./elliptic/eddsa */ 235);
- /***/ }),
- /* 209 */
- /*!********************************************!*\
- !*** ./node_modules/elliptic/package.json ***!
- \********************************************/
- /*! exports provided: name, version, description, main, files, scripts, repository, keywords, author, license, bugs, homepage, devDependencies, dependencies, default */
- /***/ (function(module) {
- module.exports = JSON.parse("{\"name\":\"elliptic\",\"version\":\"6.5.4\",\"description\":\"EC cryptography\",\"main\":\"lib/elliptic.js\",\"files\":[\"lib\"],\"scripts\":{\"lint\":\"eslint lib test\",\"lint:fix\":\"npm run lint -- --fix\",\"unit\":\"istanbul test _mocha --reporter=spec test/index.js\",\"test\":\"npm run lint && npm run unit\",\"version\":\"grunt dist && git add dist/\"},\"repository\":{\"type\":\"git\",\"url\":\"git@github.com:indutny/elliptic\"},\"keywords\":[\"EC\",\"Elliptic\",\"curve\",\"Cryptography\"],\"author\":\"Fedor Indutny <fedor@indutny.com>\",\"license\":\"MIT\",\"bugs\":{\"url\":\"https://github.com/indutny/elliptic/issues\"},\"homepage\":\"https://github.com/indutny/elliptic\",\"devDependencies\":{\"brfs\":\"^2.0.2\",\"coveralls\":\"^3.1.0\",\"eslint\":\"^7.6.0\",\"grunt\":\"^1.2.1\",\"grunt-browserify\":\"^5.3.0\",\"grunt-cli\":\"^1.3.2\",\"grunt-contrib-connect\":\"^3.0.0\",\"grunt-contrib-copy\":\"^1.0.0\",\"grunt-contrib-uglify\":\"^5.0.0\",\"grunt-mocha-istanbul\":\"^5.0.2\",\"grunt-saucelabs\":\"^9.0.1\",\"istanbul\":\"^0.4.5\",\"mocha\":\"^8.0.1\"},\"dependencies\":{\"bn.js\":\"^4.11.9\",\"brorand\":\"^1.1.0\",\"hash.js\":\"^1.0.0\",\"hmac-drbg\":\"^1.0.1\",\"inherits\":\"^2.0.4\",\"minimalistic-assert\":\"^1.0.1\",\"minimalistic-crypto-utils\":\"^1.0.1\"}}");
- /***/ }),
- /* 210 */
- /*!*****************************************************!*\
- !*** ./node_modules/elliptic/lib/elliptic/utils.js ***!
- \*****************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var utils = exports;
- var BN = __webpack_require__(/*! bn.js */ 197);
- var minAssert = __webpack_require__(/*! minimalistic-assert */ 171);
- var minUtils = __webpack_require__(/*! minimalistic-crypto-utils */ 211);
- utils.assert = minAssert;
- utils.toArray = minUtils.toArray;
- utils.zero2 = minUtils.zero2;
- utils.toHex = minUtils.toHex;
- utils.encode = minUtils.encode;
- // Represent num in a w-NAF form
- function getNAF(num, w, bits) {
- var naf = new Array(Math.max(num.bitLength(), bits) + 1);
- naf.fill(0);
- var ws = 1 << (w + 1);
- var k = num.clone();
- for (var i = 0; i < naf.length; i++) {
- var z;
- var mod = k.andln(ws - 1);
- if (k.isOdd()) {
- if (mod > (ws >> 1) - 1)
- z = (ws >> 1) - mod;
- else
- z = mod;
- k.isubn(z);
- } else {
- z = 0;
- }
- naf[i] = z;
- k.iushrn(1);
- }
- return naf;
- }
- utils.getNAF = getNAF;
- // Represent k1, k2 in a Joint Sparse Form
- function getJSF(k1, k2) {
- var jsf = [
- [],
- [],
- ];
- k1 = k1.clone();
- k2 = k2.clone();
- var d1 = 0;
- var d2 = 0;
- var m8;
- while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) {
- // First phase
- var m14 = (k1.andln(3) + d1) & 3;
- var m24 = (k2.andln(3) + d2) & 3;
- if (m14 === 3)
- m14 = -1;
- if (m24 === 3)
- m24 = -1;
- var u1;
- if ((m14 & 1) === 0) {
- u1 = 0;
- } else {
- m8 = (k1.andln(7) + d1) & 7;
- if ((m8 === 3 || m8 === 5) && m24 === 2)
- u1 = -m14;
- else
- u1 = m14;
- }
- jsf[0].push(u1);
- var u2;
- if ((m24 & 1) === 0) {
- u2 = 0;
- } else {
- m8 = (k2.andln(7) + d2) & 7;
- if ((m8 === 3 || m8 === 5) && m14 === 2)
- u2 = -m24;
- else
- u2 = m24;
- }
- jsf[1].push(u2);
- // Second phase
- if (2 * d1 === u1 + 1)
- d1 = 1 - d1;
- if (2 * d2 === u2 + 1)
- d2 = 1 - d2;
- k1.iushrn(1);
- k2.iushrn(1);
- }
- return jsf;
- }
- utils.getJSF = getJSF;
- function cachedProperty(obj, name, computer) {
- var key = '_' + name;
- obj.prototype[name] = function cachedProperty() {
- return this[key] !== undefined ? this[key] :
- this[key] = computer.call(this);
- };
- }
- utils.cachedProperty = cachedProperty;
- function parseBytes(bytes) {
- return typeof bytes === 'string' ? utils.toArray(bytes, 'hex') :
- bytes;
- }
- utils.parseBytes = parseBytes;
- function intFromLE(bytes) {
- return new BN(bytes, 'hex', 'le');
- }
- utils.intFromLE = intFromLE;
- /***/ }),
- /* 211 */
- /*!*************************************************************!*\
- !*** ./node_modules/minimalistic-crypto-utils/lib/utils.js ***!
- \*************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var utils = exports;
- function toArray(msg, enc) {
- if (Array.isArray(msg))
- return msg.slice();
- if (!msg)
- return [];
- var res = [];
- if (typeof msg !== 'string') {
- for (var i = 0; i < msg.length; i++)
- res[i] = msg[i] | 0;
- return res;
- }
- if (enc === 'hex') {
- msg = msg.replace(/[^a-z0-9]+/ig, '');
- if (msg.length % 2 !== 0)
- msg = '0' + msg;
- for (var i = 0; i < msg.length; i += 2)
- res.push(parseInt(msg[i] + msg[i + 1], 16));
- } else {
- for (var i = 0; i < msg.length; i++) {
- var c = msg.charCodeAt(i);
- var hi = c >> 8;
- var lo = c & 0xff;
- if (hi)
- res.push(hi, lo);
- else
- res.push(lo);
- }
- }
- return res;
- }
- utils.toArray = toArray;
- function zero2(word) {
- if (word.length === 1)
- return '0' + word;
- else
- return word;
- }
- utils.zero2 = zero2;
- function toHex(msg) {
- var res = '';
- for (var i = 0; i < msg.length; i++)
- res += zero2(msg[i].toString(16));
- return res;
- }
- utils.toHex = toHex;
- utils.encode = function encode(arr, enc) {
- if (enc === 'hex')
- return toHex(arr);
- else
- return arr;
- };
- /***/ }),
- /* 212 */
- /*!***********************************************************!*\
- !*** ./node_modules/elliptic/lib/elliptic/curve/index.js ***!
- \***********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var curve = exports;
- curve.base = __webpack_require__(/*! ./base */ 213);
- curve.short = __webpack_require__(/*! ./short */ 214);
- curve.mont = __webpack_require__(/*! ./mont */ 215);
- curve.edwards = __webpack_require__(/*! ./edwards */ 216);
- /***/ }),
- /* 213 */
- /*!**********************************************************!*\
- !*** ./node_modules/elliptic/lib/elliptic/curve/base.js ***!
- \**********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var BN = __webpack_require__(/*! bn.js */ 197);
- var utils = __webpack_require__(/*! ../utils */ 210);
- var getNAF = utils.getNAF;
- var getJSF = utils.getJSF;
- var assert = utils.assert;
- function BaseCurve(type, conf) {
- this.type = type;
- this.p = new BN(conf.p, 16);
- // Use Montgomery, when there is no fast reduction for the prime
- this.red = conf.prime ? BN.red(conf.prime) : BN.mont(this.p);
- // Useful for many curves
- this.zero = new BN(0).toRed(this.red);
- this.one = new BN(1).toRed(this.red);
- this.two = new BN(2).toRed(this.red);
- // Curve configuration, optional
- this.n = conf.n && new BN(conf.n, 16);
- this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed);
- // Temporary arrays
- this._wnafT1 = new Array(4);
- this._wnafT2 = new Array(4);
- this._wnafT3 = new Array(4);
- this._wnafT4 = new Array(4);
- this._bitLength = this.n ? this.n.bitLength() : 0;
- // Generalized Greg Maxwell's trick
- var adjustCount = this.n && this.p.div(this.n);
- if (!adjustCount || adjustCount.cmpn(100) > 0) {
- this.redN = null;
- } else {
- this._maxwellTrick = true;
- this.redN = this.n.toRed(this.red);
- }
- }
- module.exports = BaseCurve;
- BaseCurve.prototype.point = function point() {
- throw new Error('Not implemented');
- };
- BaseCurve.prototype.validate = function validate() {
- throw new Error('Not implemented');
- };
- BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) {
- assert(p.precomputed);
- var doubles = p._getDoubles();
- var naf = getNAF(k, 1, this._bitLength);
- var I = (1 << (doubles.step + 1)) - (doubles.step % 2 === 0 ? 2 : 1);
- I /= 3;
- // Translate into more windowed form
- var repr = [];
- var j;
- var nafW;
- for (j = 0; j < naf.length; j += doubles.step) {
- nafW = 0;
- for (var l = j + doubles.step - 1; l >= j; l--)
- nafW = (nafW << 1) + naf[l];
- repr.push(nafW);
- }
- var a = this.jpoint(null, null, null);
- var b = this.jpoint(null, null, null);
- for (var i = I; i > 0; i--) {
- for (j = 0; j < repr.length; j++) {
- nafW = repr[j];
- if (nafW === i)
- b = b.mixedAdd(doubles.points[j]);
- else if (nafW === -i)
- b = b.mixedAdd(doubles.points[j].neg());
- }
- a = a.add(b);
- }
- return a.toP();
- };
- BaseCurve.prototype._wnafMul = function _wnafMul(p, k) {
- var w = 4;
- // Precompute window
- var nafPoints = p._getNAFPoints(w);
- w = nafPoints.wnd;
- var wnd = nafPoints.points;
- // Get NAF form
- var naf = getNAF(k, w, this._bitLength);
- // Add `this`*(N+1) for every w-NAF index
- var acc = this.jpoint(null, null, null);
- for (var i = naf.length - 1; i >= 0; i--) {
- // Count zeroes
- for (var l = 0; i >= 0 && naf[i] === 0; i--)
- l++;
- if (i >= 0)
- l++;
- acc = acc.dblp(l);
- if (i < 0)
- break;
- var z = naf[i];
- assert(z !== 0);
- if (p.type === 'affine') {
- // J +- P
- if (z > 0)
- acc = acc.mixedAdd(wnd[(z - 1) >> 1]);
- else
- acc = acc.mixedAdd(wnd[(-z - 1) >> 1].neg());
- } else {
- // J +- J
- if (z > 0)
- acc = acc.add(wnd[(z - 1) >> 1]);
- else
- acc = acc.add(wnd[(-z - 1) >> 1].neg());
- }
- }
- return p.type === 'affine' ? acc.toP() : acc;
- };
- BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW,
- points,
- coeffs,
- len,
- jacobianResult) {
- var wndWidth = this._wnafT1;
- var wnd = this._wnafT2;
- var naf = this._wnafT3;
- // Fill all arrays
- var max = 0;
- var i;
- var j;
- var p;
- for (i = 0; i < len; i++) {
- p = points[i];
- var nafPoints = p._getNAFPoints(defW);
- wndWidth[i] = nafPoints.wnd;
- wnd[i] = nafPoints.points;
- }
- // Comb small window NAFs
- for (i = len - 1; i >= 1; i -= 2) {
- var a = i - 1;
- var b = i;
- if (wndWidth[a] !== 1 || wndWidth[b] !== 1) {
- naf[a] = getNAF(coeffs[a], wndWidth[a], this._bitLength);
- naf[b] = getNAF(coeffs[b], wndWidth[b], this._bitLength);
- max = Math.max(naf[a].length, max);
- max = Math.max(naf[b].length, max);
- continue;
- }
- var comb = [
- points[a], /* 1 */
- null, /* 3 */
- null, /* 5 */
- points[b], /* 7 */
- ];
- // Try to avoid Projective points, if possible
- if (points[a].y.cmp(points[b].y) === 0) {
- comb[1] = points[a].add(points[b]);
- comb[2] = points[a].toJ().mixedAdd(points[b].neg());
- } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) {
- comb[1] = points[a].toJ().mixedAdd(points[b]);
- comb[2] = points[a].add(points[b].neg());
- } else {
- comb[1] = points[a].toJ().mixedAdd(points[b]);
- comb[2] = points[a].toJ().mixedAdd(points[b].neg());
- }
- var index = [
- -3, /* -1 -1 */
- -1, /* -1 0 */
- -5, /* -1 1 */
- -7, /* 0 -1 */
- 0, /* 0 0 */
- 7, /* 0 1 */
- 5, /* 1 -1 */
- 1, /* 1 0 */
- 3, /* 1 1 */
- ];
- var jsf = getJSF(coeffs[a], coeffs[b]);
- max = Math.max(jsf[0].length, max);
- naf[a] = new Array(max);
- naf[b] = new Array(max);
- for (j = 0; j < max; j++) {
- var ja = jsf[0][j] | 0;
- var jb = jsf[1][j] | 0;
- naf[a][j] = index[(ja + 1) * 3 + (jb + 1)];
- naf[b][j] = 0;
- wnd[a] = comb;
- }
- }
- var acc = this.jpoint(null, null, null);
- var tmp = this._wnafT4;
- for (i = max; i >= 0; i--) {
- var k = 0;
- while (i >= 0) {
- var zero = true;
- for (j = 0; j < len; j++) {
- tmp[j] = naf[j][i] | 0;
- if (tmp[j] !== 0)
- zero = false;
- }
- if (!zero)
- break;
- k++;
- i--;
- }
- if (i >= 0)
- k++;
- acc = acc.dblp(k);
- if (i < 0)
- break;
- for (j = 0; j < len; j++) {
- var z = tmp[j];
- p;
- if (z === 0)
- continue;
- else if (z > 0)
- p = wnd[j][(z - 1) >> 1];
- else if (z < 0)
- p = wnd[j][(-z - 1) >> 1].neg();
- if (p.type === 'affine')
- acc = acc.mixedAdd(p);
- else
- acc = acc.add(p);
- }
- }
- // Zeroify references
- for (i = 0; i < len; i++)
- wnd[i] = null;
- if (jacobianResult)
- return acc;
- else
- return acc.toP();
- };
- function BasePoint(curve, type) {
- this.curve = curve;
- this.type = type;
- this.precomputed = null;
- }
- BaseCurve.BasePoint = BasePoint;
- BasePoint.prototype.eq = function eq(/*other*/) {
- throw new Error('Not implemented');
- };
- BasePoint.prototype.validate = function validate() {
- return this.curve.validate(this);
- };
- BaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) {
- bytes = utils.toArray(bytes, enc);
- var len = this.p.byteLength();
- // uncompressed, hybrid-odd, hybrid-even
- if ((bytes[0] === 0x04 || bytes[0] === 0x06 || bytes[0] === 0x07) &&
- bytes.length - 1 === 2 * len) {
- if (bytes[0] === 0x06)
- assert(bytes[bytes.length - 1] % 2 === 0);
- else if (bytes[0] === 0x07)
- assert(bytes[bytes.length - 1] % 2 === 1);
- var res = this.point(bytes.slice(1, 1 + len),
- bytes.slice(1 + len, 1 + 2 * len));
- return res;
- } else if ((bytes[0] === 0x02 || bytes[0] === 0x03) &&
- bytes.length - 1 === len) {
- return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 0x03);
- }
- throw new Error('Unknown point format');
- };
- BasePoint.prototype.encodeCompressed = function encodeCompressed(enc) {
- return this.encode(enc, true);
- };
- BasePoint.prototype._encode = function _encode(compact) {
- var len = this.curve.p.byteLength();
- var x = this.getX().toArray('be', len);
- if (compact)
- return [ this.getY().isEven() ? 0x02 : 0x03 ].concat(x);
- return [ 0x04 ].concat(x, this.getY().toArray('be', len));
- };
- BasePoint.prototype.encode = function encode(enc, compact) {
- return utils.encode(this._encode(compact), enc);
- };
- BasePoint.prototype.precompute = function precompute(power) {
- if (this.precomputed)
- return this;
- var precomputed = {
- doubles: null,
- naf: null,
- beta: null,
- };
- precomputed.naf = this._getNAFPoints(8);
- precomputed.doubles = this._getDoubles(4, power);
- precomputed.beta = this._getBeta();
- this.precomputed = precomputed;
- return this;
- };
- BasePoint.prototype._hasDoubles = function _hasDoubles(k) {
- if (!this.precomputed)
- return false;
- var doubles = this.precomputed.doubles;
- if (!doubles)
- return false;
- return doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step);
- };
- BasePoint.prototype._getDoubles = function _getDoubles(step, power) {
- if (this.precomputed && this.precomputed.doubles)
- return this.precomputed.doubles;
- var doubles = [ this ];
- var acc = this;
- for (var i = 0; i < power; i += step) {
- for (var j = 0; j < step; j++)
- acc = acc.dbl();
- doubles.push(acc);
- }
- return {
- step: step,
- points: doubles,
- };
- };
- BasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) {
- if (this.precomputed && this.precomputed.naf)
- return this.precomputed.naf;
- var res = [ this ];
- var max = (1 << wnd) - 1;
- var dbl = max === 1 ? null : this.dbl();
- for (var i = 1; i < max; i++)
- res[i] = res[i - 1].add(dbl);
- return {
- wnd: wnd,
- points: res,
- };
- };
- BasePoint.prototype._getBeta = function _getBeta() {
- return null;
- };
- BasePoint.prototype.dblp = function dblp(k) {
- var r = this;
- for (var i = 0; i < k; i++)
- r = r.dbl();
- return r;
- };
- /***/ }),
- /* 214 */
- /*!***********************************************************!*\
- !*** ./node_modules/elliptic/lib/elliptic/curve/short.js ***!
- \***********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var utils = __webpack_require__(/*! ../utils */ 210);
- var BN = __webpack_require__(/*! bn.js */ 197);
- var inherits = __webpack_require__(/*! inherits */ 121);
- var Base = __webpack_require__(/*! ./base */ 213);
- var assert = utils.assert;
- function ShortCurve(conf) {
- Base.call(this, 'short', conf);
- this.a = new BN(conf.a, 16).toRed(this.red);
- this.b = new BN(conf.b, 16).toRed(this.red);
- this.tinv = this.two.redInvm();
- this.zeroA = this.a.fromRed().cmpn(0) === 0;
- this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0;
- // If the curve is endomorphic, precalculate beta and lambda
- this.endo = this._getEndomorphism(conf);
- this._endoWnafT1 = new Array(4);
- this._endoWnafT2 = new Array(4);
- }
- inherits(ShortCurve, Base);
- module.exports = ShortCurve;
- ShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) {
- // No efficient endomorphism
- if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)
- return;
- // Compute beta and lambda, that lambda * P = (beta * Px; Py)
- var beta;
- var lambda;
- if (conf.beta) {
- beta = new BN(conf.beta, 16).toRed(this.red);
- } else {
- var betas = this._getEndoRoots(this.p);
- // Choose the smallest beta
- beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1];
- beta = beta.toRed(this.red);
- }
- if (conf.lambda) {
- lambda = new BN(conf.lambda, 16);
- } else {
- // Choose the lambda that is matching selected beta
- var lambdas = this._getEndoRoots(this.n);
- if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) {
- lambda = lambdas[0];
- } else {
- lambda = lambdas[1];
- assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0);
- }
- }
- // Get basis vectors, used for balanced length-two representation
- var basis;
- if (conf.basis) {
- basis = conf.basis.map(function(vec) {
- return {
- a: new BN(vec.a, 16),
- b: new BN(vec.b, 16),
- };
- });
- } else {
- basis = this._getEndoBasis(lambda);
- }
- return {
- beta: beta,
- lambda: lambda,
- basis: basis,
- };
- };
- ShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) {
- // Find roots of for x^2 + x + 1 in F
- // Root = (-1 +- Sqrt(-3)) / 2
- //
- var red = num === this.p ? this.red : BN.mont(num);
- var tinv = new BN(2).toRed(red).redInvm();
- var ntinv = tinv.redNeg();
- var s = new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv);
- var l1 = ntinv.redAdd(s).fromRed();
- var l2 = ntinv.redSub(s).fromRed();
- return [ l1, l2 ];
- };
- ShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) {
- // aprxSqrt >= sqrt(this.n)
- var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2));
- // 3.74
- // Run EGCD, until r(L + 1) < aprxSqrt
- var u = lambda;
- var v = this.n.clone();
- var x1 = new BN(1);
- var y1 = new BN(0);
- var x2 = new BN(0);
- var y2 = new BN(1);
- // NOTE: all vectors are roots of: a + b * lambda = 0 (mod n)
- var a0;
- var b0;
- // First vector
- var a1;
- var b1;
- // Second vector
- var a2;
- var b2;
- var prevR;
- var i = 0;
- var r;
- var x;
- while (u.cmpn(0) !== 0) {
- var q = v.div(u);
- r = v.sub(q.mul(u));
- x = x2.sub(q.mul(x1));
- var y = y2.sub(q.mul(y1));
- if (!a1 && r.cmp(aprxSqrt) < 0) {
- a0 = prevR.neg();
- b0 = x1;
- a1 = r.neg();
- b1 = x;
- } else if (a1 && ++i === 2) {
- break;
- }
- prevR = r;
- v = u;
- u = r;
- x2 = x1;
- x1 = x;
- y2 = y1;
- y1 = y;
- }
- a2 = r.neg();
- b2 = x;
- var len1 = a1.sqr().add(b1.sqr());
- var len2 = a2.sqr().add(b2.sqr());
- if (len2.cmp(len1) >= 0) {
- a2 = a0;
- b2 = b0;
- }
- // Normalize signs
- if (a1.negative) {
- a1 = a1.neg();
- b1 = b1.neg();
- }
- if (a2.negative) {
- a2 = a2.neg();
- b2 = b2.neg();
- }
- return [
- { a: a1, b: b1 },
- { a: a2, b: b2 },
- ];
- };
- ShortCurve.prototype._endoSplit = function _endoSplit(k) {
- var basis = this.endo.basis;
- var v1 = basis[0];
- var v2 = basis[1];
- var c1 = v2.b.mul(k).divRound(this.n);
- var c2 = v1.b.neg().mul(k).divRound(this.n);
- var p1 = c1.mul(v1.a);
- var p2 = c2.mul(v2.a);
- var q1 = c1.mul(v1.b);
- var q2 = c2.mul(v2.b);
- // Calculate answer
- var k1 = k.sub(p1).sub(p2);
- var k2 = q1.add(q2).neg();
- return { k1: k1, k2: k2 };
- };
- ShortCurve.prototype.pointFromX = function pointFromX(x, odd) {
- x = new BN(x, 16);
- if (!x.red)
- x = x.toRed(this.red);
- var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b);
- var y = y2.redSqrt();
- if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)
- throw new Error('invalid point');
- // XXX Is there any way to tell if the number is odd without converting it
- // to non-red form?
- var isOdd = y.fromRed().isOdd();
- if (odd && !isOdd || !odd && isOdd)
- y = y.redNeg();
- return this.point(x, y);
- };
- ShortCurve.prototype.validate = function validate(point) {
- if (point.inf)
- return true;
- var x = point.x;
- var y = point.y;
- var ax = this.a.redMul(x);
- var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);
- return y.redSqr().redISub(rhs).cmpn(0) === 0;
- };
- ShortCurve.prototype._endoWnafMulAdd =
- function _endoWnafMulAdd(points, coeffs, jacobianResult) {
- var npoints = this._endoWnafT1;
- var ncoeffs = this._endoWnafT2;
- for (var i = 0; i < points.length; i++) {
- var split = this._endoSplit(coeffs[i]);
- var p = points[i];
- var beta = p._getBeta();
- if (split.k1.negative) {
- split.k1.ineg();
- p = p.neg(true);
- }
- if (split.k2.negative) {
- split.k2.ineg();
- beta = beta.neg(true);
- }
- npoints[i * 2] = p;
- npoints[i * 2 + 1] = beta;
- ncoeffs[i * 2] = split.k1;
- ncoeffs[i * 2 + 1] = split.k2;
- }
- var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult);
- // Clean-up references to points and coefficients
- for (var j = 0; j < i * 2; j++) {
- npoints[j] = null;
- ncoeffs[j] = null;
- }
- return res;
- };
- function Point(curve, x, y, isRed) {
- Base.BasePoint.call(this, curve, 'affine');
- if (x === null && y === null) {
- this.x = null;
- this.y = null;
- this.inf = true;
- } else {
- this.x = new BN(x, 16);
- this.y = new BN(y, 16);
- // Force redgomery representation when loading from JSON
- if (isRed) {
- this.x.forceRed(this.curve.red);
- this.y.forceRed(this.curve.red);
- }
- if (!this.x.red)
- this.x = this.x.toRed(this.curve.red);
- if (!this.y.red)
- this.y = this.y.toRed(this.curve.red);
- this.inf = false;
- }
- }
- inherits(Point, Base.BasePoint);
- ShortCurve.prototype.point = function point(x, y, isRed) {
- return new Point(this, x, y, isRed);
- };
- ShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) {
- return Point.fromJSON(this, obj, red);
- };
- Point.prototype._getBeta = function _getBeta() {
- if (!this.curve.endo)
- return;
- var pre = this.precomputed;
- if (pre && pre.beta)
- return pre.beta;
- var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y);
- if (pre) {
- var curve = this.curve;
- var endoMul = function(p) {
- return curve.point(p.x.redMul(curve.endo.beta), p.y);
- };
- pre.beta = beta;
- beta.precomputed = {
- beta: null,
- naf: pre.naf && {
- wnd: pre.naf.wnd,
- points: pre.naf.points.map(endoMul),
- },
- doubles: pre.doubles && {
- step: pre.doubles.step,
- points: pre.doubles.points.map(endoMul),
- },
- };
- }
- return beta;
- };
- Point.prototype.toJSON = function toJSON() {
- if (!this.precomputed)
- return [ this.x, this.y ];
- return [ this.x, this.y, this.precomputed && {
- doubles: this.precomputed.doubles && {
- step: this.precomputed.doubles.step,
- points: this.precomputed.doubles.points.slice(1),
- },
- naf: this.precomputed.naf && {
- wnd: this.precomputed.naf.wnd,
- points: this.precomputed.naf.points.slice(1),
- },
- } ];
- };
- Point.fromJSON = function fromJSON(curve, obj, red) {
- if (typeof obj === 'string')
- obj = JSON.parse(obj);
- var res = curve.point(obj[0], obj[1], red);
- if (!obj[2])
- return res;
- function obj2point(obj) {
- return curve.point(obj[0], obj[1], red);
- }
- var pre = obj[2];
- res.precomputed = {
- beta: null,
- doubles: pre.doubles && {
- step: pre.doubles.step,
- points: [ res ].concat(pre.doubles.points.map(obj2point)),
- },
- naf: pre.naf && {
- wnd: pre.naf.wnd,
- points: [ res ].concat(pre.naf.points.map(obj2point)),
- },
- };
- return res;
- };
- Point.prototype.inspect = function inspect() {
- if (this.isInfinity())
- return '<EC Point Infinity>';
- return '<EC Point x: ' + this.x.fromRed().toString(16, 2) +
- ' y: ' + this.y.fromRed().toString(16, 2) + '>';
- };
- Point.prototype.isInfinity = function isInfinity() {
- return this.inf;
- };
- Point.prototype.add = function add(p) {
- // O + P = P
- if (this.inf)
- return p;
- // P + O = P
- if (p.inf)
- return this;
- // P + P = 2P
- if (this.eq(p))
- return this.dbl();
- // P + (-P) = O
- if (this.neg().eq(p))
- return this.curve.point(null, null);
- // P + Q = O
- if (this.x.cmp(p.x) === 0)
- return this.curve.point(null, null);
- var c = this.y.redSub(p.y);
- if (c.cmpn(0) !== 0)
- c = c.redMul(this.x.redSub(p.x).redInvm());
- var nx = c.redSqr().redISub(this.x).redISub(p.x);
- var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);
- return this.curve.point(nx, ny);
- };
- Point.prototype.dbl = function dbl() {
- if (this.inf)
- return this;
- // 2P = O
- var ys1 = this.y.redAdd(this.y);
- if (ys1.cmpn(0) === 0)
- return this.curve.point(null, null);
- var a = this.curve.a;
- var x2 = this.x.redSqr();
- var dyinv = ys1.redInvm();
- var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv);
- var nx = c.redSqr().redISub(this.x.redAdd(this.x));
- var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);
- return this.curve.point(nx, ny);
- };
- Point.prototype.getX = function getX() {
- return this.x.fromRed();
- };
- Point.prototype.getY = function getY() {
- return this.y.fromRed();
- };
- Point.prototype.mul = function mul(k) {
- k = new BN(k, 16);
- if (this.isInfinity())
- return this;
- else if (this._hasDoubles(k))
- return this.curve._fixedNafMul(this, k);
- else if (this.curve.endo)
- return this.curve._endoWnafMulAdd([ this ], [ k ]);
- else
- return this.curve._wnafMul(this, k);
- };
- Point.prototype.mulAdd = function mulAdd(k1, p2, k2) {
- var points = [ this, p2 ];
- var coeffs = [ k1, k2 ];
- if (this.curve.endo)
- return this.curve._endoWnafMulAdd(points, coeffs);
- else
- return this.curve._wnafMulAdd(1, points, coeffs, 2);
- };
- Point.prototype.jmulAdd = function jmulAdd(k1, p2, k2) {
- var points = [ this, p2 ];
- var coeffs = [ k1, k2 ];
- if (this.curve.endo)
- return this.curve._endoWnafMulAdd(points, coeffs, true);
- else
- return this.curve._wnafMulAdd(1, points, coeffs, 2, true);
- };
- Point.prototype.eq = function eq(p) {
- return this === p ||
- this.inf === p.inf &&
- (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0);
- };
- Point.prototype.neg = function neg(_precompute) {
- if (this.inf)
- return this;
- var res = this.curve.point(this.x, this.y.redNeg());
- if (_precompute && this.precomputed) {
- var pre = this.precomputed;
- var negate = function(p) {
- return p.neg();
- };
- res.precomputed = {
- naf: pre.naf && {
- wnd: pre.naf.wnd,
- points: pre.naf.points.map(negate),
- },
- doubles: pre.doubles && {
- step: pre.doubles.step,
- points: pre.doubles.points.map(negate),
- },
- };
- }
- return res;
- };
- Point.prototype.toJ = function toJ() {
- if (this.inf)
- return this.curve.jpoint(null, null, null);
- var res = this.curve.jpoint(this.x, this.y, this.curve.one);
- return res;
- };
- function JPoint(curve, x, y, z) {
- Base.BasePoint.call(this, curve, 'jacobian');
- if (x === null && y === null && z === null) {
- this.x = this.curve.one;
- this.y = this.curve.one;
- this.z = new BN(0);
- } else {
- this.x = new BN(x, 16);
- this.y = new BN(y, 16);
- this.z = new BN(z, 16);
- }
- if (!this.x.red)
- this.x = this.x.toRed(this.curve.red);
- if (!this.y.red)
- this.y = this.y.toRed(this.curve.red);
- if (!this.z.red)
- this.z = this.z.toRed(this.curve.red);
- this.zOne = this.z === this.curve.one;
- }
- inherits(JPoint, Base.BasePoint);
- ShortCurve.prototype.jpoint = function jpoint(x, y, z) {
- return new JPoint(this, x, y, z);
- };
- JPoint.prototype.toP = function toP() {
- if (this.isInfinity())
- return this.curve.point(null, null);
- var zinv = this.z.redInvm();
- var zinv2 = zinv.redSqr();
- var ax = this.x.redMul(zinv2);
- var ay = this.y.redMul(zinv2).redMul(zinv);
- return this.curve.point(ax, ay);
- };
- JPoint.prototype.neg = function neg() {
- return this.curve.jpoint(this.x, this.y.redNeg(), this.z);
- };
- JPoint.prototype.add = function add(p) {
- // O + P = P
- if (this.isInfinity())
- return p;
- // P + O = P
- if (p.isInfinity())
- return this;
- // 12M + 4S + 7A
- var pz2 = p.z.redSqr();
- var z2 = this.z.redSqr();
- var u1 = this.x.redMul(pz2);
- var u2 = p.x.redMul(z2);
- var s1 = this.y.redMul(pz2.redMul(p.z));
- var s2 = p.y.redMul(z2.redMul(this.z));
- var h = u1.redSub(u2);
- var r = s1.redSub(s2);
- if (h.cmpn(0) === 0) {
- if (r.cmpn(0) !== 0)
- return this.curve.jpoint(null, null, null);
- else
- return this.dbl();
- }
- var h2 = h.redSqr();
- var h3 = h2.redMul(h);
- var v = u1.redMul(h2);
- var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);
- var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));
- var nz = this.z.redMul(p.z).redMul(h);
- return this.curve.jpoint(nx, ny, nz);
- };
- JPoint.prototype.mixedAdd = function mixedAdd(p) {
- // O + P = P
- if (this.isInfinity())
- return p.toJ();
- // P + O = P
- if (p.isInfinity())
- return this;
- // 8M + 3S + 7A
- var z2 = this.z.redSqr();
- var u1 = this.x;
- var u2 = p.x.redMul(z2);
- var s1 = this.y;
- var s2 = p.y.redMul(z2).redMul(this.z);
- var h = u1.redSub(u2);
- var r = s1.redSub(s2);
- if (h.cmpn(0) === 0) {
- if (r.cmpn(0) !== 0)
- return this.curve.jpoint(null, null, null);
- else
- return this.dbl();
- }
- var h2 = h.redSqr();
- var h3 = h2.redMul(h);
- var v = u1.redMul(h2);
- var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);
- var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));
- var nz = this.z.redMul(h);
- return this.curve.jpoint(nx, ny, nz);
- };
- JPoint.prototype.dblp = function dblp(pow) {
- if (pow === 0)
- return this;
- if (this.isInfinity())
- return this;
- if (!pow)
- return this.dbl();
- var i;
- if (this.curve.zeroA || this.curve.threeA) {
- var r = this;
- for (i = 0; i < pow; i++)
- r = r.dbl();
- return r;
- }
- // 1M + 2S + 1A + N * (4S + 5M + 8A)
- // N = 1 => 6M + 6S + 9A
- var a = this.curve.a;
- var tinv = this.curve.tinv;
- var jx = this.x;
- var jy = this.y;
- var jz = this.z;
- var jz4 = jz.redSqr().redSqr();
- // Reuse results
- var jyd = jy.redAdd(jy);
- for (i = 0; i < pow; i++) {
- var jx2 = jx.redSqr();
- var jyd2 = jyd.redSqr();
- var jyd4 = jyd2.redSqr();
- var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));
- var t1 = jx.redMul(jyd2);
- var nx = c.redSqr().redISub(t1.redAdd(t1));
- var t2 = t1.redISub(nx);
- var dny = c.redMul(t2);
- dny = dny.redIAdd(dny).redISub(jyd4);
- var nz = jyd.redMul(jz);
- if (i + 1 < pow)
- jz4 = jz4.redMul(jyd4);
- jx = nx;
- jz = nz;
- jyd = dny;
- }
- return this.curve.jpoint(jx, jyd.redMul(tinv), jz);
- };
- JPoint.prototype.dbl = function dbl() {
- if (this.isInfinity())
- return this;
- if (this.curve.zeroA)
- return this._zeroDbl();
- else if (this.curve.threeA)
- return this._threeDbl();
- else
- return this._dbl();
- };
- JPoint.prototype._zeroDbl = function _zeroDbl() {
- var nx;
- var ny;
- var nz;
- // Z = 1
- if (this.zOne) {
- // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html
- // #doubling-mdbl-2007-bl
- // 1M + 5S + 14A
- // XX = X1^2
- var xx = this.x.redSqr();
- // YY = Y1^2
- var yy = this.y.redSqr();
- // YYYY = YY^2
- var yyyy = yy.redSqr();
- // S = 2 * ((X1 + YY)^2 - XX - YYYY)
- var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
- s = s.redIAdd(s);
- // M = 3 * XX + a; a = 0
- var m = xx.redAdd(xx).redIAdd(xx);
- // T = M ^ 2 - 2*S
- var t = m.redSqr().redISub(s).redISub(s);
- // 8 * YYYY
- var yyyy8 = yyyy.redIAdd(yyyy);
- yyyy8 = yyyy8.redIAdd(yyyy8);
- yyyy8 = yyyy8.redIAdd(yyyy8);
- // X3 = T
- nx = t;
- // Y3 = M * (S - T) - 8 * YYYY
- ny = m.redMul(s.redISub(t)).redISub(yyyy8);
- // Z3 = 2*Y1
- nz = this.y.redAdd(this.y);
- } else {
- // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html
- // #doubling-dbl-2009-l
- // 2M + 5S + 13A
- // A = X1^2
- var a = this.x.redSqr();
- // B = Y1^2
- var b = this.y.redSqr();
- // C = B^2
- var c = b.redSqr();
- // D = 2 * ((X1 + B)^2 - A - C)
- var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c);
- d = d.redIAdd(d);
- // E = 3 * A
- var e = a.redAdd(a).redIAdd(a);
- // F = E^2
- var f = e.redSqr();
- // 8 * C
- var c8 = c.redIAdd(c);
- c8 = c8.redIAdd(c8);
- c8 = c8.redIAdd(c8);
- // X3 = F - 2 * D
- nx = f.redISub(d).redISub(d);
- // Y3 = E * (D - X3) - 8 * C
- ny = e.redMul(d.redISub(nx)).redISub(c8);
- // Z3 = 2 * Y1 * Z1
- nz = this.y.redMul(this.z);
- nz = nz.redIAdd(nz);
- }
- return this.curve.jpoint(nx, ny, nz);
- };
- JPoint.prototype._threeDbl = function _threeDbl() {
- var nx;
- var ny;
- var nz;
- // Z = 1
- if (this.zOne) {
- // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html
- // #doubling-mdbl-2007-bl
- // 1M + 5S + 15A
- // XX = X1^2
- var xx = this.x.redSqr();
- // YY = Y1^2
- var yy = this.y.redSqr();
- // YYYY = YY^2
- var yyyy = yy.redSqr();
- // S = 2 * ((X1 + YY)^2 - XX - YYYY)
- var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
- s = s.redIAdd(s);
- // M = 3 * XX + a
- var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a);
- // T = M^2 - 2 * S
- var t = m.redSqr().redISub(s).redISub(s);
- // X3 = T
- nx = t;
- // Y3 = M * (S - T) - 8 * YYYY
- var yyyy8 = yyyy.redIAdd(yyyy);
- yyyy8 = yyyy8.redIAdd(yyyy8);
- yyyy8 = yyyy8.redIAdd(yyyy8);
- ny = m.redMul(s.redISub(t)).redISub(yyyy8);
- // Z3 = 2 * Y1
- nz = this.y.redAdd(this.y);
- } else {
- // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b
- // 3M + 5S
- // delta = Z1^2
- var delta = this.z.redSqr();
- // gamma = Y1^2
- var gamma = this.y.redSqr();
- // beta = X1 * gamma
- var beta = this.x.redMul(gamma);
- // alpha = 3 * (X1 - delta) * (X1 + delta)
- var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta));
- alpha = alpha.redAdd(alpha).redIAdd(alpha);
- // X3 = alpha^2 - 8 * beta
- var beta4 = beta.redIAdd(beta);
- beta4 = beta4.redIAdd(beta4);
- var beta8 = beta4.redAdd(beta4);
- nx = alpha.redSqr().redISub(beta8);
- // Z3 = (Y1 + Z1)^2 - gamma - delta
- nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta);
- // Y3 = alpha * (4 * beta - X3) - 8 * gamma^2
- var ggamma8 = gamma.redSqr();
- ggamma8 = ggamma8.redIAdd(ggamma8);
- ggamma8 = ggamma8.redIAdd(ggamma8);
- ggamma8 = ggamma8.redIAdd(ggamma8);
- ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8);
- }
- return this.curve.jpoint(nx, ny, nz);
- };
- JPoint.prototype._dbl = function _dbl() {
- var a = this.curve.a;
- // 4M + 6S + 10A
- var jx = this.x;
- var jy = this.y;
- var jz = this.z;
- var jz4 = jz.redSqr().redSqr();
- var jx2 = jx.redSqr();
- var jy2 = jy.redSqr();
- var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));
- var jxd4 = jx.redAdd(jx);
- jxd4 = jxd4.redIAdd(jxd4);
- var t1 = jxd4.redMul(jy2);
- var nx = c.redSqr().redISub(t1.redAdd(t1));
- var t2 = t1.redISub(nx);
- var jyd8 = jy2.redSqr();
- jyd8 = jyd8.redIAdd(jyd8);
- jyd8 = jyd8.redIAdd(jyd8);
- jyd8 = jyd8.redIAdd(jyd8);
- var ny = c.redMul(t2).redISub(jyd8);
- var nz = jy.redAdd(jy).redMul(jz);
- return this.curve.jpoint(nx, ny, nz);
- };
- JPoint.prototype.trpl = function trpl() {
- if (!this.curve.zeroA)
- return this.dbl().add(this);
- // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl
- // 5M + 10S + ...
- // XX = X1^2
- var xx = this.x.redSqr();
- // YY = Y1^2
- var yy = this.y.redSqr();
- // ZZ = Z1^2
- var zz = this.z.redSqr();
- // YYYY = YY^2
- var yyyy = yy.redSqr();
- // M = 3 * XX + a * ZZ2; a = 0
- var m = xx.redAdd(xx).redIAdd(xx);
- // MM = M^2
- var mm = m.redSqr();
- // E = 6 * ((X1 + YY)^2 - XX - YYYY) - MM
- var e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
- e = e.redIAdd(e);
- e = e.redAdd(e).redIAdd(e);
- e = e.redISub(mm);
- // EE = E^2
- var ee = e.redSqr();
- // T = 16*YYYY
- var t = yyyy.redIAdd(yyyy);
- t = t.redIAdd(t);
- t = t.redIAdd(t);
- t = t.redIAdd(t);
- // U = (M + E)^2 - MM - EE - T
- var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t);
- // X3 = 4 * (X1 * EE - 4 * YY * U)
- var yyu4 = yy.redMul(u);
- yyu4 = yyu4.redIAdd(yyu4);
- yyu4 = yyu4.redIAdd(yyu4);
- var nx = this.x.redMul(ee).redISub(yyu4);
- nx = nx.redIAdd(nx);
- nx = nx.redIAdd(nx);
- // Y3 = 8 * Y1 * (U * (T - U) - E * EE)
- var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee)));
- ny = ny.redIAdd(ny);
- ny = ny.redIAdd(ny);
- ny = ny.redIAdd(ny);
- // Z3 = (Z1 + E)^2 - ZZ - EE
- var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee);
- return this.curve.jpoint(nx, ny, nz);
- };
- JPoint.prototype.mul = function mul(k, kbase) {
- k = new BN(k, kbase);
- return this.curve._wnafMul(this, k);
- };
- JPoint.prototype.eq = function eq(p) {
- if (p.type === 'affine')
- return this.eq(p.toJ());
- if (this === p)
- return true;
- // x1 * z2^2 == x2 * z1^2
- var z2 = this.z.redSqr();
- var pz2 = p.z.redSqr();
- if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0)
- return false;
- // y1 * z2^3 == y2 * z1^3
- var z3 = z2.redMul(this.z);
- var pz3 = pz2.redMul(p.z);
- return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0;
- };
- JPoint.prototype.eqXToP = function eqXToP(x) {
- var zs = this.z.redSqr();
- var rx = x.toRed(this.curve.red).redMul(zs);
- if (this.x.cmp(rx) === 0)
- return true;
- var xc = x.clone();
- var t = this.curve.redN.redMul(zs);
- for (;;) {
- xc.iadd(this.curve.n);
- if (xc.cmp(this.curve.p) >= 0)
- return false;
- rx.redIAdd(t);
- if (this.x.cmp(rx) === 0)
- return true;
- }
- };
- JPoint.prototype.inspect = function inspect() {
- if (this.isInfinity())
- return '<EC JPoint Infinity>';
- return '<EC JPoint x: ' + this.x.toString(16, 2) +
- ' y: ' + this.y.toString(16, 2) +
- ' z: ' + this.z.toString(16, 2) + '>';
- };
- JPoint.prototype.isInfinity = function isInfinity() {
- // XXX This code assumes that zero is always zero in red
- return this.z.cmpn(0) === 0;
- };
- /***/ }),
- /* 215 */
- /*!**********************************************************!*\
- !*** ./node_modules/elliptic/lib/elliptic/curve/mont.js ***!
- \**********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var BN = __webpack_require__(/*! bn.js */ 197);
- var inherits = __webpack_require__(/*! inherits */ 121);
- var Base = __webpack_require__(/*! ./base */ 213);
- var utils = __webpack_require__(/*! ../utils */ 210);
- function MontCurve(conf) {
- Base.call(this, 'mont', conf);
- this.a = new BN(conf.a, 16).toRed(this.red);
- this.b = new BN(conf.b, 16).toRed(this.red);
- this.i4 = new BN(4).toRed(this.red).redInvm();
- this.two = new BN(2).toRed(this.red);
- this.a24 = this.i4.redMul(this.a.redAdd(this.two));
- }
- inherits(MontCurve, Base);
- module.exports = MontCurve;
- MontCurve.prototype.validate = function validate(point) {
- var x = point.normalize().x;
- var x2 = x.redSqr();
- var rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x);
- var y = rhs.redSqrt();
- return y.redSqr().cmp(rhs) === 0;
- };
- function Point(curve, x, z) {
- Base.BasePoint.call(this, curve, 'projective');
- if (x === null && z === null) {
- this.x = this.curve.one;
- this.z = this.curve.zero;
- } else {
- this.x = new BN(x, 16);
- this.z = new BN(z, 16);
- if (!this.x.red)
- this.x = this.x.toRed(this.curve.red);
- if (!this.z.red)
- this.z = this.z.toRed(this.curve.red);
- }
- }
- inherits(Point, Base.BasePoint);
- MontCurve.prototype.decodePoint = function decodePoint(bytes, enc) {
- return this.point(utils.toArray(bytes, enc), 1);
- };
- MontCurve.prototype.point = function point(x, z) {
- return new Point(this, x, z);
- };
- MontCurve.prototype.pointFromJSON = function pointFromJSON(obj) {
- return Point.fromJSON(this, obj);
- };
- Point.prototype.precompute = function precompute() {
- // No-op
- };
- Point.prototype._encode = function _encode() {
- return this.getX().toArray('be', this.curve.p.byteLength());
- };
- Point.fromJSON = function fromJSON(curve, obj) {
- return new Point(curve, obj[0], obj[1] || curve.one);
- };
- Point.prototype.inspect = function inspect() {
- if (this.isInfinity())
- return '<EC Point Infinity>';
- return '<EC Point x: ' + this.x.fromRed().toString(16, 2) +
- ' z: ' + this.z.fromRed().toString(16, 2) + '>';
- };
- Point.prototype.isInfinity = function isInfinity() {
- // XXX This code assumes that zero is always zero in red
- return this.z.cmpn(0) === 0;
- };
- Point.prototype.dbl = function dbl() {
- // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#doubling-dbl-1987-m-3
- // 2M + 2S + 4A
- // A = X1 + Z1
- var a = this.x.redAdd(this.z);
- // AA = A^2
- var aa = a.redSqr();
- // B = X1 - Z1
- var b = this.x.redSub(this.z);
- // BB = B^2
- var bb = b.redSqr();
- // C = AA - BB
- var c = aa.redSub(bb);
- // X3 = AA * BB
- var nx = aa.redMul(bb);
- // Z3 = C * (BB + A24 * C)
- var nz = c.redMul(bb.redAdd(this.curve.a24.redMul(c)));
- return this.curve.point(nx, nz);
- };
- Point.prototype.add = function add() {
- throw new Error('Not supported on Montgomery curve');
- };
- Point.prototype.diffAdd = function diffAdd(p, diff) {
- // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#diffadd-dadd-1987-m-3
- // 4M + 2S + 6A
- // A = X2 + Z2
- var a = this.x.redAdd(this.z);
- // B = X2 - Z2
- var b = this.x.redSub(this.z);
- // C = X3 + Z3
- var c = p.x.redAdd(p.z);
- // D = X3 - Z3
- var d = p.x.redSub(p.z);
- // DA = D * A
- var da = d.redMul(a);
- // CB = C * B
- var cb = c.redMul(b);
- // X5 = Z1 * (DA + CB)^2
- var nx = diff.z.redMul(da.redAdd(cb).redSqr());
- // Z5 = X1 * (DA - CB)^2
- var nz = diff.x.redMul(da.redISub(cb).redSqr());
- return this.curve.point(nx, nz);
- };
- Point.prototype.mul = function mul(k) {
- var t = k.clone();
- var a = this; // (N / 2) * Q + Q
- var b = this.curve.point(null, null); // (N / 2) * Q
- var c = this; // Q
- for (var bits = []; t.cmpn(0) !== 0; t.iushrn(1))
- bits.push(t.andln(1));
- for (var i = bits.length - 1; i >= 0; i--) {
- if (bits[i] === 0) {
- // N * Q + Q = ((N / 2) * Q + Q)) + (N / 2) * Q
- a = a.diffAdd(b, c);
- // N * Q = 2 * ((N / 2) * Q + Q))
- b = b.dbl();
- } else {
- // N * Q = ((N / 2) * Q + Q) + ((N / 2) * Q)
- b = a.diffAdd(b, c);
- // N * Q + Q = 2 * ((N / 2) * Q + Q)
- a = a.dbl();
- }
- }
- return b;
- };
- Point.prototype.mulAdd = function mulAdd() {
- throw new Error('Not supported on Montgomery curve');
- };
- Point.prototype.jumlAdd = function jumlAdd() {
- throw new Error('Not supported on Montgomery curve');
- };
- Point.prototype.eq = function eq(other) {
- return this.getX().cmp(other.getX()) === 0;
- };
- Point.prototype.normalize = function normalize() {
- this.x = this.x.redMul(this.z.redInvm());
- this.z = this.curve.one;
- return this;
- };
- Point.prototype.getX = function getX() {
- // Normalize coordinates
- this.normalize();
- return this.x.fromRed();
- };
- /***/ }),
- /* 216 */
- /*!*************************************************************!*\
- !*** ./node_modules/elliptic/lib/elliptic/curve/edwards.js ***!
- \*************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var utils = __webpack_require__(/*! ../utils */ 210);
- var BN = __webpack_require__(/*! bn.js */ 197);
- var inherits = __webpack_require__(/*! inherits */ 121);
- var Base = __webpack_require__(/*! ./base */ 213);
- var assert = utils.assert;
- function EdwardsCurve(conf) {
- // NOTE: Important as we are creating point in Base.call()
- this.twisted = (conf.a | 0) !== 1;
- this.mOneA = this.twisted && (conf.a | 0) === -1;
- this.extended = this.mOneA;
- Base.call(this, 'edwards', conf);
- this.a = new BN(conf.a, 16).umod(this.red.m);
- this.a = this.a.toRed(this.red);
- this.c = new BN(conf.c, 16).toRed(this.red);
- this.c2 = this.c.redSqr();
- this.d = new BN(conf.d, 16).toRed(this.red);
- this.dd = this.d.redAdd(this.d);
- assert(!this.twisted || this.c.fromRed().cmpn(1) === 0);
- this.oneC = (conf.c | 0) === 1;
- }
- inherits(EdwardsCurve, Base);
- module.exports = EdwardsCurve;
- EdwardsCurve.prototype._mulA = function _mulA(num) {
- if (this.mOneA)
- return num.redNeg();
- else
- return this.a.redMul(num);
- };
- EdwardsCurve.prototype._mulC = function _mulC(num) {
- if (this.oneC)
- return num;
- else
- return this.c.redMul(num);
- };
- // Just for compatibility with Short curve
- EdwardsCurve.prototype.jpoint = function jpoint(x, y, z, t) {
- return this.point(x, y, z, t);
- };
- EdwardsCurve.prototype.pointFromX = function pointFromX(x, odd) {
- x = new BN(x, 16);
- if (!x.red)
- x = x.toRed(this.red);
- var x2 = x.redSqr();
- var rhs = this.c2.redSub(this.a.redMul(x2));
- var lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2));
- var y2 = rhs.redMul(lhs.redInvm());
- var y = y2.redSqrt();
- if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)
- throw new Error('invalid point');
- var isOdd = y.fromRed().isOdd();
- if (odd && !isOdd || !odd && isOdd)
- y = y.redNeg();
- return this.point(x, y);
- };
- EdwardsCurve.prototype.pointFromY = function pointFromY(y, odd) {
- y = new BN(y, 16);
- if (!y.red)
- y = y.toRed(this.red);
- // x^2 = (y^2 - c^2) / (c^2 d y^2 - a)
- var y2 = y.redSqr();
- var lhs = y2.redSub(this.c2);
- var rhs = y2.redMul(this.d).redMul(this.c2).redSub(this.a);
- var x2 = lhs.redMul(rhs.redInvm());
- if (x2.cmp(this.zero) === 0) {
- if (odd)
- throw new Error('invalid point');
- else
- return this.point(this.zero, y);
- }
- var x = x2.redSqrt();
- if (x.redSqr().redSub(x2).cmp(this.zero) !== 0)
- throw new Error('invalid point');
- if (x.fromRed().isOdd() !== odd)
- x = x.redNeg();
- return this.point(x, y);
- };
- EdwardsCurve.prototype.validate = function validate(point) {
- if (point.isInfinity())
- return true;
- // Curve: A * X^2 + Y^2 = C^2 * (1 + D * X^2 * Y^2)
- point.normalize();
- var x2 = point.x.redSqr();
- var y2 = point.y.redSqr();
- var lhs = x2.redMul(this.a).redAdd(y2);
- var rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2)));
- return lhs.cmp(rhs) === 0;
- };
- function Point(curve, x, y, z, t) {
- Base.BasePoint.call(this, curve, 'projective');
- if (x === null && y === null && z === null) {
- this.x = this.curve.zero;
- this.y = this.curve.one;
- this.z = this.curve.one;
- this.t = this.curve.zero;
- this.zOne = true;
- } else {
- this.x = new BN(x, 16);
- this.y = new BN(y, 16);
- this.z = z ? new BN(z, 16) : this.curve.one;
- this.t = t && new BN(t, 16);
- if (!this.x.red)
- this.x = this.x.toRed(this.curve.red);
- if (!this.y.red)
- this.y = this.y.toRed(this.curve.red);
- if (!this.z.red)
- this.z = this.z.toRed(this.curve.red);
- if (this.t && !this.t.red)
- this.t = this.t.toRed(this.curve.red);
- this.zOne = this.z === this.curve.one;
- // Use extended coordinates
- if (this.curve.extended && !this.t) {
- this.t = this.x.redMul(this.y);
- if (!this.zOne)
- this.t = this.t.redMul(this.z.redInvm());
- }
- }
- }
- inherits(Point, Base.BasePoint);
- EdwardsCurve.prototype.pointFromJSON = function pointFromJSON(obj) {
- return Point.fromJSON(this, obj);
- };
- EdwardsCurve.prototype.point = function point(x, y, z, t) {
- return new Point(this, x, y, z, t);
- };
- Point.fromJSON = function fromJSON(curve, obj) {
- return new Point(curve, obj[0], obj[1], obj[2]);
- };
- Point.prototype.inspect = function inspect() {
- if (this.isInfinity())
- return '<EC Point Infinity>';
- return '<EC Point x: ' + this.x.fromRed().toString(16, 2) +
- ' y: ' + this.y.fromRed().toString(16, 2) +
- ' z: ' + this.z.fromRed().toString(16, 2) + '>';
- };
- Point.prototype.isInfinity = function isInfinity() {
- // XXX This code assumes that zero is always zero in red
- return this.x.cmpn(0) === 0 &&
- (this.y.cmp(this.z) === 0 ||
- (this.zOne && this.y.cmp(this.curve.c) === 0));
- };
- Point.prototype._extDbl = function _extDbl() {
- // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html
- // #doubling-dbl-2008-hwcd
- // 4M + 4S
- // A = X1^2
- var a = this.x.redSqr();
- // B = Y1^2
- var b = this.y.redSqr();
- // C = 2 * Z1^2
- var c = this.z.redSqr();
- c = c.redIAdd(c);
- // D = a * A
- var d = this.curve._mulA(a);
- // E = (X1 + Y1)^2 - A - B
- var e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b);
- // G = D + B
- var g = d.redAdd(b);
- // F = G - C
- var f = g.redSub(c);
- // H = D - B
- var h = d.redSub(b);
- // X3 = E * F
- var nx = e.redMul(f);
- // Y3 = G * H
- var ny = g.redMul(h);
- // T3 = E * H
- var nt = e.redMul(h);
- // Z3 = F * G
- var nz = f.redMul(g);
- return this.curve.point(nx, ny, nz, nt);
- };
- Point.prototype._projDbl = function _projDbl() {
- // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html
- // #doubling-dbl-2008-bbjlp
- // #doubling-dbl-2007-bl
- // and others
- // Generally 3M + 4S or 2M + 4S
- // B = (X1 + Y1)^2
- var b = this.x.redAdd(this.y).redSqr();
- // C = X1^2
- var c = this.x.redSqr();
- // D = Y1^2
- var d = this.y.redSqr();
- var nx;
- var ny;
- var nz;
- var e;
- var h;
- var j;
- if (this.curve.twisted) {
- // E = a * C
- e = this.curve._mulA(c);
- // F = E + D
- var f = e.redAdd(d);
- if (this.zOne) {
- // X3 = (B - C - D) * (F - 2)
- nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two));
- // Y3 = F * (E - D)
- ny = f.redMul(e.redSub(d));
- // Z3 = F^2 - 2 * F
- nz = f.redSqr().redSub(f).redSub(f);
- } else {
- // H = Z1^2
- h = this.z.redSqr();
- // J = F - 2 * H
- j = f.redSub(h).redISub(h);
- // X3 = (B-C-D)*J
- nx = b.redSub(c).redISub(d).redMul(j);
- // Y3 = F * (E - D)
- ny = f.redMul(e.redSub(d));
- // Z3 = F * J
- nz = f.redMul(j);
- }
- } else {
- // E = C + D
- e = c.redAdd(d);
- // H = (c * Z1)^2
- h = this.curve._mulC(this.z).redSqr();
- // J = E - 2 * H
- j = e.redSub(h).redSub(h);
- // X3 = c * (B - E) * J
- nx = this.curve._mulC(b.redISub(e)).redMul(j);
- // Y3 = c * E * (C - D)
- ny = this.curve._mulC(e).redMul(c.redISub(d));
- // Z3 = E * J
- nz = e.redMul(j);
- }
- return this.curve.point(nx, ny, nz);
- };
- Point.prototype.dbl = function dbl() {
- if (this.isInfinity())
- return this;
- // Double in extended coordinates
- if (this.curve.extended)
- return this._extDbl();
- else
- return this._projDbl();
- };
- Point.prototype._extAdd = function _extAdd(p) {
- // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html
- // #addition-add-2008-hwcd-3
- // 8M
- // A = (Y1 - X1) * (Y2 - X2)
- var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x));
- // B = (Y1 + X1) * (Y2 + X2)
- var b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x));
- // C = T1 * k * T2
- var c = this.t.redMul(this.curve.dd).redMul(p.t);
- // D = Z1 * 2 * Z2
- var d = this.z.redMul(p.z.redAdd(p.z));
- // E = B - A
- var e = b.redSub(a);
- // F = D - C
- var f = d.redSub(c);
- // G = D + C
- var g = d.redAdd(c);
- // H = B + A
- var h = b.redAdd(a);
- // X3 = E * F
- var nx = e.redMul(f);
- // Y3 = G * H
- var ny = g.redMul(h);
- // T3 = E * H
- var nt = e.redMul(h);
- // Z3 = F * G
- var nz = f.redMul(g);
- return this.curve.point(nx, ny, nz, nt);
- };
- Point.prototype._projAdd = function _projAdd(p) {
- // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html
- // #addition-add-2008-bbjlp
- // #addition-add-2007-bl
- // 10M + 1S
- // A = Z1 * Z2
- var a = this.z.redMul(p.z);
- // B = A^2
- var b = a.redSqr();
- // C = X1 * X2
- var c = this.x.redMul(p.x);
- // D = Y1 * Y2
- var d = this.y.redMul(p.y);
- // E = d * C * D
- var e = this.curve.d.redMul(c).redMul(d);
- // F = B - E
- var f = b.redSub(e);
- // G = B + E
- var g = b.redAdd(e);
- // X3 = A * F * ((X1 + Y1) * (X2 + Y2) - C - D)
- var tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d);
- var nx = a.redMul(f).redMul(tmp);
- var ny;
- var nz;
- if (this.curve.twisted) {
- // Y3 = A * G * (D - a * C)
- ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c)));
- // Z3 = F * G
- nz = f.redMul(g);
- } else {
- // Y3 = A * G * (D - C)
- ny = a.redMul(g).redMul(d.redSub(c));
- // Z3 = c * F * G
- nz = this.curve._mulC(f).redMul(g);
- }
- return this.curve.point(nx, ny, nz);
- };
- Point.prototype.add = function add(p) {
- if (this.isInfinity())
- return p;
- if (p.isInfinity())
- return this;
- if (this.curve.extended)
- return this._extAdd(p);
- else
- return this._projAdd(p);
- };
- Point.prototype.mul = function mul(k) {
- if (this._hasDoubles(k))
- return this.curve._fixedNafMul(this, k);
- else
- return this.curve._wnafMul(this, k);
- };
- Point.prototype.mulAdd = function mulAdd(k1, p, k2) {
- return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, false);
- };
- Point.prototype.jmulAdd = function jmulAdd(k1, p, k2) {
- return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, true);
- };
- Point.prototype.normalize = function normalize() {
- if (this.zOne)
- return this;
- // Normalize coordinates
- var zi = this.z.redInvm();
- this.x = this.x.redMul(zi);
- this.y = this.y.redMul(zi);
- if (this.t)
- this.t = this.t.redMul(zi);
- this.z = this.curve.one;
- this.zOne = true;
- return this;
- };
- Point.prototype.neg = function neg() {
- return this.curve.point(this.x.redNeg(),
- this.y,
- this.z,
- this.t && this.t.redNeg());
- };
- Point.prototype.getX = function getX() {
- this.normalize();
- return this.x.fromRed();
- };
- Point.prototype.getY = function getY() {
- this.normalize();
- return this.y.fromRed();
- };
- Point.prototype.eq = function eq(other) {
- return this === other ||
- this.getX().cmp(other.getX()) === 0 &&
- this.getY().cmp(other.getY()) === 0;
- };
- Point.prototype.eqXToP = function eqXToP(x) {
- var rx = x.toRed(this.curve.red).redMul(this.z);
- if (this.x.cmp(rx) === 0)
- return true;
- var xc = x.clone();
- var t = this.curve.redN.redMul(this.z);
- for (;;) {
- xc.iadd(this.curve.n);
- if (xc.cmp(this.curve.p) >= 0)
- return false;
- rx.redIAdd(t);
- if (this.x.cmp(rx) === 0)
- return true;
- }
- };
- // Compatibility with BaseCurve
- Point.prototype.toP = Point.prototype.normalize;
- Point.prototype.mixedAdd = Point.prototype.add;
- /***/ }),
- /* 217 */
- /*!******************************************************!*\
- !*** ./node_modules/elliptic/lib/elliptic/curves.js ***!
- \******************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var curves = exports;
- var hash = __webpack_require__(/*! hash.js */ 218);
- var curve = __webpack_require__(/*! ./curve */ 212);
- var utils = __webpack_require__(/*! ./utils */ 210);
- var assert = utils.assert;
- function PresetCurve(options) {
- if (options.type === 'short')
- this.curve = new curve.short(options);
- else if (options.type === 'edwards')
- this.curve = new curve.edwards(options);
- else
- this.curve = new curve.mont(options);
- this.g = this.curve.g;
- this.n = this.curve.n;
- this.hash = options.hash;
- assert(this.g.validate(), 'Invalid curve');
- assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O');
- }
- curves.PresetCurve = PresetCurve;
- function defineCurve(name, options) {
- Object.defineProperty(curves, name, {
- configurable: true,
- enumerable: true,
- get: function() {
- var curve = new PresetCurve(options);
- Object.defineProperty(curves, name, {
- configurable: true,
- enumerable: true,
- value: curve,
- });
- return curve;
- },
- });
- }
- defineCurve('p192', {
- type: 'short',
- prime: 'p192',
- p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff',
- a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc',
- b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1',
- n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831',
- hash: hash.sha256,
- gRed: false,
- g: [
- '188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012',
- '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811',
- ],
- });
- defineCurve('p224', {
- type: 'short',
- prime: 'p224',
- p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001',
- a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe',
- b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4',
- n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d',
- hash: hash.sha256,
- gRed: false,
- g: [
- 'b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21',
- 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34',
- ],
- });
- defineCurve('p256', {
- type: 'short',
- prime: null,
- p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff',
- a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc',
- b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b',
- n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551',
- hash: hash.sha256,
- gRed: false,
- g: [
- '6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296',
- '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5',
- ],
- });
- defineCurve('p384', {
- type: 'short',
- prime: null,
- p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
- 'fffffffe ffffffff 00000000 00000000 ffffffff',
- a: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
- 'fffffffe ffffffff 00000000 00000000 fffffffc',
- b: 'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f ' +
- '5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef',
- n: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 ' +
- 'f4372ddf 581a0db2 48b0a77a ecec196a ccc52973',
- hash: hash.sha384,
- gRed: false,
- g: [
- 'aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 ' +
- '5502f25d bf55296c 3a545e38 72760ab7',
- '3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 ' +
- '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f',
- ],
- });
- defineCurve('p521', {
- type: 'short',
- prime: null,
- p: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
- 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
- 'ffffffff ffffffff ffffffff ffffffff ffffffff',
- a: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
- 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
- 'ffffffff ffffffff ffffffff ffffffff fffffffc',
- b: '00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b ' +
- '99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd ' +
- '3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00',
- n: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
- 'ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 ' +
- 'f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409',
- hash: hash.sha512,
- gRed: false,
- g: [
- '000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 ' +
- '053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 ' +
- 'a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66',
- '00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 ' +
- '579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 ' +
- '3fad0761 353c7086 a272c240 88be9476 9fd16650',
- ],
- });
- defineCurve('curve25519', {
- type: 'mont',
- prime: 'p25519',
- p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',
- a: '76d06',
- b: '1',
- n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',
- hash: hash.sha256,
- gRed: false,
- g: [
- '9',
- ],
- });
- defineCurve('ed25519', {
- type: 'edwards',
- prime: 'p25519',
- p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',
- a: '-1',
- c: '1',
- // -121665 * (121666^(-1)) (mod P)
- d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3',
- n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',
- hash: hash.sha256,
- gRed: false,
- g: [
- '216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a',
- // 4/5
- '6666666666666666666666666666666666666666666666666666666666666658',
- ],
- });
- var pre;
- try {
- pre = __webpack_require__(/*! ./precomputed/secp256k1 */ 230);
- } catch (e) {
- pre = undefined;
- }
- defineCurve('secp256k1', {
- type: 'short',
- prime: 'k256',
- p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f',
- a: '0',
- b: '7',
- n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141',
- h: '1',
- hash: hash.sha256,
- // Precomputed endomorphism
- beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee',
- lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72',
- basis: [
- {
- a: '3086d221a7d46bcde86c90e49284eb15',
- b: '-e4437ed6010e88286f547fa90abfe4c3',
- },
- {
- a: '114ca50f7a8e2f3f657c1108d9d44cfd8',
- b: '3086d221a7d46bcde86c90e49284eb15',
- },
- ],
- gRed: false,
- g: [
- '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',
- '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8',
- pre,
- ],
- });
- /***/ }),
- /* 218 */
- /*!******************************************!*\
- !*** ./node_modules/hash.js/lib/hash.js ***!
- \******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var hash = exports;
- hash.utils = __webpack_require__(/*! ./hash/utils */ 219);
- hash.common = __webpack_require__(/*! ./hash/common */ 220);
- hash.sha = __webpack_require__(/*! ./hash/sha */ 221);
- hash.ripemd = __webpack_require__(/*! ./hash/ripemd */ 228);
- hash.hmac = __webpack_require__(/*! ./hash/hmac */ 229);
- // Proxy hash functions to the main object
- hash.sha1 = hash.sha.sha1;
- hash.sha256 = hash.sha.sha256;
- hash.sha224 = hash.sha.sha224;
- hash.sha384 = hash.sha.sha384;
- hash.sha512 = hash.sha.sha512;
- hash.ripemd160 = hash.ripemd.ripemd160;
- /***/ }),
- /* 219 */
- /*!************************************************!*\
- !*** ./node_modules/hash.js/lib/hash/utils.js ***!
- \************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var assert = __webpack_require__(/*! minimalistic-assert */ 171);
- var inherits = __webpack_require__(/*! inherits */ 121);
- exports.inherits = inherits;
- function isSurrogatePair(msg, i) {
- if ((msg.charCodeAt(i) & 0xFC00) !== 0xD800) {
- return false;
- }
- if (i < 0 || i + 1 >= msg.length) {
- return false;
- }
- return (msg.charCodeAt(i + 1) & 0xFC00) === 0xDC00;
- }
- function toArray(msg, enc) {
- if (Array.isArray(msg))
- return msg.slice();
- if (!msg)
- return [];
- var res = [];
- if (typeof msg === 'string') {
- if (!enc) {
- // Inspired by stringToUtf8ByteArray() in closure-library by Google
- // https://github.com/google/closure-library/blob/8598d87242af59aac233270742c8984e2b2bdbe0/closure/goog/crypt/crypt.js#L117-L143
- // Apache License 2.0
- // https://github.com/google/closure-library/blob/master/LICENSE
- var p = 0;
- for (var i = 0; i < msg.length; i++) {
- var c = msg.charCodeAt(i);
- if (c < 128) {
- res[p++] = c;
- } else if (c < 2048) {
- res[p++] = (c >> 6) | 192;
- res[p++] = (c & 63) | 128;
- } else if (isSurrogatePair(msg, i)) {
- c = 0x10000 + ((c & 0x03FF) << 10) + (msg.charCodeAt(++i) & 0x03FF);
- res[p++] = (c >> 18) | 240;
- res[p++] = ((c >> 12) & 63) | 128;
- res[p++] = ((c >> 6) & 63) | 128;
- res[p++] = (c & 63) | 128;
- } else {
- res[p++] = (c >> 12) | 224;
- res[p++] = ((c >> 6) & 63) | 128;
- res[p++] = (c & 63) | 128;
- }
- }
- } else if (enc === 'hex') {
- msg = msg.replace(/[^a-z0-9]+/ig, '');
- if (msg.length % 2 !== 0)
- msg = '0' + msg;
- for (i = 0; i < msg.length; i += 2)
- res.push(parseInt(msg[i] + msg[i + 1], 16));
- }
- } else {
- for (i = 0; i < msg.length; i++)
- res[i] = msg[i] | 0;
- }
- return res;
- }
- exports.toArray = toArray;
- function toHex(msg) {
- var res = '';
- for (var i = 0; i < msg.length; i++)
- res += zero2(msg[i].toString(16));
- return res;
- }
- exports.toHex = toHex;
- function htonl(w) {
- var res = (w >>> 24) |
- ((w >>> 8) & 0xff00) |
- ((w << 8) & 0xff0000) |
- ((w & 0xff) << 24);
- return res >>> 0;
- }
- exports.htonl = htonl;
- function toHex32(msg, endian) {
- var res = '';
- for (var i = 0; i < msg.length; i++) {
- var w = msg[i];
- if (endian === 'little')
- w = htonl(w);
- res += zero8(w.toString(16));
- }
- return res;
- }
- exports.toHex32 = toHex32;
- function zero2(word) {
- if (word.length === 1)
- return '0' + word;
- else
- return word;
- }
- exports.zero2 = zero2;
- function zero8(word) {
- if (word.length === 7)
- return '0' + word;
- else if (word.length === 6)
- return '00' + word;
- else if (word.length === 5)
- return '000' + word;
- else if (word.length === 4)
- return '0000' + word;
- else if (word.length === 3)
- return '00000' + word;
- else if (word.length === 2)
- return '000000' + word;
- else if (word.length === 1)
- return '0000000' + word;
- else
- return word;
- }
- exports.zero8 = zero8;
- function join32(msg, start, end, endian) {
- var len = end - start;
- assert(len % 4 === 0);
- var res = new Array(len / 4);
- for (var i = 0, k = start; i < res.length; i++, k += 4) {
- var w;
- if (endian === 'big')
- w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3];
- else
- w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k];
- res[i] = w >>> 0;
- }
- return res;
- }
- exports.join32 = join32;
- function split32(msg, endian) {
- var res = new Array(msg.length * 4);
- for (var i = 0, k = 0; i < msg.length; i++, k += 4) {
- var m = msg[i];
- if (endian === 'big') {
- res[k] = m >>> 24;
- res[k + 1] = (m >>> 16) & 0xff;
- res[k + 2] = (m >>> 8) & 0xff;
- res[k + 3] = m & 0xff;
- } else {
- res[k + 3] = m >>> 24;
- res[k + 2] = (m >>> 16) & 0xff;
- res[k + 1] = (m >>> 8) & 0xff;
- res[k] = m & 0xff;
- }
- }
- return res;
- }
- exports.split32 = split32;
- function rotr32(w, b) {
- return (w >>> b) | (w << (32 - b));
- }
- exports.rotr32 = rotr32;
- function rotl32(w, b) {
- return (w << b) | (w >>> (32 - b));
- }
- exports.rotl32 = rotl32;
- function sum32(a, b) {
- return (a + b) >>> 0;
- }
- exports.sum32 = sum32;
- function sum32_3(a, b, c) {
- return (a + b + c) >>> 0;
- }
- exports.sum32_3 = sum32_3;
- function sum32_4(a, b, c, d) {
- return (a + b + c + d) >>> 0;
- }
- exports.sum32_4 = sum32_4;
- function sum32_5(a, b, c, d, e) {
- return (a + b + c + d + e) >>> 0;
- }
- exports.sum32_5 = sum32_5;
- function sum64(buf, pos, ah, al) {
- var bh = buf[pos];
- var bl = buf[pos + 1];
- var lo = (al + bl) >>> 0;
- var hi = (lo < al ? 1 : 0) + ah + bh;
- buf[pos] = hi >>> 0;
- buf[pos + 1] = lo;
- }
- exports.sum64 = sum64;
- function sum64_hi(ah, al, bh, bl) {
- var lo = (al + bl) >>> 0;
- var hi = (lo < al ? 1 : 0) + ah + bh;
- return hi >>> 0;
- }
- exports.sum64_hi = sum64_hi;
- function sum64_lo(ah, al, bh, bl) {
- var lo = al + bl;
- return lo >>> 0;
- }
- exports.sum64_lo = sum64_lo;
- function sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) {
- var carry = 0;
- var lo = al;
- lo = (lo + bl) >>> 0;
- carry += lo < al ? 1 : 0;
- lo = (lo + cl) >>> 0;
- carry += lo < cl ? 1 : 0;
- lo = (lo + dl) >>> 0;
- carry += lo < dl ? 1 : 0;
- var hi = ah + bh + ch + dh + carry;
- return hi >>> 0;
- }
- exports.sum64_4_hi = sum64_4_hi;
- function sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) {
- var lo = al + bl + cl + dl;
- return lo >>> 0;
- }
- exports.sum64_4_lo = sum64_4_lo;
- function sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
- var carry = 0;
- var lo = al;
- lo = (lo + bl) >>> 0;
- carry += lo < al ? 1 : 0;
- lo = (lo + cl) >>> 0;
- carry += lo < cl ? 1 : 0;
- lo = (lo + dl) >>> 0;
- carry += lo < dl ? 1 : 0;
- lo = (lo + el) >>> 0;
- carry += lo < el ? 1 : 0;
- var hi = ah + bh + ch + dh + eh + carry;
- return hi >>> 0;
- }
- exports.sum64_5_hi = sum64_5_hi;
- function sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
- var lo = al + bl + cl + dl + el;
- return lo >>> 0;
- }
- exports.sum64_5_lo = sum64_5_lo;
- function rotr64_hi(ah, al, num) {
- var r = (al << (32 - num)) | (ah >>> num);
- return r >>> 0;
- }
- exports.rotr64_hi = rotr64_hi;
- function rotr64_lo(ah, al, num) {
- var r = (ah << (32 - num)) | (al >>> num);
- return r >>> 0;
- }
- exports.rotr64_lo = rotr64_lo;
- function shr64_hi(ah, al, num) {
- return ah >>> num;
- }
- exports.shr64_hi = shr64_hi;
- function shr64_lo(ah, al, num) {
- var r = (ah << (32 - num)) | (al >>> num);
- return r >>> 0;
- }
- exports.shr64_lo = shr64_lo;
- /***/ }),
- /* 220 */
- /*!*************************************************!*\
- !*** ./node_modules/hash.js/lib/hash/common.js ***!
- \*************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var utils = __webpack_require__(/*! ./utils */ 219);
- var assert = __webpack_require__(/*! minimalistic-assert */ 171);
- function BlockHash() {
- this.pending = null;
- this.pendingTotal = 0;
- this.blockSize = this.constructor.blockSize;
- this.outSize = this.constructor.outSize;
- this.hmacStrength = this.constructor.hmacStrength;
- this.padLength = this.constructor.padLength / 8;
- this.endian = 'big';
- this._delta8 = this.blockSize / 8;
- this._delta32 = this.blockSize / 32;
- }
- exports.BlockHash = BlockHash;
- BlockHash.prototype.update = function update(msg, enc) {
- // Convert message to array, pad it, and join into 32bit blocks
- msg = utils.toArray(msg, enc);
- if (!this.pending)
- this.pending = msg;
- else
- this.pending = this.pending.concat(msg);
- this.pendingTotal += msg.length;
- // Enough data, try updating
- if (this.pending.length >= this._delta8) {
- msg = this.pending;
- // Process pending data in blocks
- var r = msg.length % this._delta8;
- this.pending = msg.slice(msg.length - r, msg.length);
- if (this.pending.length === 0)
- this.pending = null;
- msg = utils.join32(msg, 0, msg.length - r, this.endian);
- for (var i = 0; i < msg.length; i += this._delta32)
- this._update(msg, i, i + this._delta32);
- }
- return this;
- };
- BlockHash.prototype.digest = function digest(enc) {
- this.update(this._pad());
- assert(this.pending === null);
- return this._digest(enc);
- };
- BlockHash.prototype._pad = function pad() {
- var len = this.pendingTotal;
- var bytes = this._delta8;
- var k = bytes - ((len + this.padLength) % bytes);
- var res = new Array(k + this.padLength);
- res[0] = 0x80;
- for (var i = 1; i < k; i++)
- res[i] = 0;
- // Append length
- len <<= 3;
- if (this.endian === 'big') {
- for (var t = 8; t < this.padLength; t++)
- res[i++] = 0;
- res[i++] = 0;
- res[i++] = 0;
- res[i++] = 0;
- res[i++] = 0;
- res[i++] = (len >>> 24) & 0xff;
- res[i++] = (len >>> 16) & 0xff;
- res[i++] = (len >>> 8) & 0xff;
- res[i++] = len & 0xff;
- } else {
- res[i++] = len & 0xff;
- res[i++] = (len >>> 8) & 0xff;
- res[i++] = (len >>> 16) & 0xff;
- res[i++] = (len >>> 24) & 0xff;
- res[i++] = 0;
- res[i++] = 0;
- res[i++] = 0;
- res[i++] = 0;
- for (t = 8; t < this.padLength; t++)
- res[i++] = 0;
- }
- return res;
- };
- /***/ }),
- /* 221 */
- /*!**********************************************!*\
- !*** ./node_modules/hash.js/lib/hash/sha.js ***!
- \**********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- exports.sha1 = __webpack_require__(/*! ./sha/1 */ 222);
- exports.sha224 = __webpack_require__(/*! ./sha/224 */ 224);
- exports.sha256 = __webpack_require__(/*! ./sha/256 */ 225);
- exports.sha384 = __webpack_require__(/*! ./sha/384 */ 226);
- exports.sha512 = __webpack_require__(/*! ./sha/512 */ 227);
- /***/ }),
- /* 222 */
- /*!************************************************!*\
- !*** ./node_modules/hash.js/lib/hash/sha/1.js ***!
- \************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var utils = __webpack_require__(/*! ../utils */ 219);
- var common = __webpack_require__(/*! ../common */ 220);
- var shaCommon = __webpack_require__(/*! ./common */ 223);
- var rotl32 = utils.rotl32;
- var sum32 = utils.sum32;
- var sum32_5 = utils.sum32_5;
- var ft_1 = shaCommon.ft_1;
- var BlockHash = common.BlockHash;
- var sha1_K = [
- 0x5A827999, 0x6ED9EBA1,
- 0x8F1BBCDC, 0xCA62C1D6
- ];
- function SHA1() {
- if (!(this instanceof SHA1))
- return new SHA1();
- BlockHash.call(this);
- this.h = [
- 0x67452301, 0xefcdab89, 0x98badcfe,
- 0x10325476, 0xc3d2e1f0 ];
- this.W = new Array(80);
- }
- utils.inherits(SHA1, BlockHash);
- module.exports = SHA1;
- SHA1.blockSize = 512;
- SHA1.outSize = 160;
- SHA1.hmacStrength = 80;
- SHA1.padLength = 64;
- SHA1.prototype._update = function _update(msg, start) {
- var W = this.W;
- for (var i = 0; i < 16; i++)
- W[i] = msg[start + i];
- for(; i < W.length; i++)
- W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1);
- var a = this.h[0];
- var b = this.h[1];
- var c = this.h[2];
- var d = this.h[3];
- var e = this.h[4];
- for (i = 0; i < W.length; i++) {
- var s = ~~(i / 20);
- var t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]);
- e = d;
- d = c;
- c = rotl32(b, 30);
- b = a;
- a = t;
- }
- this.h[0] = sum32(this.h[0], a);
- this.h[1] = sum32(this.h[1], b);
- this.h[2] = sum32(this.h[2], c);
- this.h[3] = sum32(this.h[3], d);
- this.h[4] = sum32(this.h[4], e);
- };
- SHA1.prototype._digest = function digest(enc) {
- if (enc === 'hex')
- return utils.toHex32(this.h, 'big');
- else
- return utils.split32(this.h, 'big');
- };
- /***/ }),
- /* 223 */
- /*!*****************************************************!*\
- !*** ./node_modules/hash.js/lib/hash/sha/common.js ***!
- \*****************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var utils = __webpack_require__(/*! ../utils */ 219);
- var rotr32 = utils.rotr32;
- function ft_1(s, x, y, z) {
- if (s === 0)
- return ch32(x, y, z);
- if (s === 1 || s === 3)
- return p32(x, y, z);
- if (s === 2)
- return maj32(x, y, z);
- }
- exports.ft_1 = ft_1;
- function ch32(x, y, z) {
- return (x & y) ^ ((~x) & z);
- }
- exports.ch32 = ch32;
- function maj32(x, y, z) {
- return (x & y) ^ (x & z) ^ (y & z);
- }
- exports.maj32 = maj32;
- function p32(x, y, z) {
- return x ^ y ^ z;
- }
- exports.p32 = p32;
- function s0_256(x) {
- return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22);
- }
- exports.s0_256 = s0_256;
- function s1_256(x) {
- return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25);
- }
- exports.s1_256 = s1_256;
- function g0_256(x) {
- return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3);
- }
- exports.g0_256 = g0_256;
- function g1_256(x) {
- return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10);
- }
- exports.g1_256 = g1_256;
- /***/ }),
- /* 224 */
- /*!**************************************************!*\
- !*** ./node_modules/hash.js/lib/hash/sha/224.js ***!
- \**************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var utils = __webpack_require__(/*! ../utils */ 219);
- var SHA256 = __webpack_require__(/*! ./256 */ 225);
- function SHA224() {
- if (!(this instanceof SHA224))
- return new SHA224();
- SHA256.call(this);
- this.h = [
- 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,
- 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 ];
- }
- utils.inherits(SHA224, SHA256);
- module.exports = SHA224;
- SHA224.blockSize = 512;
- SHA224.outSize = 224;
- SHA224.hmacStrength = 192;
- SHA224.padLength = 64;
- SHA224.prototype._digest = function digest(enc) {
- // Just truncate output
- if (enc === 'hex')
- return utils.toHex32(this.h.slice(0, 7), 'big');
- else
- return utils.split32(this.h.slice(0, 7), 'big');
- };
- /***/ }),
- /* 225 */
- /*!**************************************************!*\
- !*** ./node_modules/hash.js/lib/hash/sha/256.js ***!
- \**************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var utils = __webpack_require__(/*! ../utils */ 219);
- var common = __webpack_require__(/*! ../common */ 220);
- var shaCommon = __webpack_require__(/*! ./common */ 223);
- var assert = __webpack_require__(/*! minimalistic-assert */ 171);
- var sum32 = utils.sum32;
- var sum32_4 = utils.sum32_4;
- var sum32_5 = utils.sum32_5;
- var ch32 = shaCommon.ch32;
- var maj32 = shaCommon.maj32;
- var s0_256 = shaCommon.s0_256;
- var s1_256 = shaCommon.s1_256;
- var g0_256 = shaCommon.g0_256;
- var g1_256 = shaCommon.g1_256;
- var BlockHash = common.BlockHash;
- var sha256_K = [
- 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
- 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
- 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
- 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
- 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
- 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
- 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
- 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
- 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
- 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
- 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
- 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
- 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
- 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
- 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
- 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
- ];
- function SHA256() {
- if (!(this instanceof SHA256))
- return new SHA256();
- BlockHash.call(this);
- this.h = [
- 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
- 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
- ];
- this.k = sha256_K;
- this.W = new Array(64);
- }
- utils.inherits(SHA256, BlockHash);
- module.exports = SHA256;
- SHA256.blockSize = 512;
- SHA256.outSize = 256;
- SHA256.hmacStrength = 192;
- SHA256.padLength = 64;
- SHA256.prototype._update = function _update(msg, start) {
- var W = this.W;
- for (var i = 0; i < 16; i++)
- W[i] = msg[start + i];
- for (; i < W.length; i++)
- W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]);
- var a = this.h[0];
- var b = this.h[1];
- var c = this.h[2];
- var d = this.h[3];
- var e = this.h[4];
- var f = this.h[5];
- var g = this.h[6];
- var h = this.h[7];
- assert(this.k.length === W.length);
- for (i = 0; i < W.length; i++) {
- var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]);
- var T2 = sum32(s0_256(a), maj32(a, b, c));
- h = g;
- g = f;
- f = e;
- e = sum32(d, T1);
- d = c;
- c = b;
- b = a;
- a = sum32(T1, T2);
- }
- this.h[0] = sum32(this.h[0], a);
- this.h[1] = sum32(this.h[1], b);
- this.h[2] = sum32(this.h[2], c);
- this.h[3] = sum32(this.h[3], d);
- this.h[4] = sum32(this.h[4], e);
- this.h[5] = sum32(this.h[5], f);
- this.h[6] = sum32(this.h[6], g);
- this.h[7] = sum32(this.h[7], h);
- };
- SHA256.prototype._digest = function digest(enc) {
- if (enc === 'hex')
- return utils.toHex32(this.h, 'big');
- else
- return utils.split32(this.h, 'big');
- };
- /***/ }),
- /* 226 */
- /*!**************************************************!*\
- !*** ./node_modules/hash.js/lib/hash/sha/384.js ***!
- \**************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var utils = __webpack_require__(/*! ../utils */ 219);
- var SHA512 = __webpack_require__(/*! ./512 */ 227);
- function SHA384() {
- if (!(this instanceof SHA384))
- return new SHA384();
- SHA512.call(this);
- this.h = [
- 0xcbbb9d5d, 0xc1059ed8,
- 0x629a292a, 0x367cd507,
- 0x9159015a, 0x3070dd17,
- 0x152fecd8, 0xf70e5939,
- 0x67332667, 0xffc00b31,
- 0x8eb44a87, 0x68581511,
- 0xdb0c2e0d, 0x64f98fa7,
- 0x47b5481d, 0xbefa4fa4 ];
- }
- utils.inherits(SHA384, SHA512);
- module.exports = SHA384;
- SHA384.blockSize = 1024;
- SHA384.outSize = 384;
- SHA384.hmacStrength = 192;
- SHA384.padLength = 128;
- SHA384.prototype._digest = function digest(enc) {
- if (enc === 'hex')
- return utils.toHex32(this.h.slice(0, 12), 'big');
- else
- return utils.split32(this.h.slice(0, 12), 'big');
- };
- /***/ }),
- /* 227 */
- /*!**************************************************!*\
- !*** ./node_modules/hash.js/lib/hash/sha/512.js ***!
- \**************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var utils = __webpack_require__(/*! ../utils */ 219);
- var common = __webpack_require__(/*! ../common */ 220);
- var assert = __webpack_require__(/*! minimalistic-assert */ 171);
- var rotr64_hi = utils.rotr64_hi;
- var rotr64_lo = utils.rotr64_lo;
- var shr64_hi = utils.shr64_hi;
- var shr64_lo = utils.shr64_lo;
- var sum64 = utils.sum64;
- var sum64_hi = utils.sum64_hi;
- var sum64_lo = utils.sum64_lo;
- var sum64_4_hi = utils.sum64_4_hi;
- var sum64_4_lo = utils.sum64_4_lo;
- var sum64_5_hi = utils.sum64_5_hi;
- var sum64_5_lo = utils.sum64_5_lo;
- var BlockHash = common.BlockHash;
- var sha512_K = [
- 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
- 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
- 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
- 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
- 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
- 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
- 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
- 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
- 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
- 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
- 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
- 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
- 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
- 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
- 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
- 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
- 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
- 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
- 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
- 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
- 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
- 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
- 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
- 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
- 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
- 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
- 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
- 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
- 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
- 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
- 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
- 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
- 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
- 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
- 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
- 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
- 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
- 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
- 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
- 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
- ];
- function SHA512() {
- if (!(this instanceof SHA512))
- return new SHA512();
- BlockHash.call(this);
- this.h = [
- 0x6a09e667, 0xf3bcc908,
- 0xbb67ae85, 0x84caa73b,
- 0x3c6ef372, 0xfe94f82b,
- 0xa54ff53a, 0x5f1d36f1,
- 0x510e527f, 0xade682d1,
- 0x9b05688c, 0x2b3e6c1f,
- 0x1f83d9ab, 0xfb41bd6b,
- 0x5be0cd19, 0x137e2179 ];
- this.k = sha512_K;
- this.W = new Array(160);
- }
- utils.inherits(SHA512, BlockHash);
- module.exports = SHA512;
- SHA512.blockSize = 1024;
- SHA512.outSize = 512;
- SHA512.hmacStrength = 192;
- SHA512.padLength = 128;
- SHA512.prototype._prepareBlock = function _prepareBlock(msg, start) {
- var W = this.W;
- // 32 x 32bit words
- for (var i = 0; i < 32; i++)
- W[i] = msg[start + i];
- for (; i < W.length; i += 2) {
- var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2
- var c0_lo = g1_512_lo(W[i - 4], W[i - 3]);
- var c1_hi = W[i - 14]; // i - 7
- var c1_lo = W[i - 13];
- var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15
- var c2_lo = g0_512_lo(W[i - 30], W[i - 29]);
- var c3_hi = W[i - 32]; // i - 16
- var c3_lo = W[i - 31];
- W[i] = sum64_4_hi(
- c0_hi, c0_lo,
- c1_hi, c1_lo,
- c2_hi, c2_lo,
- c3_hi, c3_lo);
- W[i + 1] = sum64_4_lo(
- c0_hi, c0_lo,
- c1_hi, c1_lo,
- c2_hi, c2_lo,
- c3_hi, c3_lo);
- }
- };
- SHA512.prototype._update = function _update(msg, start) {
- this._prepareBlock(msg, start);
- var W = this.W;
- var ah = this.h[0];
- var al = this.h[1];
- var bh = this.h[2];
- var bl = this.h[3];
- var ch = this.h[4];
- var cl = this.h[5];
- var dh = this.h[6];
- var dl = this.h[7];
- var eh = this.h[8];
- var el = this.h[9];
- var fh = this.h[10];
- var fl = this.h[11];
- var gh = this.h[12];
- var gl = this.h[13];
- var hh = this.h[14];
- var hl = this.h[15];
- assert(this.k.length === W.length);
- for (var i = 0; i < W.length; i += 2) {
- var c0_hi = hh;
- var c0_lo = hl;
- var c1_hi = s1_512_hi(eh, el);
- var c1_lo = s1_512_lo(eh, el);
- var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl);
- var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl);
- var c3_hi = this.k[i];
- var c3_lo = this.k[i + 1];
- var c4_hi = W[i];
- var c4_lo = W[i + 1];
- var T1_hi = sum64_5_hi(
- c0_hi, c0_lo,
- c1_hi, c1_lo,
- c2_hi, c2_lo,
- c3_hi, c3_lo,
- c4_hi, c4_lo);
- var T1_lo = sum64_5_lo(
- c0_hi, c0_lo,
- c1_hi, c1_lo,
- c2_hi, c2_lo,
- c3_hi, c3_lo,
- c4_hi, c4_lo);
- c0_hi = s0_512_hi(ah, al);
- c0_lo = s0_512_lo(ah, al);
- c1_hi = maj64_hi(ah, al, bh, bl, ch, cl);
- c1_lo = maj64_lo(ah, al, bh, bl, ch, cl);
- var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo);
- var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo);
- hh = gh;
- hl = gl;
- gh = fh;
- gl = fl;
- fh = eh;
- fl = el;
- eh = sum64_hi(dh, dl, T1_hi, T1_lo);
- el = sum64_lo(dl, dl, T1_hi, T1_lo);
- dh = ch;
- dl = cl;
- ch = bh;
- cl = bl;
- bh = ah;
- bl = al;
- ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo);
- al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo);
- }
- sum64(this.h, 0, ah, al);
- sum64(this.h, 2, bh, bl);
- sum64(this.h, 4, ch, cl);
- sum64(this.h, 6, dh, dl);
- sum64(this.h, 8, eh, el);
- sum64(this.h, 10, fh, fl);
- sum64(this.h, 12, gh, gl);
- sum64(this.h, 14, hh, hl);
- };
- SHA512.prototype._digest = function digest(enc) {
- if (enc === 'hex')
- return utils.toHex32(this.h, 'big');
- else
- return utils.split32(this.h, 'big');
- };
- function ch64_hi(xh, xl, yh, yl, zh) {
- var r = (xh & yh) ^ ((~xh) & zh);
- if (r < 0)
- r += 0x100000000;
- return r;
- }
- function ch64_lo(xh, xl, yh, yl, zh, zl) {
- var r = (xl & yl) ^ ((~xl) & zl);
- if (r < 0)
- r += 0x100000000;
- return r;
- }
- function maj64_hi(xh, xl, yh, yl, zh) {
- var r = (xh & yh) ^ (xh & zh) ^ (yh & zh);
- if (r < 0)
- r += 0x100000000;
- return r;
- }
- function maj64_lo(xh, xl, yh, yl, zh, zl) {
- var r = (xl & yl) ^ (xl & zl) ^ (yl & zl);
- if (r < 0)
- r += 0x100000000;
- return r;
- }
- function s0_512_hi(xh, xl) {
- var c0_hi = rotr64_hi(xh, xl, 28);
- var c1_hi = rotr64_hi(xl, xh, 2); // 34
- var c2_hi = rotr64_hi(xl, xh, 7); // 39
- var r = c0_hi ^ c1_hi ^ c2_hi;
- if (r < 0)
- r += 0x100000000;
- return r;
- }
- function s0_512_lo(xh, xl) {
- var c0_lo = rotr64_lo(xh, xl, 28);
- var c1_lo = rotr64_lo(xl, xh, 2); // 34
- var c2_lo = rotr64_lo(xl, xh, 7); // 39
- var r = c0_lo ^ c1_lo ^ c2_lo;
- if (r < 0)
- r += 0x100000000;
- return r;
- }
- function s1_512_hi(xh, xl) {
- var c0_hi = rotr64_hi(xh, xl, 14);
- var c1_hi = rotr64_hi(xh, xl, 18);
- var c2_hi = rotr64_hi(xl, xh, 9); // 41
- var r = c0_hi ^ c1_hi ^ c2_hi;
- if (r < 0)
- r += 0x100000000;
- return r;
- }
- function s1_512_lo(xh, xl) {
- var c0_lo = rotr64_lo(xh, xl, 14);
- var c1_lo = rotr64_lo(xh, xl, 18);
- var c2_lo = rotr64_lo(xl, xh, 9); // 41
- var r = c0_lo ^ c1_lo ^ c2_lo;
- if (r < 0)
- r += 0x100000000;
- return r;
- }
- function g0_512_hi(xh, xl) {
- var c0_hi = rotr64_hi(xh, xl, 1);
- var c1_hi = rotr64_hi(xh, xl, 8);
- var c2_hi = shr64_hi(xh, xl, 7);
- var r = c0_hi ^ c1_hi ^ c2_hi;
- if (r < 0)
- r += 0x100000000;
- return r;
- }
- function g0_512_lo(xh, xl) {
- var c0_lo = rotr64_lo(xh, xl, 1);
- var c1_lo = rotr64_lo(xh, xl, 8);
- var c2_lo = shr64_lo(xh, xl, 7);
- var r = c0_lo ^ c1_lo ^ c2_lo;
- if (r < 0)
- r += 0x100000000;
- return r;
- }
- function g1_512_hi(xh, xl) {
- var c0_hi = rotr64_hi(xh, xl, 19);
- var c1_hi = rotr64_hi(xl, xh, 29); // 61
- var c2_hi = shr64_hi(xh, xl, 6);
- var r = c0_hi ^ c1_hi ^ c2_hi;
- if (r < 0)
- r += 0x100000000;
- return r;
- }
- function g1_512_lo(xh, xl) {
- var c0_lo = rotr64_lo(xh, xl, 19);
- var c1_lo = rotr64_lo(xl, xh, 29); // 61
- var c2_lo = shr64_lo(xh, xl, 6);
- var r = c0_lo ^ c1_lo ^ c2_lo;
- if (r < 0)
- r += 0x100000000;
- return r;
- }
- /***/ }),
- /* 228 */
- /*!*************************************************!*\
- !*** ./node_modules/hash.js/lib/hash/ripemd.js ***!
- \*************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var utils = __webpack_require__(/*! ./utils */ 219);
- var common = __webpack_require__(/*! ./common */ 220);
- var rotl32 = utils.rotl32;
- var sum32 = utils.sum32;
- var sum32_3 = utils.sum32_3;
- var sum32_4 = utils.sum32_4;
- var BlockHash = common.BlockHash;
- function RIPEMD160() {
- if (!(this instanceof RIPEMD160))
- return new RIPEMD160();
- BlockHash.call(this);
- this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ];
- this.endian = 'little';
- }
- utils.inherits(RIPEMD160, BlockHash);
- exports.ripemd160 = RIPEMD160;
- RIPEMD160.blockSize = 512;
- RIPEMD160.outSize = 160;
- RIPEMD160.hmacStrength = 192;
- RIPEMD160.padLength = 64;
- RIPEMD160.prototype._update = function update(msg, start) {
- var A = this.h[0];
- var B = this.h[1];
- var C = this.h[2];
- var D = this.h[3];
- var E = this.h[4];
- var Ah = A;
- var Bh = B;
- var Ch = C;
- var Dh = D;
- var Eh = E;
- for (var j = 0; j < 80; j++) {
- var T = sum32(
- rotl32(
- sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)),
- s[j]),
- E);
- A = E;
- E = D;
- D = rotl32(C, 10);
- C = B;
- B = T;
- T = sum32(
- rotl32(
- sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)),
- sh[j]),
- Eh);
- Ah = Eh;
- Eh = Dh;
- Dh = rotl32(Ch, 10);
- Ch = Bh;
- Bh = T;
- }
- T = sum32_3(this.h[1], C, Dh);
- this.h[1] = sum32_3(this.h[2], D, Eh);
- this.h[2] = sum32_3(this.h[3], E, Ah);
- this.h[3] = sum32_3(this.h[4], A, Bh);
- this.h[4] = sum32_3(this.h[0], B, Ch);
- this.h[0] = T;
- };
- RIPEMD160.prototype._digest = function digest(enc) {
- if (enc === 'hex')
- return utils.toHex32(this.h, 'little');
- else
- return utils.split32(this.h, 'little');
- };
- function f(j, x, y, z) {
- if (j <= 15)
- return x ^ y ^ z;
- else if (j <= 31)
- return (x & y) | ((~x) & z);
- else if (j <= 47)
- return (x | (~y)) ^ z;
- else if (j <= 63)
- return (x & z) | (y & (~z));
- else
- return x ^ (y | (~z));
- }
- function K(j) {
- if (j <= 15)
- return 0x00000000;
- else if (j <= 31)
- return 0x5a827999;
- else if (j <= 47)
- return 0x6ed9eba1;
- else if (j <= 63)
- return 0x8f1bbcdc;
- else
- return 0xa953fd4e;
- }
- function Kh(j) {
- if (j <= 15)
- return 0x50a28be6;
- else if (j <= 31)
- return 0x5c4dd124;
- else if (j <= 47)
- return 0x6d703ef3;
- else if (j <= 63)
- return 0x7a6d76e9;
- else
- return 0x00000000;
- }
- var r = [
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
- 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
- 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
- 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
- ];
- var rh = [
- 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
- 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
- 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
- 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
- 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
- ];
- var s = [
- 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
- 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
- 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
- 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
- 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
- ];
- var sh = [
- 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
- 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
- 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
- 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
- 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
- ];
- /***/ }),
- /* 229 */
- /*!***********************************************!*\
- !*** ./node_modules/hash.js/lib/hash/hmac.js ***!
- \***********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var utils = __webpack_require__(/*! ./utils */ 219);
- var assert = __webpack_require__(/*! minimalistic-assert */ 171);
- function Hmac(hash, key, enc) {
- if (!(this instanceof Hmac))
- return new Hmac(hash, key, enc);
- this.Hash = hash;
- this.blockSize = hash.blockSize / 8;
- this.outSize = hash.outSize / 8;
- this.inner = null;
- this.outer = null;
- this._init(utils.toArray(key, enc));
- }
- module.exports = Hmac;
- Hmac.prototype._init = function init(key) {
- // Shorten key, if needed
- if (key.length > this.blockSize)
- key = new this.Hash().update(key).digest();
- assert(key.length <= this.blockSize);
- // Add padding to key
- for (var i = key.length; i < this.blockSize; i++)
- key.push(0);
- for (i = 0; i < key.length; i++)
- key[i] ^= 0x36;
- this.inner = new this.Hash().update(key);
- // 0x36 ^ 0x5c = 0x6a
- for (i = 0; i < key.length; i++)
- key[i] ^= 0x6a;
- this.outer = new this.Hash().update(key);
- };
- Hmac.prototype.update = function update(msg, enc) {
- this.inner.update(msg, enc);
- return this;
- };
- Hmac.prototype.digest = function digest(enc) {
- this.outer.update(this.inner.digest());
- return this.outer.digest(enc);
- };
- /***/ }),
- /* 230 */
- /*!*********************************************************************!*\
- !*** ./node_modules/elliptic/lib/elliptic/precomputed/secp256k1.js ***!
- \*********************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- module.exports = {
- doubles: {
- step: 4,
- points: [
- [
- 'e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a',
- 'f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821',
- ],
- [
- '8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508',
- '11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf',
- ],
- [
- '175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739',
- 'd3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695',
- ],
- [
- '363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640',
- '4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9',
- ],
- [
- '8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c',
- '4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36',
- ],
- [
- '723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda',
- '96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f',
- ],
- [
- 'eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa',
- '5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999',
- ],
- [
- '100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0',
- 'cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09',
- ],
- [
- 'e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d',
- '9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d',
- ],
- [
- 'feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d',
- 'e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088',
- ],
- [
- 'da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1',
- '9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d',
- ],
- [
- '53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0',
- '5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8',
- ],
- [
- '8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047',
- '10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a',
- ],
- [
- '385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862',
- '283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453',
- ],
- [
- '6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7',
- '7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160',
- ],
- [
- '3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd',
- '56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0',
- ],
- [
- '85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83',
- '7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6',
- ],
- [
- '948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a',
- '53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589',
- ],
- [
- '6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8',
- 'bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17',
- ],
- [
- 'e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d',
- '4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda',
- ],
- [
- 'e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725',
- '7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd',
- ],
- [
- '213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754',
- '4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2',
- ],
- [
- '4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c',
- '17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6',
- ],
- [
- 'fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6',
- '6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f',
- ],
- [
- '76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39',
- 'c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01',
- ],
- [
- 'c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891',
- '893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3',
- ],
- [
- 'd895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b',
- 'febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f',
- ],
- [
- 'b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03',
- '2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7',
- ],
- [
- 'e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d',
- 'eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78',
- ],
- [
- 'a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070',
- '7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1',
- ],
- [
- '90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4',
- 'e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150',
- ],
- [
- '8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da',
- '662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82',
- ],
- [
- 'e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11',
- '1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc',
- ],
- [
- '8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e',
- 'efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b',
- ],
- [
- 'e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41',
- '2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51',
- ],
- [
- 'b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef',
- '67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45',
- ],
- [
- 'd68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8',
- 'db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120',
- ],
- [
- '324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d',
- '648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84',
- ],
- [
- '4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96',
- '35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d',
- ],
- [
- '9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd',
- 'ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d',
- ],
- [
- '6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5',
- '9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8',
- ],
- [
- 'a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266',
- '40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8',
- ],
- [
- '7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71',
- '34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac',
- ],
- [
- '928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac',
- 'c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f',
- ],
- [
- '85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751',
- '1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962',
- ],
- [
- 'ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e',
- '493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907',
- ],
- [
- '827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241',
- 'c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec',
- ],
- [
- 'eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3',
- 'be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d',
- ],
- [
- 'e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f',
- '4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414',
- ],
- [
- '1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19',
- 'aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd',
- ],
- [
- '146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be',
- 'b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0',
- ],
- [
- 'fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9',
- '6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811',
- ],
- [
- 'da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2',
- '8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1',
- ],
- [
- 'a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13',
- '7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c',
- ],
- [
- '174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c',
- 'ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73',
- ],
- [
- '959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba',
- '2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd',
- ],
- [
- 'd2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151',
- 'e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405',
- ],
- [
- '64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073',
- 'd99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589',
- ],
- [
- '8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458',
- '38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e',
- ],
- [
- '13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b',
- '69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27',
- ],
- [
- 'bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366',
- 'd3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1',
- ],
- [
- '8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa',
- '40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482',
- ],
- [
- '8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0',
- '620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945',
- ],
- [
- 'dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787',
- '7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573',
- ],
- [
- 'f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e',
- 'ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82',
- ],
- ],
- },
- naf: {
- wnd: 7,
- points: [
- [
- 'f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9',
- '388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672',
- ],
- [
- '2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4',
- 'd8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6',
- ],
- [
- '5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc',
- '6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da',
- ],
- [
- 'acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe',
- 'cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37',
- ],
- [
- '774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb',
- 'd984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b',
- ],
- [
- 'f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8',
- 'ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81',
- ],
- [
- 'd7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e',
- '581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58',
- ],
- [
- 'defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34',
- '4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77',
- ],
- [
- '2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c',
- '85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a',
- ],
- [
- '352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5',
- '321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c',
- ],
- [
- '2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f',
- '2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67',
- ],
- [
- '9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714',
- '73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402',
- ],
- [
- 'daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729',
- 'a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55',
- ],
- [
- 'c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db',
- '2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482',
- ],
- [
- '6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4',
- 'e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82',
- ],
- [
- '1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5',
- 'b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396',
- ],
- [
- '605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479',
- '2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49',
- ],
- [
- '62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d',
- '80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf',
- ],
- [
- '80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f',
- '1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a',
- ],
- [
- '7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb',
- 'd0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7',
- ],
- [
- 'd528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9',
- 'eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933',
- ],
- [
- '49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963',
- '758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a',
- ],
- [
- '77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74',
- '958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6',
- ],
- [
- 'f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530',
- 'e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37',
- ],
- [
- '463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b',
- '5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e',
- ],
- [
- 'f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247',
- 'cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6',
- ],
- [
- 'caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1',
- 'cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476',
- ],
- [
- '2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120',
- '4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40',
- ],
- [
- '7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435',
- '91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61',
- ],
- [
- '754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18',
- '673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683',
- ],
- [
- 'e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8',
- '59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5',
- ],
- [
- '186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb',
- '3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b',
- ],
- [
- 'df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f',
- '55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417',
- ],
- [
- '5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143',
- 'efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868',
- ],
- [
- '290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba',
- 'e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a',
- ],
- [
- 'af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45',
- 'f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6',
- ],
- [
- '766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a',
- '744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996',
- ],
- [
- '59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e',
- 'c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e',
- ],
- [
- 'f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8',
- 'e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d',
- ],
- [
- '7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c',
- '30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2',
- ],
- [
- '948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519',
- 'e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e',
- ],
- [
- '7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab',
- '100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437',
- ],
- [
- '3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca',
- 'ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311',
- ],
- [
- 'd3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf',
- '8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4',
- ],
- [
- '1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610',
- '68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575',
- ],
- [
- '733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4',
- 'f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d',
- ],
- [
- '15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c',
- 'd56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d',
- ],
- [
- 'a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940',
- 'edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629',
- ],
- [
- 'e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980',
- 'a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06',
- ],
- [
- '311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3',
- '66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374',
- ],
- [
- '34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf',
- '9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee',
- ],
- [
- 'f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63',
- '4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1',
- ],
- [
- 'd7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448',
- 'fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b',
- ],
- [
- '32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf',
- '5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661',
- ],
- [
- '7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5',
- '8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6',
- ],
- [
- 'ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6',
- '8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e',
- ],
- [
- '16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5',
- '5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d',
- ],
- [
- 'eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99',
- 'f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc',
- ],
- [
- '78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51',
- 'f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4',
- ],
- [
- '494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5',
- '42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c',
- ],
- [
- 'a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5',
- '204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b',
- ],
- [
- 'c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997',
- '4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913',
- ],
- [
- '841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881',
- '73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154',
- ],
- [
- '5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5',
- '39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865',
- ],
- [
- '36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66',
- 'd2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc',
- ],
- [
- '336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726',
- 'ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224',
- ],
- [
- '8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede',
- '6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e',
- ],
- [
- '1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94',
- '60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6',
- ],
- [
- '85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31',
- '3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511',
- ],
- [
- '29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51',
- 'b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b',
- ],
- [
- 'a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252',
- 'ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2',
- ],
- [
- '4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5',
- 'cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c',
- ],
- [
- 'd24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b',
- '6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3',
- ],
- [
- 'ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4',
- '322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d',
- ],
- [
- 'af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f',
- '6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700',
- ],
- [
- 'e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889',
- '2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4',
- ],
- [
- '591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246',
- 'b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196',
- ],
- [
- '11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984',
- '998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4',
- ],
- [
- '3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a',
- 'b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257',
- ],
- [
- 'cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030',
- 'bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13',
- ],
- [
- 'c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197',
- '6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096',
- ],
- [
- 'c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593',
- 'c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38',
- ],
- [
- 'a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef',
- '21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f',
- ],
- [
- '347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38',
- '60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448',
- ],
- [
- 'da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a',
- '49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a',
- ],
- [
- 'c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111',
- '5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4',
- ],
- [
- '4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502',
- '7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437',
- ],
- [
- '3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea',
- 'be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7',
- ],
- [
- 'cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26',
- '8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d',
- ],
- [
- 'b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986',
- '39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a',
- ],
- [
- 'd4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e',
- '62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54',
- ],
- [
- '48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4',
- '25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77',
- ],
- [
- 'dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda',
- 'ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517',
- ],
- [
- '6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859',
- 'cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10',
- ],
- [
- 'e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f',
- 'f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125',
- ],
- [
- 'eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c',
- '6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e',
- ],
- [
- '13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942',
- 'fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1',
- ],
- [
- 'ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a',
- '1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2',
- ],
- [
- 'b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80',
- '5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423',
- ],
- [
- 'ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d',
- '438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8',
- ],
- [
- '8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1',
- 'cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758',
- ],
- [
- '52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63',
- 'c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375',
- ],
- [
- 'e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352',
- '6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d',
- ],
- [
- '7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193',
- 'ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec',
- ],
- [
- '5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00',
- '9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0',
- ],
- [
- '32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58',
- 'ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c',
- ],
- [
- 'e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7',
- 'd3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4',
- ],
- [
- '8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8',
- 'c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f',
- ],
- [
- '4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e',
- '67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649',
- ],
- [
- '3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d',
- 'cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826',
- ],
- [
- '674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b',
- '299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5',
- ],
- [
- 'd32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f',
- 'f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87',
- ],
- [
- '30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6',
- '462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b',
- ],
- [
- 'be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297',
- '62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc',
- ],
- [
- '93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a',
- '7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c',
- ],
- [
- 'b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c',
- 'ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f',
- ],
- [
- 'd5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52',
- '4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a',
- ],
- [
- 'd3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb',
- 'bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46',
- ],
- [
- '463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065',
- 'bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f',
- ],
- [
- '7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917',
- '603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03',
- ],
- [
- '74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9',
- 'cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08',
- ],
- [
- '30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3',
- '553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8',
- ],
- [
- '9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57',
- '712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373',
- ],
- [
- '176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66',
- 'ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3',
- ],
- [
- '75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8',
- '9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8',
- ],
- [
- '809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721',
- '9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1',
- ],
- [
- '1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180',
- '4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9',
- ],
- ],
- },
- };
- /***/ }),
- /* 231 */
- /*!********************************************************!*\
- !*** ./node_modules/elliptic/lib/elliptic/ec/index.js ***!
- \********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var BN = __webpack_require__(/*! bn.js */ 197);
- var HmacDRBG = __webpack_require__(/*! hmac-drbg */ 232);
- var utils = __webpack_require__(/*! ../utils */ 210);
- var curves = __webpack_require__(/*! ../curves */ 217);
- var rand = __webpack_require__(/*! brorand */ 201);
- var assert = utils.assert;
- var KeyPair = __webpack_require__(/*! ./key */ 233);
- var Signature = __webpack_require__(/*! ./signature */ 234);
- function EC(options) {
- if (!(this instanceof EC))
- return new EC(options);
- // Shortcut `elliptic.ec(curve-name)`
- if (typeof options === 'string') {
- assert(Object.prototype.hasOwnProperty.call(curves, options),
- 'Unknown curve ' + options);
- options = curves[options];
- }
- // Shortcut for `elliptic.ec(elliptic.curves.curveName)`
- if (options instanceof curves.PresetCurve)
- options = { curve: options };
- this.curve = options.curve.curve;
- this.n = this.curve.n;
- this.nh = this.n.ushrn(1);
- this.g = this.curve.g;
- // Point on curve
- this.g = options.curve.g;
- this.g.precompute(options.curve.n.bitLength() + 1);
- // Hash for function for DRBG
- this.hash = options.hash || options.curve.hash;
- }
- module.exports = EC;
- EC.prototype.keyPair = function keyPair(options) {
- return new KeyPair(this, options);
- };
- EC.prototype.keyFromPrivate = function keyFromPrivate(priv, enc) {
- return KeyPair.fromPrivate(this, priv, enc);
- };
- EC.prototype.keyFromPublic = function keyFromPublic(pub, enc) {
- return KeyPair.fromPublic(this, pub, enc);
- };
- EC.prototype.genKeyPair = function genKeyPair(options) {
- if (!options)
- options = {};
- // Instantiate Hmac_DRBG
- var drbg = new HmacDRBG({
- hash: this.hash,
- pers: options.pers,
- persEnc: options.persEnc || 'utf8',
- entropy: options.entropy || rand(this.hash.hmacStrength),
- entropyEnc: options.entropy && options.entropyEnc || 'utf8',
- nonce: this.n.toArray(),
- });
- var bytes = this.n.byteLength();
- var ns2 = this.n.sub(new BN(2));
- for (;;) {
- var priv = new BN(drbg.generate(bytes));
- if (priv.cmp(ns2) > 0)
- continue;
- priv.iaddn(1);
- return this.keyFromPrivate(priv);
- }
- };
- EC.prototype._truncateToN = function _truncateToN(msg, truncOnly) {
- var delta = msg.byteLength() * 8 - this.n.bitLength();
- if (delta > 0)
- msg = msg.ushrn(delta);
- if (!truncOnly && msg.cmp(this.n) >= 0)
- return msg.sub(this.n);
- else
- return msg;
- };
- EC.prototype.sign = function sign(msg, key, enc, options) {
- if (typeof enc === 'object') {
- options = enc;
- enc = null;
- }
- if (!options)
- options = {};
- key = this.keyFromPrivate(key, enc);
- msg = this._truncateToN(new BN(msg, 16));
- // Zero-extend key to provide enough entropy
- var bytes = this.n.byteLength();
- var bkey = key.getPrivate().toArray('be', bytes);
- // Zero-extend nonce to have the same byte size as N
- var nonce = msg.toArray('be', bytes);
- // Instantiate Hmac_DRBG
- var drbg = new HmacDRBG({
- hash: this.hash,
- entropy: bkey,
- nonce: nonce,
- pers: options.pers,
- persEnc: options.persEnc || 'utf8',
- });
- // Number of bytes to generate
- var ns1 = this.n.sub(new BN(1));
- for (var iter = 0; ; iter++) {
- var k = options.k ?
- options.k(iter) :
- new BN(drbg.generate(this.n.byteLength()));
- k = this._truncateToN(k, true);
- if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0)
- continue;
- var kp = this.g.mul(k);
- if (kp.isInfinity())
- continue;
- var kpX = kp.getX();
- var r = kpX.umod(this.n);
- if (r.cmpn(0) === 0)
- continue;
- var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg));
- s = s.umod(this.n);
- if (s.cmpn(0) === 0)
- continue;
- var recoveryParam = (kp.getY().isOdd() ? 1 : 0) |
- (kpX.cmp(r) !== 0 ? 2 : 0);
- // Use complement of `s`, if it is > `n / 2`
- if (options.canonical && s.cmp(this.nh) > 0) {
- s = this.n.sub(s);
- recoveryParam ^= 1;
- }
- return new Signature({ r: r, s: s, recoveryParam: recoveryParam });
- }
- };
- EC.prototype.verify = function verify(msg, signature, key, enc) {
- msg = this._truncateToN(new BN(msg, 16));
- key = this.keyFromPublic(key, enc);
- signature = new Signature(signature, 'hex');
- // Perform primitive values validation
- var r = signature.r;
- var s = signature.s;
- if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0)
- return false;
- if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0)
- return false;
- // Validate signature
- var sinv = s.invm(this.n);
- var u1 = sinv.mul(msg).umod(this.n);
- var u2 = sinv.mul(r).umod(this.n);
- var p;
- if (!this.curve._maxwellTrick) {
- p = this.g.mulAdd(u1, key.getPublic(), u2);
- if (p.isInfinity())
- return false;
- return p.getX().umod(this.n).cmp(r) === 0;
- }
- // NOTE: Greg Maxwell's trick, inspired by:
- // https://git.io/vad3K
- p = this.g.jmulAdd(u1, key.getPublic(), u2);
- if (p.isInfinity())
- return false;
- // Compare `p.x` of Jacobian point with `r`,
- // this will do `p.x == r * p.z^2` instead of multiplying `p.x` by the
- // inverse of `p.z^2`
- return p.eqXToP(r);
- };
- EC.prototype.recoverPubKey = function(msg, signature, j, enc) {
- assert((3 & j) === j, 'The recovery param is more than two bits');
- signature = new Signature(signature, enc);
- var n = this.n;
- var e = new BN(msg);
- var r = signature.r;
- var s = signature.s;
- // A set LSB signifies that the y-coordinate is odd
- var isYOdd = j & 1;
- var isSecondKey = j >> 1;
- if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey)
- throw new Error('Unable to find sencond key candinate');
- // 1.1. Let x = r + jn.
- if (isSecondKey)
- r = this.curve.pointFromX(r.add(this.curve.n), isYOdd);
- else
- r = this.curve.pointFromX(r, isYOdd);
- var rInv = signature.r.invm(n);
- var s1 = n.sub(e).mul(rInv).umod(n);
- var s2 = s.mul(rInv).umod(n);
- // 1.6.1 Compute Q = r^-1 (sR - eG)
- // Q = r^-1 (sR + -eG)
- return this.g.mulAdd(s1, r, s2);
- };
- EC.prototype.getKeyRecoveryParam = function(e, signature, Q, enc) {
- signature = new Signature(signature, enc);
- if (signature.recoveryParam !== null)
- return signature.recoveryParam;
- for (var i = 0; i < 4; i++) {
- var Qprime;
- try {
- Qprime = this.recoverPubKey(e, signature, i);
- } catch (e) {
- continue;
- }
- if (Qprime.eq(Q))
- return i;
- }
- throw new Error('Unable to find valid recovery factor');
- };
- /***/ }),
- /* 232 */
- /*!*************************************************!*\
- !*** ./node_modules/hmac-drbg/lib/hmac-drbg.js ***!
- \*************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var hash = __webpack_require__(/*! hash.js */ 218);
- var utils = __webpack_require__(/*! minimalistic-crypto-utils */ 211);
- var assert = __webpack_require__(/*! minimalistic-assert */ 171);
- function HmacDRBG(options) {
- if (!(this instanceof HmacDRBG))
- return new HmacDRBG(options);
- this.hash = options.hash;
- this.predResist = !!options.predResist;
- this.outLen = this.hash.outSize;
- this.minEntropy = options.minEntropy || this.hash.hmacStrength;
- this._reseed = null;
- this.reseedInterval = null;
- this.K = null;
- this.V = null;
- var entropy = utils.toArray(options.entropy, options.entropyEnc || 'hex');
- var nonce = utils.toArray(options.nonce, options.nonceEnc || 'hex');
- var pers = utils.toArray(options.pers, options.persEnc || 'hex');
- assert(entropy.length >= (this.minEntropy / 8),
- 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');
- this._init(entropy, nonce, pers);
- }
- module.exports = HmacDRBG;
- HmacDRBG.prototype._init = function init(entropy, nonce, pers) {
- var seed = entropy.concat(nonce).concat(pers);
- this.K = new Array(this.outLen / 8);
- this.V = new Array(this.outLen / 8);
- for (var i = 0; i < this.V.length; i++) {
- this.K[i] = 0x00;
- this.V[i] = 0x01;
- }
- this._update(seed);
- this._reseed = 1;
- this.reseedInterval = 0x1000000000000; // 2^48
- };
- HmacDRBG.prototype._hmac = function hmac() {
- return new hash.hmac(this.hash, this.K);
- };
- HmacDRBG.prototype._update = function update(seed) {
- var kmac = this._hmac()
- .update(this.V)
- .update([ 0x00 ]);
- if (seed)
- kmac = kmac.update(seed);
- this.K = kmac.digest();
- this.V = this._hmac().update(this.V).digest();
- if (!seed)
- return;
- this.K = this._hmac()
- .update(this.V)
- .update([ 0x01 ])
- .update(seed)
- .digest();
- this.V = this._hmac().update(this.V).digest();
- };
- HmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) {
- // Optional entropy enc
- if (typeof entropyEnc !== 'string') {
- addEnc = add;
- add = entropyEnc;
- entropyEnc = null;
- }
- entropy = utils.toArray(entropy, entropyEnc);
- add = utils.toArray(add, addEnc);
- assert(entropy.length >= (this.minEntropy / 8),
- 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');
- this._update(entropy.concat(add || []));
- this._reseed = 1;
- };
- HmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) {
- if (this._reseed > this.reseedInterval)
- throw new Error('Reseed is required');
- // Optional encoding
- if (typeof enc !== 'string') {
- addEnc = add;
- add = enc;
- enc = null;
- }
- // Optional additional data
- if (add) {
- add = utils.toArray(add, addEnc || 'hex');
- this._update(add);
- }
- var temp = [];
- while (temp.length < len) {
- this.V = this._hmac().update(this.V).digest();
- temp = temp.concat(this.V);
- }
- var res = temp.slice(0, len);
- this._update(add);
- this._reseed++;
- return utils.encode(res, enc);
- };
- /***/ }),
- /* 233 */
- /*!******************************************************!*\
- !*** ./node_modules/elliptic/lib/elliptic/ec/key.js ***!
- \******************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var BN = __webpack_require__(/*! bn.js */ 197);
- var utils = __webpack_require__(/*! ../utils */ 210);
- var assert = utils.assert;
- function KeyPair(ec, options) {
- this.ec = ec;
- this.priv = null;
- this.pub = null;
- // KeyPair(ec, { priv: ..., pub: ... })
- if (options.priv)
- this._importPrivate(options.priv, options.privEnc);
- if (options.pub)
- this._importPublic(options.pub, options.pubEnc);
- }
- module.exports = KeyPair;
- KeyPair.fromPublic = function fromPublic(ec, pub, enc) {
- if (pub instanceof KeyPair)
- return pub;
- return new KeyPair(ec, {
- pub: pub,
- pubEnc: enc,
- });
- };
- KeyPair.fromPrivate = function fromPrivate(ec, priv, enc) {
- if (priv instanceof KeyPair)
- return priv;
- return new KeyPair(ec, {
- priv: priv,
- privEnc: enc,
- });
- };
- KeyPair.prototype.validate = function validate() {
- var pub = this.getPublic();
- if (pub.isInfinity())
- return { result: false, reason: 'Invalid public key' };
- if (!pub.validate())
- return { result: false, reason: 'Public key is not a point' };
- if (!pub.mul(this.ec.curve.n).isInfinity())
- return { result: false, reason: 'Public key * N != O' };
- return { result: true, reason: null };
- };
- KeyPair.prototype.getPublic = function getPublic(compact, enc) {
- // compact is optional argument
- if (typeof compact === 'string') {
- enc = compact;
- compact = null;
- }
- if (!this.pub)
- this.pub = this.ec.g.mul(this.priv);
- if (!enc)
- return this.pub;
- return this.pub.encode(enc, compact);
- };
- KeyPair.prototype.getPrivate = function getPrivate(enc) {
- if (enc === 'hex')
- return this.priv.toString(16, 2);
- else
- return this.priv;
- };
- KeyPair.prototype._importPrivate = function _importPrivate(key, enc) {
- this.priv = new BN(key, enc || 16);
- // Ensure that the priv won't be bigger than n, otherwise we may fail
- // in fixed multiplication method
- this.priv = this.priv.umod(this.ec.curve.n);
- };
- KeyPair.prototype._importPublic = function _importPublic(key, enc) {
- if (key.x || key.y) {
- // Montgomery points only have an `x` coordinate.
- // Weierstrass/Edwards points on the other hand have both `x` and
- // `y` coordinates.
- if (this.ec.curve.type === 'mont') {
- assert(key.x, 'Need x coordinate');
- } else if (this.ec.curve.type === 'short' ||
- this.ec.curve.type === 'edwards') {
- assert(key.x && key.y, 'Need both x and y coordinate');
- }
- this.pub = this.ec.curve.point(key.x, key.y);
- return;
- }
- this.pub = this.ec.curve.decodePoint(key, enc);
- };
- // ECDH
- KeyPair.prototype.derive = function derive(pub) {
- if(!pub.validate()) {
- assert(pub.validate(), 'public point not validated');
- }
- return pub.mul(this.priv).getX();
- };
- // ECDSA
- KeyPair.prototype.sign = function sign(msg, enc, options) {
- return this.ec.sign(msg, this, enc, options);
- };
- KeyPair.prototype.verify = function verify(msg, signature) {
- return this.ec.verify(msg, signature, this);
- };
- KeyPair.prototype.inspect = function inspect() {
- return '<Key priv: ' + (this.priv && this.priv.toString(16, 2)) +
- ' pub: ' + (this.pub && this.pub.inspect()) + ' >';
- };
- /***/ }),
- /* 234 */
- /*!************************************************************!*\
- !*** ./node_modules/elliptic/lib/elliptic/ec/signature.js ***!
- \************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var BN = __webpack_require__(/*! bn.js */ 197);
- var utils = __webpack_require__(/*! ../utils */ 210);
- var assert = utils.assert;
- function Signature(options, enc) {
- if (options instanceof Signature)
- return options;
- if (this._importDER(options, enc))
- return;
- assert(options.r && options.s, 'Signature without r or s');
- this.r = new BN(options.r, 16);
- this.s = new BN(options.s, 16);
- if (options.recoveryParam === undefined)
- this.recoveryParam = null;
- else
- this.recoveryParam = options.recoveryParam;
- }
- module.exports = Signature;
- function Position() {
- this.place = 0;
- }
- function getLength(buf, p) {
- var initial = buf[p.place++];
- if (!(initial & 0x80)) {
- return initial;
- }
- var octetLen = initial & 0xf;
- // Indefinite length or overflow
- if (octetLen === 0 || octetLen > 4) {
- return false;
- }
- var val = 0;
- for (var i = 0, off = p.place; i < octetLen; i++, off++) {
- val <<= 8;
- val |= buf[off];
- val >>>= 0;
- }
- // Leading zeroes
- if (val <= 0x7f) {
- return false;
- }
- p.place = off;
- return val;
- }
- function rmPadding(buf) {
- var i = 0;
- var len = buf.length - 1;
- while (!buf[i] && !(buf[i + 1] & 0x80) && i < len) {
- i++;
- }
- if (i === 0) {
- return buf;
- }
- return buf.slice(i);
- }
- Signature.prototype._importDER = function _importDER(data, enc) {
- data = utils.toArray(data, enc);
- var p = new Position();
- if (data[p.place++] !== 0x30) {
- return false;
- }
- var len = getLength(data, p);
- if (len === false) {
- return false;
- }
- if ((len + p.place) !== data.length) {
- return false;
- }
- if (data[p.place++] !== 0x02) {
- return false;
- }
- var rlen = getLength(data, p);
- if (rlen === false) {
- return false;
- }
- var r = data.slice(p.place, rlen + p.place);
- p.place += rlen;
- if (data[p.place++] !== 0x02) {
- return false;
- }
- var slen = getLength(data, p);
- if (slen === false) {
- return false;
- }
- if (data.length !== slen + p.place) {
- return false;
- }
- var s = data.slice(p.place, slen + p.place);
- if (r[0] === 0) {
- if (r[1] & 0x80) {
- r = r.slice(1);
- } else {
- // Leading zeroes
- return false;
- }
- }
- if (s[0] === 0) {
- if (s[1] & 0x80) {
- s = s.slice(1);
- } else {
- // Leading zeroes
- return false;
- }
- }
- this.r = new BN(r);
- this.s = new BN(s);
- this.recoveryParam = null;
- return true;
- };
- function constructLength(arr, len) {
- if (len < 0x80) {
- arr.push(len);
- return;
- }
- var octets = 1 + (Math.log(len) / Math.LN2 >>> 3);
- arr.push(octets | 0x80);
- while (--octets) {
- arr.push((len >>> (octets << 3)) & 0xff);
- }
- arr.push(len);
- }
- Signature.prototype.toDER = function toDER(enc) {
- var r = this.r.toArray();
- var s = this.s.toArray();
- // Pad values
- if (r[0] & 0x80)
- r = [ 0 ].concat(r);
- // Pad values
- if (s[0] & 0x80)
- s = [ 0 ].concat(s);
- r = rmPadding(r);
- s = rmPadding(s);
- while (!s[0] && !(s[1] & 0x80)) {
- s = s.slice(1);
- }
- var arr = [ 0x02 ];
- constructLength(arr, r.length);
- arr = arr.concat(r);
- arr.push(0x02);
- constructLength(arr, s.length);
- var backHalf = arr.concat(s);
- var res = [ 0x30 ];
- constructLength(res, backHalf.length);
- res = res.concat(backHalf);
- return utils.encode(res, enc);
- };
- /***/ }),
- /* 235 */
- /*!***********************************************************!*\
- !*** ./node_modules/elliptic/lib/elliptic/eddsa/index.js ***!
- \***********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var hash = __webpack_require__(/*! hash.js */ 218);
- var curves = __webpack_require__(/*! ../curves */ 217);
- var utils = __webpack_require__(/*! ../utils */ 210);
- var assert = utils.assert;
- var parseBytes = utils.parseBytes;
- var KeyPair = __webpack_require__(/*! ./key */ 236);
- var Signature = __webpack_require__(/*! ./signature */ 237);
- function EDDSA(curve) {
- assert(curve === 'ed25519', 'only tested with ed25519 so far');
- if (!(this instanceof EDDSA))
- return new EDDSA(curve);
- curve = curves[curve].curve;
- this.curve = curve;
- this.g = curve.g;
- this.g.precompute(curve.n.bitLength() + 1);
- this.pointClass = curve.point().constructor;
- this.encodingLength = Math.ceil(curve.n.bitLength() / 8);
- this.hash = hash.sha512;
- }
- module.exports = EDDSA;
- /**
- * @param {Array|String} message - message bytes
- * @param {Array|String|KeyPair} secret - secret bytes or a keypair
- * @returns {Signature} - signature
- */
- EDDSA.prototype.sign = function sign(message, secret) {
- message = parseBytes(message);
- var key = this.keyFromSecret(secret);
- var r = this.hashInt(key.messagePrefix(), message);
- var R = this.g.mul(r);
- var Rencoded = this.encodePoint(R);
- var s_ = this.hashInt(Rencoded, key.pubBytes(), message)
- .mul(key.priv());
- var S = r.add(s_).umod(this.curve.n);
- return this.makeSignature({ R: R, S: S, Rencoded: Rencoded });
- };
- /**
- * @param {Array} message - message bytes
- * @param {Array|String|Signature} sig - sig bytes
- * @param {Array|String|Point|KeyPair} pub - public key
- * @returns {Boolean} - true if public key matches sig of message
- */
- EDDSA.prototype.verify = function verify(message, sig, pub) {
- message = parseBytes(message);
- sig = this.makeSignature(sig);
- var key = this.keyFromPublic(pub);
- var h = this.hashInt(sig.Rencoded(), key.pubBytes(), message);
- var SG = this.g.mul(sig.S());
- var RplusAh = sig.R().add(key.pub().mul(h));
- return RplusAh.eq(SG);
- };
- EDDSA.prototype.hashInt = function hashInt() {
- var hash = this.hash();
- for (var i = 0; i < arguments.length; i++)
- hash.update(arguments[i]);
- return utils.intFromLE(hash.digest()).umod(this.curve.n);
- };
- EDDSA.prototype.keyFromPublic = function keyFromPublic(pub) {
- return KeyPair.fromPublic(this, pub);
- };
- EDDSA.prototype.keyFromSecret = function keyFromSecret(secret) {
- return KeyPair.fromSecret(this, secret);
- };
- EDDSA.prototype.makeSignature = function makeSignature(sig) {
- if (sig instanceof Signature)
- return sig;
- return new Signature(this, sig);
- };
- /**
- * * https://tools.ietf.org/html/draft-josefsson-eddsa-ed25519-03#section-5.2
- *
- * EDDSA defines methods for encoding and decoding points and integers. These are
- * helper convenience methods, that pass along to utility functions implied
- * parameters.
- *
- */
- EDDSA.prototype.encodePoint = function encodePoint(point) {
- var enc = point.getY().toArray('le', this.encodingLength);
- enc[this.encodingLength - 1] |= point.getX().isOdd() ? 0x80 : 0;
- return enc;
- };
- EDDSA.prototype.decodePoint = function decodePoint(bytes) {
- bytes = utils.parseBytes(bytes);
- var lastIx = bytes.length - 1;
- var normed = bytes.slice(0, lastIx).concat(bytes[lastIx] & ~0x80);
- var xIsOdd = (bytes[lastIx] & 0x80) !== 0;
- var y = utils.intFromLE(normed);
- return this.curve.pointFromY(y, xIsOdd);
- };
- EDDSA.prototype.encodeInt = function encodeInt(num) {
- return num.toArray('le', this.encodingLength);
- };
- EDDSA.prototype.decodeInt = function decodeInt(bytes) {
- return utils.intFromLE(bytes);
- };
- EDDSA.prototype.isPoint = function isPoint(val) {
- return val instanceof this.pointClass;
- };
- /***/ }),
- /* 236 */
- /*!*********************************************************!*\
- !*** ./node_modules/elliptic/lib/elliptic/eddsa/key.js ***!
- \*********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var utils = __webpack_require__(/*! ../utils */ 210);
- var assert = utils.assert;
- var parseBytes = utils.parseBytes;
- var cachedProperty = utils.cachedProperty;
- /**
- * @param {EDDSA} eddsa - instance
- * @param {Object} params - public/private key parameters
- *
- * @param {Array<Byte>} [params.secret] - secret seed bytes
- * @param {Point} [params.pub] - public key point (aka `A` in eddsa terms)
- * @param {Array<Byte>} [params.pub] - public key point encoded as bytes
- *
- */
- function KeyPair(eddsa, params) {
- this.eddsa = eddsa;
- this._secret = parseBytes(params.secret);
- if (eddsa.isPoint(params.pub))
- this._pub = params.pub;
- else
- this._pubBytes = parseBytes(params.pub);
- }
- KeyPair.fromPublic = function fromPublic(eddsa, pub) {
- if (pub instanceof KeyPair)
- return pub;
- return new KeyPair(eddsa, { pub: pub });
- };
- KeyPair.fromSecret = function fromSecret(eddsa, secret) {
- if (secret instanceof KeyPair)
- return secret;
- return new KeyPair(eddsa, { secret: secret });
- };
- KeyPair.prototype.secret = function secret() {
- return this._secret;
- };
- cachedProperty(KeyPair, 'pubBytes', function pubBytes() {
- return this.eddsa.encodePoint(this.pub());
- });
- cachedProperty(KeyPair, 'pub', function pub() {
- if (this._pubBytes)
- return this.eddsa.decodePoint(this._pubBytes);
- return this.eddsa.g.mul(this.priv());
- });
- cachedProperty(KeyPair, 'privBytes', function privBytes() {
- var eddsa = this.eddsa;
- var hash = this.hash();
- var lastIx = eddsa.encodingLength - 1;
- var a = hash.slice(0, eddsa.encodingLength);
- a[0] &= 248;
- a[lastIx] &= 127;
- a[lastIx] |= 64;
- return a;
- });
- cachedProperty(KeyPair, 'priv', function priv() {
- return this.eddsa.decodeInt(this.privBytes());
- });
- cachedProperty(KeyPair, 'hash', function hash() {
- return this.eddsa.hash().update(this.secret()).digest();
- });
- cachedProperty(KeyPair, 'messagePrefix', function messagePrefix() {
- return this.hash().slice(this.eddsa.encodingLength);
- });
- KeyPair.prototype.sign = function sign(message) {
- assert(this._secret, 'KeyPair can only verify');
- return this.eddsa.sign(message, this);
- };
- KeyPair.prototype.verify = function verify(message, sig) {
- return this.eddsa.verify(message, sig, this);
- };
- KeyPair.prototype.getSecret = function getSecret(enc) {
- assert(this._secret, 'KeyPair is public only');
- return utils.encode(this.secret(), enc);
- };
- KeyPair.prototype.getPublic = function getPublic(enc) {
- return utils.encode(this.pubBytes(), enc);
- };
- module.exports = KeyPair;
- /***/ }),
- /* 237 */
- /*!***************************************************************!*\
- !*** ./node_modules/elliptic/lib/elliptic/eddsa/signature.js ***!
- \***************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var BN = __webpack_require__(/*! bn.js */ 197);
- var utils = __webpack_require__(/*! ../utils */ 210);
- var assert = utils.assert;
- var cachedProperty = utils.cachedProperty;
- var parseBytes = utils.parseBytes;
- /**
- * @param {EDDSA} eddsa - eddsa instance
- * @param {Array<Bytes>|Object} sig -
- * @param {Array<Bytes>|Point} [sig.R] - R point as Point or bytes
- * @param {Array<Bytes>|bn} [sig.S] - S scalar as bn or bytes
- * @param {Array<Bytes>} [sig.Rencoded] - R point encoded
- * @param {Array<Bytes>} [sig.Sencoded] - S scalar encoded
- */
- function Signature(eddsa, sig) {
- this.eddsa = eddsa;
- if (typeof sig !== 'object')
- sig = parseBytes(sig);
- if (Array.isArray(sig)) {
- sig = {
- R: sig.slice(0, eddsa.encodingLength),
- S: sig.slice(eddsa.encodingLength),
- };
- }
- assert(sig.R && sig.S, 'Signature without R or S');
- if (eddsa.isPoint(sig.R))
- this._R = sig.R;
- if (sig.S instanceof BN)
- this._S = sig.S;
- this._Rencoded = Array.isArray(sig.R) ? sig.R : sig.Rencoded;
- this._Sencoded = Array.isArray(sig.S) ? sig.S : sig.Sencoded;
- }
- cachedProperty(Signature, 'S', function S() {
- return this.eddsa.decodeInt(this.Sencoded());
- });
- cachedProperty(Signature, 'R', function R() {
- return this.eddsa.decodePoint(this.Rencoded());
- });
- cachedProperty(Signature, 'Rencoded', function Rencoded() {
- return this.eddsa.encodePoint(this.R());
- });
- cachedProperty(Signature, 'Sencoded', function Sencoded() {
- return this.eddsa.encodeInt(this.S());
- });
- Signature.prototype.toBytes = function toBytes() {
- return this.Rencoded().concat(this.Sencoded());
- };
- Signature.prototype.toHex = function toHex() {
- return utils.encode(this.toBytes(), 'hex').toUpperCase();
- };
- module.exports = Signature;
- /***/ }),
- /* 238 */
- /*!******************************************!*\
- !*** ./node_modules/parse-asn1/index.js ***!
- \******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var asn1 = __webpack_require__(/*! ./asn1 */ 239)
- var aesid = __webpack_require__(/*! ./aesid.json */ 256)
- var fixProc = __webpack_require__(/*! ./fixProc */ 257)
- var ciphers = __webpack_require__(/*! browserify-aes */ 175)
- var compat = __webpack_require__(/*! pbkdf2 */ 160)
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- module.exports = parseKeys
- function parseKeys (buffer) {
- var password
- if (typeof buffer === 'object' && !Buffer.isBuffer(buffer)) {
- password = buffer.passphrase
- buffer = buffer.key
- }
- if (typeof buffer === 'string') {
- buffer = Buffer.from(buffer)
- }
- var stripped = fixProc(buffer, password)
- var type = stripped.tag
- var data = stripped.data
- var subtype, ndata
- switch (type) {
- case 'CERTIFICATE':
- ndata = asn1.certificate.decode(data, 'der').tbsCertificate.subjectPublicKeyInfo
- // falls through
- case 'PUBLIC KEY':
- if (!ndata) {
- ndata = asn1.PublicKey.decode(data, 'der')
- }
- subtype = ndata.algorithm.algorithm.join('.')
- switch (subtype) {
- case '1.2.840.113549.1.1.1':
- return asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data, 'der')
- case '1.2.840.10045.2.1':
- ndata.subjectPrivateKey = ndata.subjectPublicKey
- return {
- type: 'ec',
- data: ndata
- }
- case '1.2.840.10040.4.1':
- ndata.algorithm.params.pub_key = asn1.DSAparam.decode(ndata.subjectPublicKey.data, 'der')
- return {
- type: 'dsa',
- data: ndata.algorithm.params
- }
- default: throw new Error('unknown key id ' + subtype)
- }
- // throw new Error('unknown key type ' + type)
- case 'ENCRYPTED PRIVATE KEY':
- data = asn1.EncryptedPrivateKey.decode(data, 'der')
- data = decrypt(data, password)
- // falls through
- case 'PRIVATE KEY':
- ndata = asn1.PrivateKey.decode(data, 'der')
- subtype = ndata.algorithm.algorithm.join('.')
- switch (subtype) {
- case '1.2.840.113549.1.1.1':
- return asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey, 'der')
- case '1.2.840.10045.2.1':
- return {
- curve: ndata.algorithm.curve,
- privateKey: asn1.ECPrivateKey.decode(ndata.subjectPrivateKey, 'der').privateKey
- }
- case '1.2.840.10040.4.1':
- ndata.algorithm.params.priv_key = asn1.DSAparam.decode(ndata.subjectPrivateKey, 'der')
- return {
- type: 'dsa',
- params: ndata.algorithm.params
- }
- default: throw new Error('unknown key id ' + subtype)
- }
- // throw new Error('unknown key type ' + type)
- case 'RSA PUBLIC KEY':
- return asn1.RSAPublicKey.decode(data, 'der')
- case 'RSA PRIVATE KEY':
- return asn1.RSAPrivateKey.decode(data, 'der')
- case 'DSA PRIVATE KEY':
- return {
- type: 'dsa',
- params: asn1.DSAPrivateKey.decode(data, 'der')
- }
- case 'EC PRIVATE KEY':
- data = asn1.ECPrivateKey.decode(data, 'der')
- return {
- curve: data.parameters.value,
- privateKey: data.privateKey
- }
- default: throw new Error('unknown key type ' + type)
- }
- }
- parseKeys.signature = asn1.signature
- function decrypt (data, password) {
- var salt = data.algorithm.decrypt.kde.kdeparams.salt
- var iters = parseInt(data.algorithm.decrypt.kde.kdeparams.iters.toString(), 10)
- var algo = aesid[data.algorithm.decrypt.cipher.algo.join('.')]
- var iv = data.algorithm.decrypt.cipher.iv
- var cipherText = data.subjectPrivateKey
- var keylen = parseInt(algo.split('-')[1], 10) / 8
- var key = compat.pbkdf2Sync(password, salt, iters, keylen, 'sha1')
- var cipher = ciphers.createDecipheriv(algo, key, iv)
- var out = []
- out.push(cipher.update(cipherText))
- out.push(cipher.final())
- return Buffer.concat(out)
- }
- /***/ }),
- /* 239 */
- /*!*****************************************!*\
- !*** ./node_modules/parse-asn1/asn1.js ***!
- \*****************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- // from https://github.com/indutny/self-signed/blob/gh-pages/lib/asn1.js
- // Fedor, you are amazing.
- var asn1 = __webpack_require__(/*! asn1.js */ 240)
- exports.certificate = __webpack_require__(/*! ./certificate */ 255)
- var RSAPrivateKey = asn1.define('RSAPrivateKey', function () {
- this.seq().obj(
- this.key('version').int(),
- this.key('modulus').int(),
- this.key('publicExponent').int(),
- this.key('privateExponent').int(),
- this.key('prime1').int(),
- this.key('prime2').int(),
- this.key('exponent1').int(),
- this.key('exponent2').int(),
- this.key('coefficient').int()
- )
- })
- exports.RSAPrivateKey = RSAPrivateKey
- var RSAPublicKey = asn1.define('RSAPublicKey', function () {
- this.seq().obj(
- this.key('modulus').int(),
- this.key('publicExponent').int()
- )
- })
- exports.RSAPublicKey = RSAPublicKey
- var PublicKey = asn1.define('SubjectPublicKeyInfo', function () {
- this.seq().obj(
- this.key('algorithm').use(AlgorithmIdentifier),
- this.key('subjectPublicKey').bitstr()
- )
- })
- exports.PublicKey = PublicKey
- var AlgorithmIdentifier = asn1.define('AlgorithmIdentifier', function () {
- this.seq().obj(
- this.key('algorithm').objid(),
- this.key('none').null_().optional(),
- this.key('curve').objid().optional(),
- this.key('params').seq().obj(
- this.key('p').int(),
- this.key('q').int(),
- this.key('g').int()
- ).optional()
- )
- })
- var PrivateKeyInfo = asn1.define('PrivateKeyInfo', function () {
- this.seq().obj(
- this.key('version').int(),
- this.key('algorithm').use(AlgorithmIdentifier),
- this.key('subjectPrivateKey').octstr()
- )
- })
- exports.PrivateKey = PrivateKeyInfo
- var EncryptedPrivateKeyInfo = asn1.define('EncryptedPrivateKeyInfo', function () {
- this.seq().obj(
- this.key('algorithm').seq().obj(
- this.key('id').objid(),
- this.key('decrypt').seq().obj(
- this.key('kde').seq().obj(
- this.key('id').objid(),
- this.key('kdeparams').seq().obj(
- this.key('salt').octstr(),
- this.key('iters').int()
- )
- ),
- this.key('cipher').seq().obj(
- this.key('algo').objid(),
- this.key('iv').octstr()
- )
- )
- ),
- this.key('subjectPrivateKey').octstr()
- )
- })
- exports.EncryptedPrivateKey = EncryptedPrivateKeyInfo
- var DSAPrivateKey = asn1.define('DSAPrivateKey', function () {
- this.seq().obj(
- this.key('version').int(),
- this.key('p').int(),
- this.key('q').int(),
- this.key('g').int(),
- this.key('pub_key').int(),
- this.key('priv_key').int()
- )
- })
- exports.DSAPrivateKey = DSAPrivateKey
- exports.DSAparam = asn1.define('DSAparam', function () {
- this.int()
- })
- var ECPrivateKey = asn1.define('ECPrivateKey', function () {
- this.seq().obj(
- this.key('version').int(),
- this.key('privateKey').octstr(),
- this.key('parameters').optional().explicit(0).use(ECParameters),
- this.key('publicKey').optional().explicit(1).bitstr()
- )
- })
- exports.ECPrivateKey = ECPrivateKey
- var ECParameters = asn1.define('ECParameters', function () {
- this.choice({
- namedCurve: this.objid()
- })
- })
- exports.signature = asn1.define('signature', function () {
- this.seq().obj(
- this.key('r').int(),
- this.key('s').int()
- )
- })
- /***/ }),
- /* 240 */
- /*!******************************************!*\
- !*** ./node_modules/asn1.js/lib/asn1.js ***!
- \******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- const asn1 = exports;
- asn1.bignum = __webpack_require__(/*! bn.js */ 197);
- asn1.define = __webpack_require__(/*! ./asn1/api */ 241).define;
- asn1.base = __webpack_require__(/*! ./asn1/base */ 253);
- asn1.constants = __webpack_require__(/*! ./asn1/constants */ 254);
- asn1.decoders = __webpack_require__(/*! ./asn1/decoders */ 250);
- asn1.encoders = __webpack_require__(/*! ./asn1/encoders */ 242);
- /***/ }),
- /* 241 */
- /*!**********************************************!*\
- !*** ./node_modules/asn1.js/lib/asn1/api.js ***!
- \**********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- const encoders = __webpack_require__(/*! ./encoders */ 242);
- const decoders = __webpack_require__(/*! ./decoders */ 250);
- const inherits = __webpack_require__(/*! inherits */ 121);
- const api = exports;
- api.define = function define(name, body) {
- return new Entity(name, body);
- };
- function Entity(name, body) {
- this.name = name;
- this.body = body;
- this.decoders = {};
- this.encoders = {};
- }
- Entity.prototype._createNamed = function createNamed(Base) {
- const name = this.name;
- function Generated(entity) {
- this._initNamed(entity, name);
- }
- inherits(Generated, Base);
- Generated.prototype._initNamed = function _initNamed(entity, name) {
- Base.call(this, entity, name);
- };
- return new Generated(this);
- };
- Entity.prototype._getDecoder = function _getDecoder(enc) {
- enc = enc || 'der';
- // Lazily create decoder
- if (!this.decoders.hasOwnProperty(enc))
- this.decoders[enc] = this._createNamed(decoders[enc]);
- return this.decoders[enc];
- };
- Entity.prototype.decode = function decode(data, enc, options) {
- return this._getDecoder(enc).decode(data, options);
- };
- Entity.prototype._getEncoder = function _getEncoder(enc) {
- enc = enc || 'der';
- // Lazily create encoder
- if (!this.encoders.hasOwnProperty(enc))
- this.encoders[enc] = this._createNamed(encoders[enc]);
- return this.encoders[enc];
- };
- Entity.prototype.encode = function encode(data, enc, /* internal */ reporter) {
- return this._getEncoder(enc).encode(data, reporter);
- };
- /***/ }),
- /* 242 */
- /*!*********************************************************!*\
- !*** ./node_modules/asn1.js/lib/asn1/encoders/index.js ***!
- \*********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- const encoders = exports;
- encoders.der = __webpack_require__(/*! ./der */ 243);
- encoders.pem = __webpack_require__(/*! ./pem */ 249);
- /***/ }),
- /* 243 */
- /*!*******************************************************!*\
- !*** ./node_modules/asn1.js/lib/asn1/encoders/der.js ***!
- \*******************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- const inherits = __webpack_require__(/*! inherits */ 121);
- const Buffer = __webpack_require__(/*! safer-buffer */ 244).Buffer;
- const Node = __webpack_require__(/*! ../base/node */ 245);
- // Import DER constants
- const der = __webpack_require__(/*! ../constants/der */ 248);
- function DEREncoder(entity) {
- this.enc = 'der';
- this.name = entity.name;
- this.entity = entity;
- // Construct base tree
- this.tree = new DERNode();
- this.tree._init(entity.body);
- }
- module.exports = DEREncoder;
- DEREncoder.prototype.encode = function encode(data, reporter) {
- return this.tree._encode(data, reporter).join();
- };
- // Tree methods
- function DERNode(parent) {
- Node.call(this, 'der', parent);
- }
- inherits(DERNode, Node);
- DERNode.prototype._encodeComposite = function encodeComposite(tag,
- primitive,
- cls,
- content) {
- const encodedTag = encodeTag(tag, primitive, cls, this.reporter);
- // Short form
- if (content.length < 0x80) {
- const header = Buffer.alloc(2);
- header[0] = encodedTag;
- header[1] = content.length;
- return this._createEncoderBuffer([ header, content ]);
- }
- // Long form
- // Count octets required to store length
- let lenOctets = 1;
- for (let i = content.length; i >= 0x100; i >>= 8)
- lenOctets++;
- const header = Buffer.alloc(1 + 1 + lenOctets);
- header[0] = encodedTag;
- header[1] = 0x80 | lenOctets;
- for (let i = 1 + lenOctets, j = content.length; j > 0; i--, j >>= 8)
- header[i] = j & 0xff;
- return this._createEncoderBuffer([ header, content ]);
- };
- DERNode.prototype._encodeStr = function encodeStr(str, tag) {
- if (tag === 'bitstr') {
- return this._createEncoderBuffer([ str.unused | 0, str.data ]);
- } else if (tag === 'bmpstr') {
- const buf = Buffer.alloc(str.length * 2);
- for (let i = 0; i < str.length; i++) {
- buf.writeUInt16BE(str.charCodeAt(i), i * 2);
- }
- return this._createEncoderBuffer(buf);
- } else if (tag === 'numstr') {
- if (!this._isNumstr(str)) {
- return this.reporter.error('Encoding of string type: numstr supports ' +
- 'only digits and space');
- }
- return this._createEncoderBuffer(str);
- } else if (tag === 'printstr') {
- if (!this._isPrintstr(str)) {
- return this.reporter.error('Encoding of string type: printstr supports ' +
- 'only latin upper and lower case letters, ' +
- 'digits, space, apostrophe, left and rigth ' +
- 'parenthesis, plus sign, comma, hyphen, ' +
- 'dot, slash, colon, equal sign, ' +
- 'question mark');
- }
- return this._createEncoderBuffer(str);
- } else if (/str$/.test(tag)) {
- return this._createEncoderBuffer(str);
- } else if (tag === 'objDesc') {
- return this._createEncoderBuffer(str);
- } else {
- return this.reporter.error('Encoding of string type: ' + tag +
- ' unsupported');
- }
- };
- DERNode.prototype._encodeObjid = function encodeObjid(id, values, relative) {
- if (typeof id === 'string') {
- if (!values)
- return this.reporter.error('string objid given, but no values map found');
- if (!values.hasOwnProperty(id))
- return this.reporter.error('objid not found in values map');
- id = values[id].split(/[\s.]+/g);
- for (let i = 0; i < id.length; i++)
- id[i] |= 0;
- } else if (Array.isArray(id)) {
- id = id.slice();
- for (let i = 0; i < id.length; i++)
- id[i] |= 0;
- }
- if (!Array.isArray(id)) {
- return this.reporter.error('objid() should be either array or string, ' +
- 'got: ' + JSON.stringify(id));
- }
- if (!relative) {
- if (id[1] >= 40)
- return this.reporter.error('Second objid identifier OOB');
- id.splice(0, 2, id[0] * 40 + id[1]);
- }
- // Count number of octets
- let size = 0;
- for (let i = 0; i < id.length; i++) {
- let ident = id[i];
- for (size++; ident >= 0x80; ident >>= 7)
- size++;
- }
- const objid = Buffer.alloc(size);
- let offset = objid.length - 1;
- for (let i = id.length - 1; i >= 0; i--) {
- let ident = id[i];
- objid[offset--] = ident & 0x7f;
- while ((ident >>= 7) > 0)
- objid[offset--] = 0x80 | (ident & 0x7f);
- }
- return this._createEncoderBuffer(objid);
- };
- function two(num) {
- if (num < 10)
- return '0' + num;
- else
- return num;
- }
- DERNode.prototype._encodeTime = function encodeTime(time, tag) {
- let str;
- const date = new Date(time);
- if (tag === 'gentime') {
- str = [
- two(date.getUTCFullYear()),
- two(date.getUTCMonth() + 1),
- two(date.getUTCDate()),
- two(date.getUTCHours()),
- two(date.getUTCMinutes()),
- two(date.getUTCSeconds()),
- 'Z'
- ].join('');
- } else if (tag === 'utctime') {
- str = [
- two(date.getUTCFullYear() % 100),
- two(date.getUTCMonth() + 1),
- two(date.getUTCDate()),
- two(date.getUTCHours()),
- two(date.getUTCMinutes()),
- two(date.getUTCSeconds()),
- 'Z'
- ].join('');
- } else {
- this.reporter.error('Encoding ' + tag + ' time is not supported yet');
- }
- return this._encodeStr(str, 'octstr');
- };
- DERNode.prototype._encodeNull = function encodeNull() {
- return this._createEncoderBuffer('');
- };
- DERNode.prototype._encodeInt = function encodeInt(num, values) {
- if (typeof num === 'string') {
- if (!values)
- return this.reporter.error('String int or enum given, but no values map');
- if (!values.hasOwnProperty(num)) {
- return this.reporter.error('Values map doesn\'t contain: ' +
- JSON.stringify(num));
- }
- num = values[num];
- }
- // Bignum, assume big endian
- if (typeof num !== 'number' && !Buffer.isBuffer(num)) {
- const numArray = num.toArray();
- if (!num.sign && numArray[0] & 0x80) {
- numArray.unshift(0);
- }
- num = Buffer.from(numArray);
- }
- if (Buffer.isBuffer(num)) {
- let size = num.length;
- if (num.length === 0)
- size++;
- const out = Buffer.alloc(size);
- num.copy(out);
- if (num.length === 0)
- out[0] = 0;
- return this._createEncoderBuffer(out);
- }
- if (num < 0x80)
- return this._createEncoderBuffer(num);
- if (num < 0x100)
- return this._createEncoderBuffer([0, num]);
- let size = 1;
- for (let i = num; i >= 0x100; i >>= 8)
- size++;
- const out = new Array(size);
- for (let i = out.length - 1; i >= 0; i--) {
- out[i] = num & 0xff;
- num >>= 8;
- }
- if(out[0] & 0x80) {
- out.unshift(0);
- }
- return this._createEncoderBuffer(Buffer.from(out));
- };
- DERNode.prototype._encodeBool = function encodeBool(value) {
- return this._createEncoderBuffer(value ? 0xff : 0);
- };
- DERNode.prototype._use = function use(entity, obj) {
- if (typeof entity === 'function')
- entity = entity(obj);
- return entity._getEncoder('der').tree;
- };
- DERNode.prototype._skipDefault = function skipDefault(dataBuffer, reporter, parent) {
- const state = this._baseState;
- let i;
- if (state['default'] === null)
- return false;
- const data = dataBuffer.join();
- if (state.defaultBuffer === undefined)
- state.defaultBuffer = this._encodeValue(state['default'], reporter, parent).join();
- if (data.length !== state.defaultBuffer.length)
- return false;
- for (i=0; i < data.length; i++)
- if (data[i] !== state.defaultBuffer[i])
- return false;
- return true;
- };
- // Utility methods
- function encodeTag(tag, primitive, cls, reporter) {
- let res;
- if (tag === 'seqof')
- tag = 'seq';
- else if (tag === 'setof')
- tag = 'set';
- if (der.tagByName.hasOwnProperty(tag))
- res = der.tagByName[tag];
- else if (typeof tag === 'number' && (tag | 0) === tag)
- res = tag;
- else
- return reporter.error('Unknown tag: ' + tag);
- if (res >= 0x1f)
- return reporter.error('Multi-octet tag encoding unsupported');
- if (!primitive)
- res |= 0x20;
- res |= (der.tagClassByName[cls || 'universal'] << 6);
- return res;
- }
- /***/ }),
- /* 244 */
- /*!********************************************!*\
- !*** ./node_modules/safer-buffer/safer.js ***!
- \********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(process) {/* eslint-disable node/no-deprecated-api */
- var buffer = __webpack_require__(/*! buffer */ 116)
- var Buffer = buffer.Buffer
- var safer = {}
- var key
- for (key in buffer) {
- if (!buffer.hasOwnProperty(key)) continue
- if (key === 'SlowBuffer' || key === 'Buffer') continue
- safer[key] = buffer[key]
- }
- var Safer = safer.Buffer = {}
- for (key in Buffer) {
- if (!Buffer.hasOwnProperty(key)) continue
- if (key === 'allocUnsafe' || key === 'allocUnsafeSlow') continue
- Safer[key] = Buffer[key]
- }
- safer.Buffer.prototype = Buffer.prototype
- if (!Safer.from || Safer.from === Uint8Array.from) {
- Safer.from = function (value, encodingOrOffset, length) {
- if (typeof value === 'number') {
- throw new TypeError('The "value" argument must not be of type number. Received type ' + typeof value)
- }
- if (value && typeof value.length === 'undefined') {
- throw new TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type ' + typeof value)
- }
- return Buffer(value, encodingOrOffset, length)
- }
- }
- if (!Safer.alloc) {
- Safer.alloc = function (size, fill, encoding) {
- if (typeof size !== 'number') {
- throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size)
- }
- if (size < 0 || size >= 2 * (1 << 30)) {
- throw new RangeError('The value "' + size + '" is invalid for option "size"')
- }
- var buf = Buffer(size)
- if (!fill || fill.length === 0) {
- buf.fill(0)
- } else if (typeof encoding === 'string') {
- buf.fill(fill, encoding)
- } else {
- buf.fill(fill)
- }
- return buf
- }
- }
- if (!safer.kStringMaxLength) {
- try {
- safer.kStringMaxLength = process.binding('buffer').kStringMaxLength
- } catch (e) {
- // we can't determine kStringMaxLength in environments where process.binding
- // is unsupported, so let's not set it
- }
- }
- if (!safer.constants) {
- safer.constants = {
- MAX_LENGTH: safer.kMaxLength
- }
- if (safer.kStringMaxLength) {
- safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength
- }
- }
- module.exports = safer
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../node-libs-browser/mock/process.js */ 113)))
- /***/ }),
- /* 245 */
- /*!****************************************************!*\
- !*** ./node_modules/asn1.js/lib/asn1/base/node.js ***!
- \****************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- const Reporter = __webpack_require__(/*! ../base/reporter */ 246).Reporter;
- const EncoderBuffer = __webpack_require__(/*! ../base/buffer */ 247).EncoderBuffer;
- const DecoderBuffer = __webpack_require__(/*! ../base/buffer */ 247).DecoderBuffer;
- const assert = __webpack_require__(/*! minimalistic-assert */ 171);
- // Supported tags
- const tags = [
- 'seq', 'seqof', 'set', 'setof', 'objid', 'bool',
- 'gentime', 'utctime', 'null_', 'enum', 'int', 'objDesc',
- 'bitstr', 'bmpstr', 'charstr', 'genstr', 'graphstr', 'ia5str', 'iso646str',
- 'numstr', 'octstr', 'printstr', 't61str', 'unistr', 'utf8str', 'videostr'
- ];
- // Public methods list
- const methods = [
- 'key', 'obj', 'use', 'optional', 'explicit', 'implicit', 'def', 'choice',
- 'any', 'contains'
- ].concat(tags);
- // Overrided methods list
- const overrided = [
- '_peekTag', '_decodeTag', '_use',
- '_decodeStr', '_decodeObjid', '_decodeTime',
- '_decodeNull', '_decodeInt', '_decodeBool', '_decodeList',
- '_encodeComposite', '_encodeStr', '_encodeObjid', '_encodeTime',
- '_encodeNull', '_encodeInt', '_encodeBool'
- ];
- function Node(enc, parent, name) {
- const state = {};
- this._baseState = state;
- state.name = name;
- state.enc = enc;
- state.parent = parent || null;
- state.children = null;
- // State
- state.tag = null;
- state.args = null;
- state.reverseArgs = null;
- state.choice = null;
- state.optional = false;
- state.any = false;
- state.obj = false;
- state.use = null;
- state.useDecoder = null;
- state.key = null;
- state['default'] = null;
- state.explicit = null;
- state.implicit = null;
- state.contains = null;
- // Should create new instance on each method
- if (!state.parent) {
- state.children = [];
- this._wrap();
- }
- }
- module.exports = Node;
- const stateProps = [
- 'enc', 'parent', 'children', 'tag', 'args', 'reverseArgs', 'choice',
- 'optional', 'any', 'obj', 'use', 'alteredUse', 'key', 'default', 'explicit',
- 'implicit', 'contains'
- ];
- Node.prototype.clone = function clone() {
- const state = this._baseState;
- const cstate = {};
- stateProps.forEach(function(prop) {
- cstate[prop] = state[prop];
- });
- const res = new this.constructor(cstate.parent);
- res._baseState = cstate;
- return res;
- };
- Node.prototype._wrap = function wrap() {
- const state = this._baseState;
- methods.forEach(function(method) {
- this[method] = function _wrappedMethod() {
- const clone = new this.constructor(this);
- state.children.push(clone);
- return clone[method].apply(clone, arguments);
- };
- }, this);
- };
- Node.prototype._init = function init(body) {
- const state = this._baseState;
- assert(state.parent === null);
- body.call(this);
- // Filter children
- state.children = state.children.filter(function(child) {
- return child._baseState.parent === this;
- }, this);
- assert.equal(state.children.length, 1, 'Root node can have only one child');
- };
- Node.prototype._useArgs = function useArgs(args) {
- const state = this._baseState;
- // Filter children and args
- const children = args.filter(function(arg) {
- return arg instanceof this.constructor;
- }, this);
- args = args.filter(function(arg) {
- return !(arg instanceof this.constructor);
- }, this);
- if (children.length !== 0) {
- assert(state.children === null);
- state.children = children;
- // Replace parent to maintain backward link
- children.forEach(function(child) {
- child._baseState.parent = this;
- }, this);
- }
- if (args.length !== 0) {
- assert(state.args === null);
- state.args = args;
- state.reverseArgs = args.map(function(arg) {
- if (typeof arg !== 'object' || arg.constructor !== Object)
- return arg;
- const res = {};
- Object.keys(arg).forEach(function(key) {
- if (key == (key | 0))
- key |= 0;
- const value = arg[key];
- res[value] = key;
- });
- return res;
- });
- }
- };
- //
- // Overrided methods
- //
- overrided.forEach(function(method) {
- Node.prototype[method] = function _overrided() {
- const state = this._baseState;
- throw new Error(method + ' not implemented for encoding: ' + state.enc);
- };
- });
- //
- // Public methods
- //
- tags.forEach(function(tag) {
- Node.prototype[tag] = function _tagMethod() {
- const state = this._baseState;
- const args = Array.prototype.slice.call(arguments);
- assert(state.tag === null);
- state.tag = tag;
- this._useArgs(args);
- return this;
- };
- });
- Node.prototype.use = function use(item) {
- assert(item);
- const state = this._baseState;
- assert(state.use === null);
- state.use = item;
- return this;
- };
- Node.prototype.optional = function optional() {
- const state = this._baseState;
- state.optional = true;
- return this;
- };
- Node.prototype.def = function def(val) {
- const state = this._baseState;
- assert(state['default'] === null);
- state['default'] = val;
- state.optional = true;
- return this;
- };
- Node.prototype.explicit = function explicit(num) {
- const state = this._baseState;
- assert(state.explicit === null && state.implicit === null);
- state.explicit = num;
- return this;
- };
- Node.prototype.implicit = function implicit(num) {
- const state = this._baseState;
- assert(state.explicit === null && state.implicit === null);
- state.implicit = num;
- return this;
- };
- Node.prototype.obj = function obj() {
- const state = this._baseState;
- const args = Array.prototype.slice.call(arguments);
- state.obj = true;
- if (args.length !== 0)
- this._useArgs(args);
- return this;
- };
- Node.prototype.key = function key(newKey) {
- const state = this._baseState;
- assert(state.key === null);
- state.key = newKey;
- return this;
- };
- Node.prototype.any = function any() {
- const state = this._baseState;
- state.any = true;
- return this;
- };
- Node.prototype.choice = function choice(obj) {
- const state = this._baseState;
- assert(state.choice === null);
- state.choice = obj;
- this._useArgs(Object.keys(obj).map(function(key) {
- return obj[key];
- }));
- return this;
- };
- Node.prototype.contains = function contains(item) {
- const state = this._baseState;
- assert(state.use === null);
- state.contains = item;
- return this;
- };
- //
- // Decoding
- //
- Node.prototype._decode = function decode(input, options) {
- const state = this._baseState;
- // Decode root node
- if (state.parent === null)
- return input.wrapResult(state.children[0]._decode(input, options));
- let result = state['default'];
- let present = true;
- let prevKey = null;
- if (state.key !== null)
- prevKey = input.enterKey(state.key);
- // Check if tag is there
- if (state.optional) {
- let tag = null;
- if (state.explicit !== null)
- tag = state.explicit;
- else if (state.implicit !== null)
- tag = state.implicit;
- else if (state.tag !== null)
- tag = state.tag;
- if (tag === null && !state.any) {
- // Trial and Error
- const save = input.save();
- try {
- if (state.choice === null)
- this._decodeGeneric(state.tag, input, options);
- else
- this._decodeChoice(input, options);
- present = true;
- } catch (e) {
- present = false;
- }
- input.restore(save);
- } else {
- present = this._peekTag(input, tag, state.any);
- if (input.isError(present))
- return present;
- }
- }
- // Push object on stack
- let prevObj;
- if (state.obj && present)
- prevObj = input.enterObject();
- if (present) {
- // Unwrap explicit values
- if (state.explicit !== null) {
- const explicit = this._decodeTag(input, state.explicit);
- if (input.isError(explicit))
- return explicit;
- input = explicit;
- }
- const start = input.offset;
- // Unwrap implicit and normal values
- if (state.use === null && state.choice === null) {
- let save;
- if (state.any)
- save = input.save();
- const body = this._decodeTag(
- input,
- state.implicit !== null ? state.implicit : state.tag,
- state.any
- );
- if (input.isError(body))
- return body;
- if (state.any)
- result = input.raw(save);
- else
- input = body;
- }
- if (options && options.track && state.tag !== null)
- options.track(input.path(), start, input.length, 'tagged');
- if (options && options.track && state.tag !== null)
- options.track(input.path(), input.offset, input.length, 'content');
- // Select proper method for tag
- if (state.any) {
- // no-op
- } else if (state.choice === null) {
- result = this._decodeGeneric(state.tag, input, options);
- } else {
- result = this._decodeChoice(input, options);
- }
- if (input.isError(result))
- return result;
- // Decode children
- if (!state.any && state.choice === null && state.children !== null) {
- state.children.forEach(function decodeChildren(child) {
- // NOTE: We are ignoring errors here, to let parser continue with other
- // parts of encoded data
- child._decode(input, options);
- });
- }
- // Decode contained/encoded by schema, only in bit or octet strings
- if (state.contains && (state.tag === 'octstr' || state.tag === 'bitstr')) {
- const data = new DecoderBuffer(result);
- result = this._getUse(state.contains, input._reporterState.obj)
- ._decode(data, options);
- }
- }
- // Pop object
- if (state.obj && present)
- result = input.leaveObject(prevObj);
- // Set key
- if (state.key !== null && (result !== null || present === true))
- input.leaveKey(prevKey, state.key, result);
- else if (prevKey !== null)
- input.exitKey(prevKey);
- return result;
- };
- Node.prototype._decodeGeneric = function decodeGeneric(tag, input, options) {
- const state = this._baseState;
- if (tag === 'seq' || tag === 'set')
- return null;
- if (tag === 'seqof' || tag === 'setof')
- return this._decodeList(input, tag, state.args[0], options);
- else if (/str$/.test(tag))
- return this._decodeStr(input, tag, options);
- else if (tag === 'objid' && state.args)
- return this._decodeObjid(input, state.args[0], state.args[1], options);
- else if (tag === 'objid')
- return this._decodeObjid(input, null, null, options);
- else if (tag === 'gentime' || tag === 'utctime')
- return this._decodeTime(input, tag, options);
- else if (tag === 'null_')
- return this._decodeNull(input, options);
- else if (tag === 'bool')
- return this._decodeBool(input, options);
- else if (tag === 'objDesc')
- return this._decodeStr(input, tag, options);
- else if (tag === 'int' || tag === 'enum')
- return this._decodeInt(input, state.args && state.args[0], options);
- if (state.use !== null) {
- return this._getUse(state.use, input._reporterState.obj)
- ._decode(input, options);
- } else {
- return input.error('unknown tag: ' + tag);
- }
- };
- Node.prototype._getUse = function _getUse(entity, obj) {
- const state = this._baseState;
- // Create altered use decoder if implicit is set
- state.useDecoder = this._use(entity, obj);
- assert(state.useDecoder._baseState.parent === null);
- state.useDecoder = state.useDecoder._baseState.children[0];
- if (state.implicit !== state.useDecoder._baseState.implicit) {
- state.useDecoder = state.useDecoder.clone();
- state.useDecoder._baseState.implicit = state.implicit;
- }
- return state.useDecoder;
- };
- Node.prototype._decodeChoice = function decodeChoice(input, options) {
- const state = this._baseState;
- let result = null;
- let match = false;
- Object.keys(state.choice).some(function(key) {
- const save = input.save();
- const node = state.choice[key];
- try {
- const value = node._decode(input, options);
- if (input.isError(value))
- return false;
- result = { type: key, value: value };
- match = true;
- } catch (e) {
- input.restore(save);
- return false;
- }
- return true;
- }, this);
- if (!match)
- return input.error('Choice not matched');
- return result;
- };
- //
- // Encoding
- //
- Node.prototype._createEncoderBuffer = function createEncoderBuffer(data) {
- return new EncoderBuffer(data, this.reporter);
- };
- Node.prototype._encode = function encode(data, reporter, parent) {
- const state = this._baseState;
- if (state['default'] !== null && state['default'] === data)
- return;
- const result = this._encodeValue(data, reporter, parent);
- if (result === undefined)
- return;
- if (this._skipDefault(result, reporter, parent))
- return;
- return result;
- };
- Node.prototype._encodeValue = function encode(data, reporter, parent) {
- const state = this._baseState;
- // Decode root node
- if (state.parent === null)
- return state.children[0]._encode(data, reporter || new Reporter());
- let result = null;
- // Set reporter to share it with a child class
- this.reporter = reporter;
- // Check if data is there
- if (state.optional && data === undefined) {
- if (state['default'] !== null)
- data = state['default'];
- else
- return;
- }
- // Encode children first
- let content = null;
- let primitive = false;
- if (state.any) {
- // Anything that was given is translated to buffer
- result = this._createEncoderBuffer(data);
- } else if (state.choice) {
- result = this._encodeChoice(data, reporter);
- } else if (state.contains) {
- content = this._getUse(state.contains, parent)._encode(data, reporter);
- primitive = true;
- } else if (state.children) {
- content = state.children.map(function(child) {
- if (child._baseState.tag === 'null_')
- return child._encode(null, reporter, data);
- if (child._baseState.key === null)
- return reporter.error('Child should have a key');
- const prevKey = reporter.enterKey(child._baseState.key);
- if (typeof data !== 'object')
- return reporter.error('Child expected, but input is not object');
- const res = child._encode(data[child._baseState.key], reporter, data);
- reporter.leaveKey(prevKey);
- return res;
- }, this).filter(function(child) {
- return child;
- });
- content = this._createEncoderBuffer(content);
- } else {
- if (state.tag === 'seqof' || state.tag === 'setof') {
- // TODO(indutny): this should be thrown on DSL level
- if (!(state.args && state.args.length === 1))
- return reporter.error('Too many args for : ' + state.tag);
- if (!Array.isArray(data))
- return reporter.error('seqof/setof, but data is not Array');
- const child = this.clone();
- child._baseState.implicit = null;
- content = this._createEncoderBuffer(data.map(function(item) {
- const state = this._baseState;
- return this._getUse(state.args[0], data)._encode(item, reporter);
- }, child));
- } else if (state.use !== null) {
- result = this._getUse(state.use, parent)._encode(data, reporter);
- } else {
- content = this._encodePrimitive(state.tag, data);
- primitive = true;
- }
- }
- // Encode data itself
- if (!state.any && state.choice === null) {
- const tag = state.implicit !== null ? state.implicit : state.tag;
- const cls = state.implicit === null ? 'universal' : 'context';
- if (tag === null) {
- if (state.use === null)
- reporter.error('Tag could be omitted only for .use()');
- } else {
- if (state.use === null)
- result = this._encodeComposite(tag, primitive, cls, content);
- }
- }
- // Wrap in explicit
- if (state.explicit !== null)
- result = this._encodeComposite(state.explicit, false, 'context', result);
- return result;
- };
- Node.prototype._encodeChoice = function encodeChoice(data, reporter) {
- const state = this._baseState;
- const node = state.choice[data.type];
- if (!node) {
- assert(
- false,
- data.type + ' not found in ' +
- JSON.stringify(Object.keys(state.choice)));
- }
- return node._encode(data.value, reporter);
- };
- Node.prototype._encodePrimitive = function encodePrimitive(tag, data) {
- const state = this._baseState;
- if (/str$/.test(tag))
- return this._encodeStr(data, tag);
- else if (tag === 'objid' && state.args)
- return this._encodeObjid(data, state.reverseArgs[0], state.args[1]);
- else if (tag === 'objid')
- return this._encodeObjid(data, null, null);
- else if (tag === 'gentime' || tag === 'utctime')
- return this._encodeTime(data, tag);
- else if (tag === 'null_')
- return this._encodeNull();
- else if (tag === 'int' || tag === 'enum')
- return this._encodeInt(data, state.args && state.reverseArgs[0]);
- else if (tag === 'bool')
- return this._encodeBool(data);
- else if (tag === 'objDesc')
- return this._encodeStr(data, tag);
- else
- throw new Error('Unsupported tag: ' + tag);
- };
- Node.prototype._isNumstr = function isNumstr(str) {
- return /^[0-9 ]*$/.test(str);
- };
- Node.prototype._isPrintstr = function isPrintstr(str) {
- return /^[A-Za-z0-9 '()+,-./:=?]*$/.test(str);
- };
- /***/ }),
- /* 246 */
- /*!********************************************************!*\
- !*** ./node_modules/asn1.js/lib/asn1/base/reporter.js ***!
- \********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- const inherits = __webpack_require__(/*! inherits */ 121);
- function Reporter(options) {
- this._reporterState = {
- obj: null,
- path: [],
- options: options || {},
- errors: []
- };
- }
- exports.Reporter = Reporter;
- Reporter.prototype.isError = function isError(obj) {
- return obj instanceof ReporterError;
- };
- Reporter.prototype.save = function save() {
- const state = this._reporterState;
- return { obj: state.obj, pathLen: state.path.length };
- };
- Reporter.prototype.restore = function restore(data) {
- const state = this._reporterState;
- state.obj = data.obj;
- state.path = state.path.slice(0, data.pathLen);
- };
- Reporter.prototype.enterKey = function enterKey(key) {
- return this._reporterState.path.push(key);
- };
- Reporter.prototype.exitKey = function exitKey(index) {
- const state = this._reporterState;
- state.path = state.path.slice(0, index - 1);
- };
- Reporter.prototype.leaveKey = function leaveKey(index, key, value) {
- const state = this._reporterState;
- this.exitKey(index);
- if (state.obj !== null)
- state.obj[key] = value;
- };
- Reporter.prototype.path = function path() {
- return this._reporterState.path.join('/');
- };
- Reporter.prototype.enterObject = function enterObject() {
- const state = this._reporterState;
- const prev = state.obj;
- state.obj = {};
- return prev;
- };
- Reporter.prototype.leaveObject = function leaveObject(prev) {
- const state = this._reporterState;
- const now = state.obj;
- state.obj = prev;
- return now;
- };
- Reporter.prototype.error = function error(msg) {
- let err;
- const state = this._reporterState;
- const inherited = msg instanceof ReporterError;
- if (inherited) {
- err = msg;
- } else {
- err = new ReporterError(state.path.map(function(elem) {
- return '[' + JSON.stringify(elem) + ']';
- }).join(''), msg.message || msg, msg.stack);
- }
- if (!state.options.partial)
- throw err;
- if (!inherited)
- state.errors.push(err);
- return err;
- };
- Reporter.prototype.wrapResult = function wrapResult(result) {
- const state = this._reporterState;
- if (!state.options.partial)
- return result;
- return {
- result: this.isError(result) ? null : result,
- errors: state.errors
- };
- };
- function ReporterError(path, msg) {
- this.path = path;
- this.rethrow(msg);
- }
- inherits(ReporterError, Error);
- ReporterError.prototype.rethrow = function rethrow(msg) {
- this.message = msg + ' at: ' + (this.path || '(shallow)');
- if (Error.captureStackTrace)
- Error.captureStackTrace(this, ReporterError);
- if (!this.stack) {
- try {
- // IE only adds stack when thrown
- throw new Error(this.message);
- } catch (e) {
- this.stack = e.stack;
- }
- }
- return this;
- };
- /***/ }),
- /* 247 */
- /*!******************************************************!*\
- !*** ./node_modules/asn1.js/lib/asn1/base/buffer.js ***!
- \******************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- const inherits = __webpack_require__(/*! inherits */ 121);
- const Reporter = __webpack_require__(/*! ../base/reporter */ 246).Reporter;
- const Buffer = __webpack_require__(/*! safer-buffer */ 244).Buffer;
- function DecoderBuffer(base, options) {
- Reporter.call(this, options);
- if (!Buffer.isBuffer(base)) {
- this.error('Input not Buffer');
- return;
- }
- this.base = base;
- this.offset = 0;
- this.length = base.length;
- }
- inherits(DecoderBuffer, Reporter);
- exports.DecoderBuffer = DecoderBuffer;
- DecoderBuffer.isDecoderBuffer = function isDecoderBuffer(data) {
- if (data instanceof DecoderBuffer) {
- return true;
- }
- // Or accept compatible API
- const isCompatible = typeof data === 'object' &&
- Buffer.isBuffer(data.base) &&
- data.constructor.name === 'DecoderBuffer' &&
- typeof data.offset === 'number' &&
- typeof data.length === 'number' &&
- typeof data.save === 'function' &&
- typeof data.restore === 'function' &&
- typeof data.isEmpty === 'function' &&
- typeof data.readUInt8 === 'function' &&
- typeof data.skip === 'function' &&
- typeof data.raw === 'function';
- return isCompatible;
- };
- DecoderBuffer.prototype.save = function save() {
- return { offset: this.offset, reporter: Reporter.prototype.save.call(this) };
- };
- DecoderBuffer.prototype.restore = function restore(save) {
- // Return skipped data
- const res = new DecoderBuffer(this.base);
- res.offset = save.offset;
- res.length = this.offset;
- this.offset = save.offset;
- Reporter.prototype.restore.call(this, save.reporter);
- return res;
- };
- DecoderBuffer.prototype.isEmpty = function isEmpty() {
- return this.offset === this.length;
- };
- DecoderBuffer.prototype.readUInt8 = function readUInt8(fail) {
- if (this.offset + 1 <= this.length)
- return this.base.readUInt8(this.offset++, true);
- else
- return this.error(fail || 'DecoderBuffer overrun');
- };
- DecoderBuffer.prototype.skip = function skip(bytes, fail) {
- if (!(this.offset + bytes <= this.length))
- return this.error(fail || 'DecoderBuffer overrun');
- const res = new DecoderBuffer(this.base);
- // Share reporter state
- res._reporterState = this._reporterState;
- res.offset = this.offset;
- res.length = this.offset + bytes;
- this.offset += bytes;
- return res;
- };
- DecoderBuffer.prototype.raw = function raw(save) {
- return this.base.slice(save ? save.offset : this.offset, this.length);
- };
- function EncoderBuffer(value, reporter) {
- if (Array.isArray(value)) {
- this.length = 0;
- this.value = value.map(function(item) {
- if (!EncoderBuffer.isEncoderBuffer(item))
- item = new EncoderBuffer(item, reporter);
- this.length += item.length;
- return item;
- }, this);
- } else if (typeof value === 'number') {
- if (!(0 <= value && value <= 0xff))
- return reporter.error('non-byte EncoderBuffer value');
- this.value = value;
- this.length = 1;
- } else if (typeof value === 'string') {
- this.value = value;
- this.length = Buffer.byteLength(value);
- } else if (Buffer.isBuffer(value)) {
- this.value = value;
- this.length = value.length;
- } else {
- return reporter.error('Unsupported type: ' + typeof value);
- }
- }
- exports.EncoderBuffer = EncoderBuffer;
- EncoderBuffer.isEncoderBuffer = function isEncoderBuffer(data) {
- if (data instanceof EncoderBuffer) {
- return true;
- }
- // Or accept compatible API
- const isCompatible = typeof data === 'object' &&
- data.constructor.name === 'EncoderBuffer' &&
- typeof data.length === 'number' &&
- typeof data.join === 'function';
- return isCompatible;
- };
- EncoderBuffer.prototype.join = function join(out, offset) {
- if (!out)
- out = Buffer.alloc(this.length);
- if (!offset)
- offset = 0;
- if (this.length === 0)
- return out;
- if (Array.isArray(this.value)) {
- this.value.forEach(function(item) {
- item.join(out, offset);
- offset += item.length;
- });
- } else {
- if (typeof this.value === 'number')
- out[offset] = this.value;
- else if (typeof this.value === 'string')
- out.write(this.value, offset);
- else if (Buffer.isBuffer(this.value))
- this.value.copy(out, offset);
- offset += this.length;
- }
- return out;
- };
- /***/ }),
- /* 248 */
- /*!********************************************************!*\
- !*** ./node_modules/asn1.js/lib/asn1/constants/der.js ***!
- \********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- // Helper
- function reverse(map) {
- const res = {};
- Object.keys(map).forEach(function(key) {
- // Convert key to integer if it is stringified
- if ((key | 0) == key)
- key = key | 0;
- const value = map[key];
- res[value] = key;
- });
- return res;
- }
- exports.tagClass = {
- 0: 'universal',
- 1: 'application',
- 2: 'context',
- 3: 'private'
- };
- exports.tagClassByName = reverse(exports.tagClass);
- exports.tag = {
- 0x00: 'end',
- 0x01: 'bool',
- 0x02: 'int',
- 0x03: 'bitstr',
- 0x04: 'octstr',
- 0x05: 'null_',
- 0x06: 'objid',
- 0x07: 'objDesc',
- 0x08: 'external',
- 0x09: 'real',
- 0x0a: 'enum',
- 0x0b: 'embed',
- 0x0c: 'utf8str',
- 0x0d: 'relativeOid',
- 0x10: 'seq',
- 0x11: 'set',
- 0x12: 'numstr',
- 0x13: 'printstr',
- 0x14: 't61str',
- 0x15: 'videostr',
- 0x16: 'ia5str',
- 0x17: 'utctime',
- 0x18: 'gentime',
- 0x19: 'graphstr',
- 0x1a: 'iso646str',
- 0x1b: 'genstr',
- 0x1c: 'unistr',
- 0x1d: 'charstr',
- 0x1e: 'bmpstr'
- };
- exports.tagByName = reverse(exports.tag);
- /***/ }),
- /* 249 */
- /*!*******************************************************!*\
- !*** ./node_modules/asn1.js/lib/asn1/encoders/pem.js ***!
- \*******************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- const inherits = __webpack_require__(/*! inherits */ 121);
- const DEREncoder = __webpack_require__(/*! ./der */ 243);
- function PEMEncoder(entity) {
- DEREncoder.call(this, entity);
- this.enc = 'pem';
- }
- inherits(PEMEncoder, DEREncoder);
- module.exports = PEMEncoder;
- PEMEncoder.prototype.encode = function encode(data, options) {
- const buf = DEREncoder.prototype.encode.call(this, data);
- const p = buf.toString('base64');
- const out = [ '-----BEGIN ' + options.label + '-----' ];
- for (let i = 0; i < p.length; i += 64)
- out.push(p.slice(i, i + 64));
- out.push('-----END ' + options.label + '-----');
- return out.join('\n');
- };
- /***/ }),
- /* 250 */
- /*!*********************************************************!*\
- !*** ./node_modules/asn1.js/lib/asn1/decoders/index.js ***!
- \*********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- const decoders = exports;
- decoders.der = __webpack_require__(/*! ./der */ 251);
- decoders.pem = __webpack_require__(/*! ./pem */ 252);
- /***/ }),
- /* 251 */
- /*!*******************************************************!*\
- !*** ./node_modules/asn1.js/lib/asn1/decoders/der.js ***!
- \*******************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- const inherits = __webpack_require__(/*! inherits */ 121);
- const bignum = __webpack_require__(/*! bn.js */ 197);
- const DecoderBuffer = __webpack_require__(/*! ../base/buffer */ 247).DecoderBuffer;
- const Node = __webpack_require__(/*! ../base/node */ 245);
- // Import DER constants
- const der = __webpack_require__(/*! ../constants/der */ 248);
- function DERDecoder(entity) {
- this.enc = 'der';
- this.name = entity.name;
- this.entity = entity;
- // Construct base tree
- this.tree = new DERNode();
- this.tree._init(entity.body);
- }
- module.exports = DERDecoder;
- DERDecoder.prototype.decode = function decode(data, options) {
- if (!DecoderBuffer.isDecoderBuffer(data)) {
- data = new DecoderBuffer(data, options);
- }
- return this.tree._decode(data, options);
- };
- // Tree methods
- function DERNode(parent) {
- Node.call(this, 'der', parent);
- }
- inherits(DERNode, Node);
- DERNode.prototype._peekTag = function peekTag(buffer, tag, any) {
- if (buffer.isEmpty())
- return false;
- const state = buffer.save();
- const decodedTag = derDecodeTag(buffer, 'Failed to peek tag: "' + tag + '"');
- if (buffer.isError(decodedTag))
- return decodedTag;
- buffer.restore(state);
- return decodedTag.tag === tag || decodedTag.tagStr === tag ||
- (decodedTag.tagStr + 'of') === tag || any;
- };
- DERNode.prototype._decodeTag = function decodeTag(buffer, tag, any) {
- const decodedTag = derDecodeTag(buffer,
- 'Failed to decode tag of "' + tag + '"');
- if (buffer.isError(decodedTag))
- return decodedTag;
- let len = derDecodeLen(buffer,
- decodedTag.primitive,
- 'Failed to get length of "' + tag + '"');
- // Failure
- if (buffer.isError(len))
- return len;
- if (!any &&
- decodedTag.tag !== tag &&
- decodedTag.tagStr !== tag &&
- decodedTag.tagStr + 'of' !== tag) {
- return buffer.error('Failed to match tag: "' + tag + '"');
- }
- if (decodedTag.primitive || len !== null)
- return buffer.skip(len, 'Failed to match body of: "' + tag + '"');
- // Indefinite length... find END tag
- const state = buffer.save();
- const res = this._skipUntilEnd(
- buffer,
- 'Failed to skip indefinite length body: "' + this.tag + '"');
- if (buffer.isError(res))
- return res;
- len = buffer.offset - state.offset;
- buffer.restore(state);
- return buffer.skip(len, 'Failed to match body of: "' + tag + '"');
- };
- DERNode.prototype._skipUntilEnd = function skipUntilEnd(buffer, fail) {
- for (;;) {
- const tag = derDecodeTag(buffer, fail);
- if (buffer.isError(tag))
- return tag;
- const len = derDecodeLen(buffer, tag.primitive, fail);
- if (buffer.isError(len))
- return len;
- let res;
- if (tag.primitive || len !== null)
- res = buffer.skip(len);
- else
- res = this._skipUntilEnd(buffer, fail);
- // Failure
- if (buffer.isError(res))
- return res;
- if (tag.tagStr === 'end')
- break;
- }
- };
- DERNode.prototype._decodeList = function decodeList(buffer, tag, decoder,
- options) {
- const result = [];
- while (!buffer.isEmpty()) {
- const possibleEnd = this._peekTag(buffer, 'end');
- if (buffer.isError(possibleEnd))
- return possibleEnd;
- const res = decoder.decode(buffer, 'der', options);
- if (buffer.isError(res) && possibleEnd)
- break;
- result.push(res);
- }
- return result;
- };
- DERNode.prototype._decodeStr = function decodeStr(buffer, tag) {
- if (tag === 'bitstr') {
- const unused = buffer.readUInt8();
- if (buffer.isError(unused))
- return unused;
- return { unused: unused, data: buffer.raw() };
- } else if (tag === 'bmpstr') {
- const raw = buffer.raw();
- if (raw.length % 2 === 1)
- return buffer.error('Decoding of string type: bmpstr length mismatch');
- let str = '';
- for (let i = 0; i < raw.length / 2; i++) {
- str += String.fromCharCode(raw.readUInt16BE(i * 2));
- }
- return str;
- } else if (tag === 'numstr') {
- const numstr = buffer.raw().toString('ascii');
- if (!this._isNumstr(numstr)) {
- return buffer.error('Decoding of string type: ' +
- 'numstr unsupported characters');
- }
- return numstr;
- } else if (tag === 'octstr') {
- return buffer.raw();
- } else if (tag === 'objDesc') {
- return buffer.raw();
- } else if (tag === 'printstr') {
- const printstr = buffer.raw().toString('ascii');
- if (!this._isPrintstr(printstr)) {
- return buffer.error('Decoding of string type: ' +
- 'printstr unsupported characters');
- }
- return printstr;
- } else if (/str$/.test(tag)) {
- return buffer.raw().toString();
- } else {
- return buffer.error('Decoding of string type: ' + tag + ' unsupported');
- }
- };
- DERNode.prototype._decodeObjid = function decodeObjid(buffer, values, relative) {
- let result;
- const identifiers = [];
- let ident = 0;
- let subident = 0;
- while (!buffer.isEmpty()) {
- subident = buffer.readUInt8();
- ident <<= 7;
- ident |= subident & 0x7f;
- if ((subident & 0x80) === 0) {
- identifiers.push(ident);
- ident = 0;
- }
- }
- if (subident & 0x80)
- identifiers.push(ident);
- const first = (identifiers[0] / 40) | 0;
- const second = identifiers[0] % 40;
- if (relative)
- result = identifiers;
- else
- result = [first, second].concat(identifiers.slice(1));
- if (values) {
- let tmp = values[result.join(' ')];
- if (tmp === undefined)
- tmp = values[result.join('.')];
- if (tmp !== undefined)
- result = tmp;
- }
- return result;
- };
- DERNode.prototype._decodeTime = function decodeTime(buffer, tag) {
- const str = buffer.raw().toString();
- let year;
- let mon;
- let day;
- let hour;
- let min;
- let sec;
- if (tag === 'gentime') {
- year = str.slice(0, 4) | 0;
- mon = str.slice(4, 6) | 0;
- day = str.slice(6, 8) | 0;
- hour = str.slice(8, 10) | 0;
- min = str.slice(10, 12) | 0;
- sec = str.slice(12, 14) | 0;
- } else if (tag === 'utctime') {
- year = str.slice(0, 2) | 0;
- mon = str.slice(2, 4) | 0;
- day = str.slice(4, 6) | 0;
- hour = str.slice(6, 8) | 0;
- min = str.slice(8, 10) | 0;
- sec = str.slice(10, 12) | 0;
- if (year < 70)
- year = 2000 + year;
- else
- year = 1900 + year;
- } else {
- return buffer.error('Decoding ' + tag + ' time is not supported yet');
- }
- return Date.UTC(year, mon - 1, day, hour, min, sec, 0);
- };
- DERNode.prototype._decodeNull = function decodeNull() {
- return null;
- };
- DERNode.prototype._decodeBool = function decodeBool(buffer) {
- const res = buffer.readUInt8();
- if (buffer.isError(res))
- return res;
- else
- return res !== 0;
- };
- DERNode.prototype._decodeInt = function decodeInt(buffer, values) {
- // Bigint, return as it is (assume big endian)
- const raw = buffer.raw();
- let res = new bignum(raw);
- if (values)
- res = values[res.toString(10)] || res;
- return res;
- };
- DERNode.prototype._use = function use(entity, obj) {
- if (typeof entity === 'function')
- entity = entity(obj);
- return entity._getDecoder('der').tree;
- };
- // Utility methods
- function derDecodeTag(buf, fail) {
- let tag = buf.readUInt8(fail);
- if (buf.isError(tag))
- return tag;
- const cls = der.tagClass[tag >> 6];
- const primitive = (tag & 0x20) === 0;
- // Multi-octet tag - load
- if ((tag & 0x1f) === 0x1f) {
- let oct = tag;
- tag = 0;
- while ((oct & 0x80) === 0x80) {
- oct = buf.readUInt8(fail);
- if (buf.isError(oct))
- return oct;
- tag <<= 7;
- tag |= oct & 0x7f;
- }
- } else {
- tag &= 0x1f;
- }
- const tagStr = der.tag[tag];
- return {
- cls: cls,
- primitive: primitive,
- tag: tag,
- tagStr: tagStr
- };
- }
- function derDecodeLen(buf, primitive, fail) {
- let len = buf.readUInt8(fail);
- if (buf.isError(len))
- return len;
- // Indefinite form
- if (!primitive && len === 0x80)
- return null;
- // Definite form
- if ((len & 0x80) === 0) {
- // Short form
- return len;
- }
- // Long form
- const num = len & 0x7f;
- if (num > 4)
- return buf.error('length octect is too long');
- len = 0;
- for (let i = 0; i < num; i++) {
- len <<= 8;
- const j = buf.readUInt8(fail);
- if (buf.isError(j))
- return j;
- len |= j;
- }
- return len;
- }
- /***/ }),
- /* 252 */
- /*!*******************************************************!*\
- !*** ./node_modules/asn1.js/lib/asn1/decoders/pem.js ***!
- \*******************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- const inherits = __webpack_require__(/*! inherits */ 121);
- const Buffer = __webpack_require__(/*! safer-buffer */ 244).Buffer;
- const DERDecoder = __webpack_require__(/*! ./der */ 251);
- function PEMDecoder(entity) {
- DERDecoder.call(this, entity);
- this.enc = 'pem';
- }
- inherits(PEMDecoder, DERDecoder);
- module.exports = PEMDecoder;
- PEMDecoder.prototype.decode = function decode(data, options) {
- const lines = data.toString().split(/[\r\n]+/g);
- const label = options.label.toUpperCase();
- const re = /^-----(BEGIN|END) ([^-]+)-----$/;
- let start = -1;
- let end = -1;
- for (let i = 0; i < lines.length; i++) {
- const match = lines[i].match(re);
- if (match === null)
- continue;
- if (match[2] !== label)
- continue;
- if (start === -1) {
- if (match[1] !== 'BEGIN')
- break;
- start = i;
- } else {
- if (match[1] !== 'END')
- break;
- end = i;
- break;
- }
- }
- if (start === -1 || end === -1)
- throw new Error('PEM section not found for: ' + label);
- const base64 = lines.slice(start + 1, end).join('');
- // Remove excessive symbols
- base64.replace(/[^a-z0-9+/=]+/gi, '');
- const input = Buffer.from(base64, 'base64');
- return DERDecoder.prototype.decode.call(this, input, options);
- };
- /***/ }),
- /* 253 */
- /*!*****************************************************!*\
- !*** ./node_modules/asn1.js/lib/asn1/base/index.js ***!
- \*****************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- const base = exports;
- base.Reporter = __webpack_require__(/*! ./reporter */ 246).Reporter;
- base.DecoderBuffer = __webpack_require__(/*! ./buffer */ 247).DecoderBuffer;
- base.EncoderBuffer = __webpack_require__(/*! ./buffer */ 247).EncoderBuffer;
- base.Node = __webpack_require__(/*! ./node */ 245);
- /***/ }),
- /* 254 */
- /*!**********************************************************!*\
- !*** ./node_modules/asn1.js/lib/asn1/constants/index.js ***!
- \**********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- const constants = exports;
- // Helper
- constants._reverse = function reverse(map) {
- const res = {};
- Object.keys(map).forEach(function(key) {
- // Convert key to integer if it is stringified
- if ((key | 0) == key)
- key = key | 0;
- const value = map[key];
- res[value] = key;
- });
- return res;
- };
- constants.der = __webpack_require__(/*! ./der */ 248);
- /***/ }),
- /* 255 */
- /*!************************************************!*\
- !*** ./node_modules/parse-asn1/certificate.js ***!
- \************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- // from https://github.com/Rantanen/node-dtls/blob/25a7dc861bda38cfeac93a723500eea4f0ac2e86/Certificate.js
- // thanks to @Rantanen
- var asn = __webpack_require__(/*! asn1.js */ 240)
- var Time = asn.define('Time', function () {
- this.choice({
- utcTime: this.utctime(),
- generalTime: this.gentime()
- })
- })
- var AttributeTypeValue = asn.define('AttributeTypeValue', function () {
- this.seq().obj(
- this.key('type').objid(),
- this.key('value').any()
- )
- })
- var AlgorithmIdentifier = asn.define('AlgorithmIdentifier', function () {
- this.seq().obj(
- this.key('algorithm').objid(),
- this.key('parameters').optional(),
- this.key('curve').objid().optional()
- )
- })
- var SubjectPublicKeyInfo = asn.define('SubjectPublicKeyInfo', function () {
- this.seq().obj(
- this.key('algorithm').use(AlgorithmIdentifier),
- this.key('subjectPublicKey').bitstr()
- )
- })
- var RelativeDistinguishedName = asn.define('RelativeDistinguishedName', function () {
- this.setof(AttributeTypeValue)
- })
- var RDNSequence = asn.define('RDNSequence', function () {
- this.seqof(RelativeDistinguishedName)
- })
- var Name = asn.define('Name', function () {
- this.choice({
- rdnSequence: this.use(RDNSequence)
- })
- })
- var Validity = asn.define('Validity', function () {
- this.seq().obj(
- this.key('notBefore').use(Time),
- this.key('notAfter').use(Time)
- )
- })
- var Extension = asn.define('Extension', function () {
- this.seq().obj(
- this.key('extnID').objid(),
- this.key('critical').bool().def(false),
- this.key('extnValue').octstr()
- )
- })
- var TBSCertificate = asn.define('TBSCertificate', function () {
- this.seq().obj(
- this.key('version').explicit(0).int().optional(),
- this.key('serialNumber').int(),
- this.key('signature').use(AlgorithmIdentifier),
- this.key('issuer').use(Name),
- this.key('validity').use(Validity),
- this.key('subject').use(Name),
- this.key('subjectPublicKeyInfo').use(SubjectPublicKeyInfo),
- this.key('issuerUniqueID').implicit(1).bitstr().optional(),
- this.key('subjectUniqueID').implicit(2).bitstr().optional(),
- this.key('extensions').explicit(3).seqof(Extension).optional()
- )
- })
- var X509Certificate = asn.define('X509Certificate', function () {
- this.seq().obj(
- this.key('tbsCertificate').use(TBSCertificate),
- this.key('signatureAlgorithm').use(AlgorithmIdentifier),
- this.key('signatureValue').bitstr()
- )
- })
- module.exports = X509Certificate
- /***/ }),
- /* 256 */
- /*!********************************************!*\
- !*** ./node_modules/parse-asn1/aesid.json ***!
- \********************************************/
- /*! exports provided: 2.16.840.1.101.3.4.1.1, 2.16.840.1.101.3.4.1.2, 2.16.840.1.101.3.4.1.3, 2.16.840.1.101.3.4.1.4, 2.16.840.1.101.3.4.1.21, 2.16.840.1.101.3.4.1.22, 2.16.840.1.101.3.4.1.23, 2.16.840.1.101.3.4.1.24, 2.16.840.1.101.3.4.1.41, 2.16.840.1.101.3.4.1.42, 2.16.840.1.101.3.4.1.43, 2.16.840.1.101.3.4.1.44, default */
- /***/ (function(module) {
- module.exports = JSON.parse("{\"2.16.840.1.101.3.4.1.1\":\"aes-128-ecb\",\"2.16.840.1.101.3.4.1.2\":\"aes-128-cbc\",\"2.16.840.1.101.3.4.1.3\":\"aes-128-ofb\",\"2.16.840.1.101.3.4.1.4\":\"aes-128-cfb\",\"2.16.840.1.101.3.4.1.21\":\"aes-192-ecb\",\"2.16.840.1.101.3.4.1.22\":\"aes-192-cbc\",\"2.16.840.1.101.3.4.1.23\":\"aes-192-ofb\",\"2.16.840.1.101.3.4.1.24\":\"aes-192-cfb\",\"2.16.840.1.101.3.4.1.41\":\"aes-256-ecb\",\"2.16.840.1.101.3.4.1.42\":\"aes-256-cbc\",\"2.16.840.1.101.3.4.1.43\":\"aes-256-ofb\",\"2.16.840.1.101.3.4.1.44\":\"aes-256-cfb\"}");
- /***/ }),
- /* 257 */
- /*!********************************************!*\
- !*** ./node_modules/parse-asn1/fixProc.js ***!
- \********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- // adapted from https://github.com/apatil/pemstrip
- var findProc = /Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m
- var startRegex = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m
- var fullRegex = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m
- var evp = __webpack_require__(/*! evp_bytestokey */ 192)
- var ciphers = __webpack_require__(/*! browserify-aes */ 175)
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- module.exports = function (okey, password) {
- var key = okey.toString()
- var match = key.match(findProc)
- var decrypted
- if (!match) {
- var match2 = key.match(fullRegex)
- decrypted = Buffer.from(match2[2].replace(/[\r\n]/g, ''), 'base64')
- } else {
- var suite = 'aes' + match[1]
- var iv = Buffer.from(match[2], 'hex')
- var cipherText = Buffer.from(match[3].replace(/[\r\n]/g, ''), 'base64')
- var cipherKey = evp(password, iv.slice(0, 8), parseInt(match[1], 10)).key
- var out = []
- var cipher = ciphers.createDecipheriv(suite, cipherKey, iv)
- out.push(cipher.update(cipherText))
- out.push(cipher.final())
- decrypted = Buffer.concat(out)
- }
- var tag = key.match(startRegex)[1]
- return {
- tag: tag,
- data: decrypted
- }
- }
- /***/ }),
- /* 258 */
- /*!**********************************************************!*\
- !*** ./node_modules/browserify-sign/browser/curves.json ***!
- \**********************************************************/
- /*! exports provided: 1.3.132.0.10, 1.3.132.0.33, 1.2.840.10045.3.1.1, 1.2.840.10045.3.1.7, 1.3.132.0.34, 1.3.132.0.35, default */
- /***/ (function(module) {
- module.exports = JSON.parse("{\"1.3.132.0.10\":\"secp256k1\",\"1.3.132.0.33\":\"p224\",\"1.2.840.10045.3.1.1\":\"p192\",\"1.2.840.10045.3.1.7\":\"p256\",\"1.3.132.0.34\":\"p384\",\"1.3.132.0.35\":\"p521\"}");
- /***/ }),
- /* 259 */
- /*!********************************************************!*\
- !*** ./node_modules/browserify-sign/browser/verify.js ***!
- \********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- // much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- var BN = __webpack_require__(/*! bn.js */ 197)
- var EC = __webpack_require__(/*! elliptic */ 208).ec
- var parseKeys = __webpack_require__(/*! parse-asn1 */ 238)
- var curves = __webpack_require__(/*! ./curves.json */ 258)
- function verify (sig, hash, key, signType, tag) {
- var pub = parseKeys(key)
- if (pub.type === 'ec') {
- // rsa keys can be interpreted as ecdsa ones in openssl
- if (signType !== 'ecdsa' && signType !== 'ecdsa/rsa') throw new Error('wrong public key type')
- return ecVerify(sig, hash, pub)
- } else if (pub.type === 'dsa') {
- if (signType !== 'dsa') throw new Error('wrong public key type')
- return dsaVerify(sig, hash, pub)
- } else {
- if (signType !== 'rsa' && signType !== 'ecdsa/rsa') throw new Error('wrong public key type')
- }
- hash = Buffer.concat([tag, hash])
- var len = pub.modulus.byteLength()
- var pad = [1]
- var padNum = 0
- while (hash.length + pad.length + 2 < len) {
- pad.push(0xff)
- padNum++
- }
- pad.push(0x00)
- var i = -1
- while (++i < hash.length) {
- pad.push(hash[i])
- }
- pad = Buffer.from(pad)
- var red = BN.mont(pub.modulus)
- sig = new BN(sig).toRed(red)
- sig = sig.redPow(new BN(pub.publicExponent))
- sig = Buffer.from(sig.fromRed().toArray())
- var out = padNum < 8 ? 1 : 0
- len = Math.min(sig.length, pad.length)
- if (sig.length !== pad.length) out = 1
- i = -1
- while (++i < len) out |= sig[i] ^ pad[i]
- return out === 0
- }
- function ecVerify (sig, hash, pub) {
- var curveId = curves[pub.data.algorithm.curve.join('.')]
- if (!curveId) throw new Error('unknown curve ' + pub.data.algorithm.curve.join('.'))
- var curve = new EC(curveId)
- var pubkey = pub.data.subjectPrivateKey.data
- return curve.verify(hash, sig, pubkey)
- }
- function dsaVerify (sig, hash, pub) {
- var p = pub.data.p
- var q = pub.data.q
- var g = pub.data.g
- var y = pub.data.pub_key
- var unpacked = parseKeys.signature.decode(sig, 'der')
- var s = unpacked.s
- var r = unpacked.r
- checkValue(s, q)
- checkValue(r, q)
- var montp = BN.mont(p)
- var w = s.invm(q)
- var v = g.toRed(montp)
- .redPow(new BN(hash).mul(w).mod(q))
- .fromRed()
- .mul(y.toRed(montp).redPow(r.mul(w).mod(q)).fromRed())
- .mod(p)
- .mod(q)
- return v.cmp(r) === 0
- }
- function checkValue (b, q) {
- if (b.cmpn(0) <= 0) throw new Error('invalid sig')
- if (b.cmp(q) >= q) throw new Error('invalid sig')
- }
- module.exports = verify
- /***/ }),
- /* 260 */
- /*!*********************************************!*\
- !*** ./node_modules/create-ecdh/browser.js ***!
- \*********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- /* WEBPACK VAR INJECTION */(function(Buffer) {var elliptic = __webpack_require__(/*! elliptic */ 208)
- var BN = __webpack_require__(/*! bn.js */ 197)
- module.exports = function createECDH (curve) {
- return new ECDH(curve)
- }
- var aliases = {
- secp256k1: {
- name: 'secp256k1',
- byteLength: 32
- },
- secp224r1: {
- name: 'p224',
- byteLength: 28
- },
- prime256v1: {
- name: 'p256',
- byteLength: 32
- },
- prime192v1: {
- name: 'p192',
- byteLength: 24
- },
- ed25519: {
- name: 'ed25519',
- byteLength: 32
- },
- secp384r1: {
- name: 'p384',
- byteLength: 48
- },
- secp521r1: {
- name: 'p521',
- byteLength: 66
- }
- }
- aliases.p224 = aliases.secp224r1
- aliases.p256 = aliases.secp256r1 = aliases.prime256v1
- aliases.p192 = aliases.secp192r1 = aliases.prime192v1
- aliases.p384 = aliases.secp384r1
- aliases.p521 = aliases.secp521r1
- function ECDH (curve) {
- this.curveType = aliases[curve]
- if (!this.curveType) {
- this.curveType = {
- name: curve
- }
- }
- this.curve = new elliptic.ec(this.curveType.name) // eslint-disable-line new-cap
- this.keys = void 0
- }
- ECDH.prototype.generateKeys = function (enc, format) {
- this.keys = this.curve.genKeyPair()
- return this.getPublicKey(enc, format)
- }
- ECDH.prototype.computeSecret = function (other, inenc, enc) {
- inenc = inenc || 'utf8'
- if (!Buffer.isBuffer(other)) {
- other = new Buffer(other, inenc)
- }
- var otherPub = this.curve.keyFromPublic(other).getPublic()
- var out = otherPub.mul(this.keys.getPrivate()).getX()
- return formatReturnValue(out, enc, this.curveType.byteLength)
- }
- ECDH.prototype.getPublicKey = function (enc, format) {
- var key = this.keys.getPublic(format === 'compressed', true)
- if (format === 'hybrid') {
- if (key[key.length - 1] % 2) {
- key[0] = 7
- } else {
- key[0] = 6
- }
- }
- return formatReturnValue(key, enc)
- }
- ECDH.prototype.getPrivateKey = function (enc) {
- return formatReturnValue(this.keys.getPrivate(), enc)
- }
- ECDH.prototype.setPublicKey = function (pub, enc) {
- enc = enc || 'utf8'
- if (!Buffer.isBuffer(pub)) {
- pub = new Buffer(pub, enc)
- }
- this.keys._importPublic(pub)
- return this
- }
- ECDH.prototype.setPrivateKey = function (priv, enc) {
- enc = enc || 'utf8'
- if (!Buffer.isBuffer(priv)) {
- priv = new Buffer(priv, enc)
- }
- var _priv = new BN(priv)
- _priv = _priv.toString(16)
- this.keys = this.curve.genKeyPair()
- this.keys._importPrivate(_priv)
- return this
- }
- function formatReturnValue (bn, enc, len) {
- if (!Array.isArray(bn)) {
- bn = bn.toArray()
- }
- var buf = new Buffer(bn)
- if (len && buf.length < len) {
- var zeros = new Buffer(len - buf.length)
- zeros.fill(0)
- buf = Buffer.concat([zeros, buf])
- }
- if (!enc) {
- return buf
- } else {
- return buf.toString(enc)
- }
- }
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../buffer/index.js */ 116).Buffer))
- /***/ }),
- /* 261 */
- /*!************************************************!*\
- !*** ./node_modules/public-encrypt/browser.js ***!
- \************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- exports.publicEncrypt = __webpack_require__(/*! ./publicEncrypt */ 262)
- exports.privateDecrypt = __webpack_require__(/*! ./privateDecrypt */ 266)
- exports.privateEncrypt = function privateEncrypt (key, buf) {
- return exports.publicEncrypt(key, buf, true)
- }
- exports.publicDecrypt = function publicDecrypt (key, buf) {
- return exports.privateDecrypt(key, buf, true)
- }
- /***/ }),
- /* 262 */
- /*!******************************************************!*\
- !*** ./node_modules/public-encrypt/publicEncrypt.js ***!
- \******************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var parseKeys = __webpack_require__(/*! parse-asn1 */ 238)
- var randomBytes = __webpack_require__(/*! randombytes */ 112)
- var createHash = __webpack_require__(/*! create-hash */ 120)
- var mgf = __webpack_require__(/*! ./mgf */ 263)
- var xor = __webpack_require__(/*! ./xor */ 264)
- var BN = __webpack_require__(/*! bn.js */ 197)
- var withPublic = __webpack_require__(/*! ./withPublic */ 265)
- var crt = __webpack_require__(/*! browserify-rsa */ 207)
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- module.exports = function publicEncrypt (publicKey, msg, reverse) {
- var padding
- if (publicKey.padding) {
- padding = publicKey.padding
- } else if (reverse) {
- padding = 1
- } else {
- padding = 4
- }
- var key = parseKeys(publicKey)
- var paddedMsg
- if (padding === 4) {
- paddedMsg = oaep(key, msg)
- } else if (padding === 1) {
- paddedMsg = pkcs1(key, msg, reverse)
- } else if (padding === 3) {
- paddedMsg = new BN(msg)
- if (paddedMsg.cmp(key.modulus) >= 0) {
- throw new Error('data too long for modulus')
- }
- } else {
- throw new Error('unknown padding')
- }
- if (reverse) {
- return crt(paddedMsg, key)
- } else {
- return withPublic(paddedMsg, key)
- }
- }
- function oaep (key, msg) {
- var k = key.modulus.byteLength()
- var mLen = msg.length
- var iHash = createHash('sha1').update(Buffer.alloc(0)).digest()
- var hLen = iHash.length
- var hLen2 = 2 * hLen
- if (mLen > k - hLen2 - 2) {
- throw new Error('message too long')
- }
- var ps = Buffer.alloc(k - mLen - hLen2 - 2)
- var dblen = k - hLen - 1
- var seed = randomBytes(hLen)
- var maskedDb = xor(Buffer.concat([iHash, ps, Buffer.alloc(1, 1), msg], dblen), mgf(seed, dblen))
- var maskedSeed = xor(seed, mgf(maskedDb, hLen))
- return new BN(Buffer.concat([Buffer.alloc(1), maskedSeed, maskedDb], k))
- }
- function pkcs1 (key, msg, reverse) {
- var mLen = msg.length
- var k = key.modulus.byteLength()
- if (mLen > k - 11) {
- throw new Error('message too long')
- }
- var ps
- if (reverse) {
- ps = Buffer.alloc(k - mLen - 3, 0xff)
- } else {
- ps = nonZero(k - mLen - 3)
- }
- return new BN(Buffer.concat([Buffer.from([0, reverse ? 1 : 2]), ps, Buffer.alloc(1), msg], k))
- }
- function nonZero (len) {
- var out = Buffer.allocUnsafe(len)
- var i = 0
- var cache = randomBytes(len * 2)
- var cur = 0
- var num
- while (i < len) {
- if (cur === cache.length) {
- cache = randomBytes(len * 2)
- cur = 0
- }
- num = cache[cur++]
- if (num) {
- out[i++] = num
- }
- }
- return out
- }
- /***/ }),
- /* 263 */
- /*!********************************************!*\
- !*** ./node_modules/public-encrypt/mgf.js ***!
- \********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var createHash = __webpack_require__(/*! create-hash */ 120)
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- module.exports = function (seed, len) {
- var t = Buffer.alloc(0)
- var i = 0
- var c
- while (t.length < len) {
- c = i2ops(i++)
- t = Buffer.concat([t, createHash('sha1').update(seed).update(c).digest()])
- }
- return t.slice(0, len)
- }
- function i2ops (c) {
- var out = Buffer.allocUnsafe(4)
- out.writeUInt32BE(c, 0)
- return out
- }
- /***/ }),
- /* 264 */
- /*!********************************************!*\
- !*** ./node_modules/public-encrypt/xor.js ***!
- \********************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- module.exports = function xor (a, b) {
- var len = a.length
- var i = -1
- while (++i < len) {
- a[i] ^= b[i]
- }
- return a
- }
- /***/ }),
- /* 265 */
- /*!***************************************************!*\
- !*** ./node_modules/public-encrypt/withPublic.js ***!
- \***************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var BN = __webpack_require__(/*! bn.js */ 197)
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- function withPublic (paddedMsg, key) {
- return Buffer.from(paddedMsg
- .toRed(BN.mont(key.modulus))
- .redPow(new BN(key.publicExponent))
- .fromRed()
- .toArray())
- }
- module.exports = withPublic
- /***/ }),
- /* 266 */
- /*!*******************************************************!*\
- !*** ./node_modules/public-encrypt/privateDecrypt.js ***!
- \*******************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var parseKeys = __webpack_require__(/*! parse-asn1 */ 238)
- var mgf = __webpack_require__(/*! ./mgf */ 263)
- var xor = __webpack_require__(/*! ./xor */ 264)
- var BN = __webpack_require__(/*! bn.js */ 197)
- var crt = __webpack_require__(/*! browserify-rsa */ 207)
- var createHash = __webpack_require__(/*! create-hash */ 120)
- var withPublic = __webpack_require__(/*! ./withPublic */ 265)
- var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
- module.exports = function privateDecrypt (privateKey, enc, reverse) {
- var padding
- if (privateKey.padding) {
- padding = privateKey.padding
- } else if (reverse) {
- padding = 1
- } else {
- padding = 4
- }
- var key = parseKeys(privateKey)
- var k = key.modulus.byteLength()
- if (enc.length > k || new BN(enc).cmp(key.modulus) >= 0) {
- throw new Error('decryption error')
- }
- var msg
- if (reverse) {
- msg = withPublic(new BN(enc), key)
- } else {
- msg = crt(enc, key)
- }
- var zBuffer = Buffer.alloc(k - msg.length)
- msg = Buffer.concat([zBuffer, msg], k)
- if (padding === 4) {
- return oaep(key, msg)
- } else if (padding === 1) {
- return pkcs1(key, msg, reverse)
- } else if (padding === 3) {
- return msg
- } else {
- throw new Error('unknown padding')
- }
- }
- function oaep (key, msg) {
- var k = key.modulus.byteLength()
- var iHash = createHash('sha1').update(Buffer.alloc(0)).digest()
- var hLen = iHash.length
- if (msg[0] !== 0) {
- throw new Error('decryption error')
- }
- var maskedSeed = msg.slice(1, hLen + 1)
- var maskedDb = msg.slice(hLen + 1)
- var seed = xor(maskedSeed, mgf(maskedDb, hLen))
- var db = xor(maskedDb, mgf(seed, k - hLen - 1))
- if (compare(iHash, db.slice(0, hLen))) {
- throw new Error('decryption error')
- }
- var i = hLen
- while (db[i] === 0) {
- i++
- }
- if (db[i++] !== 1) {
- throw new Error('decryption error')
- }
- return db.slice(i)
- }
- function pkcs1 (key, msg, reverse) {
- var p1 = msg.slice(0, 2)
- var i = 2
- var status = 0
- while (msg[i++] !== 0) {
- if (i >= msg.length) {
- status++
- break
- }
- }
- var ps = msg.slice(2, i - 1)
- if ((p1.toString('hex') !== '0002' && !reverse) || (p1.toString('hex') !== '0001' && reverse)) {
- status++
- }
- if (ps.length < 8) {
- status++
- }
- if (status) {
- throw new Error('decryption error')
- }
- return msg.slice(i)
- }
- function compare (a, b) {
- a = Buffer.from(a)
- b = Buffer.from(b)
- var dif = 0
- var len = a.length
- if (a.length !== b.length) {
- dif++
- len = Math.min(a.length, b.length)
- }
- var i = -1
- while (++i < len) {
- dif += (a[i] ^ b[i])
- }
- return dif
- }
- /***/ }),
- /* 267 */
- /*!********************************************!*\
- !*** ./node_modules/randomfill/browser.js ***!
- \********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(global, process) {
- function oldBrowser () {
- throw new Error('secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11')
- }
- var safeBuffer = __webpack_require__(/*! safe-buffer */ 115)
- var randombytes = __webpack_require__(/*! randombytes */ 112)
- var Buffer = safeBuffer.Buffer
- var kBufferMaxLength = safeBuffer.kMaxLength
- var crypto = global.crypto || global.msCrypto
- var kMaxUint32 = Math.pow(2, 32) - 1
- function assertOffset (offset, length) {
- if (typeof offset !== 'number' || offset !== offset) { // eslint-disable-line no-self-compare
- throw new TypeError('offset must be a number')
- }
- if (offset > kMaxUint32 || offset < 0) {
- throw new TypeError('offset must be a uint32')
- }
- if (offset > kBufferMaxLength || offset > length) {
- throw new RangeError('offset out of range')
- }
- }
- function assertSize (size, offset, length) {
- if (typeof size !== 'number' || size !== size) { // eslint-disable-line no-self-compare
- throw new TypeError('size must be a number')
- }
- if (size > kMaxUint32 || size < 0) {
- throw new TypeError('size must be a uint32')
- }
- if (size + offset > length || size > kBufferMaxLength) {
- throw new RangeError('buffer too small')
- }
- }
- if ((crypto && crypto.getRandomValues) || !process.browser) {
- exports.randomFill = randomFill
- exports.randomFillSync = randomFillSync
- } else {
- exports.randomFill = oldBrowser
- exports.randomFillSync = oldBrowser
- }
- function randomFill (buf, offset, size, cb) {
- if (!Buffer.isBuffer(buf) && !(buf instanceof global.Uint8Array)) {
- throw new TypeError('"buf" argument must be a Buffer or Uint8Array')
- }
- if (typeof offset === 'function') {
- cb = offset
- offset = 0
- size = buf.length
- } else if (typeof size === 'function') {
- cb = size
- size = buf.length - offset
- } else if (typeof cb !== 'function') {
- throw new TypeError('"cb" argument must be a function')
- }
- assertOffset(offset, buf.length)
- assertSize(size, offset, buf.length)
- return actualFill(buf, offset, size, cb)
- }
- function actualFill (buf, offset, size, cb) {
- if (process.browser) {
- var ourBuf = buf.buffer
- var uint = new Uint8Array(ourBuf, offset, size)
- crypto.getRandomValues(uint)
- if (cb) {
- process.nextTick(function () {
- cb(null, buf)
- })
- return
- }
- return buf
- }
- if (cb) {
- randombytes(size, function (err, bytes) {
- if (err) {
- return cb(err)
- }
- bytes.copy(buf, offset)
- cb(null, buf)
- })
- return
- }
- var bytes = randombytes(size)
- bytes.copy(buf, offset)
- return buf
- }
- function randomFillSync (buf, offset, size) {
- if (typeof offset === 'undefined') {
- offset = 0
- }
- if (!Buffer.isBuffer(buf) && !(buf instanceof global.Uint8Array)) {
- throw new TypeError('"buf" argument must be a Buffer or Uint8Array')
- }
- assertOffset(offset, buf.length)
- if (size === undefined) size = buf.length - offset
- assertSize(size, offset, buf.length)
- return actualFill(buf, offset, size)
- }
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ 3), __webpack_require__(/*! ./../node-libs-browser/mock/process.js */ 113)))
- /***/ }),
- /* 268 */,
- /* 269 */,
- /* 270 */,
- /* 271 */,
- /* 272 */,
- /* 273 */,
- /* 274 */,
- /* 275 */,
- /* 276 */,
- /* 277 */,
- /* 278 */,
- /* 279 */,
- /* 280 */,
- /* 281 */,
- /* 282 */,
- /* 283 */,
- /* 284 */,
- /* 285 */,
- /* 286 */,
- /* 287 */,
- /* 288 */,
- /* 289 */,
- /* 290 */,
- /* 291 */,
- /* 292 */,
- /* 293 */,
- /* 294 */,
- /* 295 */,
- /* 296 */,
- /* 297 */,
- /* 298 */,
- /* 299 */,
- /* 300 */
- /*!********************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/index.js ***!
- \********************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ 13);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- var _exportNames = {
- ArgumentException: true,
- ArithmeticException: true,
- ChecksumException: true,
- Exception: true,
- FormatException: true,
- IllegalArgumentException: true,
- IllegalStateException: true,
- NotFoundException: true,
- ReaderException: true,
- ReedSolomonException: true,
- UnsupportedOperationException: true,
- WriterException: true,
- BarcodeFormat: true,
- Binarizer: true,
- BinaryBitmap: true,
- DecodeHintType: true,
- InvertedLuminanceSource: true,
- LuminanceSource: true,
- MultiFormatReader: true,
- MultiFormatWriter: true,
- PlanarYUVLuminanceSource: true,
- Result: true,
- ResultMetadataType: true,
- RGBLuminanceSource: true,
- ResultPoint: true,
- ZXingSystem: true,
- ZXingStringBuilder: true,
- ZXingStringEncoding: true,
- ZXingCharset: true,
- ZXingArrays: true,
- ZXingStandardCharsets: true,
- ZXingInteger: true,
- BitArray: true,
- BitMatrix: true,
- BitSource: true,
- CharacterSetECI: true,
- DecoderResult: true,
- DefaultGridSampler: true,
- DetectorResult: true,
- EncodeHintType: true,
- GlobalHistogramBinarizer: true,
- GridSampler: true,
- GridSamplerInstance: true,
- HybridBinarizer: true,
- PerspectiveTransform: true,
- StringUtils: true,
- MathUtils: true,
- WhiteRectangleDetector: true,
- GenericGF: true,
- GenericGFPoly: true,
- ReedSolomonDecoder: true,
- ReedSolomonEncoder: true,
- DataMatrixReader: true,
- DataMatrixDecodedBitStreamParser: true,
- DataMatrixDefaultPlacement: true,
- DataMatrixErrorCorrection: true,
- DataMatrixHighLevelEncoder: true,
- DataMatrixSymbolInfo: true,
- DataMatrixSymbolShapeHint: true,
- DataMatrixWriter: true,
- PDF417Reader: true,
- PDF417ResultMetadata: true,
- PDF417DecodedBitStreamParser: true,
- PDF417DecoderErrorCorrection: true,
- QRCodeReader: true,
- QRCodeWriter: true,
- QRCodeDecoderErrorCorrectionLevel: true,
- QRCodeDecoderFormatInformation: true,
- QRCodeVersion: true,
- QRCodeMode: true,
- QRCodeDecodedBitStreamParser: true,
- QRCodeDataMask: true,
- QRCodeEncoder: true,
- QRCodeEncoderQRCode: true,
- QRCodeMatrixUtil: true,
- QRCodeByteMatrix: true,
- QRCodeMaskUtil: true,
- AztecCodeReader: true,
- AztecCodeWriter: true,
- AztecDetectorResult: true,
- AztecEncoder: true,
- AztecHighLevelEncoder: true,
- AztecCode: true,
- AztecDecoder: true,
- AztecDetector: true,
- AztecPoint: true,
- OneDReader: true,
- EAN13Reader: true,
- Code128Reader: true,
- ITFReader: true,
- Code39Reader: true,
- Code93Reader: true,
- RSS14Reader: true,
- RSSExpandedReader: true,
- AbstractExpandedDecoder: true,
- createAbstractExpandedDecoder: true,
- MultiFormatOneDReader: true,
- CodaBarReader: true
- };
- Object.defineProperty(exports, "AbstractExpandedDecoder", {
- enumerable: true,
- get: function get() {
- return _AbstractExpandedDecoder.default;
- }
- });
- Object.defineProperty(exports, "ArgumentException", {
- enumerable: true,
- get: function get() {
- return _ArgumentException.default;
- }
- });
- Object.defineProperty(exports, "ArithmeticException", {
- enumerable: true,
- get: function get() {
- return _ArithmeticException.default;
- }
- });
- Object.defineProperty(exports, "AztecCode", {
- enumerable: true,
- get: function get() {
- return _AztecCode.default;
- }
- });
- Object.defineProperty(exports, "AztecCodeReader", {
- enumerable: true,
- get: function get() {
- return _AztecReader.default;
- }
- });
- Object.defineProperty(exports, "AztecCodeWriter", {
- enumerable: true,
- get: function get() {
- return _AztecWriter.default;
- }
- });
- Object.defineProperty(exports, "AztecDecoder", {
- enumerable: true,
- get: function get() {
- return _Decoder.default;
- }
- });
- Object.defineProperty(exports, "AztecDetector", {
- enumerable: true,
- get: function get() {
- return _Detector.default;
- }
- });
- Object.defineProperty(exports, "AztecDetectorResult", {
- enumerable: true,
- get: function get() {
- return _AztecDetectorResult.default;
- }
- });
- Object.defineProperty(exports, "AztecEncoder", {
- enumerable: true,
- get: function get() {
- return _Encoder2.default;
- }
- });
- Object.defineProperty(exports, "AztecHighLevelEncoder", {
- enumerable: true,
- get: function get() {
- return _HighLevelEncoder2.default;
- }
- });
- Object.defineProperty(exports, "AztecPoint", {
- enumerable: true,
- get: function get() {
- return _Detector.Point;
- }
- });
- Object.defineProperty(exports, "BarcodeFormat", {
- enumerable: true,
- get: function get() {
- return _BarcodeFormat.default;
- }
- });
- Object.defineProperty(exports, "Binarizer", {
- enumerable: true,
- get: function get() {
- return _Binarizer.default;
- }
- });
- Object.defineProperty(exports, "BinaryBitmap", {
- enumerable: true,
- get: function get() {
- return _BinaryBitmap.default;
- }
- });
- Object.defineProperty(exports, "BitArray", {
- enumerable: true,
- get: function get() {
- return _BitArray.default;
- }
- });
- Object.defineProperty(exports, "BitMatrix", {
- enumerable: true,
- get: function get() {
- return _BitMatrix.default;
- }
- });
- Object.defineProperty(exports, "BitSource", {
- enumerable: true,
- get: function get() {
- return _BitSource.default;
- }
- });
- Object.defineProperty(exports, "CharacterSetECI", {
- enumerable: true,
- get: function get() {
- return _CharacterSetECI.default;
- }
- });
- Object.defineProperty(exports, "ChecksumException", {
- enumerable: true,
- get: function get() {
- return _ChecksumException.default;
- }
- });
- Object.defineProperty(exports, "CodaBarReader", {
- enumerable: true,
- get: function get() {
- return _CodaBarReader.default;
- }
- });
- Object.defineProperty(exports, "Code128Reader", {
- enumerable: true,
- get: function get() {
- return _Code128Reader.default;
- }
- });
- Object.defineProperty(exports, "Code39Reader", {
- enumerable: true,
- get: function get() {
- return _Code39Reader.default;
- }
- });
- Object.defineProperty(exports, "Code93Reader", {
- enumerable: true,
- get: function get() {
- return _Code93Reader.default;
- }
- });
- Object.defineProperty(exports, "DataMatrixDecodedBitStreamParser", {
- enumerable: true,
- get: function get() {
- return _DecodedBitStreamParser.default;
- }
- });
- Object.defineProperty(exports, "DataMatrixDefaultPlacement", {
- enumerable: true,
- get: function get() {
- return _DefaultPlacement.default;
- }
- });
- Object.defineProperty(exports, "DataMatrixErrorCorrection", {
- enumerable: true,
- get: function get() {
- return _ErrorCorrection.default;
- }
- });
- Object.defineProperty(exports, "DataMatrixHighLevelEncoder", {
- enumerable: true,
- get: function get() {
- return _HighLevelEncoder.default;
- }
- });
- Object.defineProperty(exports, "DataMatrixReader", {
- enumerable: true,
- get: function get() {
- return _DataMatrixReader.default;
- }
- });
- Object.defineProperty(exports, "DataMatrixSymbolInfo", {
- enumerable: true,
- get: function get() {
- return _SymbolInfo.default;
- }
- });
- Object.defineProperty(exports, "DataMatrixSymbolShapeHint", {
- enumerable: true,
- get: function get() {
- return _constants.SymbolShapeHint;
- }
- });
- Object.defineProperty(exports, "DataMatrixWriter", {
- enumerable: true,
- get: function get() {
- return _DataMatrixWriter.default;
- }
- });
- Object.defineProperty(exports, "DecodeHintType", {
- enumerable: true,
- get: function get() {
- return _DecodeHintType.default;
- }
- });
- Object.defineProperty(exports, "DecoderResult", {
- enumerable: true,
- get: function get() {
- return _DecoderResult.default;
- }
- });
- Object.defineProperty(exports, "DefaultGridSampler", {
- enumerable: true,
- get: function get() {
- return _DefaultGridSampler.default;
- }
- });
- Object.defineProperty(exports, "DetectorResult", {
- enumerable: true,
- get: function get() {
- return _DetectorResult.default;
- }
- });
- Object.defineProperty(exports, "EAN13Reader", {
- enumerable: true,
- get: function get() {
- return _EAN13Reader.default;
- }
- });
- Object.defineProperty(exports, "EncodeHintType", {
- enumerable: true,
- get: function get() {
- return _EncodeHintType.default;
- }
- });
- Object.defineProperty(exports, "Exception", {
- enumerable: true,
- get: function get() {
- return _Exception.default;
- }
- });
- Object.defineProperty(exports, "FormatException", {
- enumerable: true,
- get: function get() {
- return _FormatException.default;
- }
- });
- Object.defineProperty(exports, "GenericGF", {
- enumerable: true,
- get: function get() {
- return _GenericGF.default;
- }
- });
- Object.defineProperty(exports, "GenericGFPoly", {
- enumerable: true,
- get: function get() {
- return _GenericGFPoly.default;
- }
- });
- Object.defineProperty(exports, "GlobalHistogramBinarizer", {
- enumerable: true,
- get: function get() {
- return _GlobalHistogramBinarizer.default;
- }
- });
- Object.defineProperty(exports, "GridSampler", {
- enumerable: true,
- get: function get() {
- return _GridSampler.default;
- }
- });
- Object.defineProperty(exports, "GridSamplerInstance", {
- enumerable: true,
- get: function get() {
- return _GridSamplerInstance.default;
- }
- });
- Object.defineProperty(exports, "HybridBinarizer", {
- enumerable: true,
- get: function get() {
- return _HybridBinarizer.default;
- }
- });
- Object.defineProperty(exports, "ITFReader", {
- enumerable: true,
- get: function get() {
- return _ITFReader.default;
- }
- });
- Object.defineProperty(exports, "IllegalArgumentException", {
- enumerable: true,
- get: function get() {
- return _IllegalArgumentException.default;
- }
- });
- Object.defineProperty(exports, "IllegalStateException", {
- enumerable: true,
- get: function get() {
- return _IllegalStateException.default;
- }
- });
- Object.defineProperty(exports, "InvertedLuminanceSource", {
- enumerable: true,
- get: function get() {
- return _InvertedLuminanceSource.default;
- }
- });
- Object.defineProperty(exports, "LuminanceSource", {
- enumerable: true,
- get: function get() {
- return _LuminanceSource.default;
- }
- });
- Object.defineProperty(exports, "MathUtils", {
- enumerable: true,
- get: function get() {
- return _MathUtils.default;
- }
- });
- Object.defineProperty(exports, "MultiFormatOneDReader", {
- enumerable: true,
- get: function get() {
- return _MultiFormatOneDReader.default;
- }
- });
- Object.defineProperty(exports, "MultiFormatReader", {
- enumerable: true,
- get: function get() {
- return _MultiFormatReader.default;
- }
- });
- Object.defineProperty(exports, "MultiFormatWriter", {
- enumerable: true,
- get: function get() {
- return _MultiFormatWriter.default;
- }
- });
- Object.defineProperty(exports, "NotFoundException", {
- enumerable: true,
- get: function get() {
- return _NotFoundException.default;
- }
- });
- Object.defineProperty(exports, "OneDReader", {
- enumerable: true,
- get: function get() {
- return _OneDReader.default;
- }
- });
- Object.defineProperty(exports, "PDF417DecodedBitStreamParser", {
- enumerable: true,
- get: function get() {
- return _DecodedBitStreamParser2.default;
- }
- });
- Object.defineProperty(exports, "PDF417DecoderErrorCorrection", {
- enumerable: true,
- get: function get() {
- return _ErrorCorrection2.default;
- }
- });
- Object.defineProperty(exports, "PDF417Reader", {
- enumerable: true,
- get: function get() {
- return _PDF417Reader.default;
- }
- });
- Object.defineProperty(exports, "PDF417ResultMetadata", {
- enumerable: true,
- get: function get() {
- return _PDF417ResultMetadata.default;
- }
- });
- Object.defineProperty(exports, "PerspectiveTransform", {
- enumerable: true,
- get: function get() {
- return _PerspectiveTransform.default;
- }
- });
- Object.defineProperty(exports, "PlanarYUVLuminanceSource", {
- enumerable: true,
- get: function get() {
- return _PlanarYUVLuminanceSource.default;
- }
- });
- Object.defineProperty(exports, "QRCodeByteMatrix", {
- enumerable: true,
- get: function get() {
- return _ByteMatrix.default;
- }
- });
- Object.defineProperty(exports, "QRCodeDataMask", {
- enumerable: true,
- get: function get() {
- return _DataMask.default;
- }
- });
- Object.defineProperty(exports, "QRCodeDecodedBitStreamParser", {
- enumerable: true,
- get: function get() {
- return _DecodedBitStreamParser3.default;
- }
- });
- Object.defineProperty(exports, "QRCodeDecoderErrorCorrectionLevel", {
- enumerable: true,
- get: function get() {
- return _ErrorCorrectionLevel.default;
- }
- });
- Object.defineProperty(exports, "QRCodeDecoderFormatInformation", {
- enumerable: true,
- get: function get() {
- return _FormatInformation.default;
- }
- });
- Object.defineProperty(exports, "QRCodeEncoder", {
- enumerable: true,
- get: function get() {
- return _Encoder.default;
- }
- });
- Object.defineProperty(exports, "QRCodeEncoderQRCode", {
- enumerable: true,
- get: function get() {
- return _QRCode.default;
- }
- });
- Object.defineProperty(exports, "QRCodeMaskUtil", {
- enumerable: true,
- get: function get() {
- return _MaskUtil.default;
- }
- });
- Object.defineProperty(exports, "QRCodeMatrixUtil", {
- enumerable: true,
- get: function get() {
- return _MatrixUtil.default;
- }
- });
- Object.defineProperty(exports, "QRCodeMode", {
- enumerable: true,
- get: function get() {
- return _Mode.default;
- }
- });
- Object.defineProperty(exports, "QRCodeReader", {
- enumerable: true,
- get: function get() {
- return _QRCodeReader.default;
- }
- });
- Object.defineProperty(exports, "QRCodeVersion", {
- enumerable: true,
- get: function get() {
- return _Version.default;
- }
- });
- Object.defineProperty(exports, "QRCodeWriter", {
- enumerable: true,
- get: function get() {
- return _QRCodeWriter.default;
- }
- });
- Object.defineProperty(exports, "RGBLuminanceSource", {
- enumerable: true,
- get: function get() {
- return _RGBLuminanceSource.default;
- }
- });
- Object.defineProperty(exports, "RSS14Reader", {
- enumerable: true,
- get: function get() {
- return _RSS14Reader.default;
- }
- });
- Object.defineProperty(exports, "RSSExpandedReader", {
- enumerable: true,
- get: function get() {
- return _RSSExpandedReader.default;
- }
- });
- Object.defineProperty(exports, "ReaderException", {
- enumerable: true,
- get: function get() {
- return _ReaderException.default;
- }
- });
- Object.defineProperty(exports, "ReedSolomonDecoder", {
- enumerable: true,
- get: function get() {
- return _ReedSolomonDecoder.default;
- }
- });
- Object.defineProperty(exports, "ReedSolomonEncoder", {
- enumerable: true,
- get: function get() {
- return _ReedSolomonEncoder.default;
- }
- });
- Object.defineProperty(exports, "ReedSolomonException", {
- enumerable: true,
- get: function get() {
- return _ReedSolomonException.default;
- }
- });
- Object.defineProperty(exports, "Result", {
- enumerable: true,
- get: function get() {
- return _Result.default;
- }
- });
- Object.defineProperty(exports, "ResultMetadataType", {
- enumerable: true,
- get: function get() {
- return _ResultMetadataType.default;
- }
- });
- Object.defineProperty(exports, "ResultPoint", {
- enumerable: true,
- get: function get() {
- return _ResultPoint.default;
- }
- });
- Object.defineProperty(exports, "StringUtils", {
- enumerable: true,
- get: function get() {
- return _StringUtils.default;
- }
- });
- Object.defineProperty(exports, "UnsupportedOperationException", {
- enumerable: true,
- get: function get() {
- return _UnsupportedOperationException.default;
- }
- });
- Object.defineProperty(exports, "WhiteRectangleDetector", {
- enumerable: true,
- get: function get() {
- return _WhiteRectangleDetector.default;
- }
- });
- Object.defineProperty(exports, "WriterException", {
- enumerable: true,
- get: function get() {
- return _WriterException.default;
- }
- });
- Object.defineProperty(exports, "ZXingArrays", {
- enumerable: true,
- get: function get() {
- return _Arrays.default;
- }
- });
- Object.defineProperty(exports, "ZXingCharset", {
- enumerable: true,
- get: function get() {
- return _Charset.default;
- }
- });
- Object.defineProperty(exports, "ZXingInteger", {
- enumerable: true,
- get: function get() {
- return _Integer.default;
- }
- });
- Object.defineProperty(exports, "ZXingStandardCharsets", {
- enumerable: true,
- get: function get() {
- return _StandardCharsets.default;
- }
- });
- Object.defineProperty(exports, "ZXingStringBuilder", {
- enumerable: true,
- get: function get() {
- return _StringBuilder.default;
- }
- });
- Object.defineProperty(exports, "ZXingStringEncoding", {
- enumerable: true,
- get: function get() {
- return _StringEncoding.default;
- }
- });
- Object.defineProperty(exports, "ZXingSystem", {
- enumerable: true,
- get: function get() {
- return _System.default;
- }
- });
- Object.defineProperty(exports, "createAbstractExpandedDecoder", {
- enumerable: true,
- get: function get() {
- return _AbstractExpandedDecoderComplement.createDecoder;
- }
- });
- var _browser = __webpack_require__(/*! ./browser */ 301);
- Object.keys(_browser).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
- if (key in exports && exports[key] === _browser[key]) return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function get() {
- return _browser[key];
- }
- });
- });
- var _ArgumentException = _interopRequireDefault(__webpack_require__(/*! ./core/ArgumentException */ 304));
- var _ArithmeticException = _interopRequireDefault(__webpack_require__(/*! ./core/ArithmeticException */ 341));
- var _ChecksumException = _interopRequireDefault(__webpack_require__(/*! ./core/ChecksumException */ 309));
- var _Exception = _interopRequireDefault(__webpack_require__(/*! ./core/Exception */ 305));
- var _FormatException = _interopRequireDefault(__webpack_require__(/*! ./core/FormatException */ 324));
- var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ./core/IllegalArgumentException */ 308));
- var _IllegalStateException = _interopRequireDefault(__webpack_require__(/*! ./core/IllegalStateException */ 344));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ./core/NotFoundException */ 327));
- var _ReaderException = _interopRequireDefault(__webpack_require__(/*! ./core/ReaderException */ 458));
- var _ReedSolomonException = _interopRequireDefault(__webpack_require__(/*! ./core/ReedSolomonException */ 343));
- var _UnsupportedOperationException = _interopRequireDefault(__webpack_require__(/*! ./core/UnsupportedOperationException */ 326));
- var _WriterException = _interopRequireDefault(__webpack_require__(/*! ./core/WriterException */ 469));
- var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ./core/BarcodeFormat */ 334));
- var _Binarizer = _interopRequireDefault(__webpack_require__(/*! ./core/Binarizer */ 312));
- var _BinaryBitmap = _interopRequireDefault(__webpack_require__(/*! ./core/BinaryBitmap */ 307));
- var _DecodeHintType = _interopRequireDefault(__webpack_require__(/*! ./core/DecodeHintType */ 322));
- var _InvertedLuminanceSource = _interopRequireDefault(__webpack_require__(/*! ./core/InvertedLuminanceSource */ 329));
- var _LuminanceSource = _interopRequireDefault(__webpack_require__(/*! ./core/LuminanceSource */ 330));
- var _MultiFormatReader = _interopRequireDefault(__webpack_require__(/*! ./core/MultiFormatReader */ 413));
- var _MultiFormatWriter = _interopRequireDefault(__webpack_require__(/*! ./core/MultiFormatWriter */ 473));
- var _PlanarYUVLuminanceSource = _interopRequireDefault(__webpack_require__(/*! ./core/PlanarYUVLuminanceSource */ 475));
- var _Result = _interopRequireDefault(__webpack_require__(/*! ./core/Result */ 333));
- var _ResultMetadataType = _interopRequireDefault(__webpack_require__(/*! ./core/ResultMetadataType */ 335));
- var _RGBLuminanceSource = _interopRequireDefault(__webpack_require__(/*! ./core/RGBLuminanceSource */ 476));
- var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ./core/ResultPoint */ 346));
- var _System = _interopRequireDefault(__webpack_require__(/*! ./core/util/System */ 315));
- var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ./core/util/StringBuilder */ 320));
- var _StringEncoding = _interopRequireDefault(__webpack_require__(/*! ./core/util/StringEncoding */ 325));
- var _Charset = _interopRequireDefault(__webpack_require__(/*! ./core/util/Charset */ 477));
- var _Arrays = _interopRequireDefault(__webpack_require__(/*! ./core/util/Arrays */ 314));
- var _StandardCharsets = _interopRequireDefault(__webpack_require__(/*! ./core/util/StandardCharsets */ 478));
- var _Integer = _interopRequireDefault(__webpack_require__(/*! ./core/util/Integer */ 318));
- var _BitArray = _interopRequireDefault(__webpack_require__(/*! ./core/common/BitArray */ 313));
- var _BitMatrix = _interopRequireDefault(__webpack_require__(/*! ./core/common/BitMatrix */ 319));
- var _BitSource = _interopRequireDefault(__webpack_require__(/*! ./core/common/BitSource */ 410));
- var _CharacterSetECI = _interopRequireDefault(__webpack_require__(/*! ./core/common/CharacterSetECI */ 323));
- var _DecoderResult = _interopRequireDefault(__webpack_require__(/*! ./core/common/DecoderResult */ 337));
- var _DefaultGridSampler = _interopRequireDefault(__webpack_require__(/*! ./core/common/DefaultGridSampler */ 353));
- var _DetectorResult = _interopRequireDefault(__webpack_require__(/*! ./core/common/DetectorResult */ 350));
- var _EncodeHintType = _interopRequireDefault(__webpack_require__(/*! ./core/EncodeHintType */ 462));
- var _GlobalHistogramBinarizer = _interopRequireDefault(__webpack_require__(/*! ./core/common/GlobalHistogramBinarizer */ 311));
- var _GridSampler = _interopRequireDefault(__webpack_require__(/*! ./core/common/GridSampler */ 354));
- var _GridSamplerInstance = _interopRequireDefault(__webpack_require__(/*! ./core/common/GridSamplerInstance */ 352));
- var _HybridBinarizer = _interopRequireDefault(__webpack_require__(/*! ./core/common/HybridBinarizer */ 310));
- var _PerspectiveTransform = _interopRequireDefault(__webpack_require__(/*! ./core/common/PerspectiveTransform */ 355));
- var _StringUtils = _interopRequireDefault(__webpack_require__(/*! ./core/common/StringUtils */ 321));
- var _MathUtils = _interopRequireDefault(__webpack_require__(/*! ./core/common/detector/MathUtils */ 347));
- var _WhiteRectangleDetector = _interopRequireDefault(__webpack_require__(/*! ./core/common/detector/WhiteRectangleDetector */ 351));
- var _GenericGF = _interopRequireDefault(__webpack_require__(/*! ./core/common/reedsolomon/GenericGF */ 338));
- var _GenericGFPoly = _interopRequireDefault(__webpack_require__(/*! ./core/common/reedsolomon/GenericGFPoly */ 339));
- var _ReedSolomonDecoder = _interopRequireDefault(__webpack_require__(/*! ./core/common/reedsolomon/ReedSolomonDecoder */ 342));
- var _ReedSolomonEncoder = _interopRequireDefault(__webpack_require__(/*! ./core/common/reedsolomon/ReedSolomonEncoder */ 464));
- var _DataMatrixReader = _interopRequireDefault(__webpack_require__(/*! ./core/datamatrix/DataMatrixReader */ 404));
- var _DecodedBitStreamParser = _interopRequireDefault(__webpack_require__(/*! ./core/datamatrix/decoder/DecodedBitStreamParser */ 409));
- var _DefaultPlacement = _interopRequireDefault(__webpack_require__(/*! ./core/datamatrix/encoder/DefaultPlacement */ 479));
- var _ErrorCorrection = _interopRequireDefault(__webpack_require__(/*! ./core/datamatrix/encoder/ErrorCorrection */ 480));
- var _HighLevelEncoder = _interopRequireDefault(__webpack_require__(/*! ./core/datamatrix/encoder/HighLevelEncoder */ 482));
- var _SymbolInfo = _interopRequireDefault(__webpack_require__(/*! ./core/datamatrix/encoder/SymbolInfo */ 488));
- var _constants = __webpack_require__(/*! ./core/datamatrix/encoder/constants */ 481);
- var _DataMatrixWriter = _interopRequireDefault(__webpack_require__(/*! ./core/datamatrix/DataMatrixWriter */ 491));
- var _PDF417Reader = _interopRequireDefault(__webpack_require__(/*! ./core/pdf417/PDF417Reader */ 433));
- var _PDF417ResultMetadata = _interopRequireDefault(__webpack_require__(/*! ./core/pdf417/PDF417ResultMetadata */ 452));
- var _DecodedBitStreamParser2 = _interopRequireDefault(__webpack_require__(/*! ./core/pdf417/decoder/DecodedBitStreamParser */ 451));
- var _ErrorCorrection2 = _interopRequireDefault(__webpack_require__(/*! ./core/pdf417/decoder/ec/ErrorCorrection */ 438));
- var _QRCodeReader = _interopRequireDefault(__webpack_require__(/*! ./core/qrcode/QRCodeReader */ 414));
- var _QRCodeWriter = _interopRequireDefault(__webpack_require__(/*! ./core/qrcode/QRCodeWriter */ 474));
- var _ErrorCorrectionLevel = _interopRequireDefault(__webpack_require__(/*! ./core/qrcode/decoder/ErrorCorrectionLevel */ 419));
- var _FormatInformation = _interopRequireDefault(__webpack_require__(/*! ./core/qrcode/decoder/FormatInformation */ 418));
- var _Version = _interopRequireDefault(__webpack_require__(/*! ./core/qrcode/decoder/Version */ 417));
- var _Mode = _interopRequireDefault(__webpack_require__(/*! ./core/qrcode/decoder/Mode */ 425));
- var _DecodedBitStreamParser3 = _interopRequireDefault(__webpack_require__(/*! ./core/qrcode/decoder/DecodedBitStreamParser */ 424));
- var _DataMask = _interopRequireDefault(__webpack_require__(/*! ./core/qrcode/decoder/DataMask */ 422));
- var _Encoder = _interopRequireDefault(__webpack_require__(/*! ./core/qrcode/encoder/Encoder */ 463));
- var _QRCode = _interopRequireDefault(__webpack_require__(/*! ./core/qrcode/encoder/QRCode */ 467));
- var _MatrixUtil = _interopRequireDefault(__webpack_require__(/*! ./core/qrcode/encoder/MatrixUtil */ 468));
- var _ByteMatrix = _interopRequireDefault(__webpack_require__(/*! ./core/qrcode/encoder/ByteMatrix */ 466));
- var _MaskUtil = _interopRequireDefault(__webpack_require__(/*! ./core/qrcode/encoder/MaskUtil */ 465));
- var _AztecReader = _interopRequireDefault(__webpack_require__(/*! ./core/aztec/AztecReader */ 332));
- var _AztecWriter = _interopRequireDefault(__webpack_require__(/*! ./core/aztec/AztecWriter */ 496));
- var _AztecDetectorResult = _interopRequireDefault(__webpack_require__(/*! ./core/aztec/AztecDetectorResult */ 349));
- var _Encoder2 = _interopRequireDefault(__webpack_require__(/*! ./core/aztec/encoder/Encoder */ 497));
- var _HighLevelEncoder2 = _interopRequireDefault(__webpack_require__(/*! ./core/aztec/encoder/HighLevelEncoder */ 499));
- var _AztecCode = _interopRequireDefault(__webpack_require__(/*! ./core/aztec/encoder/AztecCode */ 498));
- var _Decoder = _interopRequireDefault(__webpack_require__(/*! ./core/aztec/decoder/Decoder */ 336));
- var _Detector = _interopRequireWildcard(__webpack_require__(/*! ./core/aztec/detector/Detector */ 345));
- var _OneDReader = _interopRequireDefault(__webpack_require__(/*! ./core/oned/OneDReader */ 359));
- var _EAN13Reader = _interopRequireDefault(__webpack_require__(/*! ./core/oned/EAN13Reader */ 364));
- var _Code128Reader = _interopRequireDefault(__webpack_require__(/*! ./core/oned/Code128Reader */ 358));
- var _ITFReader = _interopRequireDefault(__webpack_require__(/*! ./core/oned/ITFReader */ 362));
- var _Code39Reader = _interopRequireDefault(__webpack_require__(/*! ./core/oned/Code39Reader */ 360));
- var _Code93Reader = _interopRequireDefault(__webpack_require__(/*! ./core/oned/Code93Reader */ 361));
- var _RSS14Reader = _interopRequireDefault(__webpack_require__(/*! ./core/oned/rss/RSS14Reader */ 401));
- var _RSSExpandedReader = _interopRequireDefault(__webpack_require__(/*! ./core/oned/rss/expanded/RSSExpandedReader */ 374));
- var _AbstractExpandedDecoder = _interopRequireDefault(__webpack_require__(/*! ./core/oned/rss/expanded/decoders/AbstractExpandedDecoder */ 390));
- var _AbstractExpandedDecoderComplement = __webpack_require__(/*! ./core/oned/rss/expanded/decoders/AbstractExpandedDecoderComplement */ 380);
- var _MultiFormatOneDReader = _interopRequireDefault(__webpack_require__(/*! ./core/oned/MultiFormatOneDReader */ 357));
- var _CodaBarReader = _interopRequireDefault(__webpack_require__(/*! ./core/oned/CodaBarReader */ 373));
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
- /***/ }),
- /* 301 */
- /*!**********************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/browser.js ***!
- \**********************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- var _BrowserAztecCodeReader = __webpack_require__(/*! ./browser/BrowserAztecCodeReader */ 302);
- Object.keys(_BrowserAztecCodeReader).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- if (key in exports && exports[key] === _BrowserAztecCodeReader[key]) return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function get() {
- return _BrowserAztecCodeReader[key];
- }
- });
- });
- var _BrowserBarcodeReader = __webpack_require__(/*! ./browser/BrowserBarcodeReader */ 356);
- Object.keys(_BrowserBarcodeReader).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- if (key in exports && exports[key] === _BrowserBarcodeReader[key]) return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function get() {
- return _BrowserBarcodeReader[key];
- }
- });
- });
- var _BrowserCodeReader = __webpack_require__(/*! ./browser/BrowserCodeReader */ 303);
- Object.keys(_BrowserCodeReader).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- if (key in exports && exports[key] === _BrowserCodeReader[key]) return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function get() {
- return _BrowserCodeReader[key];
- }
- });
- });
- var _BrowserDatamatrixCodeReader = __webpack_require__(/*! ./browser/BrowserDatamatrixCodeReader */ 403);
- Object.keys(_BrowserDatamatrixCodeReader).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- if (key in exports && exports[key] === _BrowserDatamatrixCodeReader[key]) return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function get() {
- return _BrowserDatamatrixCodeReader[key];
- }
- });
- });
- var _BrowserMultiFormatReader = __webpack_require__(/*! ./browser/BrowserMultiFormatReader */ 412);
- Object.keys(_BrowserMultiFormatReader).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- if (key in exports && exports[key] === _BrowserMultiFormatReader[key]) return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function get() {
- return _BrowserMultiFormatReader[key];
- }
- });
- });
- var _BrowserPDF417Reader = __webpack_require__(/*! ./browser/BrowserPDF417Reader */ 459);
- Object.keys(_BrowserPDF417Reader).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- if (key in exports && exports[key] === _BrowserPDF417Reader[key]) return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function get() {
- return _BrowserPDF417Reader[key];
- }
- });
- });
- var _BrowserQRCodeReader = __webpack_require__(/*! ./browser/BrowserQRCodeReader */ 460);
- Object.keys(_BrowserQRCodeReader).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- if (key in exports && exports[key] === _BrowserQRCodeReader[key]) return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function get() {
- return _BrowserQRCodeReader[key];
- }
- });
- });
- var _BrowserQRCodeSvgWriter = __webpack_require__(/*! ./browser/BrowserQRCodeSvgWriter */ 461);
- Object.keys(_BrowserQRCodeSvgWriter).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- if (key in exports && exports[key] === _BrowserQRCodeSvgWriter[key]) return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function get() {
- return _BrowserQRCodeSvgWriter[key];
- }
- });
- });
- var _DecodeContinuouslyCallback = __webpack_require__(/*! ./browser/DecodeContinuouslyCallback */ 471);
- Object.keys(_DecodeContinuouslyCallback).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- if (key in exports && exports[key] === _DecodeContinuouslyCallback[key]) return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function get() {
- return _DecodeContinuouslyCallback[key];
- }
- });
- });
- var _HTMLCanvasElementLuminanceSource = __webpack_require__(/*! ./browser/HTMLCanvasElementLuminanceSource */ 328);
- Object.keys(_HTMLCanvasElementLuminanceSource).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- if (key in exports && exports[key] === _HTMLCanvasElementLuminanceSource[key]) return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function get() {
- return _HTMLCanvasElementLuminanceSource[key];
- }
- });
- });
- var _HTMLVisualMediaElement = __webpack_require__(/*! ./browser/HTMLVisualMediaElement */ 472);
- Object.keys(_HTMLVisualMediaElement).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- if (key in exports && exports[key] === _HTMLVisualMediaElement[key]) return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function get() {
- return _HTMLVisualMediaElement[key];
- }
- });
- });
- var _VideoInputDevice = __webpack_require__(/*! ./browser/VideoInputDevice */ 331);
- Object.keys(_VideoInputDevice).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- if (key in exports && exports[key] === _VideoInputDevice[key]) return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function get() {
- return _VideoInputDevice[key];
- }
- });
- });
- /***/ }),
- /* 302 */
- /*!*********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/browser/BrowserAztecCodeReader.js ***!
- \*********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.BrowserAztecCodeReader = void 0;
- var _BrowserCodeReader = __webpack_require__(/*! ./BrowserCodeReader */ 303);
- var _AztecReader = _interopRequireDefault(__webpack_require__(/*! ../core/aztec/AztecReader */ 332));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /**
- * Aztec Code reader to use from browser.
- *
- * @class BrowserAztecCodeReader
- * @extends {BrowserCodeReader}
- */
- var BrowserAztecCodeReader = /** @class */function (_super) {
- __extends(BrowserAztecCodeReader, _super);
- /**
- * Creates an instance of BrowserAztecCodeReader.
- * @param {number} [timeBetweenScansMillis=500] the time delay between subsequent decode tries
- *
- * @memberOf BrowserAztecCodeReader
- */
- function BrowserAztecCodeReader(timeBetweenScansMillis) {
- if (timeBetweenScansMillis === void 0) {
- timeBetweenScansMillis = 500;
- }
- return _super.call(this, new _AztecReader.default(), timeBetweenScansMillis) || this;
- }
- return BrowserAztecCodeReader;
- }(_BrowserCodeReader.BrowserCodeReader);
- exports.BrowserAztecCodeReader = BrowserAztecCodeReader;
- /***/ }),
- /* 303 */
- /*!****************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/browser/BrowserCodeReader.js ***!
- \****************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.BrowserCodeReader = void 0;
- var _ArgumentException = _interopRequireDefault(__webpack_require__(/*! ../core/ArgumentException */ 304));
- var _BinaryBitmap = _interopRequireDefault(__webpack_require__(/*! ../core/BinaryBitmap */ 307));
- var _ChecksumException = _interopRequireDefault(__webpack_require__(/*! ../core/ChecksumException */ 309));
- var _HybridBinarizer = _interopRequireDefault(__webpack_require__(/*! ../core/common/HybridBinarizer */ 310));
- var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../core/FormatException */ 324));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../core/NotFoundException */ 327));
- var _HTMLCanvasElementLuminanceSource = __webpack_require__(/*! ./HTMLCanvasElementLuminanceSource */ 328);
- var _VideoInputDevice = __webpack_require__(/*! ./VideoInputDevice */ 331);
- var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
- function adopt(value) {
- return value instanceof P ? value : new P(function (resolve) {
- resolve(value);
- });
- }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) {
- try {
- step(generator.next(value));
- } catch (e) {
- reject(e);
- }
- }
- function rejected(value) {
- try {
- step(generator["throw"](value));
- } catch (e) {
- reject(e);
- }
- }
- function step(result) {
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
- }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
- };
- var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
- var _ = {
- label: 0,
- sent: function sent() {
- if (t[0] & 1) throw t[1];
- return t[1];
- },
- trys: [],
- ops: []
- },
- f,
- y,
- t,
- g;
- return g = {
- next: verb(0),
- "throw": verb(1),
- "return": verb(2)
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
- return this;
- }), g;
- function verb(n) {
- return function (v) {
- return step([n, v]);
- };
- }
- function step(op) {
- if (f) throw new TypeError("Generator is already executing.");
- while (_) {
- try {
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
- if (y = 0, t) op = [op[0] & 2, t.value];
- switch (op[0]) {
- case 0:
- case 1:
- t = op;
- break;
- case 4:
- _.label++;
- return {
- value: op[1],
- done: false
- };
- case 5:
- _.label++;
- y = op[1];
- op = [0];
- continue;
- case 7:
- op = _.ops.pop();
- _.trys.pop();
- continue;
- default:
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
- _ = 0;
- continue;
- }
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
- _.label = op[1];
- break;
- }
- if (op[0] === 6 && _.label < t[1]) {
- _.label = t[1];
- t = op;
- break;
- }
- if (t && _.label < t[2]) {
- _.label = t[2];
- _.ops.push(op);
- break;
- }
- if (t[2]) _.ops.pop();
- _.trys.pop();
- continue;
- }
- op = body.call(thisArg, _);
- } catch (e) {
- op = [6, e];
- y = 0;
- } finally {
- f = t = 0;
- }
- }
- if (op[0] & 5) throw op[1];
- return {
- value: op[0] ? op[1] : void 0,
- done: true
- };
- }
- };
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- /**
- * @deprecated Moving to @zxing/browser
- *
- * Base class for browser code reader.
- */
- var BrowserCodeReader = /** @class */function () {
- /**
- * Creates an instance of BrowserCodeReader.
- * @param {Reader} reader The reader instance to decode the barcode
- * @param {number} [timeBetweenScansMillis=500] the time delay between subsequent successful decode tries
- *
- * @memberOf BrowserCodeReader
- */
- function BrowserCodeReader(reader, timeBetweenScansMillis, _hints) {
- if (timeBetweenScansMillis === void 0) {
- timeBetweenScansMillis = 500;
- }
- this.reader = reader;
- this.timeBetweenScansMillis = timeBetweenScansMillis;
- this._hints = _hints;
- /**
- * This will break the loop.
- */
- this._stopContinuousDecode = false;
- /**
- * This will break the loop.
- */
- this._stopAsyncDecode = false;
- /**
- * Delay time between decode attempts made by the scanner.
- */
- this._timeBetweenDecodingAttempts = 0;
- }
- Object.defineProperty(BrowserCodeReader.prototype, "hasNavigator", {
- /**
- * If navigator is present.
- */
- get: function get() {
- return typeof navigator !== 'undefined';
- },
- enumerable: false,
- configurable: true
- });
- Object.defineProperty(BrowserCodeReader.prototype, "isMediaDevicesSuported", {
- /**
- * If mediaDevices under navigator is supported.
- */
- get: function get() {
- return this.hasNavigator && !!navigator.mediaDevices;
- },
- enumerable: false,
- configurable: true
- });
- Object.defineProperty(BrowserCodeReader.prototype, "canEnumerateDevices", {
- /**
- * If enumerateDevices under navigator is supported.
- */
- get: function get() {
- return !!(this.isMediaDevicesSuported && navigator.mediaDevices.enumerateDevices);
- },
- enumerable: false,
- configurable: true
- });
- Object.defineProperty(BrowserCodeReader.prototype, "timeBetweenDecodingAttempts", {
- /** Time between two decoding tries in milli seconds. */
- get: function get() {
- return this._timeBetweenDecodingAttempts;
- },
- /**
- * Change the time span the decoder waits between two decoding tries.
- *
- * @param {number} millis Time between two decoding tries in milli seconds.
- */
- set: function set(millis) {
- this._timeBetweenDecodingAttempts = millis < 0 ? 0 : millis;
- },
- enumerable: false,
- configurable: true
- });
- Object.defineProperty(BrowserCodeReader.prototype, "hints", {
- /**
- * Sets the hints.
- */
- get: function get() {
- return this._hints;
- },
- /**
- * Sets the hints.
- */
- set: function set(hints) {
- this._hints = hints || null;
- },
- enumerable: false,
- configurable: true
- });
- /**
- * Lists all the available video input devices.
- */
- BrowserCodeReader.prototype.listVideoInputDevices = function () {
- return __awaiter(this, void 0, void 0, function () {
- var devices, videoDevices, devices_1, devices_1_1, device, kind, deviceId, label, groupId, videoDevice;
- var e_1, _a;
- return __generator(this, function (_b) {
- switch (_b.label) {
- case 0:
- if (!this.hasNavigator) {
- throw new Error("Can't enumerate devices, navigator is not present.");
- }
- if (!this.canEnumerateDevices) {
- throw new Error("Can't enumerate devices, method not supported.");
- }
- return [4 /*yield*/, navigator.mediaDevices.enumerateDevices()];
- case 1:
- devices = _b.sent();
- videoDevices = [];
- try {
- for (devices_1 = __values(devices), devices_1_1 = devices_1.next(); !devices_1_1.done; devices_1_1 = devices_1.next()) {
- device = devices_1_1.value;
- kind = device.kind === 'video' ? 'videoinput' : device.kind;
- if (kind !== 'videoinput') {
- continue;
- }
- deviceId = device.deviceId || device.id;
- label = device.label || "Video device " + (videoDevices.length + 1);
- groupId = device.groupId;
- videoDevice = {
- deviceId: deviceId,
- label: label,
- kind: kind,
- groupId: groupId
- };
- videoDevices.push(videoDevice);
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (devices_1_1 && !devices_1_1.done && (_a = devices_1.return)) _a.call(devices_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- return [2 /*return*/, videoDevices];
- }
- });
- });
- };
- /**
- * Obtain the list of available devices with type 'videoinput'.
- *
- * @returns {Promise<VideoInputDevice[]>} an array of available video input devices
- *
- * @memberOf BrowserCodeReader
- *
- * @deprecated Use `listVideoInputDevices` instead.
- */
- BrowserCodeReader.prototype.getVideoInputDevices = function () {
- return __awaiter(this, void 0, void 0, function () {
- var devices;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- return [4 /*yield*/, this.listVideoInputDevices()];
- case 1:
- devices = _a.sent();
- return [2 /*return*/, devices.map(function (d) {
- return new _VideoInputDevice.VideoInputDevice(d.deviceId, d.label);
- })];
- }
- });
- });
- };
- /**
- * Let's you find a device using it's Id.
- */
- BrowserCodeReader.prototype.findDeviceById = function (deviceId) {
- return __awaiter(this, void 0, void 0, function () {
- var devices;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- return [4 /*yield*/, this.listVideoInputDevices()];
- case 1:
- devices = _a.sent();
- if (!devices) {
- return [2 /*return*/, null];
- }
- return [2 /*return*/, devices.find(function (x) {
- return x.deviceId === deviceId;
- })];
- }
- });
- });
- };
- /**
- * Decodes the barcode from the device specified by deviceId while showing the video in the specified video element.
- *
- * @param deviceId the id of one of the devices obtained after calling getVideoInputDevices. Can be undefined, in this case it will decode from one of the available devices, preffering the main camera (environment facing) if available.
- * @param video the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.
- * @returns The decoding result.
- *
- * @memberOf BrowserCodeReader
- *
- * @deprecated Use `decodeOnceFromVideoDevice` instead.
- */
- BrowserCodeReader.prototype.decodeFromInputVideoDevice = function (deviceId, videoSource) {
- return __awaiter(this, void 0, void 0, function () {
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- return [4 /*yield*/, this.decodeOnceFromVideoDevice(deviceId, videoSource)];
- case 1:
- return [2 /*return*/, _a.sent()];
- }
- });
- });
- };
- /**
- * In one attempt, tries to decode the barcode from the device specified by deviceId while showing the video in the specified video element.
- *
- * @param deviceId the id of one of the devices obtained after calling getVideoInputDevices. Can be undefined, in this case it will decode from one of the available devices, preffering the main camera (environment facing) if available.
- * @param video the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.
- * @returns The decoding result.
- *
- * @memberOf BrowserCodeReader
- */
- BrowserCodeReader.prototype.decodeOnceFromVideoDevice = function (deviceId, videoSource) {
- return __awaiter(this, void 0, void 0, function () {
- var videoConstraints, constraints;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- this.reset();
- if (!deviceId) {
- videoConstraints = {
- facingMode: 'environment'
- };
- } else {
- videoConstraints = {
- deviceId: {
- exact: deviceId
- }
- };
- }
- constraints = {
- video: videoConstraints
- };
- return [4 /*yield*/, this.decodeOnceFromConstraints(constraints, videoSource)];
- case 1:
- return [2 /*return*/, _a.sent()];
- }
- });
- });
- };
- /**
- * In one attempt, tries to decode the barcode from a stream obtained from the given constraints while showing the video in the specified video element.
- *
- * @param constraints the media stream constraints to get s valid media stream to decode from
- * @param video the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.
- * @returns The decoding result.
- *
- * @memberOf BrowserCodeReader
- */
- BrowserCodeReader.prototype.decodeOnceFromConstraints = function (constraints, videoSource) {
- return __awaiter(this, void 0, void 0, function () {
- var stream;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- return [4 /*yield*/, navigator.mediaDevices.getUserMedia(constraints)];
- case 1:
- stream = _a.sent();
- return [4 /*yield*/, this.decodeOnceFromStream(stream, videoSource)];
- case 2:
- return [2 /*return*/, _a.sent()];
- }
- });
- });
- };
- /**
- * In one attempt, tries to decode the barcode from a stream obtained from the given constraints while showing the video in the specified video element.
- *
- * @param {MediaStream} [constraints] the media stream constraints to get s valid media stream to decode from
- * @param {string|HTMLVideoElement} [video] the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.
- * @returns {Promise<Result>} The decoding result.
- *
- * @memberOf BrowserCodeReader
- */
- BrowserCodeReader.prototype.decodeOnceFromStream = function (stream, videoSource) {
- return __awaiter(this, void 0, void 0, function () {
- var video, result;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- this.reset();
- return [4 /*yield*/, this.attachStreamToVideo(stream, videoSource)];
- case 1:
- video = _a.sent();
- return [4 /*yield*/, this.decodeOnce(video)];
- case 2:
- result = _a.sent();
- return [2 /*return*/, result];
- }
- });
- });
- };
- /**
- * Continuously decodes the barcode from the device specified by device while showing the video in the specified video element.
- *
- * @param {string|null} [deviceId] the id of one of the devices obtained after calling getVideoInputDevices. Can be undefined, in this case it will decode from one of the available devices, preffering the main camera (environment facing) if available.
- * @param {string|HTMLVideoElement|null} [video] the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.
- * @returns {Promise<void>}
- *
- * @memberOf BrowserCodeReader
- *
- * @deprecated Use `decodeFromVideoDevice` instead.
- */
- BrowserCodeReader.prototype.decodeFromInputVideoDeviceContinuously = function (deviceId, videoSource, callbackFn) {
- return __awaiter(this, void 0, void 0, function () {
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- return [4 /*yield*/, this.decodeFromVideoDevice(deviceId, videoSource, callbackFn)];
- case 1:
- return [2 /*return*/, _a.sent()];
- }
- });
- });
- };
- /**
- * Continuously tries to decode the barcode from the device specified by device while showing the video in the specified video element.
- *
- * @param {string|null} [deviceId] the id of one of the devices obtained after calling getVideoInputDevices. Can be undefined, in this case it will decode from one of the available devices, preffering the main camera (environment facing) if available.
- * @param {string|HTMLVideoElement|null} [video] the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.
- * @returns {Promise<void>}
- *
- * @memberOf BrowserCodeReader
- */
- BrowserCodeReader.prototype.decodeFromVideoDevice = function (deviceId, videoSource, callbackFn) {
- return __awaiter(this, void 0, void 0, function () {
- var videoConstraints, constraints;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- if (!deviceId) {
- videoConstraints = {
- facingMode: 'environment'
- };
- } else {
- videoConstraints = {
- deviceId: {
- exact: deviceId
- }
- };
- }
- constraints = {
- video: videoConstraints
- };
- return [4 /*yield*/, this.decodeFromConstraints(constraints, videoSource, callbackFn)];
- case 1:
- return [2 /*return*/, _a.sent()];
- }
- });
- });
- };
- /**
- * Continuously tries to decode the barcode from a stream obtained from the given constraints while showing the video in the specified video element.
- *
- * @param {MediaStream} [constraints] the media stream constraints to get s valid media stream to decode from
- * @param {string|HTMLVideoElement} [video] the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.
- * @returns {Promise<Result>} The decoding result.
- *
- * @memberOf BrowserCodeReader
- */
- BrowserCodeReader.prototype.decodeFromConstraints = function (constraints, videoSource, callbackFn) {
- return __awaiter(this, void 0, void 0, function () {
- var stream;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- return [4 /*yield*/, navigator.mediaDevices.getUserMedia(constraints)];
- case 1:
- stream = _a.sent();
- return [4 /*yield*/, this.decodeFromStream(stream, videoSource, callbackFn)];
- case 2:
- return [2 /*return*/, _a.sent()];
- }
- });
- });
- };
- /**
- * In one attempt, tries to decode the barcode from a stream obtained from the given constraints while showing the video in the specified video element.
- *
- * @param {MediaStream} [constraints] the media stream constraints to get s valid media stream to decode from
- * @param {string|HTMLVideoElement} [video] the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.
- * @returns {Promise<Result>} The decoding result.
- *
- * @memberOf BrowserCodeReader
- */
- BrowserCodeReader.prototype.decodeFromStream = function (stream, videoSource, callbackFn) {
- return __awaiter(this, void 0, void 0, function () {
- var video;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- this.reset();
- return [4 /*yield*/, this.attachStreamToVideo(stream, videoSource)];
- case 1:
- video = _a.sent();
- return [4 /*yield*/, this.decodeContinuously(video, callbackFn)];
- case 2:
- return [2 /*return*/, _a.sent()];
- }
- });
- });
- };
- /**
- * Breaks the decoding loop.
- */
- BrowserCodeReader.prototype.stopAsyncDecode = function () {
- this._stopAsyncDecode = true;
- };
- /**
- * Breaks the decoding loop.
- */
- BrowserCodeReader.prototype.stopContinuousDecode = function () {
- this._stopContinuousDecode = true;
- };
- /**
- * Sets the new stream and request a new decoding-with-delay.
- *
- * @param stream The stream to be shown in the video element.
- * @param decodeFn A callback for the decode method.
- */
- BrowserCodeReader.prototype.attachStreamToVideo = function (stream, videoSource) {
- return __awaiter(this, void 0, void 0, function () {
- var videoElement;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- videoElement = this.prepareVideoElement(videoSource);
- this.addVideoSource(videoElement, stream);
- this.videoElement = videoElement;
- this.stream = stream;
- return [4 /*yield*/, this.playVideoOnLoadAsync(videoElement)];
- case 1:
- _a.sent();
- return [2 /*return*/, videoElement];
- }
- });
- });
- };
- /**
- *
- * @param videoElement
- */
- BrowserCodeReader.prototype.playVideoOnLoadAsync = function (videoElement) {
- var _this = this;
- return new Promise(function (resolve, reject) {
- return _this.playVideoOnLoad(videoElement, function () {
- return resolve();
- });
- });
- };
- /**
- * Binds listeners and callbacks to the videoElement.
- *
- * @param element
- * @param callbackFn
- */
- BrowserCodeReader.prototype.playVideoOnLoad = function (element, callbackFn) {
- var _this = this;
- this.videoEndedListener = function () {
- return _this.stopStreams();
- };
- this.videoCanPlayListener = function () {
- return _this.tryPlayVideo(element);
- };
- element.addEventListener('ended', this.videoEndedListener);
- element.addEventListener('canplay', this.videoCanPlayListener);
- element.addEventListener('playing', callbackFn);
- // if canplay was already fired, we won't know when to play, so just give it a try
- this.tryPlayVideo(element);
- };
- /**
- * Checks if the given video element is currently playing.
- */
- BrowserCodeReader.prototype.isVideoPlaying = function (video) {
- return video.currentTime > 0 && !video.paused && !video.ended && video.readyState > 2;
- };
- /**
- * Just tries to play the video and logs any errors.
- * The play call is only made is the video is not already playing.
- */
- BrowserCodeReader.prototype.tryPlayVideo = function (videoElement) {
- return __awaiter(this, void 0, void 0, function () {
- var _a;
- return __generator(this, function (_b) {
- switch (_b.label) {
- case 0:
- if (this.isVideoPlaying(videoElement)) {
- console.warn('Trying to play video that is already playing.');
- return [2 /*return*/];
- }
- _b.label = 1;
- case 1:
- _b.trys.push([1, 3,, 4]);
- return [4 /*yield*/, videoElement.play()];
- case 2:
- _b.sent();
- return [3 /*break*/, 4];
- case 3:
- _a = _b.sent();
- console.warn('It was not possible to play the video.');
- return [3 /*break*/, 4];
- case 4:
- return [2 /*return*/];
- }
- });
- });
- };
- /**
- * Searches and validates a media element.
- */
- BrowserCodeReader.prototype.getMediaElement = function (mediaElementId, type) {
- var mediaElement = document.getElementById(mediaElementId);
- if (!mediaElement) {
- throw new _ArgumentException.default("element with id '" + mediaElementId + "' not found");
- }
- if (mediaElement.nodeName.toLowerCase() !== type.toLowerCase()) {
- throw new _ArgumentException.default("element with id '" + mediaElementId + "' must be an " + type + " element");
- }
- return mediaElement;
- };
- /**
- * Decodes the barcode from an image.
- *
- * @param {(string|HTMLImageElement)} [source] The image element that can be either an element id or the element itself. Can be undefined in which case the decoding will be done from the imageUrl parameter.
- * @param {string} [url]
- * @returns {Promise<Result>} The decoding result.
- *
- * @memberOf BrowserCodeReader
- */
- BrowserCodeReader.prototype.decodeFromImage = function (source, url) {
- if (!source && !url) {
- throw new _ArgumentException.default('either imageElement with a src set or an url must be provided');
- }
- if (url && !source) {
- return this.decodeFromImageUrl(url);
- }
- return this.decodeFromImageElement(source);
- };
- /**
- * Decodes the barcode from a video.
- *
- * @param {(string|HTMLImageElement)} [source] The image element that can be either an element id or the element itself. Can be undefined in which case the decoding will be done from the imageUrl parameter.
- * @param {string} [url]
- * @returns {Promise<Result>} The decoding result.
- *
- * @memberOf BrowserCodeReader
- */
- BrowserCodeReader.prototype.decodeFromVideo = function (source, url) {
- if (!source && !url) {
- throw new _ArgumentException.default('Either an element with a src set or an URL must be provided');
- }
- if (url && !source) {
- return this.decodeFromVideoUrl(url);
- }
- return this.decodeFromVideoElement(source);
- };
- /**
- * Decodes continuously the barcode from a video.
- *
- * @param {(string|HTMLImageElement)} [source] The image element that can be either an element id or the element itself. Can be undefined in which case the decoding will be done from the imageUrl parameter.
- * @param {string} [url]
- * @returns {Promise<Result>} The decoding result.
- *
- * @memberOf BrowserCodeReader
- *
- * @experimental
- */
- BrowserCodeReader.prototype.decodeFromVideoContinuously = function (source, url, callbackFn) {
- if (undefined === source && undefined === url) {
- throw new _ArgumentException.default('Either an element with a src set or an URL must be provided');
- }
- if (url && !source) {
- return this.decodeFromVideoUrlContinuously(url, callbackFn);
- }
- return this.decodeFromVideoElementContinuously(source, callbackFn);
- };
- /**
- * Decodes something from an image HTML element.
- */
- BrowserCodeReader.prototype.decodeFromImageElement = function (source) {
- if (!source) {
- throw new _ArgumentException.default('An image element must be provided.');
- }
- this.reset();
- var element = this.prepareImageElement(source);
- this.imageElement = element;
- var task;
- if (this.isImageLoaded(element)) {
- task = this.decodeOnce(element, false, true);
- } else {
- task = this._decodeOnLoadImage(element);
- }
- return task;
- };
- /**
- * Decodes something from an image HTML element.
- */
- BrowserCodeReader.prototype.decodeFromVideoElement = function (source) {
- var element = this._decodeFromVideoElementSetup(source);
- return this._decodeOnLoadVideo(element);
- };
- /**
- * Decodes something from an image HTML element.
- */
- BrowserCodeReader.prototype.decodeFromVideoElementContinuously = function (source, callbackFn) {
- var element = this._decodeFromVideoElementSetup(source);
- return this._decodeOnLoadVideoContinuously(element, callbackFn);
- };
- /**
- * Sets up the video source so it can be decoded when loaded.
- *
- * @param source The video source element.
- */
- BrowserCodeReader.prototype._decodeFromVideoElementSetup = function (source) {
- if (!source) {
- throw new _ArgumentException.default('A video element must be provided.');
- }
- this.reset();
- var element = this.prepareVideoElement(source);
- // defines the video element before starts decoding
- this.videoElement = element;
- return element;
- };
- /**
- * Decodes an image from a URL.
- */
- BrowserCodeReader.prototype.decodeFromImageUrl = function (url) {
- if (!url) {
- throw new _ArgumentException.default('An URL must be provided.');
- }
- this.reset();
- var element = this.prepareImageElement();
- this.imageElement = element;
- var decodeTask = this._decodeOnLoadImage(element);
- element.src = url;
- return decodeTask;
- };
- /**
- * Decodes an image from a URL.
- */
- BrowserCodeReader.prototype.decodeFromVideoUrl = function (url) {
- if (!url) {
- throw new _ArgumentException.default('An URL must be provided.');
- }
- this.reset();
- // creates a new element
- var element = this.prepareVideoElement();
- var decodeTask = this.decodeFromVideoElement(element);
- element.src = url;
- return decodeTask;
- };
- /**
- * Decodes an image from a URL.
- *
- * @experimental
- */
- BrowserCodeReader.prototype.decodeFromVideoUrlContinuously = function (url, callbackFn) {
- if (!url) {
- throw new _ArgumentException.default('An URL must be provided.');
- }
- this.reset();
- // creates a new element
- var element = this.prepareVideoElement();
- var decodeTask = this.decodeFromVideoElementContinuously(element, callbackFn);
- element.src = url;
- return decodeTask;
- };
- BrowserCodeReader.prototype._decodeOnLoadImage = function (element) {
- var _this = this;
- return new Promise(function (resolve, reject) {
- _this.imageLoadedListener = function () {
- return _this.decodeOnce(element, false, true).then(resolve, reject);
- };
- element.addEventListener('load', _this.imageLoadedListener);
- });
- };
- BrowserCodeReader.prototype._decodeOnLoadVideo = function (videoElement) {
- return __awaiter(this, void 0, void 0, function () {
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- // plays the video
- return [4 /*yield*/, this.playVideoOnLoadAsync(videoElement)];
- case 1:
- // plays the video
- _a.sent();
- return [4 /*yield*/, this.decodeOnce(videoElement)];
- case 2:
- // starts decoding after played the video
- return [2 /*return*/, _a.sent()];
- }
- });
- });
- };
- BrowserCodeReader.prototype._decodeOnLoadVideoContinuously = function (videoElement, callbackFn) {
- return __awaiter(this, void 0, void 0, function () {
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- // plays the video
- return [4 /*yield*/, this.playVideoOnLoadAsync(videoElement)];
- case 1:
- // plays the video
- _a.sent();
- // starts decoding after played the video
- this.decodeContinuously(videoElement, callbackFn);
- return [2 /*return*/];
- }
- });
- });
- };
- BrowserCodeReader.prototype.isImageLoaded = function (img) {
- // During the onload event, IE correctly identifies any images that
- // weren’t downloaded as not complete. Others should too. Gecko-based
- // browsers act like NS4 in that they report this incorrectly.
- if (!img.complete) {
- return false;
- }
- // However, they do have two very useful properties: naturalWidth and
- // naturalHeight. These give the true size of the image. If it failed
- // to load, either of these should be zero.
- if (img.naturalWidth === 0) {
- return false;
- }
- // No other way of checking: assume it’s ok.
- return true;
- };
- BrowserCodeReader.prototype.prepareImageElement = function (imageSource) {
- var imageElement;
- if (typeof imageSource === 'undefined') {
- imageElement = document.createElement('img');
- imageElement.width = 200;
- imageElement.height = 200;
- }
- if (typeof imageSource === 'string') {
- imageElement = this.getMediaElement(imageSource, 'img');
- }
- if (imageSource instanceof HTMLImageElement) {
- imageElement = imageSource;
- }
- return imageElement;
- };
- /**
- * Sets a HTMLVideoElement for scanning or creates a new one.
- *
- * @param videoSource The HTMLVideoElement to be set.
- */
- BrowserCodeReader.prototype.prepareVideoElement = function (videoSource) {
- var videoElement;
- if (!videoSource && typeof document !== 'undefined') {
- videoElement = document.createElement('video');
- videoElement.width = 200;
- videoElement.height = 200;
- }
- if (typeof videoSource === 'string') {
- videoElement = this.getMediaElement(videoSource, 'video');
- }
- if (videoSource instanceof HTMLVideoElement) {
- videoElement = videoSource;
- }
- // Needed for iOS 11
- videoElement.setAttribute('autoplay', 'true');
- videoElement.setAttribute('muted', 'true');
- videoElement.setAttribute('playsinline', 'true');
- return videoElement;
- };
- /**
- * Tries to decode from the video input until it finds some value.
- */
- BrowserCodeReader.prototype.decodeOnce = function (element, retryIfNotFound, retryIfChecksumOrFormatError) {
- var _this = this;
- if (retryIfNotFound === void 0) {
- retryIfNotFound = true;
- }
- if (retryIfChecksumOrFormatError === void 0) {
- retryIfChecksumOrFormatError = true;
- }
- this._stopAsyncDecode = false;
- var loop = function loop(resolve, reject) {
- if (_this._stopAsyncDecode) {
- reject(new _NotFoundException.default('Video stream has ended before any code could be detected.'));
- _this._stopAsyncDecode = undefined;
- return;
- }
- try {
- var result = _this.decode(element);
- resolve(result);
- } catch (e) {
- var ifNotFound = retryIfNotFound && e instanceof _NotFoundException.default;
- var isChecksumOrFormatError = e instanceof _ChecksumException.default || e instanceof _FormatException.default;
- var ifChecksumOrFormat = isChecksumOrFormatError && retryIfChecksumOrFormatError;
- if (ifNotFound || ifChecksumOrFormat) {
- // trying again
- return setTimeout(loop, _this._timeBetweenDecodingAttempts, resolve, reject);
- }
- reject(e);
- }
- };
- return new Promise(function (resolve, reject) {
- return loop(resolve, reject);
- });
- };
- /**
- * Continuously decodes from video input.
- */
- BrowserCodeReader.prototype.decodeContinuously = function (element, callbackFn) {
- var _this = this;
- this._stopContinuousDecode = false;
- var loop = function loop() {
- if (_this._stopContinuousDecode) {
- _this._stopContinuousDecode = undefined;
- return;
- }
- try {
- var result = _this.decode(element);
- callbackFn(result, null);
- setTimeout(loop, _this.timeBetweenScansMillis);
- } catch (e) {
- callbackFn(null, e);
- var isChecksumOrFormatError = e instanceof _ChecksumException.default || e instanceof _FormatException.default;
- var isNotFound = e instanceof _NotFoundException.default;
- if (isChecksumOrFormatError || isNotFound) {
- // trying again
- setTimeout(loop, _this._timeBetweenDecodingAttempts);
- }
- }
- };
- loop();
- };
- /**
- * Gets the BinaryBitmap for ya! (and decodes it)
- */
- BrowserCodeReader.prototype.decode = function (element) {
- // get binary bitmap for decode function
- var binaryBitmap = this.createBinaryBitmap(element);
- return this.decodeBitmap(binaryBitmap);
- };
- /**
- * Creates a binaryBitmap based in some image source.
- *
- * @param mediaElement HTML element containing drawable image source.
- */
- BrowserCodeReader.prototype.createBinaryBitmap = function (mediaElement) {
- var ctx = this.getCaptureCanvasContext(mediaElement);
- // doing a scan with inverted colors on the second scan should only happen for video elements
- var doAutoInvert = false;
- if (mediaElement instanceof HTMLVideoElement) {
- this.drawFrameOnCanvas(mediaElement);
- doAutoInvert = true;
- } else {
- this.drawImageOnCanvas(mediaElement);
- }
- var canvas = this.getCaptureCanvas(mediaElement);
- var luminanceSource = new _HTMLCanvasElementLuminanceSource.HTMLCanvasElementLuminanceSource(canvas, doAutoInvert);
- var hybridBinarizer = new _HybridBinarizer.default(luminanceSource);
- return new _BinaryBitmap.default(hybridBinarizer);
- };
- /**
- *
- */
- BrowserCodeReader.prototype.getCaptureCanvasContext = function (mediaElement) {
- if (!this.captureCanvasContext) {
- var elem = this.getCaptureCanvas(mediaElement);
- var ctx = void 0;
- try {
- ctx = elem.getContext('2d', {
- willReadFrequently: true
- });
- } catch (e) {
- ctx = elem.getContext('2d');
- }
- this.captureCanvasContext = ctx;
- }
- return this.captureCanvasContext;
- };
- /**
- *
- */
- BrowserCodeReader.prototype.getCaptureCanvas = function (mediaElement) {
- if (!this.captureCanvas) {
- var elem = this.createCaptureCanvas(mediaElement);
- this.captureCanvas = elem;
- }
- return this.captureCanvas;
- };
- /**
- * Overwriting this allows you to manipulate the next frame in anyway you want before decode.
- */
- BrowserCodeReader.prototype.drawFrameOnCanvas = function (srcElement, dimensions, canvasElementContext) {
- if (dimensions === void 0) {
- dimensions = {
- sx: 0,
- sy: 0,
- sWidth: srcElement.videoWidth,
- sHeight: srcElement.videoHeight,
- dx: 0,
- dy: 0,
- dWidth: srcElement.videoWidth,
- dHeight: srcElement.videoHeight
- };
- }
- if (canvasElementContext === void 0) {
- canvasElementContext = this.captureCanvasContext;
- }
- canvasElementContext.drawImage(srcElement, dimensions.sx, dimensions.sy, dimensions.sWidth, dimensions.sHeight, dimensions.dx, dimensions.dy, dimensions.dWidth, dimensions.dHeight);
- };
- /**
- * Ovewriting this allows you to manipulate the snapshot image in anyway you want before decode.
- */
- BrowserCodeReader.prototype.drawImageOnCanvas = function (srcElement, dimensions, canvasElementContext) {
- if (dimensions === void 0) {
- dimensions = {
- sx: 0,
- sy: 0,
- sWidth: srcElement.naturalWidth,
- sHeight: srcElement.naturalHeight,
- dx: 0,
- dy: 0,
- dWidth: srcElement.naturalWidth,
- dHeight: srcElement.naturalHeight
- };
- }
- if (canvasElementContext === void 0) {
- canvasElementContext = this.captureCanvasContext;
- }
- canvasElementContext.drawImage(srcElement, dimensions.sx, dimensions.sy, dimensions.sWidth, dimensions.sHeight, dimensions.dx, dimensions.dy, dimensions.dWidth, dimensions.dHeight);
- };
- /**
- * Call the encapsulated readers decode
- */
- BrowserCodeReader.prototype.decodeBitmap = function (binaryBitmap) {
- return this.reader.decode(binaryBitmap, this._hints);
- };
- /**
- * 🖌 Prepares the canvas for capture and scan frames.
- */
- BrowserCodeReader.prototype.createCaptureCanvas = function (mediaElement) {
- if (typeof document === 'undefined') {
- this._destroyCaptureCanvas();
- return null;
- }
- var canvasElement = document.createElement('canvas');
- var width;
- var height;
- if (typeof mediaElement !== 'undefined') {
- if (mediaElement instanceof HTMLVideoElement) {
- width = mediaElement.videoWidth;
- height = mediaElement.videoHeight;
- } else if (mediaElement instanceof HTMLImageElement) {
- width = mediaElement.naturalWidth || mediaElement.width;
- height = mediaElement.naturalHeight || mediaElement.height;
- }
- }
- canvasElement.style.width = width + 'px';
- canvasElement.style.height = height + 'px';
- canvasElement.width = width;
- canvasElement.height = height;
- return canvasElement;
- };
- /**
- * Stops the continuous scan and cleans the stream.
- */
- BrowserCodeReader.prototype.stopStreams = function () {
- if (this.stream) {
- this.stream.getVideoTracks().forEach(function (t) {
- return t.stop();
- });
- this.stream = undefined;
- }
- if (this._stopAsyncDecode === false) {
- this.stopAsyncDecode();
- }
- if (this._stopContinuousDecode === false) {
- this.stopContinuousDecode();
- }
- };
- /**
- * Resets the code reader to the initial state. Cancels any ongoing barcode scanning from video or camera.
- *
- * @memberOf BrowserCodeReader
- */
- BrowserCodeReader.prototype.reset = function () {
- // stops the camera, preview and scan 🔴
- this.stopStreams();
- // clean and forget about HTML elements
- this._destroyVideoElement();
- this._destroyImageElement();
- this._destroyCaptureCanvas();
- };
- BrowserCodeReader.prototype._destroyVideoElement = function () {
- if (!this.videoElement) {
- return;
- }
- // first gives freedon to the element 🕊
- if (typeof this.videoEndedListener !== 'undefined') {
- this.videoElement.removeEventListener('ended', this.videoEndedListener);
- }
- if (typeof this.videoPlayingEventListener !== 'undefined') {
- this.videoElement.removeEventListener('playing', this.videoPlayingEventListener);
- }
- if (typeof this.videoCanPlayListener !== 'undefined') {
- this.videoElement.removeEventListener('loadedmetadata', this.videoCanPlayListener);
- }
- // then forgets about that element 😢
- this.cleanVideoSource(this.videoElement);
- this.videoElement = undefined;
- };
- BrowserCodeReader.prototype._destroyImageElement = function () {
- if (!this.imageElement) {
- return;
- }
- // first gives freedon to the element 🕊
- if (undefined !== this.imageLoadedListener) {
- this.imageElement.removeEventListener('load', this.imageLoadedListener);
- }
- // then forget about that element 😢
- this.imageElement.src = undefined;
- this.imageElement.removeAttribute('src');
- this.imageElement = undefined;
- };
- /**
- * Cleans canvas references 🖌
- */
- BrowserCodeReader.prototype._destroyCaptureCanvas = function () {
- // then forget about that element 😢
- this.captureCanvasContext = undefined;
- this.captureCanvas = undefined;
- };
- /**
- * Defines what the videoElement src will be.
- *
- * @param videoElement
- * @param stream
- */
- BrowserCodeReader.prototype.addVideoSource = function (videoElement, stream) {
- // Older browsers may not have `srcObject`
- try {
- // @note Throws Exception if interrupted by a new loaded request
- videoElement.srcObject = stream;
- } catch (err) {
- // @note Avoid using this in new browsers, as it is going away.
- // @ts-ignore
- videoElement.src = URL.createObjectURL(stream);
- }
- };
- /**
- * Unbinds a HTML video src property.
- *
- * @param videoElement
- */
- BrowserCodeReader.prototype.cleanVideoSource = function (videoElement) {
- try {
- videoElement.srcObject = null;
- } catch (err) {
- videoElement.src = '';
- }
- this.videoElement.removeAttribute('src');
- };
- return BrowserCodeReader;
- }();
- exports.BrowserCodeReader = BrowserCodeReader;
- /***/ }),
- /* 304 */
- /*!*************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/ArgumentException.js ***!
- \*************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _Exception = _interopRequireDefault(__webpack_require__(/*! ./Exception */ 305));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /**
- * Custom Error class of type Exception.
- */
- var ArgumentException = /** @class */function (_super) {
- __extends(ArgumentException, _super);
- function ArgumentException() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ArgumentException.kind = 'ArgumentException';
- return ArgumentException;
- }(_Exception.default);
- var _default = ArgumentException;
- exports.default = _default;
- /***/ }),
- /* 305 */
- /*!*****************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/Exception.js ***!
- \*****************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _tsCustomError = __webpack_require__(/*! ts-custom-error */ 306);
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /**
- * Custom Error class of type Exception.
- */
- var Exception = /** @class */function (_super) {
- __extends(Exception, _super);
- /**
- * Allows Exception to be constructed directly
- * with some message and prototype definition.
- */
- function Exception(message) {
- if (message === void 0) {
- message = undefined;
- }
- var _this = _super.call(this, message) || this;
- _this.message = message;
- return _this;
- }
- Exception.prototype.getKind = function () {
- var ex = this.constructor;
- return ex.kind;
- };
- /**
- * It's typed as string so it can be extended and overriden.
- */
- Exception.kind = 'Exception';
- return Exception;
- }(_tsCustomError.CustomError);
- var _default = Exception;
- exports.default = _default;
- /***/ }),
- /* 306 */
- /*!******************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/ts-custom-error/dist/custom-error.mjs ***!
- \******************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.CustomError = void 0;
- exports.customErrorFactory = customErrorFactory;
- function fixProto(target, prototype) {
- var setPrototypeOf = Object.setPrototypeOf;
- setPrototypeOf ? setPrototypeOf(target, prototype) : target.__proto__ = prototype;
- }
- function fixStack(target, fn) {
- if (fn === void 0) {
- fn = target.constructor;
- }
- var captureStackTrace = Error.captureStackTrace;
- captureStackTrace && captureStackTrace(target, fn);
- }
- var __extends = undefined && undefined.__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var CustomError = function (_super) {
- __extends(CustomError, _super);
- function CustomError(message, options) {
- var _newTarget = this.constructor;
- var _this = _super.call(this, message, options) || this;
- Object.defineProperty(_this, 'name', {
- value: _newTarget.name,
- enumerable: false,
- configurable: true
- });
- fixProto(_this, _newTarget.prototype);
- fixStack(_this);
- return _this;
- }
- return CustomError;
- }(Error);
- exports.CustomError = CustomError;
- var __spreadArray = undefined && undefined.__spreadArray || function (to, from, pack) {
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
- if (ar || !(i in from)) {
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
- ar[i] = from[i];
- }
- }
- return to.concat(ar || Array.prototype.slice.call(from));
- };
- function customErrorFactory(fn, parent) {
- if (parent === void 0) {
- parent = Error;
- }
- function CustomError() {
- var args = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
- if (!(this instanceof CustomError)) return new (CustomError.bind.apply(CustomError, __spreadArray([void 0], args, false)))();
- parent.apply(this, args);
- Object.defineProperty(this, 'name', {
- value: fn.name || parent.name,
- enumerable: false,
- configurable: true
- });
- fn.apply(this, args);
- fixStack(this, CustomError);
- }
- return Object.defineProperties(CustomError, {
- prototype: {
- value: Object.create(parent.prototype, {
- constructor: {
- value: CustomError,
- writable: true,
- configurable: true
- }
- })
- }
- });
- }
- /***/ }),
- /* 307 */
- /*!********************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/BinaryBitmap.js ***!
- \********************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ./IllegalArgumentException */ 308));
- /*
- * Copyright 2009 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var BinaryBitmap = /** @class */function () {
- function BinaryBitmap(binarizer) {
- this.binarizer = binarizer;
- if (binarizer === null) {
- throw new _IllegalArgumentException.default('Binarizer must be non-null.');
- }
- }
- /**
- * @return The width of the bitmap.
- */
- BinaryBitmap.prototype.getWidth = function () {
- return this.binarizer.getWidth();
- };
- /**
- * @return The height of the bitmap.
- */
- BinaryBitmap.prototype.getHeight = function () {
- return this.binarizer.getHeight();
- };
- /**
- * Converts one row of luminance data to 1 bit data. May actually do the conversion, or return
- * cached data. Callers should assume this method is expensive and call it as seldom as possible.
- * This method is intended for decoding 1D barcodes and may choose to apply sharpening.
- *
- * @param y The row to fetch, which must be in [0, bitmap height)
- * @param row An optional preallocated array. If null or too small, it will be ignored.
- * If used, the Binarizer will call BitArray.clear(). Always use the returned object.
- * @return The array of bits for this row (true means black).
- * @throws NotFoundException if row can't be binarized
- */
- BinaryBitmap.prototype.getBlackRow = function (y /*int*/, row) {
- return this.binarizer.getBlackRow(y, row);
- };
- /**
- * Converts a 2D array of luminance data to 1 bit. As above, assume this method is expensive
- * and do not call it repeatedly. This method is intended for decoding 2D barcodes and may or
- * may not apply sharpening. Therefore, a row from this matrix may not be identical to one
- * fetched using getBlackRow(), so don't mix and match between them.
- *
- * @return The 2D array of bits for the image (true means black).
- * @throws NotFoundException if image can't be binarized to make a matrix
- */
- BinaryBitmap.prototype.getBlackMatrix = function () {
- // The matrix is created on demand the first time it is requested, then cached. There are two
- // reasons for this:
- // 1. This work will never be done if the caller only installs 1D Reader objects, or if a
- // 1D Reader finds a barcode before the 2D Readers run.
- // 2. This work will only be done once even if the caller installs multiple 2D Readers.
- if (this.matrix === null || this.matrix === undefined) {
- this.matrix = this.binarizer.getBlackMatrix();
- }
- return this.matrix;
- };
- /**
- * @return Whether this bitmap can be cropped.
- */
- BinaryBitmap.prototype.isCropSupported = function () {
- return this.binarizer.getLuminanceSource().isCropSupported();
- };
- /**
- * Returns a new object with cropped image data. Implementations may keep a reference to the
- * original data rather than a copy. Only callable if isCropSupported() is true.
- *
- * @param left The left coordinate, which must be in [0,getWidth())
- * @param top The top coordinate, which must be in [0,getHeight())
- * @param width The width of the rectangle to crop.
- * @param height The height of the rectangle to crop.
- * @return A cropped version of this object.
- */
- BinaryBitmap.prototype.crop = function (left /*int*/, top /*int*/, width /*int*/, height /*int*/) {
- var newSource = this.binarizer.getLuminanceSource().crop(left, top, width, height);
- return new BinaryBitmap(this.binarizer.createBinarizer(newSource));
- };
- /**
- * @return Whether this bitmap supports counter-clockwise rotation.
- */
- BinaryBitmap.prototype.isRotateSupported = function () {
- return this.binarizer.getLuminanceSource().isRotateSupported();
- };
- /**
- * Returns a new object with rotated image data by 90 degrees counterclockwise.
- * Only callable if {@link #isRotateSupported()} is true.
- *
- * @return A rotated version of this object.
- */
- BinaryBitmap.prototype.rotateCounterClockwise = function () {
- var newSource = this.binarizer.getLuminanceSource().rotateCounterClockwise();
- return new BinaryBitmap(this.binarizer.createBinarizer(newSource));
- };
- /**
- * Returns a new object with rotated image data by 45 degrees counterclockwise.
- * Only callable if {@link #isRotateSupported()} is true.
- *
- * @return A rotated version of this object.
- */
- BinaryBitmap.prototype.rotateCounterClockwise45 = function () {
- var newSource = this.binarizer.getLuminanceSource().rotateCounterClockwise45();
- return new BinaryBitmap(this.binarizer.createBinarizer(newSource));
- };
- /*@Override*/
- BinaryBitmap.prototype.toString = function () {
- try {
- return this.getBlackMatrix().toString();
- } catch (e /*: NotFoundException*/) {
- return '';
- }
- };
- return BinaryBitmap;
- }();
- var _default = BinaryBitmap;
- exports.default = _default;
- /***/ }),
- /* 308 */
- /*!********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/IllegalArgumentException.js ***!
- \********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _Exception = _interopRequireDefault(__webpack_require__(/*! ./Exception */ 305));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /**
- * Custom Error class of type Exception.
- */
- var IllegalArgumentException = /** @class */function (_super) {
- __extends(IllegalArgumentException, _super);
- function IllegalArgumentException() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- IllegalArgumentException.kind = 'IllegalArgumentException';
- return IllegalArgumentException;
- }(_Exception.default);
- var _default = IllegalArgumentException;
- exports.default = _default;
- /***/ }),
- /* 309 */
- /*!*************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/ChecksumException.js ***!
- \*************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _Exception = _interopRequireDefault(__webpack_require__(/*! ./Exception */ 305));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /**
- * Custom Error class of type Exception.
- */
- var ChecksumException = /** @class */function (_super) {
- __extends(ChecksumException, _super);
- function ChecksumException() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ChecksumException.getChecksumInstance = function () {
- return new ChecksumException();
- };
- ChecksumException.kind = 'ChecksumException';
- return ChecksumException;
- }(_Exception.default);
- var _default = ChecksumException;
- exports.default = _default;
- /***/ }),
- /* 310 */
- /*!******************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/HybridBinarizer.js ***!
- \******************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _GlobalHistogramBinarizer = _interopRequireDefault(__webpack_require__(/*! ./GlobalHistogramBinarizer */ 311));
- var _BitMatrix = _interopRequireDefault(__webpack_require__(/*! ./BitMatrix */ 319));
- /*
- * Copyright 2009 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /**
- * This class implements a local thresholding algorithm, which while slower than the
- * GlobalHistogramBinarizer, is fairly efficient for what it does. It is designed for
- * high frequency images of barcodes with black data on white backgrounds. For this application,
- * it does a much better job than a global blackpoint with severe shadows and gradients.
- * However it tends to produce artifacts on lower frequency images and is therefore not
- * a good general purpose binarizer for uses outside ZXing.
- *
- * This class extends GlobalHistogramBinarizer, using the older histogram approach for 1D readers,
- * and the newer local approach for 2D readers. 1D decoding using a per-row histogram is already
- * inherently local, and only fails for horizontal gradients. We can revisit that problem later,
- * but for now it was not a win to use local blocks for 1D.
- *
- * This Binarizer is the default for the unit tests and the recommended class for library users.
- *
- * @author dswitkin@google.com (Daniel Switkin)
- */
- var HybridBinarizer = /** @class */function (_super) {
- __extends(HybridBinarizer, _super);
- function HybridBinarizer(source) {
- var _this = _super.call(this, source) || this;
- _this.matrix = null;
- return _this;
- }
- /**
- * Calculates the final BitMatrix once for all requests. This could be called once from the
- * constructor instead, but there are some advantages to doing it lazily, such as making
- * profiling easier, and not doing heavy lifting when callers don't expect it.
- */
- /*@Override*/
- HybridBinarizer.prototype.getBlackMatrix = function () {
- if (this.matrix !== null) {
- return this.matrix;
- }
- var source = this.getLuminanceSource();
- var width = source.getWidth();
- var height = source.getHeight();
- if (width >= HybridBinarizer.MINIMUM_DIMENSION && height >= HybridBinarizer.MINIMUM_DIMENSION) {
- var luminances = source.getMatrix();
- var subWidth = width >> HybridBinarizer.BLOCK_SIZE_POWER;
- if ((width & HybridBinarizer.BLOCK_SIZE_MASK) !== 0) {
- subWidth++;
- }
- var subHeight = height >> HybridBinarizer.BLOCK_SIZE_POWER;
- if ((height & HybridBinarizer.BLOCK_SIZE_MASK) !== 0) {
- subHeight++;
- }
- var blackPoints = HybridBinarizer.calculateBlackPoints(luminances, subWidth, subHeight, width, height);
- var newMatrix = new _BitMatrix.default(width, height);
- HybridBinarizer.calculateThresholdForBlock(luminances, subWidth, subHeight, width, height, blackPoints, newMatrix);
- this.matrix = newMatrix;
- } else {
- // If the image is too small, fall back to the global histogram approach.
- this.matrix = _super.prototype.getBlackMatrix.call(this);
- }
- return this.matrix;
- };
- /*@Override*/
- HybridBinarizer.prototype.createBinarizer = function (source) {
- return new HybridBinarizer(source);
- };
- /**
- * For each block in the image, calculate the average black point using a 5x5 grid
- * of the blocks around it. Also handles the corner cases (fractional blocks are computed based
- * on the last pixels in the row/column which are also used in the previous block).
- */
- HybridBinarizer.calculateThresholdForBlock = function (luminances, subWidth /*int*/, subHeight /*int*/, width /*int*/, height /*int*/, blackPoints, matrix) {
- var maxYOffset = height - HybridBinarizer.BLOCK_SIZE;
- var maxXOffset = width - HybridBinarizer.BLOCK_SIZE;
- for (var y = 0; y < subHeight; y++) {
- var yoffset = y << HybridBinarizer.BLOCK_SIZE_POWER;
- if (yoffset > maxYOffset) {
- yoffset = maxYOffset;
- }
- var top_1 = HybridBinarizer.cap(y, 2, subHeight - 3);
- for (var x = 0; x < subWidth; x++) {
- var xoffset = x << HybridBinarizer.BLOCK_SIZE_POWER;
- if (xoffset > maxXOffset) {
- xoffset = maxXOffset;
- }
- var left = HybridBinarizer.cap(x, 2, subWidth - 3);
- var sum = 0;
- for (var z = -2; z <= 2; z++) {
- var blackRow = blackPoints[top_1 + z];
- sum += blackRow[left - 2] + blackRow[left - 1] + blackRow[left] + blackRow[left + 1] + blackRow[left + 2];
- }
- var average = sum / 25;
- HybridBinarizer.thresholdBlock(luminances, xoffset, yoffset, average, width, matrix);
- }
- }
- };
- HybridBinarizer.cap = function (value /*int*/, min /*int*/, max /*int*/) {
- return value < min ? min : value > max ? max : value;
- };
- /**
- * Applies a single threshold to a block of pixels.
- */
- HybridBinarizer.thresholdBlock = function (luminances, xoffset /*int*/, yoffset /*int*/, threshold /*int*/, stride /*int*/, matrix) {
- for (var y = 0, offset = yoffset * stride + xoffset; y < HybridBinarizer.BLOCK_SIZE; y++, offset += stride) {
- for (var x = 0; x < HybridBinarizer.BLOCK_SIZE; x++) {
- // Comparison needs to be <= so that black == 0 pixels are black even if the threshold is 0.
- if ((luminances[offset + x] & 0xFF) <= threshold) {
- matrix.set(xoffset + x, yoffset + y);
- }
- }
- }
- };
- /**
- * Calculates a single black point for each block of pixels and saves it away.
- * See the following thread for a discussion of this algorithm:
- * http://groups.google.com/group/zxing/browse_thread/thread/d06efa2c35a7ddc0
- */
- HybridBinarizer.calculateBlackPoints = function (luminances, subWidth /*int*/, subHeight /*int*/, width /*int*/, height /*int*/) {
- var maxYOffset = height - HybridBinarizer.BLOCK_SIZE;
- var maxXOffset = width - HybridBinarizer.BLOCK_SIZE;
- // tslint:disable-next-line:whitespace
- var blackPoints = new Array(subHeight); // subWidth
- for (var y = 0; y < subHeight; y++) {
- blackPoints[y] = new Int32Array(subWidth);
- var yoffset = y << HybridBinarizer.BLOCK_SIZE_POWER;
- if (yoffset > maxYOffset) {
- yoffset = maxYOffset;
- }
- for (var x = 0; x < subWidth; x++) {
- var xoffset = x << HybridBinarizer.BLOCK_SIZE_POWER;
- if (xoffset > maxXOffset) {
- xoffset = maxXOffset;
- }
- var sum = 0;
- var min = 0xFF;
- var max = 0;
- for (var yy = 0, offset = yoffset * width + xoffset; yy < HybridBinarizer.BLOCK_SIZE; yy++, offset += width) {
- for (var xx = 0; xx < HybridBinarizer.BLOCK_SIZE; xx++) {
- var pixel = luminances[offset + xx] & 0xFF;
- sum += pixel;
- // still looking for good contrast
- if (pixel < min) {
- min = pixel;
- }
- if (pixel > max) {
- max = pixel;
- }
- }
- // short-circuit min/max tests once dynamic range is met
- if (max - min > HybridBinarizer.MIN_DYNAMIC_RANGE) {
- // finish the rest of the rows quickly
- for (yy++, offset += width; yy < HybridBinarizer.BLOCK_SIZE; yy++, offset += width) {
- for (var xx = 0; xx < HybridBinarizer.BLOCK_SIZE; xx++) {
- sum += luminances[offset + xx] & 0xFF;
- }
- }
- }
- }
- // The default estimate is the average of the values in the block.
- var average = sum >> HybridBinarizer.BLOCK_SIZE_POWER * 2;
- if (max - min <= HybridBinarizer.MIN_DYNAMIC_RANGE) {
- // If variation within the block is low, assume this is a block with only light or only
- // dark pixels. In that case we do not want to use the average, as it would divide this
- // low contrast area into black and white pixels, essentially creating data out of noise.
- //
- // The default assumption is that the block is light/background. Since no estimate for
- // the level of dark pixels exists locally, use half the min for the block.
- average = min / 2;
- if (y > 0 && x > 0) {
- // Correct the "white background" assumption for blocks that have neighbors by comparing
- // the pixels in this block to the previously calculated black points. This is based on
- // the fact that dark barcode symbology is always surrounded by some amount of light
- // background for which reasonable black point estimates were made. The bp estimated at
- // the boundaries is used for the interior.
- // The (min < bp) is arbitrary but works better than other heuristics that were tried.
- var averageNeighborBlackPoint = (blackPoints[y - 1][x] + 2 * blackPoints[y][x - 1] + blackPoints[y - 1][x - 1]) / 4;
- if (min < averageNeighborBlackPoint) {
- average = averageNeighborBlackPoint;
- }
- }
- }
- blackPoints[y][x] = average;
- }
- }
- return blackPoints;
- };
- // This class uses 5x5 blocks to compute local luminance, where each block is 8x8 pixels.
- // So this is the smallest dimension in each axis we can accept.
- HybridBinarizer.BLOCK_SIZE_POWER = 3;
- HybridBinarizer.BLOCK_SIZE = 1 << HybridBinarizer.BLOCK_SIZE_POWER; // ...0100...00
- HybridBinarizer.BLOCK_SIZE_MASK = HybridBinarizer.BLOCK_SIZE - 1; // ...0011...11
- HybridBinarizer.MINIMUM_DIMENSION = HybridBinarizer.BLOCK_SIZE * 5;
- HybridBinarizer.MIN_DYNAMIC_RANGE = 24;
- return HybridBinarizer;
- }(_GlobalHistogramBinarizer.default);
- var _default = HybridBinarizer;
- exports.default = _default;
- /***/ }),
- /* 311 */
- /*!***************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/GlobalHistogramBinarizer.js ***!
- \***************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _Binarizer = _interopRequireDefault(__webpack_require__(/*! ../Binarizer */ 312));
- var _BitArray = _interopRequireDefault(__webpack_require__(/*! ./BitArray */ 313));
- var _BitMatrix = _interopRequireDefault(__webpack_require__(/*! ./BitMatrix */ 319));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
- /*
- * Copyright 2009 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /*namespace com.google.zxing.common {*/
- /**
- * This Binarizer implementation uses the old ZXing global histogram approach. It is suitable
- * for low-end mobile devices which don't have enough CPU or memory to use a local thresholding
- * algorithm. However, because it picks a global black point, it cannot handle difficult shadows
- * and gradients.
- *
- * Faster mobile devices and all desktop applications should probably use HybridBinarizer instead.
- *
- * @author dswitkin@google.com (Daniel Switkin)
- * @author Sean Owen
- */
- var GlobalHistogramBinarizer = /** @class */function (_super) {
- __extends(GlobalHistogramBinarizer, _super);
- function GlobalHistogramBinarizer(source) {
- var _this = _super.call(this, source) || this;
- _this.luminances = GlobalHistogramBinarizer.EMPTY;
- _this.buckets = new Int32Array(GlobalHistogramBinarizer.LUMINANCE_BUCKETS);
- return _this;
- }
- // Applies simple sharpening to the row data to improve performance of the 1D Readers.
- /*@Override*/
- GlobalHistogramBinarizer.prototype.getBlackRow = function (y /*int*/, row) {
- var source = this.getLuminanceSource();
- var width = source.getWidth();
- if (row === undefined || row === null || row.getSize() < width) {
- row = new _BitArray.default(width);
- } else {
- row.clear();
- }
- this.initArrays(width);
- var localLuminances = source.getRow(y, this.luminances);
- var localBuckets = this.buckets;
- for (var x = 0; x < width; x++) {
- localBuckets[(localLuminances[x] & 0xff) >> GlobalHistogramBinarizer.LUMINANCE_SHIFT]++;
- }
- var blackPoint = GlobalHistogramBinarizer.estimateBlackPoint(localBuckets);
- if (width < 3) {
- // Special case for very small images
- for (var x = 0; x < width; x++) {
- if ((localLuminances[x] & 0xff) < blackPoint) {
- row.set(x);
- }
- }
- } else {
- var left = localLuminances[0] & 0xff;
- var center = localLuminances[1] & 0xff;
- for (var x = 1; x < width - 1; x++) {
- var right = localLuminances[x + 1] & 0xff;
- // A simple -1 4 -1 box filter with a weight of 2.
- if ((center * 4 - left - right) / 2 < blackPoint) {
- row.set(x);
- }
- left = center;
- center = right;
- }
- }
- return row;
- };
- // Does not sharpen the data, as this call is intended to only be used by 2D Readers.
- /*@Override*/
- GlobalHistogramBinarizer.prototype.getBlackMatrix = function () {
- var source = this.getLuminanceSource();
- var width = source.getWidth();
- var height = source.getHeight();
- var matrix = new _BitMatrix.default(width, height);
- // Quickly calculates the histogram by sampling four rows from the image. This proved to be
- // more robust on the blackbox tests than sampling a diagonal as we used to do.
- this.initArrays(width);
- var localBuckets = this.buckets;
- for (var y = 1; y < 5; y++) {
- var row = Math.floor(height * y / 5);
- var localLuminances_1 = source.getRow(row, this.luminances);
- var right = Math.floor(width * 4 / 5);
- for (var x = Math.floor(width / 5); x < right; x++) {
- var pixel = localLuminances_1[x] & 0xff;
- localBuckets[pixel >> GlobalHistogramBinarizer.LUMINANCE_SHIFT]++;
- }
- }
- var blackPoint = GlobalHistogramBinarizer.estimateBlackPoint(localBuckets);
- // We delay reading the entire image luminance until the black point estimation succeeds.
- // Although we end up reading four rows twice, it is consistent with our motto of
- // "fail quickly" which is necessary for continuous scanning.
- var localLuminances = source.getMatrix();
- for (var y = 0; y < height; y++) {
- var offset = y * width;
- for (var x = 0; x < width; x++) {
- var pixel = localLuminances[offset + x] & 0xff;
- if (pixel < blackPoint) {
- matrix.set(x, y);
- }
- }
- }
- return matrix;
- };
- /*@Override*/
- GlobalHistogramBinarizer.prototype.createBinarizer = function (source) {
- return new GlobalHistogramBinarizer(source);
- };
- GlobalHistogramBinarizer.prototype.initArrays = function (luminanceSize /*int*/) {
- if (this.luminances.length < luminanceSize) {
- this.luminances = new Uint8ClampedArray(luminanceSize);
- }
- var buckets = this.buckets;
- for (var x = 0; x < GlobalHistogramBinarizer.LUMINANCE_BUCKETS; x++) {
- buckets[x] = 0;
- }
- };
- GlobalHistogramBinarizer.estimateBlackPoint = function (buckets) {
- // Find the tallest peak in the histogram.
- var numBuckets = buckets.length;
- var maxBucketCount = 0;
- var firstPeak = 0;
- var firstPeakSize = 0;
- for (var x = 0; x < numBuckets; x++) {
- if (buckets[x] > firstPeakSize) {
- firstPeak = x;
- firstPeakSize = buckets[x];
- }
- if (buckets[x] > maxBucketCount) {
- maxBucketCount = buckets[x];
- }
- }
- // Find the second-tallest peak which is somewhat far from the tallest peak.
- var secondPeak = 0;
- var secondPeakScore = 0;
- for (var x = 0; x < numBuckets; x++) {
- var distanceToBiggest = x - firstPeak;
- // Encourage more distant second peaks by multiplying by square of distance.
- var score = buckets[x] * distanceToBiggest * distanceToBiggest;
- if (score > secondPeakScore) {
- secondPeak = x;
- secondPeakScore = score;
- }
- }
- // Make sure firstPeak corresponds to the black peak.
- if (firstPeak > secondPeak) {
- var temp = firstPeak;
- firstPeak = secondPeak;
- secondPeak = temp;
- }
- // If there is too little contrast in the image to pick a meaningful black point, throw rather
- // than waste time trying to decode the image, and risk false positives.
- if (secondPeak - firstPeak <= numBuckets / 16) {
- throw new _NotFoundException.default();
- }
- // Find a valley between them that is low and closer to the white peak.
- var bestValley = secondPeak - 1;
- var bestValleyScore = -1;
- for (var x = secondPeak - 1; x > firstPeak; x--) {
- var fromFirst = x - firstPeak;
- var score = fromFirst * fromFirst * (secondPeak - x) * (maxBucketCount - buckets[x]);
- if (score > bestValleyScore) {
- bestValley = x;
- bestValleyScore = score;
- }
- }
- return bestValley << GlobalHistogramBinarizer.LUMINANCE_SHIFT;
- };
- GlobalHistogramBinarizer.LUMINANCE_BITS = 5;
- GlobalHistogramBinarizer.LUMINANCE_SHIFT = 8 - GlobalHistogramBinarizer.LUMINANCE_BITS;
- GlobalHistogramBinarizer.LUMINANCE_BUCKETS = 1 << GlobalHistogramBinarizer.LUMINANCE_BITS;
- GlobalHistogramBinarizer.EMPTY = Uint8ClampedArray.from([0]);
- return GlobalHistogramBinarizer;
- }(_Binarizer.default);
- var _default = GlobalHistogramBinarizer;
- exports.default = _default;
- /***/ }),
- /* 312 */
- /*!*****************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/Binarizer.js ***!
- \*****************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- /*
- * Copyright 2009 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /**
- * This class hierarchy provides a set of methods to convert luminance data to 1 bit data.
- * It allows the algorithm to vary polymorphically, for example allowing a very expensive
- * thresholding technique for servers and a fast one for mobile. It also permits the implementation
- * to vary, e.g. a JNI version for Android and a Java fallback version for other platforms.
- *
- * @author dswitkin@google.com (Daniel Switkin)
- */
- var Binarizer = /** @class */function () {
- function Binarizer(source) {
- this.source = source;
- }
- Binarizer.prototype.getLuminanceSource = function () {
- return this.source;
- };
- Binarizer.prototype.getWidth = function () {
- return this.source.getWidth();
- };
- Binarizer.prototype.getHeight = function () {
- return this.source.getHeight();
- };
- return Binarizer;
- }();
- var _default = Binarizer;
- exports.default = _default;
- /***/ }),
- /* 313 */
- /*!***********************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/BitArray.js ***!
- \***********************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../IllegalArgumentException */ 308));
- var _Arrays = _interopRequireDefault(__webpack_require__(/*! ../util/Arrays */ 314));
- var _Integer = _interopRequireDefault(__webpack_require__(/*! ../util/Integer */ 318));
- var _System = _interopRequireDefault(__webpack_require__(/*! ../util/System */ 315));
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /*namespace com.google.zxing.common {*/
- /*import java.util.Arrays;*/
- /**
- * <p>A simple, fast array of bits, represented compactly by an array of ints internally.</p>
- *
- * @author Sean Owen
- */
- var BitArray /*implements Cloneable*/ = /** @class */function () {
- // public constructor() {
- // this.size = 0
- // this.bits = new Int32Array(1)
- // }
- // public constructor(size?: number /*int*/) {
- // if (undefined === size) {
- // this.size = 0
- // } else {
- // this.size = size
- // }
- // this.bits = this.makeArray(size)
- // }
- // For testing only
- function BitArray(size /*int*/, bits) {
- if (undefined === size) {
- this.size = 0;
- this.bits = new Int32Array(1);
- } else {
- this.size = size;
- if (undefined === bits || null === bits) {
- this.bits = BitArray.makeArray(size);
- } else {
- this.bits = bits;
- }
- }
- }
- BitArray.prototype.getSize = function () {
- return this.size;
- };
- BitArray.prototype.getSizeInBytes = function () {
- return Math.floor((this.size + 7) / 8);
- };
- BitArray.prototype.ensureCapacity = function (size /*int*/) {
- if (size > this.bits.length * 32) {
- var newBits = BitArray.makeArray(size);
- _System.default.arraycopy(this.bits, 0, newBits, 0, this.bits.length);
- this.bits = newBits;
- }
- };
- /**
- * @param i bit to get
- * @return true iff bit i is set
- */
- BitArray.prototype.get = function (i /*int*/) {
- return (this.bits[Math.floor(i / 32)] & 1 << (i & 0x1F)) !== 0;
- };
- /**
- * Sets bit i.
- *
- * @param i bit to set
- */
- BitArray.prototype.set = function (i /*int*/) {
- this.bits[Math.floor(i / 32)] |= 1 << (i & 0x1F);
- };
- /**
- * Flips bit i.
- *
- * @param i bit to set
- */
- BitArray.prototype.flip = function (i /*int*/) {
- this.bits[Math.floor(i / 32)] ^= 1 << (i & 0x1F);
- };
- /**
- * @param from first bit to check
- * @return index of first bit that is set, starting from the given index, or size if none are set
- * at or beyond this given index
- * @see #getNextUnset(int)
- */
- BitArray.prototype.getNextSet = function (from /*int*/) {
- var size = this.size;
- if (from >= size) {
- return size;
- }
- var bits = this.bits;
- var bitsOffset = Math.floor(from / 32);
- var currentBits = bits[bitsOffset];
- // mask off lesser bits first
- currentBits &= ~((1 << (from & 0x1F)) - 1);
- var length = bits.length;
- while (currentBits === 0) {
- if (++bitsOffset === length) {
- return size;
- }
- currentBits = bits[bitsOffset];
- }
- var result = bitsOffset * 32 + _Integer.default.numberOfTrailingZeros(currentBits);
- return result > size ? size : result;
- };
- /**
- * @param from index to start looking for unset bit
- * @return index of next unset bit, or {@code size} if none are unset until the end
- * @see #getNextSet(int)
- */
- BitArray.prototype.getNextUnset = function (from /*int*/) {
- var size = this.size;
- if (from >= size) {
- return size;
- }
- var bits = this.bits;
- var bitsOffset = Math.floor(from / 32);
- var currentBits = ~bits[bitsOffset];
- // mask off lesser bits first
- currentBits &= ~((1 << (from & 0x1F)) - 1);
- var length = bits.length;
- while (currentBits === 0) {
- if (++bitsOffset === length) {
- return size;
- }
- currentBits = ~bits[bitsOffset];
- }
- var result = bitsOffset * 32 + _Integer.default.numberOfTrailingZeros(currentBits);
- return result > size ? size : result;
- };
- /**
- * Sets a block of 32 bits, starting at bit i.
- *
- * @param i first bit to set
- * @param newBits the new value of the next 32 bits. Note again that the least-significant bit
- * corresponds to bit i, the next-least-significant to i+1, and so on.
- */
- BitArray.prototype.setBulk = function (i /*int*/, newBits /*int*/) {
- this.bits[Math.floor(i / 32)] = newBits;
- };
- /**
- * Sets a range of bits.
- *
- * @param start start of range, inclusive.
- * @param end end of range, exclusive
- */
- BitArray.prototype.setRange = function (start /*int*/, end /*int*/) {
- if (end < start || start < 0 || end > this.size) {
- throw new _IllegalArgumentException.default();
- }
- if (end === start) {
- return;
- }
- end--; // will be easier to treat this as the last actually set bit -- inclusive
- var firstInt = Math.floor(start / 32);
- var lastInt = Math.floor(end / 32);
- var bits = this.bits;
- for (var i = firstInt; i <= lastInt; i++) {
- var firstBit = i > firstInt ? 0 : start & 0x1F;
- var lastBit = i < lastInt ? 31 : end & 0x1F;
- // Ones from firstBit to lastBit, inclusive
- var mask = (2 << lastBit) - (1 << firstBit);
- bits[i] |= mask;
- }
- };
- /**
- * Clears all bits (sets to false).
- */
- BitArray.prototype.clear = function () {
- var max = this.bits.length;
- var bits = this.bits;
- for (var i = 0; i < max; i++) {
- bits[i] = 0;
- }
- };
- /**
- * Efficient method to check if a range of bits is set, or not set.
- *
- * @param start start of range, inclusive.
- * @param end end of range, exclusive
- * @param value if true, checks that bits in range are set, otherwise checks that they are not set
- * @return true iff all bits are set or not set in range, according to value argument
- * @throws IllegalArgumentException if end is less than start or the range is not contained in the array
- */
- BitArray.prototype.isRange = function (start /*int*/, end /*int*/, value) {
- if (end < start || start < 0 || end > this.size) {
- throw new _IllegalArgumentException.default();
- }
- if (end === start) {
- return true; // empty range matches
- }
- end--; // will be easier to treat this as the last actually set bit -- inclusive
- var firstInt = Math.floor(start / 32);
- var lastInt = Math.floor(end / 32);
- var bits = this.bits;
- for (var i = firstInt; i <= lastInt; i++) {
- var firstBit = i > firstInt ? 0 : start & 0x1F;
- var lastBit = i < lastInt ? 31 : end & 0x1F;
- // Ones from firstBit to lastBit, inclusive
- var mask = (2 << lastBit) - (1 << firstBit) & 0xFFFFFFFF;
- // TYPESCRIPTPORT: & 0xFFFFFFFF added to discard anything after 32 bits, as ES has 53 bits
- // Return false if we're looking for 1s and the masked bits[i] isn't all 1s (is: that,
- // equals the mask, or we're looking for 0s and the masked portion is not all 0s
- if ((bits[i] & mask) !== (value ? mask : 0)) {
- return false;
- }
- }
- return true;
- };
- BitArray.prototype.appendBit = function (bit) {
- this.ensureCapacity(this.size + 1);
- if (bit) {
- this.bits[Math.floor(this.size / 32)] |= 1 << (this.size & 0x1F);
- }
- this.size++;
- };
- /**
- * Appends the least-significant bits, from value, in order from most-significant to
- * least-significant. For example, appending 6 bits from 0x000001E will append the bits
- * 0, 1, 1, 1, 1, 0 in that order.
- *
- * @param value {@code int} containing bits to append
- * @param numBits bits from value to append
- */
- BitArray.prototype.appendBits = function (value /*int*/, numBits /*int*/) {
- if (numBits < 0 || numBits > 32) {
- throw new _IllegalArgumentException.default('Num bits must be between 0 and 32');
- }
- this.ensureCapacity(this.size + numBits);
- // const appendBit = this.appendBit;
- for (var numBitsLeft = numBits; numBitsLeft > 0; numBitsLeft--) {
- this.appendBit((value >> numBitsLeft - 1 & 0x01) === 1);
- }
- };
- BitArray.prototype.appendBitArray = function (other) {
- var otherSize = other.size;
- this.ensureCapacity(this.size + otherSize);
- // const appendBit = this.appendBit;
- for (var i = 0; i < otherSize; i++) {
- this.appendBit(other.get(i));
- }
- };
- BitArray.prototype.xor = function (other) {
- if (this.size !== other.size) {
- throw new _IllegalArgumentException.default('Sizes don\'t match');
- }
- var bits = this.bits;
- for (var i = 0, length_1 = bits.length; i < length_1; i++) {
- // The last int could be incomplete (i.e. not have 32 bits in
- // it) but there is no problem since 0 XOR 0 == 0.
- bits[i] ^= other.bits[i];
- }
- };
- /**
- *
- * @param bitOffset first bit to start writing
- * @param array array to write into. Bytes are written most-significant byte first. This is the opposite
- * of the internal representation, which is exposed by {@link #getBitArray()}
- * @param offset position in array to start writing
- * @param numBytes how many bytes to write
- */
- BitArray.prototype.toBytes = function (bitOffset /*int*/, array, offset /*int*/, numBytes /*int*/) {
- for (var i = 0; i < numBytes; i++) {
- var theByte = 0;
- for (var j = 0; j < 8; j++) {
- if (this.get(bitOffset)) {
- theByte |= 1 << 7 - j;
- }
- bitOffset++;
- }
- array[offset + i] = /*(byte)*/theByte;
- }
- };
- /**
- * @return underlying array of ints. The first element holds the first 32 bits, and the least
- * significant bit is bit 0.
- */
- BitArray.prototype.getBitArray = function () {
- return this.bits;
- };
- /**
- * Reverses all bits in the array.
- */
- BitArray.prototype.reverse = function () {
- var newBits = new Int32Array(this.bits.length);
- // reverse all int's first
- var len = Math.floor((this.size - 1) / 32);
- var oldBitsLen = len + 1;
- var bits = this.bits;
- for (var i = 0; i < oldBitsLen; i++) {
- var x = bits[i];
- x = x >> 1 & 0x55555555 | (x & 0x55555555) << 1;
- x = x >> 2 & 0x33333333 | (x & 0x33333333) << 2;
- x = x >> 4 & 0x0f0f0f0f | (x & 0x0f0f0f0f) << 4;
- x = x >> 8 & 0x00ff00ff | (x & 0x00ff00ff) << 8;
- x = x >> 16 & 0x0000ffff | (x & 0x0000ffff) << 16;
- newBits[len - i] = /*(int)*/x;
- }
- // now correct the int's if the bit size isn't a multiple of 32
- if (this.size !== oldBitsLen * 32) {
- var leftOffset = oldBitsLen * 32 - this.size;
- var currentInt = newBits[0] >>> leftOffset;
- for (var i = 1; i < oldBitsLen; i++) {
- var nextInt = newBits[i];
- currentInt |= nextInt << 32 - leftOffset;
- newBits[i - 1] = currentInt;
- currentInt = nextInt >>> leftOffset;
- }
- newBits[oldBitsLen - 1] = currentInt;
- }
- this.bits = newBits;
- };
- BitArray.makeArray = function (size /*int*/) {
- return new Int32Array(Math.floor((size + 31) / 32));
- };
- /*@Override*/
- BitArray.prototype.equals = function (o) {
- if (!(o instanceof BitArray)) {
- return false;
- }
- var other = o;
- return this.size === other.size && _Arrays.default.equals(this.bits, other.bits);
- };
- /*@Override*/
- BitArray.prototype.hashCode = function () {
- return 31 * this.size + _Arrays.default.hashCode(this.bits);
- };
- /*@Override*/
- BitArray.prototype.toString = function () {
- var result = '';
- for (var i = 0, size = this.size; i < size; i++) {
- if ((i & 0x07) === 0) {
- result += ' ';
- }
- result += this.get(i) ? 'X' : '.';
- }
- return result;
- };
- /*@Override*/
- BitArray.prototype.clone = function () {
- return new BitArray(this.size, this.bits.slice());
- };
- /**
- * converts to boolean array.
- */
- BitArray.prototype.toArray = function () {
- var result = [];
- for (var i = 0, size = this.size; i < size; i++) {
- result.push(this.get(i));
- }
- return result;
- };
- return BitArray;
- }();
- var _default = BitArray;
- exports.default = _default;
- /***/ }),
- /* 314 */
- /*!*******************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/util/Arrays.js ***!
- \*******************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _System = _interopRequireDefault(__webpack_require__(/*! ./System */ 315));
- var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../IllegalArgumentException */ 308));
- var _ArrayIndexOutOfBoundsException = _interopRequireDefault(__webpack_require__(/*! ../ArrayIndexOutOfBoundsException */ 316));
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- var Arrays = /** @class */function () {
- function Arrays() {}
- /**
- * Assigns the specified int value to each element of the specified array
- * of ints.
- *
- * @param a the array to be filled
- * @param val the value to be stored in all elements of the array
- */
- Arrays.fill = function (a, val) {
- for (var i = 0, len = a.length; i < len; i++) {
- a[i] = val;
- }
- };
- /**
- * Assigns the specified int value to each element of the specified
- * range of the specified array of ints. The range to be filled
- * extends from index {@code fromIndex}, inclusive, to index
- * {@code toIndex}, exclusive. (If {@code fromIndex==toIndex}, the
- * range to be filled is empty.)
- *
- * @param a the array to be filled
- * @param fromIndex the index of the first element (inclusive) to be
- * filled with the specified value
- * @param toIndex the index of the last element (exclusive) to be
- * filled with the specified value
- * @param val the value to be stored in all elements of the array
- * @throws IllegalArgumentException if {@code fromIndex > toIndex}
- * @throws ArrayIndexOutOfBoundsException if {@code fromIndex < 0} or
- * {@code toIndex > a.length}
- */
- Arrays.fillWithin = function (a, fromIndex, toIndex, val) {
- Arrays.rangeCheck(a.length, fromIndex, toIndex);
- for (var i = fromIndex; i < toIndex; i++) {
- a[i] = val;
- }
- };
- /**
- * Checks that {@code fromIndex} and {@code toIndex} are in
- * the range and throws an exception if they aren't.
- */
- Arrays.rangeCheck = function (arrayLength, fromIndex, toIndex) {
- if (fromIndex > toIndex) {
- throw new _IllegalArgumentException.default('fromIndex(' + fromIndex + ') > toIndex(' + toIndex + ')');
- }
- if (fromIndex < 0) {
- throw new _ArrayIndexOutOfBoundsException.default(fromIndex);
- }
- if (toIndex > arrayLength) {
- throw new _ArrayIndexOutOfBoundsException.default(toIndex);
- }
- };
- Arrays.asList = function () {
- var args = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
- return args;
- };
- Arrays.create = function (rows, cols, value) {
- var arr = Array.from({
- length: rows
- });
- return arr.map(function (x) {
- return Array.from({
- length: cols
- }).fill(value);
- });
- };
- Arrays.createInt32Array = function (rows, cols, value) {
- var arr = Array.from({
- length: rows
- });
- return arr.map(function (x) {
- return Int32Array.from({
- length: cols
- }).fill(value);
- });
- };
- Arrays.equals = function (first, second) {
- if (!first) {
- return false;
- }
- if (!second) {
- return false;
- }
- if (!first.length) {
- return false;
- }
- if (!second.length) {
- return false;
- }
- if (first.length !== second.length) {
- return false;
- }
- for (var i = 0, length_1 = first.length; i < length_1; i++) {
- if (first[i] !== second[i]) {
- return false;
- }
- }
- return true;
- };
- Arrays.hashCode = function (a) {
- var e_1, _a;
- if (a === null) {
- return 0;
- }
- var result = 1;
- try {
- for (var a_1 = __values(a), a_1_1 = a_1.next(); !a_1_1.done; a_1_1 = a_1.next()) {
- var element = a_1_1.value;
- result = 31 * result + element;
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (a_1_1 && !a_1_1.done && (_a = a_1.return)) _a.call(a_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- return result;
- };
- Arrays.fillUint8Array = function (a, value) {
- for (var i = 0; i !== a.length; i++) {
- a[i] = value;
- }
- };
- Arrays.copyOf = function (original, newLength) {
- return original.slice(0, newLength);
- };
- Arrays.copyOfUint8Array = function (original, newLength) {
- if (original.length <= newLength) {
- var newArray = new Uint8Array(newLength);
- newArray.set(original);
- return newArray;
- }
- return original.slice(0, newLength);
- };
- Arrays.copyOfRange = function (original, from, to) {
- var newLength = to - from;
- var copy = new Int32Array(newLength);
- _System.default.arraycopy(original, from, copy, 0, newLength);
- return copy;
- };
- /*
- * Returns the index of of the element in a sorted array or (-n-1) where n is the insertion point
- * for the new element.
- * Parameters:
- * ar - A sorted array
- * el - An element to search for
- * comparator - A comparator function. The function takes two arguments: (a, b) and returns:
- * a negative number if a is less than b;
- * 0 if a is equal to b;
- * a positive number of a is greater than b.
- * The array may contain duplicate elements. If there are more than one equal elements in the array,
- * the returned value can be the index of any one of the equal elements.
- *
- * http://jsfiddle.net/aryzhov/pkfst550/
- */
- Arrays.binarySearch = function (ar, el, comparator) {
- if (undefined === comparator) {
- comparator = Arrays.numberComparator;
- }
- var m = 0;
- var n = ar.length - 1;
- while (m <= n) {
- var k = n + m >> 1;
- var cmp = comparator(el, ar[k]);
- if (cmp > 0) {
- m = k + 1;
- } else if (cmp < 0) {
- n = k - 1;
- } else {
- return k;
- }
- }
- return -m - 1;
- };
- Arrays.numberComparator = function (a, b) {
- return a - b;
- };
- return Arrays;
- }();
- var _default = Arrays;
- exports.default = _default;
- /***/ }),
- /* 315 */
- /*!*******************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/util/System.js ***!
- \*******************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var System = /** @class */function () {
- function System() {}
- // public static void arraycopy(Object src, int srcPos, Object dest, int destPos, int length)
- /**
- * Makes a copy of a array.
- */
- System.arraycopy = function (src, srcPos, dest, destPos, length) {
- // TODO: better use split or set?
- while (length--) {
- dest[destPos++] = src[srcPos++];
- }
- };
- /**
- * Returns the current time in milliseconds.
- */
- System.currentTimeMillis = function () {
- return Date.now();
- };
- return System;
- }();
- var _default = System;
- exports.default = _default;
- /***/ }),
- /* 316 */
- /*!**************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/ArrayIndexOutOfBoundsException.js ***!
- \**************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _IndexOutOfBoundsException = _interopRequireDefault(__webpack_require__(/*! ./IndexOutOfBoundsException */ 317));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /**
- * Custom Error class of type Exception.
- */
- var ArrayIndexOutOfBoundsException = /** @class */function (_super) {
- __extends(ArrayIndexOutOfBoundsException, _super);
- function ArrayIndexOutOfBoundsException(index, message) {
- if (index === void 0) {
- index = undefined;
- }
- if (message === void 0) {
- message = undefined;
- }
- var _this = _super.call(this, message) || this;
- _this.index = index;
- _this.message = message;
- return _this;
- }
- ArrayIndexOutOfBoundsException.kind = 'ArrayIndexOutOfBoundsException';
- return ArrayIndexOutOfBoundsException;
- }(_IndexOutOfBoundsException.default);
- var _default = ArrayIndexOutOfBoundsException;
- exports.default = _default;
- /***/ }),
- /* 317 */
- /*!*********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/IndexOutOfBoundsException.js ***!
- \*********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _Exception = _interopRequireDefault(__webpack_require__(/*! ./Exception */ 305));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /**
- * Custom Error class of type Exception.
- */
- var IndexOutOfBoundsException = /** @class */function (_super) {
- __extends(IndexOutOfBoundsException, _super);
- function IndexOutOfBoundsException() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- IndexOutOfBoundsException.kind = 'IndexOutOfBoundsException';
- return IndexOutOfBoundsException;
- }(_Exception.default);
- var _default = IndexOutOfBoundsException;
- exports.default = _default;
- /***/ }),
- /* 318 */
- /*!********************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/util/Integer.js ***!
- \********************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- /**
- * Ponyfill for Java's Integer class.
- */
- var Integer = /** @class */function () {
- function Integer() {}
- Integer.numberOfTrailingZeros = function (i) {
- var y;
- if (i === 0) return 32;
- var n = 31;
- y = i << 16;
- if (y !== 0) {
- n -= 16;
- i = y;
- }
- y = i << 8;
- if (y !== 0) {
- n -= 8;
- i = y;
- }
- y = i << 4;
- if (y !== 0) {
- n -= 4;
- i = y;
- }
- y = i << 2;
- if (y !== 0) {
- n -= 2;
- i = y;
- }
- return n - (i << 1 >>> 31);
- };
- Integer.numberOfLeadingZeros = function (i) {
- // HD, Figure 5-6
- if (i === 0) {
- return 32;
- }
- var n = 1;
- if (i >>> 16 === 0) {
- n += 16;
- i <<= 16;
- }
- if (i >>> 24 === 0) {
- n += 8;
- i <<= 8;
- }
- if (i >>> 28 === 0) {
- n += 4;
- i <<= 4;
- }
- if (i >>> 30 === 0) {
- n += 2;
- i <<= 2;
- }
- n -= i >>> 31;
- return n;
- };
- Integer.toHexString = function (i) {
- return i.toString(16);
- };
- Integer.toBinaryString = function (intNumber) {
- return String(parseInt(String(intNumber), 2));
- };
- // Returns the number of one-bits in the two's complement binary representation of the specified int value. This function is sometimes referred to as the population count.
- // Returns:
- // the number of one-bits in the two's complement binary representation of the specified int value.
- Integer.bitCount = function (i) {
- // HD, Figure 5-2
- i = i - (i >>> 1 & 0x55555555);
- i = (i & 0x33333333) + (i >>> 2 & 0x33333333);
- i = i + (i >>> 4) & 0x0f0f0f0f;
- i = i + (i >>> 8);
- i = i + (i >>> 16);
- return i & 0x3f;
- };
- Integer.truncDivision = function (dividend, divisor) {
- return Math.trunc(dividend / divisor);
- };
- /**
- * Converts A string to an integer.
- * @param s A string to convert into a number.
- * @param radix A value between 2 and 36 that specifies the base of the number in numString. If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. All other strings are considered decimal.
- */
- Integer.parseInt = function (num, radix) {
- if (radix === void 0) {
- radix = undefined;
- }
- return parseInt(num, radix);
- };
- Integer.MIN_VALUE_32_BITS = -2147483648;
- Integer.MAX_VALUE = Number.MAX_SAFE_INTEGER;
- return Integer;
- }();
- var _default = Integer;
- exports.default = _default;
- /***/ }),
- /* 319 */
- /*!************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/BitMatrix.js ***!
- \************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _BitArray = _interopRequireDefault(__webpack_require__(/*! ./BitArray */ 313));
- var _System = _interopRequireDefault(__webpack_require__(/*! ../util/System */ 315));
- var _Arrays = _interopRequireDefault(__webpack_require__(/*! ../util/Arrays */ 314));
- var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../util/StringBuilder */ 320));
- var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../IllegalArgumentException */ 308));
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /*namespace com.google.zxing.common {*/
- /*import java.util.Arrays;*/
- /**
- * <p>Represents a 2D matrix of bits. In function arguments below, and throughout the common
- * module, x is the column position, and y is the row position. The ordering is always x, y.
- * The origin is at the top-left.</p>
- *
- * <p>Internally the bits are represented in a 1-D array of 32-bit ints. However, each row begins
- * with a new int. This is done intentionally so that we can copy out a row into a BitArray very
- * efficiently.</p>
- *
- * <p>The ordering of bits is row-major. Within each int, the least significant bits are used first,
- * meaning they represent lower x values. This is compatible with BitArray's implementation.</p>
- *
- * @author Sean Owen
- * @author dswitkin@google.com (Daniel Switkin)
- */
- var BitMatrix /*implements Cloneable*/ = /** @class */function () {
- /**
- * Creates an empty square {@link BitMatrix}.
- *
- * @param dimension height and width
- */
- // public constructor(dimension: number /*int*/) {
- // this(dimension, dimension)
- // }
- /**
- * Creates an empty {@link BitMatrix}.
- *
- * @param width bit matrix width
- * @param height bit matrix height
- */
- // public constructor(width: number /*int*/, height: number /*int*/) {
- // if (width < 1 || height < 1) {
- // throw new IllegalArgumentException("Both dimensions must be greater than 0")
- // }
- // this.width = width
- // this.height = height
- // this.rowSize = (width + 31) / 32
- // bits = new int[rowSize * height];
- // }
- function BitMatrix(width /*int*/, height /*int*/, rowSize /*int*/, bits) {
- this.width = width;
- this.height = height;
- this.rowSize = rowSize;
- this.bits = bits;
- if (undefined === height || null === height) {
- height = width;
- }
- this.height = height;
- if (width < 1 || height < 1) {
- throw new _IllegalArgumentException.default('Both dimensions must be greater than 0');
- }
- if (undefined === rowSize || null === rowSize) {
- rowSize = Math.floor((width + 31) / 32);
- }
- this.rowSize = rowSize;
- if (undefined === bits || null === bits) {
- this.bits = new Int32Array(this.rowSize * this.height);
- }
- }
- /**
- * Interprets a 2D array of booleans as a {@link BitMatrix}, where "true" means an "on" bit.
- *
- * @function parse
- * @param image bits of the image, as a row-major 2D array. Elements are arrays representing rows
- * @return {@link BitMatrix} representation of image
- */
- BitMatrix.parseFromBooleanArray = function (image) {
- var height = image.length;
- var width = image[0].length;
- var bits = new BitMatrix(width, height);
- for (var i = 0; i < height; i++) {
- var imageI = image[i];
- for (var j = 0; j < width; j++) {
- if (imageI[j]) {
- bits.set(j, i);
- }
- }
- }
- return bits;
- };
- /**
- *
- * @function parse
- * @param stringRepresentation
- * @param setString
- * @param unsetString
- */
- BitMatrix.parseFromString = function (stringRepresentation, setString, unsetString) {
- if (stringRepresentation === null) {
- throw new _IllegalArgumentException.default('stringRepresentation cannot be null');
- }
- var bits = new Array(stringRepresentation.length);
- var bitsPos = 0;
- var rowStartPos = 0;
- var rowLength = -1;
- var nRows = 0;
- var pos = 0;
- while (pos < stringRepresentation.length) {
- if (stringRepresentation.charAt(pos) === '\n' || stringRepresentation.charAt(pos) === '\r') {
- if (bitsPos > rowStartPos) {
- if (rowLength === -1) {
- rowLength = bitsPos - rowStartPos;
- } else if (bitsPos - rowStartPos !== rowLength) {
- throw new _IllegalArgumentException.default('row lengths do not match');
- }
- rowStartPos = bitsPos;
- nRows++;
- }
- pos++;
- } else if (stringRepresentation.substring(pos, pos + setString.length) === setString) {
- pos += setString.length;
- bits[bitsPos] = true;
- bitsPos++;
- } else if (stringRepresentation.substring(pos, pos + unsetString.length) === unsetString) {
- pos += unsetString.length;
- bits[bitsPos] = false;
- bitsPos++;
- } else {
- throw new _IllegalArgumentException.default('illegal character encountered: ' + stringRepresentation.substring(pos));
- }
- }
- // no EOL at end?
- if (bitsPos > rowStartPos) {
- if (rowLength === -1) {
- rowLength = bitsPos - rowStartPos;
- } else if (bitsPos - rowStartPos !== rowLength) {
- throw new _IllegalArgumentException.default('row lengths do not match');
- }
- nRows++;
- }
- var matrix = new BitMatrix(rowLength, nRows);
- for (var i = 0; i < bitsPos; i++) {
- if (bits[i]) {
- matrix.set(Math.floor(i % rowLength), Math.floor(i / rowLength));
- }
- }
- return matrix;
- };
- /**
- * <p>Gets the requested bit, where true means black.</p>
- *
- * @param x The horizontal component (i.e. which column)
- * @param y The vertical component (i.e. which row)
- * @return value of given bit in matrix
- */
- BitMatrix.prototype.get = function (x /*int*/, y /*int*/) {
- var offset = y * this.rowSize + Math.floor(x / 32);
- return (this.bits[offset] >>> (x & 0x1f) & 1) !== 0;
- };
- /**
- * <p>Sets the given bit to true.</p>
- *
- * @param x The horizontal component (i.e. which column)
- * @param y The vertical component (i.e. which row)
- */
- BitMatrix.prototype.set = function (x /*int*/, y /*int*/) {
- var offset = y * this.rowSize + Math.floor(x / 32);
- this.bits[offset] |= 1 << (x & 0x1f) & 0xFFFFFFFF;
- };
- BitMatrix.prototype.unset = function (x /*int*/, y /*int*/) {
- var offset = y * this.rowSize + Math.floor(x / 32);
- this.bits[offset] &= ~(1 << (x & 0x1f) & 0xFFFFFFFF);
- };
- /**
- * <p>Flips the given bit.</p>
- *
- * @param x The horizontal component (i.e. which column)
- * @param y The vertical component (i.e. which row)
- */
- BitMatrix.prototype.flip = function (x /*int*/, y /*int*/) {
- var offset = y * this.rowSize + Math.floor(x / 32);
- this.bits[offset] ^= 1 << (x & 0x1f) & 0xFFFFFFFF;
- };
- /**
- * Exclusive-or (XOR): Flip the bit in this {@code BitMatrix} if the corresponding
- * mask bit is set.
- *
- * @param mask XOR mask
- */
- BitMatrix.prototype.xor = function (mask) {
- if (this.width !== mask.getWidth() || this.height !== mask.getHeight() || this.rowSize !== mask.getRowSize()) {
- throw new _IllegalArgumentException.default('input matrix dimensions do not match');
- }
- var rowArray = new _BitArray.default(Math.floor(this.width / 32) + 1);
- var rowSize = this.rowSize;
- var bits = this.bits;
- for (var y = 0, height = this.height; y < height; y++) {
- var offset = y * rowSize;
- var row = mask.getRow(y, rowArray).getBitArray();
- for (var x = 0; x < rowSize; x++) {
- bits[offset + x] ^= row[x];
- }
- }
- };
- /**
- * Clears all bits (sets to false).
- */
- BitMatrix.prototype.clear = function () {
- var bits = this.bits;
- var max = bits.length;
- for (var i = 0; i < max; i++) {
- bits[i] = 0;
- }
- };
- /**
- * <p>Sets a square region of the bit matrix to true.</p>
- *
- * @param left The horizontal position to begin at (inclusive)
- * @param top The vertical position to begin at (inclusive)
- * @param width The width of the region
- * @param height The height of the region
- */
- BitMatrix.prototype.setRegion = function (left /*int*/, top /*int*/, width /*int*/, height /*int*/) {
- if (top < 0 || left < 0) {
- throw new _IllegalArgumentException.default('Left and top must be nonnegative');
- }
- if (height < 1 || width < 1) {
- throw new _IllegalArgumentException.default('Height and width must be at least 1');
- }
- var right = left + width;
- var bottom = top + height;
- if (bottom > this.height || right > this.width) {
- throw new _IllegalArgumentException.default('The region must fit inside the matrix');
- }
- var rowSize = this.rowSize;
- var bits = this.bits;
- for (var y = top; y < bottom; y++) {
- var offset = y * rowSize;
- for (var x = left; x < right; x++) {
- bits[offset + Math.floor(x / 32)] |= 1 << (x & 0x1f) & 0xFFFFFFFF;
- }
- }
- };
- /**
- * A fast method to retrieve one row of data from the matrix as a BitArray.
- *
- * @param y The row to retrieve
- * @param row An optional caller-allocated BitArray, will be allocated if null or too small
- * @return The resulting BitArray - this reference should always be used even when passing
- * your own row
- */
- BitMatrix.prototype.getRow = function (y /*int*/, row) {
- if (row === null || row === undefined || row.getSize() < this.width) {
- row = new _BitArray.default(this.width);
- } else {
- row.clear();
- }
- var rowSize = this.rowSize;
- var bits = this.bits;
- var offset = y * rowSize;
- for (var x = 0; x < rowSize; x++) {
- row.setBulk(x * 32, bits[offset + x]);
- }
- return row;
- };
- /**
- * @param y row to set
- * @param row {@link BitArray} to copy from
- */
- BitMatrix.prototype.setRow = function (y /*int*/, row) {
- _System.default.arraycopy(row.getBitArray(), 0, this.bits, y * this.rowSize, this.rowSize);
- };
- /**
- * Modifies this {@code BitMatrix} to represent the same but rotated 180 degrees
- */
- BitMatrix.prototype.rotate180 = function () {
- var width = this.getWidth();
- var height = this.getHeight();
- var topRow = new _BitArray.default(width);
- var bottomRow = new _BitArray.default(width);
- for (var i = 0, length_1 = Math.floor((height + 1) / 2); i < length_1; i++) {
- topRow = this.getRow(i, topRow);
- bottomRow = this.getRow(height - 1 - i, bottomRow);
- topRow.reverse();
- bottomRow.reverse();
- this.setRow(i, bottomRow);
- this.setRow(height - 1 - i, topRow);
- }
- };
- /**
- * This is useful in detecting the enclosing rectangle of a 'pure' barcode.
- *
- * @return {@code left,top,width,height} enclosing rectangle of all 1 bits, or null if it is all white
- */
- BitMatrix.prototype.getEnclosingRectangle = function () {
- var width = this.width;
- var height = this.height;
- var rowSize = this.rowSize;
- var bits = this.bits;
- var left = width;
- var top = height;
- var right = -1;
- var bottom = -1;
- for (var y = 0; y < height; y++) {
- for (var x32 = 0; x32 < rowSize; x32++) {
- var theBits = bits[y * rowSize + x32];
- if (theBits !== 0) {
- if (y < top) {
- top = y;
- }
- if (y > bottom) {
- bottom = y;
- }
- if (x32 * 32 < left) {
- var bit = 0;
- while ((theBits << 31 - bit & 0xFFFFFFFF) === 0) {
- bit++;
- }
- if (x32 * 32 + bit < left) {
- left = x32 * 32 + bit;
- }
- }
- if (x32 * 32 + 31 > right) {
- var bit = 31;
- while (theBits >>> bit === 0) {
- bit--;
- }
- if (x32 * 32 + bit > right) {
- right = x32 * 32 + bit;
- }
- }
- }
- }
- }
- if (right < left || bottom < top) {
- return null;
- }
- return Int32Array.from([left, top, right - left + 1, bottom - top + 1]);
- };
- /**
- * This is useful in detecting a corner of a 'pure' barcode.
- *
- * @return {@code x,y} coordinate of top-left-most 1 bit, or null if it is all white
- */
- BitMatrix.prototype.getTopLeftOnBit = function () {
- var rowSize = this.rowSize;
- var bits = this.bits;
- var bitsOffset = 0;
- while (bitsOffset < bits.length && bits[bitsOffset] === 0) {
- bitsOffset++;
- }
- if (bitsOffset === bits.length) {
- return null;
- }
- var y = bitsOffset / rowSize;
- var x = bitsOffset % rowSize * 32;
- var theBits = bits[bitsOffset];
- var bit = 0;
- while ((theBits << 31 - bit & 0xFFFFFFFF) === 0) {
- bit++;
- }
- x += bit;
- return Int32Array.from([x, y]);
- };
- BitMatrix.prototype.getBottomRightOnBit = function () {
- var rowSize = this.rowSize;
- var bits = this.bits;
- var bitsOffset = bits.length - 1;
- while (bitsOffset >= 0 && bits[bitsOffset] === 0) {
- bitsOffset--;
- }
- if (bitsOffset < 0) {
- return null;
- }
- var y = Math.floor(bitsOffset / rowSize);
- var x = Math.floor(bitsOffset % rowSize) * 32;
- var theBits = bits[bitsOffset];
- var bit = 31;
- while (theBits >>> bit === 0) {
- bit--;
- }
- x += bit;
- return Int32Array.from([x, y]);
- };
- /**
- * @return The width of the matrix
- */
- BitMatrix.prototype.getWidth = function () {
- return this.width;
- };
- /**
- * @return The height of the matrix
- */
- BitMatrix.prototype.getHeight = function () {
- return this.height;
- };
- /**
- * @return The row size of the matrix
- */
- BitMatrix.prototype.getRowSize = function () {
- return this.rowSize;
- };
- /*@Override*/
- BitMatrix.prototype.equals = function (o) {
- if (!(o instanceof BitMatrix)) {
- return false;
- }
- var other = o;
- return this.width === other.width && this.height === other.height && this.rowSize === other.rowSize && _Arrays.default.equals(this.bits, other.bits);
- };
- /*@Override*/
- BitMatrix.prototype.hashCode = function () {
- var hash = this.width;
- hash = 31 * hash + this.width;
- hash = 31 * hash + this.height;
- hash = 31 * hash + this.rowSize;
- hash = 31 * hash + _Arrays.default.hashCode(this.bits);
- return hash;
- };
- /**
- * @return string representation using "X" for set and " " for unset bits
- */
- /*@Override*/
- // public toString(): string {
- // return toString(": "X, " ")
- // }
- /**
- * @param setString representation of a set bit
- * @param unsetString representation of an unset bit
- * @return string representation of entire matrix utilizing given strings
- */
- // public toString(setString: string = "X ", unsetString: string = " "): string {
- // return this.buildToString(setString, unsetString, "\n")
- // }
- /**
- * @param setString representation of a set bit
- * @param unsetString representation of an unset bit
- * @param lineSeparator newline character in string representation
- * @return string representation of entire matrix utilizing given strings and line separator
- * @deprecated call {@link #toString(String,String)} only, which uses \n line separator always
- */
- // @Deprecated
- BitMatrix.prototype.toString = function (setString, unsetString, lineSeparator) {
- if (setString === void 0) {
- setString = 'X ';
- }
- if (unsetString === void 0) {
- unsetString = ' ';
- }
- if (lineSeparator === void 0) {
- lineSeparator = '\n';
- }
- return this.buildToString(setString, unsetString, lineSeparator);
- };
- BitMatrix.prototype.buildToString = function (setString, unsetString, lineSeparator) {
- var result = new _StringBuilder.default();
- // result.append(lineSeparator);
- for (var y = 0, height = this.height; y < height; y++) {
- for (var x = 0, width = this.width; x < width; x++) {
- result.append(this.get(x, y) ? setString : unsetString);
- }
- result.append(lineSeparator);
- }
- return result.toString();
- };
- /*@Override*/
- BitMatrix.prototype.clone = function () {
- return new BitMatrix(this.width, this.height, this.rowSize, this.bits.slice());
- };
- return BitMatrix;
- }();
- var _default = BitMatrix;
- exports.default = _default;
- /***/ }),
- /* 320 */
- /*!**************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/util/StringBuilder.js ***!
- \**************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _StringUtils = _interopRequireDefault(__webpack_require__(/*! ../common/StringUtils */ 321));
- var StringBuilder = /** @class */function () {
- function StringBuilder(value) {
- if (value === void 0) {
- value = '';
- }
- this.value = value;
- }
- StringBuilder.prototype.enableDecoding = function (encoding) {
- this.encoding = encoding;
- return this;
- };
- StringBuilder.prototype.append = function (s) {
- if (typeof s === 'string') {
- this.value += s.toString();
- } else if (this.encoding) {
- // use passed format (fromCharCode will return UTF8 encoding)
- this.value += _StringUtils.default.castAsNonUtf8Char(s, this.encoding);
- } else {
- // correctly converts from UTF-8, but not other encodings
- this.value += String.fromCharCode(s);
- }
- return this;
- };
- StringBuilder.prototype.appendChars = function (str, offset, len) {
- for (var i = offset; offset < offset + len; i++) {
- this.append(str[i]);
- }
- return this;
- };
- StringBuilder.prototype.length = function () {
- return this.value.length;
- };
- StringBuilder.prototype.charAt = function (n) {
- return this.value.charAt(n);
- };
- StringBuilder.prototype.deleteCharAt = function (n) {
- this.value = this.value.substr(0, n) + this.value.substring(n + 1);
- };
- StringBuilder.prototype.setCharAt = function (n, c) {
- this.value = this.value.substr(0, n) + c + this.value.substr(n + 1);
- };
- StringBuilder.prototype.substring = function (start, end) {
- return this.value.substring(start, end);
- };
- /**
- * @note helper method for RSS Expanded
- */
- StringBuilder.prototype.setLengthToZero = function () {
- this.value = '';
- };
- StringBuilder.prototype.toString = function () {
- return this.value;
- };
- StringBuilder.prototype.insert = function (n, c) {
- this.value = this.value.substring(0, n) + c + this.value.substring(n);
- };
- return StringBuilder;
- }();
- var _default = StringBuilder;
- exports.default = _default;
- /***/ }),
- /* 321 */
- /*!**************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/StringUtils.js ***!
- \**************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
- var _DecodeHintType = _interopRequireDefault(__webpack_require__(/*! ../DecodeHintType */ 322));
- var _CharacterSetECI = _interopRequireDefault(__webpack_require__(/*! ./CharacterSetECI */ 323));
- var _StringEncoding = _interopRequireDefault(__webpack_require__(/*! ../util/StringEncoding */ 325));
- /*
- * Copyright (C) 2010 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /*namespace com.google.zxing.common {*/
- /*import java.nio.charset.Charset;*/
- /*import java.util.Map;*/
- /**
- * Common string-related functions.
- *
- * @author Sean Owen
- * @author Alex Dupre
- */
- var StringUtils = /** @class */function () {
- function StringUtils() {}
- // SHIFT_JIS.equalsIgnoreCase(PLATFORM_DEFAULT_ENCODING) ||
- // EUC_JP.equalsIgnoreCase(PLATFORM_DEFAULT_ENCODING);
- StringUtils.castAsNonUtf8Char = function (code, encoding) {
- if (encoding === void 0) {
- encoding = null;
- }
- // ISO 8859-1 is the Java default as UTF-8 is JavaScripts
- // you can see this method as a Java version of String.fromCharCode
- var e = encoding ? encoding.getName() : this.ISO88591;
- // use passed format (fromCharCode will return UTF8 encoding)
- return _StringEncoding.default.decode(new Uint8Array([code]), e);
- };
- /**
- * @param bytes bytes encoding a string, whose encoding should be guessed
- * @param hints decode hints if applicable
- * @return name of guessed encoding; at the moment will only guess one of:
- * {@link #SHIFT_JIS}, {@link #UTF8}, {@link #ISO88591}, or the platform
- * default encoding if none of these can possibly be correct
- */
- StringUtils.guessEncoding = function (bytes, hints) {
- if (hints !== null && hints !== undefined && undefined !== hints.get(_DecodeHintType.default.CHARACTER_SET)) {
- return hints.get(_DecodeHintType.default.CHARACTER_SET).toString();
- }
- // For now, merely tries to distinguish ISO-8859-1, UTF-8 and Shift_JIS,
- // which should be by far the most common encodings.
- var length = bytes.length;
- var canBeISO88591 = true;
- var canBeShiftJIS = true;
- var canBeUTF8 = true;
- var utf8BytesLeft = 0;
- // int utf8LowChars = 0
- var utf2BytesChars = 0;
- var utf3BytesChars = 0;
- var utf4BytesChars = 0;
- var sjisBytesLeft = 0;
- // int sjisLowChars = 0
- var sjisKatakanaChars = 0;
- // int sjisDoubleBytesChars = 0
- var sjisCurKatakanaWordLength = 0;
- var sjisCurDoubleBytesWordLength = 0;
- var sjisMaxKatakanaWordLength = 0;
- var sjisMaxDoubleBytesWordLength = 0;
- // int isoLowChars = 0
- // int isoHighChars = 0
- var isoHighOther = 0;
- var utf8bom = bytes.length > 3 && bytes[0] === /*(byte) */0xEF && bytes[1] === /*(byte) */0xBB && bytes[2] === /*(byte) */0xBF;
- for (var i = 0; i < length && (canBeISO88591 || canBeShiftJIS || canBeUTF8); i++) {
- var value = bytes[i] & 0xFF;
- // UTF-8 stuff
- if (canBeUTF8) {
- if (utf8BytesLeft > 0) {
- if ((value & 0x80) === 0) {
- canBeUTF8 = false;
- } else {
- utf8BytesLeft--;
- }
- } else if ((value & 0x80) !== 0) {
- if ((value & 0x40) === 0) {
- canBeUTF8 = false;
- } else {
- utf8BytesLeft++;
- if ((value & 0x20) === 0) {
- utf2BytesChars++;
- } else {
- utf8BytesLeft++;
- if ((value & 0x10) === 0) {
- utf3BytesChars++;
- } else {
- utf8BytesLeft++;
- if ((value & 0x08) === 0) {
- utf4BytesChars++;
- } else {
- canBeUTF8 = false;
- }
- }
- }
- }
- } // else {
- // utf8LowChars++
- // }
- }
- // ISO-8859-1 stuff
- if (canBeISO88591) {
- if (value > 0x7F && value < 0xA0) {
- canBeISO88591 = false;
- } else if (value > 0x9F) {
- if (value < 0xC0 || value === 0xD7 || value === 0xF7) {
- isoHighOther++;
- } // else {
- // isoHighChars++
- // }
- } // else {
- // isoLowChars++
- // }
- }
- // Shift_JIS stuff
- if (canBeShiftJIS) {
- if (sjisBytesLeft > 0) {
- if (value < 0x40 || value === 0x7F || value > 0xFC) {
- canBeShiftJIS = false;
- } else {
- sjisBytesLeft--;
- }
- } else if (value === 0x80 || value === 0xA0 || value > 0xEF) {
- canBeShiftJIS = false;
- } else if (value > 0xA0 && value < 0xE0) {
- sjisKatakanaChars++;
- sjisCurDoubleBytesWordLength = 0;
- sjisCurKatakanaWordLength++;
- if (sjisCurKatakanaWordLength > sjisMaxKatakanaWordLength) {
- sjisMaxKatakanaWordLength = sjisCurKatakanaWordLength;
- }
- } else if (value > 0x7F) {
- sjisBytesLeft++;
- // sjisDoubleBytesChars++
- sjisCurKatakanaWordLength = 0;
- sjisCurDoubleBytesWordLength++;
- if (sjisCurDoubleBytesWordLength > sjisMaxDoubleBytesWordLength) {
- sjisMaxDoubleBytesWordLength = sjisCurDoubleBytesWordLength;
- }
- } else {
- // sjisLowChars++
- sjisCurKatakanaWordLength = 0;
- sjisCurDoubleBytesWordLength = 0;
- }
- }
- }
- if (canBeUTF8 && utf8BytesLeft > 0) {
- canBeUTF8 = false;
- }
- if (canBeShiftJIS && sjisBytesLeft > 0) {
- canBeShiftJIS = false;
- }
- // Easy -- if there is BOM or at least 1 valid not-single byte character (and no evidence it can't be UTF-8), done
- if (canBeUTF8 && (utf8bom || utf2BytesChars + utf3BytesChars + utf4BytesChars > 0)) {
- return StringUtils.UTF8;
- }
- // Easy -- if assuming Shift_JIS or at least 3 valid consecutive not-ascii characters (and no evidence it can't be), done
- if (canBeShiftJIS && (StringUtils.ASSUME_SHIFT_JIS || sjisMaxKatakanaWordLength >= 3 || sjisMaxDoubleBytesWordLength >= 3)) {
- return StringUtils.SHIFT_JIS;
- }
- // Distinguishing Shift_JIS and ISO-8859-1 can be a little tough for short words. The crude heuristic is:
- // - If we saw
- // - only two consecutive katakana chars in the whole text, or
- // - at least 10% of bytes that could be "upper" not-alphanumeric Latin1,
- // - then we conclude Shift_JIS, else ISO-8859-1
- if (canBeISO88591 && canBeShiftJIS) {
- return sjisMaxKatakanaWordLength === 2 && sjisKatakanaChars === 2 || isoHighOther * 10 >= length ? StringUtils.SHIFT_JIS : StringUtils.ISO88591;
- }
- // Otherwise, try in order ISO-8859-1, Shift JIS, UTF-8 and fall back to default platform encoding
- if (canBeISO88591) {
- return StringUtils.ISO88591;
- }
- if (canBeShiftJIS) {
- return StringUtils.SHIFT_JIS;
- }
- if (canBeUTF8) {
- return StringUtils.UTF8;
- }
- // Otherwise, we take a wild guess with platform encoding
- return StringUtils.PLATFORM_DEFAULT_ENCODING;
- };
- /**
- *
- * @see https://stackoverflow.com/a/13439711/4367683
- *
- * @param append The new string to append.
- * @param args Argumets values to be formated.
- */
- StringUtils.format = function (append) {
- var args = [];
- for (var _i = 1; _i < arguments.length; _i++) {
- args[_i - 1] = arguments[_i];
- }
- var i = -1;
- function callback(exp, p0, p1, p2, p3, p4) {
- if (exp === '%%') return '%';
- if (args[++i] === undefined) return undefined;
- exp = p2 ? parseInt(p2.substr(1)) : undefined;
- var base = p3 ? parseInt(p3.substr(1)) : undefined;
- var val;
- switch (p4) {
- case 's':
- val = args[i];
- break;
- case 'c':
- val = args[i][0];
- break;
- case 'f':
- val = parseFloat(args[i]).toFixed(exp);
- break;
- case 'p':
- val = parseFloat(args[i]).toPrecision(exp);
- break;
- case 'e':
- val = parseFloat(args[i]).toExponential(exp);
- break;
- case 'x':
- val = parseInt(args[i]).toString(base ? base : 16);
- break;
- case 'd':
- val = parseFloat(parseInt(args[i], base ? base : 10).toPrecision(exp)).toFixed(0);
- break;
- }
- val = (0, _typeof2.default)(val) === 'object' ? JSON.stringify(val) : (+val).toString(base);
- var size = parseInt(p1); /* padding size */
- var ch = p1 && p1[0] + '' === '0' ? '0' : ' '; /* isnull? */
- while (val.length < size) {
- val = p0 !== undefined ? val + ch : ch + val;
- } /* isminus? */
- return val;
- }
- var regex = /%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;
- return append.replace(regex, callback);
- };
- /**
- *
- */
- StringUtils.getBytes = function (str, encoding) {
- return _StringEncoding.default.encode(str, encoding);
- };
- /**
- * Returns the charcode at the specified index or at index zero.
- */
- StringUtils.getCharCode = function (str, index) {
- if (index === void 0) {
- index = 0;
- }
- return str.charCodeAt(index);
- };
- /**
- * Returns char for given charcode
- */
- StringUtils.getCharAt = function (charCode) {
- return String.fromCharCode(charCode);
- };
- StringUtils.SHIFT_JIS = _CharacterSetECI.default.SJIS.getName(); // "SJIS"
- StringUtils.GB2312 = 'GB2312';
- StringUtils.ISO88591 = _CharacterSetECI.default.ISO8859_1.getName(); // "ISO8859_1"
- StringUtils.EUC_JP = 'EUC_JP';
- StringUtils.UTF8 = _CharacterSetECI.default.UTF8.getName(); // "UTF8"
- StringUtils.PLATFORM_DEFAULT_ENCODING = StringUtils.UTF8; // "UTF8"//Charset.defaultCharset().name()
- StringUtils.ASSUME_SHIFT_JIS = false;
- return StringUtils;
- }();
- var _default = StringUtils;
- exports.default = _default;
- /***/ }),
- /* 322 */
- /*!**********************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/DecodeHintType.js ***!
- \**********************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- /*
- * Copyright 2009 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /*namespace com.google.zxing {*/
- /**
- * Encapsulates a type of hint that a caller may pass to a barcode reader to help it
- * more quickly or accurately decode it. It is up to implementations to decide what,
- * if anything, to do with the information that is supplied.
- *
- * @author Sean Owen
- * @author dswitkin@google.com (Daniel Switkin)
- * @see Reader#decode(BinaryBitmap,java.util.Map)
- */
- var DecodeHintType;
- (function (DecodeHintType) {
- /**
- * Unspecified, application-specific hint. Maps to an unspecified {@link Object}.
- */
- DecodeHintType[DecodeHintType["OTHER"] = 0] = "OTHER"; /*(Object.class)*/
- /**
- * Image is a pure monochrome image of a barcode. Doesn't matter what it maps to;
- * use {@link Boolean#TRUE}.
- */
- DecodeHintType[DecodeHintType["PURE_BARCODE"] = 1] = "PURE_BARCODE"; /*(Void.class)*/
- /**
- * Image is known to be of one of a few possible formats.
- * Maps to a {@link List} of {@link BarcodeFormat}s.
- */
- DecodeHintType[DecodeHintType["POSSIBLE_FORMATS"] = 2] = "POSSIBLE_FORMATS"; /*(List.class)*/
- /**
- * Spend more time to try to find a barcode; optimize for accuracy, not speed.
- * Doesn't matter what it maps to; use {@link Boolean#TRUE}.
- */
- DecodeHintType[DecodeHintType["TRY_HARDER"] = 3] = "TRY_HARDER"; /*(Void.class)*/
- /**
- * Specifies what character encoding to use when decoding, where applicable (type String)
- */
- DecodeHintType[DecodeHintType["CHARACTER_SET"] = 4] = "CHARACTER_SET"; /*(String.class)*/
- /**
- * Allowed lengths of encoded data -- reject anything else. Maps to an {@code Int32Array}.
- */
- DecodeHintType[DecodeHintType["ALLOWED_LENGTHS"] = 5] = "ALLOWED_LENGTHS"; /*(Int32Array.class)*/
- /**
- * Assume Code 39 codes employ a check digit. Doesn't matter what it maps to;
- * use {@link Boolean#TRUE}.
- */
- DecodeHintType[DecodeHintType["ASSUME_CODE_39_CHECK_DIGIT"] = 6] = "ASSUME_CODE_39_CHECK_DIGIT"; /*(Void.class)*/
- /**
- * Enable extended mode for Code 39 codes. Doesn't matter what it maps to;
- * use {@link Boolean#TRUE}.
- */
- DecodeHintType[DecodeHintType["ENABLE_CODE_39_EXTENDED_MODE"] = 7] = "ENABLE_CODE_39_EXTENDED_MODE"; /*(Void.class)*/
- /**
- * Assume the barcode is being processed as a GS1 barcode, and modify behavior as needed.
- * For example this affects FNC1 handling for Code 128 (aka GS1-128). Doesn't matter what it maps to;
- * use {@link Boolean#TRUE}.
- */
- DecodeHintType[DecodeHintType["ASSUME_GS1"] = 8] = "ASSUME_GS1"; /*(Void.class)*/
- /**
- * If true, return the start and end digits in a Codabar barcode instead of stripping them. They
- * are alpha, whereas the rest are numeric. By default, they are stripped, but this causes them
- * to not be. Doesn't matter what it maps to; use {@link Boolean#TRUE}.
- */
- DecodeHintType[DecodeHintType["RETURN_CODABAR_START_END"] = 9] = "RETURN_CODABAR_START_END"; /*(Void.class)*/
- /**
- * The caller needs to be notified via callback when a possible {@link ResultPoint}
- * is found. Maps to a {@link ResultPointCallback}.
- */
- DecodeHintType[DecodeHintType["NEED_RESULT_POINT_CALLBACK"] = 10] = "NEED_RESULT_POINT_CALLBACK"; /*(ResultPointCallback.class)*/
- /**
- * Allowed extension lengths for EAN or UPC barcodes. Other formats will ignore this.
- * Maps to an {@code Int32Array} of the allowed extension lengths, for example [2], [5], or [2, 5].
- * If it is optional to have an extension, do not set this hint. If this is set,
- * and a UPC or EAN barcode is found but an extension is not, then no result will be returned
- * at all.
- */
- DecodeHintType[DecodeHintType["ALLOWED_EAN_EXTENSIONS"] = 11] = "ALLOWED_EAN_EXTENSIONS"; /*(Int32Array.class)*/
- // End of enumeration values.
- /**
- * Data type the hint is expecting.
- * Among the possible values the {@link Void} stands out as being used for
- * hints that do not expect a value to be supplied (flag hints). Such hints
- * will possibly have their value ignored, or replaced by a
- * {@link Boolean#TRUE}. Hint suppliers should probably use
- * {@link Boolean#TRUE} as directed by the actual hint documentation.
- */
- // private valueType: Class<?>
- // DecodeHintType(valueType: Class<?>) {
- // this.valueType = valueType
- // }
- // public getValueType(): Class<?> {
- // return valueType
- // }
- })(DecodeHintType || (DecodeHintType = {}));
- var _default = DecodeHintType;
- exports.default = _default;
- /***/ }),
- /* 323 */
- /*!******************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/CharacterSetECI.js ***!
- \******************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = exports.CharacterSetValueIdentifiers = void 0;
- var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../FormatException */ 324));
- /*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- /*namespace com.google.zxing.common {*/
- /*import java.util.HashMap;*/
- /*import java.util.Map;*/
- var CharacterSetValueIdentifiers;
- exports.CharacterSetValueIdentifiers = CharacterSetValueIdentifiers;
- (function (CharacterSetValueIdentifiers) {
- CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["Cp437"] = 0] = "Cp437";
- CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ISO8859_1"] = 1] = "ISO8859_1";
- CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ISO8859_2"] = 2] = "ISO8859_2";
- CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ISO8859_3"] = 3] = "ISO8859_3";
- CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ISO8859_4"] = 4] = "ISO8859_4";
- CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ISO8859_5"] = 5] = "ISO8859_5";
- CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ISO8859_6"] = 6] = "ISO8859_6";
- CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ISO8859_7"] = 7] = "ISO8859_7";
- CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ISO8859_8"] = 8] = "ISO8859_8";
- CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ISO8859_9"] = 9] = "ISO8859_9";
- CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ISO8859_10"] = 10] = "ISO8859_10";
- CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ISO8859_11"] = 11] = "ISO8859_11";
- CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ISO8859_13"] = 12] = "ISO8859_13";
- CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ISO8859_14"] = 13] = "ISO8859_14";
- CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ISO8859_15"] = 14] = "ISO8859_15";
- CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ISO8859_16"] = 15] = "ISO8859_16";
- CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["SJIS"] = 16] = "SJIS";
- CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["Cp1250"] = 17] = "Cp1250";
- CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["Cp1251"] = 18] = "Cp1251";
- CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["Cp1252"] = 19] = "Cp1252";
- CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["Cp1256"] = 20] = "Cp1256";
- CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["UnicodeBigUnmarked"] = 21] = "UnicodeBigUnmarked";
- CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["UTF8"] = 22] = "UTF8";
- CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ASCII"] = 23] = "ASCII";
- CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["Big5"] = 24] = "Big5";
- CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["GB18030"] = 25] = "GB18030";
- CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["EUC_KR"] = 26] = "EUC_KR";
- })(CharacterSetValueIdentifiers || (exports.CharacterSetValueIdentifiers = CharacterSetValueIdentifiers = {}));
- /**
- * Encapsulates a Character Set ECI, according to "Extended Channel Interpretations" 5.3.1.1
- * of ISO 18004.
- *
- * @author Sean Owen
- */
- var CharacterSetECI = /** @class */function () {
- function CharacterSetECI(valueIdentifier, valuesParam, name) {
- var e_1, _a;
- var otherEncodingNames = [];
- for (var _i = 3; _i < arguments.length; _i++) {
- otherEncodingNames[_i - 3] = arguments[_i];
- }
- this.valueIdentifier = valueIdentifier;
- this.name = name;
- if (typeof valuesParam === 'number') {
- this.values = Int32Array.from([valuesParam]);
- } else {
- this.values = valuesParam;
- }
- this.otherEncodingNames = otherEncodingNames;
- CharacterSetECI.VALUE_IDENTIFIER_TO_ECI.set(valueIdentifier, this);
- CharacterSetECI.NAME_TO_ECI.set(name, this);
- var values = this.values;
- for (var i = 0, length_1 = values.length; i !== length_1; i++) {
- var v = values[i];
- CharacterSetECI.VALUES_TO_ECI.set(v, this);
- }
- try {
- for (var otherEncodingNames_1 = __values(otherEncodingNames), otherEncodingNames_1_1 = otherEncodingNames_1.next(); !otherEncodingNames_1_1.done; otherEncodingNames_1_1 = otherEncodingNames_1.next()) {
- var otherName = otherEncodingNames_1_1.value;
- CharacterSetECI.NAME_TO_ECI.set(otherName, this);
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (otherEncodingNames_1_1 && !otherEncodingNames_1_1.done && (_a = otherEncodingNames_1.return)) _a.call(otherEncodingNames_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- }
- // CharacterSetECI(value: number /*int*/) {
- // this(new Int32Array {value})
- // }
- // CharacterSetECI(value: number /*int*/, String... otherEncodingNames) {
- // this.values = new Int32Array {value}
- // this.otherEncodingNames = otherEncodingNames
- // }
- // CharacterSetECI(values: Int32Array, String... otherEncodingNames) {
- // this.values = values
- // this.otherEncodingNames = otherEncodingNames
- // }
- CharacterSetECI.prototype.getValueIdentifier = function () {
- return this.valueIdentifier;
- };
- CharacterSetECI.prototype.getName = function () {
- return this.name;
- };
- CharacterSetECI.prototype.getValue = function () {
- return this.values[0];
- };
- /**
- * @param value character set ECI value
- * @return {@code CharacterSetECI} representing ECI of given value, or null if it is legal but
- * unsupported
- * @throws FormatException if ECI value is invalid
- */
- CharacterSetECI.getCharacterSetECIByValue = function (value /*int*/) {
- if (value < 0 || value >= 900) {
- throw new _FormatException.default('incorect value');
- }
- var characterSet = CharacterSetECI.VALUES_TO_ECI.get(value);
- if (undefined === characterSet) {
- throw new _FormatException.default('incorect value');
- }
- return characterSet;
- };
- /**
- * @param name character set ECI encoding name
- * @return CharacterSetECI representing ECI for character encoding, or null if it is legal
- * but unsupported
- */
- CharacterSetECI.getCharacterSetECIByName = function (name) {
- var characterSet = CharacterSetECI.NAME_TO_ECI.get(name);
- if (undefined === characterSet) {
- throw new _FormatException.default('incorect value');
- }
- return characterSet;
- };
- CharacterSetECI.prototype.equals = function (o) {
- if (!(o instanceof CharacterSetECI)) {
- return false;
- }
- var other = o;
- return this.getName() === other.getName();
- };
- CharacterSetECI.VALUE_IDENTIFIER_TO_ECI = new Map();
- CharacterSetECI.VALUES_TO_ECI = new Map();
- CharacterSetECI.NAME_TO_ECI = new Map();
- // Enum name is a Java encoding valid for java.lang and java.io
- // TYPESCRIPTPORT: changed the main label for ISO as the TextEncoder did not recognized them in the form from java
- // (eg ISO8859_1 must be ISO88591 or ISO8859-1 or ISO-8859-1)
- // later on: well, except 16 wich does not work with ISO885916 so used ISO-8859-1 form for default
- CharacterSetECI.Cp437 = new CharacterSetECI(CharacterSetValueIdentifiers.Cp437, Int32Array.from([0, 2]), 'Cp437');
- CharacterSetECI.ISO8859_1 = new CharacterSetECI(CharacterSetValueIdentifiers.ISO8859_1, Int32Array.from([1, 3]), 'ISO-8859-1', 'ISO88591', 'ISO8859_1');
- CharacterSetECI.ISO8859_2 = new CharacterSetECI(CharacterSetValueIdentifiers.ISO8859_2, 4, 'ISO-8859-2', 'ISO88592', 'ISO8859_2');
- CharacterSetECI.ISO8859_3 = new CharacterSetECI(CharacterSetValueIdentifiers.ISO8859_3, 5, 'ISO-8859-3', 'ISO88593', 'ISO8859_3');
- CharacterSetECI.ISO8859_4 = new CharacterSetECI(CharacterSetValueIdentifiers.ISO8859_4, 6, 'ISO-8859-4', 'ISO88594', 'ISO8859_4');
- CharacterSetECI.ISO8859_5 = new CharacterSetECI(CharacterSetValueIdentifiers.ISO8859_5, 7, 'ISO-8859-5', 'ISO88595', 'ISO8859_5');
- CharacterSetECI.ISO8859_6 = new CharacterSetECI(CharacterSetValueIdentifiers.ISO8859_6, 8, 'ISO-8859-6', 'ISO88596', 'ISO8859_6');
- CharacterSetECI.ISO8859_7 = new CharacterSetECI(CharacterSetValueIdentifiers.ISO8859_7, 9, 'ISO-8859-7', 'ISO88597', 'ISO8859_7');
- CharacterSetECI.ISO8859_8 = new CharacterSetECI(CharacterSetValueIdentifiers.ISO8859_8, 10, 'ISO-8859-8', 'ISO88598', 'ISO8859_8');
- CharacterSetECI.ISO8859_9 = new CharacterSetECI(CharacterSetValueIdentifiers.ISO8859_9, 11, 'ISO-8859-9', 'ISO88599', 'ISO8859_9');
- CharacterSetECI.ISO8859_10 = new CharacterSetECI(CharacterSetValueIdentifiers.ISO8859_10, 12, 'ISO-8859-10', 'ISO885910', 'ISO8859_10');
- CharacterSetECI.ISO8859_11 = new CharacterSetECI(CharacterSetValueIdentifiers.ISO8859_11, 13, 'ISO-8859-11', 'ISO885911', 'ISO8859_11');
- CharacterSetECI.ISO8859_13 = new CharacterSetECI(CharacterSetValueIdentifiers.ISO8859_13, 15, 'ISO-8859-13', 'ISO885913', 'ISO8859_13');
- CharacterSetECI.ISO8859_14 = new CharacterSetECI(CharacterSetValueIdentifiers.ISO8859_14, 16, 'ISO-8859-14', 'ISO885914', 'ISO8859_14');
- CharacterSetECI.ISO8859_15 = new CharacterSetECI(CharacterSetValueIdentifiers.ISO8859_15, 17, 'ISO-8859-15', 'ISO885915', 'ISO8859_15');
- CharacterSetECI.ISO8859_16 = new CharacterSetECI(CharacterSetValueIdentifiers.ISO8859_16, 18, 'ISO-8859-16', 'ISO885916', 'ISO8859_16');
- CharacterSetECI.SJIS = new CharacterSetECI(CharacterSetValueIdentifiers.SJIS, 20, 'SJIS', 'Shift_JIS');
- CharacterSetECI.Cp1250 = new CharacterSetECI(CharacterSetValueIdentifiers.Cp1250, 21, 'Cp1250', 'windows-1250');
- CharacterSetECI.Cp1251 = new CharacterSetECI(CharacterSetValueIdentifiers.Cp1251, 22, 'Cp1251', 'windows-1251');
- CharacterSetECI.Cp1252 = new CharacterSetECI(CharacterSetValueIdentifiers.Cp1252, 23, 'Cp1252', 'windows-1252');
- CharacterSetECI.Cp1256 = new CharacterSetECI(CharacterSetValueIdentifiers.Cp1256, 24, 'Cp1256', 'windows-1256');
- CharacterSetECI.UnicodeBigUnmarked = new CharacterSetECI(CharacterSetValueIdentifiers.UnicodeBigUnmarked, 25, 'UnicodeBigUnmarked', 'UTF-16BE', 'UnicodeBig');
- CharacterSetECI.UTF8 = new CharacterSetECI(CharacterSetValueIdentifiers.UTF8, 26, 'UTF8', 'UTF-8');
- CharacterSetECI.ASCII = new CharacterSetECI(CharacterSetValueIdentifiers.ASCII, Int32Array.from([27, 170]), 'ASCII', 'US-ASCII');
- CharacterSetECI.Big5 = new CharacterSetECI(CharacterSetValueIdentifiers.Big5, 28, 'Big5');
- CharacterSetECI.GB18030 = new CharacterSetECI(CharacterSetValueIdentifiers.GB18030, 29, 'GB18030', 'GB2312', 'EUC_CN', 'GBK');
- CharacterSetECI.EUC_KR = new CharacterSetECI(CharacterSetValueIdentifiers.EUC_KR, 30, 'EUC_KR', 'EUC-KR');
- return CharacterSetECI;
- }();
- var _default = CharacterSetECI;
- exports.default = _default;
- /***/ }),
- /* 324 */
- /*!***********************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/FormatException.js ***!
- \***********************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _Exception = _interopRequireDefault(__webpack_require__(/*! ./Exception */ 305));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /**
- * Custom Error class of type Exception.
- */
- var FormatException = /** @class */function (_super) {
- __extends(FormatException, _super);
- function FormatException() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- FormatException.getFormatInstance = function () {
- return new FormatException();
- };
- FormatException.kind = 'FormatException';
- return FormatException;
- }(_Exception.default);
- var _default = FormatException;
- exports.default = _default;
- /***/ }),
- /* 325 */
- /*!***************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/util/StringEncoding.js ***!
- \***************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _UnsupportedOperationException = _interopRequireDefault(__webpack_require__(/*! ../UnsupportedOperationException */ 326));
- var _CharacterSetECI = _interopRequireDefault(__webpack_require__(/*! ../common/CharacterSetECI */ 323));
- /**
- * Responsible for en/decoding strings.
- */
- var StringEncoding = /** @class */function () {
- function StringEncoding() {}
- /**
- * Decodes some Uint8Array to a string format.
- */
- StringEncoding.decode = function (bytes, encoding) {
- var encodingName = this.encodingName(encoding);
- if (this.customDecoder) {
- return this.customDecoder(bytes, encodingName);
- }
- // Increases browser support.
- if (typeof TextDecoder === 'undefined' || this.shouldDecodeOnFallback(encodingName)) {
- return this.decodeFallback(bytes, encodingName);
- }
- return new TextDecoder(encodingName).decode(bytes);
- };
- /**
- * Checks if the decoding method should use the fallback for decoding
- * once Node TextDecoder doesn't support all encoding formats.
- *
- * @param encodingName
- */
- StringEncoding.shouldDecodeOnFallback = function (encodingName) {
- return !StringEncoding.isBrowser() && encodingName === 'ISO-8859-1';
- };
- /**
- * Encodes some string into a Uint8Array.
- */
- StringEncoding.encode = function (s, encoding) {
- var encodingName = this.encodingName(encoding);
- if (this.customEncoder) {
- return this.customEncoder(s, encodingName);
- }
- // Increases browser support.
- if (typeof TextEncoder === 'undefined') {
- return this.encodeFallback(s);
- }
- // TextEncoder only encodes to UTF8 by default as specified by encoding.spec.whatwg.org
- return new TextEncoder().encode(s);
- };
- StringEncoding.isBrowser = function () {
- return typeof window !== 'undefined' && {}.toString.call(window) === '[object Window]';
- };
- /**
- * Returns the string value from some encoding character set.
- */
- StringEncoding.encodingName = function (encoding) {
- return typeof encoding === 'string' ? encoding : encoding.getName();
- };
- /**
- * Returns character set from some encoding character set.
- */
- StringEncoding.encodingCharacterSet = function (encoding) {
- if (encoding instanceof _CharacterSetECI.default) {
- return encoding;
- }
- return _CharacterSetECI.default.getCharacterSetECIByName(encoding);
- };
- /**
- * Runs a fallback for the native decoding funcion.
- */
- StringEncoding.decodeFallback = function (bytes, encoding) {
- var characterSet = this.encodingCharacterSet(encoding);
- if (StringEncoding.isDecodeFallbackSupported(characterSet)) {
- var s = '';
- for (var i = 0, length_1 = bytes.length; i < length_1; i++) {
- var h = bytes[i].toString(16);
- if (h.length < 2) {
- h = '0' + h;
- }
- s += '%' + h;
- }
- return decodeURIComponent(s);
- }
- if (characterSet.equals(_CharacterSetECI.default.UnicodeBigUnmarked)) {
- return String.fromCharCode.apply(null, new Uint16Array(bytes.buffer));
- }
- throw new _UnsupportedOperationException.default("Encoding " + this.encodingName(encoding) + " not supported by fallback.");
- };
- StringEncoding.isDecodeFallbackSupported = function (characterSet) {
- return characterSet.equals(_CharacterSetECI.default.UTF8) || characterSet.equals(_CharacterSetECI.default.ISO8859_1) || characterSet.equals(_CharacterSetECI.default.ASCII);
- };
- /**
- * Runs a fallback for the native encoding funcion.
- *
- * @see https://stackoverflow.com/a/17192845/4367683
- */
- StringEncoding.encodeFallback = function (s) {
- var encodedURIstring = btoa(unescape(encodeURIComponent(s)));
- var charList = encodedURIstring.split('');
- var uintArray = [];
- for (var i = 0; i < charList.length; i++) {
- uintArray.push(charList[i].charCodeAt(0));
- }
- return new Uint8Array(uintArray);
- };
- return StringEncoding;
- }();
- var _default = StringEncoding;
- exports.default = _default;
- /***/ }),
- /* 326 */
- /*!*************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/UnsupportedOperationException.js ***!
- \*************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _Exception = _interopRequireDefault(__webpack_require__(/*! ./Exception */ 305));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /**
- * Custom Error class of type Exception.
- */
- var UnsupportedOperationException = /** @class */function (_super) {
- __extends(UnsupportedOperationException, _super);
- function UnsupportedOperationException() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- UnsupportedOperationException.kind = 'UnsupportedOperationException';
- return UnsupportedOperationException;
- }(_Exception.default);
- var _default = UnsupportedOperationException;
- exports.default = _default;
- /***/ }),
- /* 327 */
- /*!*************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/NotFoundException.js ***!
- \*************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _Exception = _interopRequireDefault(__webpack_require__(/*! ./Exception */ 305));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /**
- * Custom Error class of type Exception.
- */
- var NotFoundException = /** @class */function (_super) {
- __extends(NotFoundException, _super);
- function NotFoundException() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- NotFoundException.getNotFoundInstance = function () {
- return new NotFoundException();
- };
- NotFoundException.kind = 'NotFoundException';
- return NotFoundException;
- }(_Exception.default);
- var _default = NotFoundException;
- exports.default = _default;
- /***/ }),
- /* 328 */
- /*!*******************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/browser/HTMLCanvasElementLuminanceSource.js ***!
- \*******************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.HTMLCanvasElementLuminanceSource = void 0;
- var _InvertedLuminanceSource = _interopRequireDefault(__webpack_require__(/*! ../core/InvertedLuminanceSource */ 329));
- var _LuminanceSource = _interopRequireDefault(__webpack_require__(/*! ../core/LuminanceSource */ 330));
- var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../core/IllegalArgumentException */ 308));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /**
- * @deprecated Moving to @zxing/browser
- */
- var HTMLCanvasElementLuminanceSource = /** @class */function (_super) {
- __extends(HTMLCanvasElementLuminanceSource, _super);
- function HTMLCanvasElementLuminanceSource(canvas, doAutoInvert) {
- if (doAutoInvert === void 0) {
- doAutoInvert = false;
- }
- var _this = _super.call(this, canvas.width, canvas.height) || this;
- _this.canvas = canvas;
- _this.tempCanvasElement = null;
- _this.buffer = HTMLCanvasElementLuminanceSource.makeBufferFromCanvasImageData(canvas, doAutoInvert);
- return _this;
- }
- HTMLCanvasElementLuminanceSource.makeBufferFromCanvasImageData = function (canvas, doAutoInvert) {
- if (doAutoInvert === void 0) {
- doAutoInvert = false;
- }
- var imageData = canvas.getContext('2d').getImageData(0, 0, canvas.width, canvas.height);
- return HTMLCanvasElementLuminanceSource.toGrayscaleBuffer(imageData.data, canvas.width, canvas.height, doAutoInvert);
- };
- HTMLCanvasElementLuminanceSource.toGrayscaleBuffer = function (imageBuffer, width, height, doAutoInvert) {
- if (doAutoInvert === void 0) {
- doAutoInvert = false;
- }
- var grayscaleBuffer = new Uint8ClampedArray(width * height);
- HTMLCanvasElementLuminanceSource.FRAME_INDEX = !HTMLCanvasElementLuminanceSource.FRAME_INDEX;
- if (HTMLCanvasElementLuminanceSource.FRAME_INDEX || !doAutoInvert) {
- for (var i = 0, j = 0, length_1 = imageBuffer.length; i < length_1; i += 4, j++) {
- var gray = void 0;
- var alpha = imageBuffer[i + 3];
- // The color of fully-transparent pixels is irrelevant. They are often, technically, fully-transparent
- // black (0 alpha, and then 0 RGB). They are often used, of course as the "white" area in a
- // barcode image. Force any such pixel to be white:
- if (alpha === 0) {
- gray = 0xFF;
- } else {
- var pixelR = imageBuffer[i];
- var pixelG = imageBuffer[i + 1];
- var pixelB = imageBuffer[i + 2];
- // .299R + 0.587G + 0.114B (YUV/YIQ for PAL and NTSC),
- // (306*R) >> 10 is approximately equal to R*0.299, and so on.
- // 0x200 >> 10 is 0.5, it implements rounding.
- gray = 306 * pixelR + 601 * pixelG + 117 * pixelB + 0x200 >> 10;
- }
- grayscaleBuffer[j] = gray;
- }
- } else {
- for (var i = 0, j = 0, length_2 = imageBuffer.length; i < length_2; i += 4, j++) {
- var gray = void 0;
- var alpha = imageBuffer[i + 3];
- // The color of fully-transparent pixels is irrelevant. They are often, technically, fully-transparent
- // black (0 alpha, and then 0 RGB). They are often used, of course as the "white" area in a
- // barcode image. Force any such pixel to be white:
- if (alpha === 0) {
- gray = 0xFF;
- } else {
- var pixelR = imageBuffer[i];
- var pixelG = imageBuffer[i + 1];
- var pixelB = imageBuffer[i + 2];
- // .299R + 0.587G + 0.114B (YUV/YIQ for PAL and NTSC),
- // (306*R) >> 10 is approximately equal to R*0.299, and so on.
- // 0x200 >> 10 is 0.5, it implements rounding.
- gray = 306 * pixelR + 601 * pixelG + 117 * pixelB + 0x200 >> 10;
- }
- grayscaleBuffer[j] = 0xFF - gray;
- }
- }
- return grayscaleBuffer;
- };
- HTMLCanvasElementLuminanceSource.prototype.getRow = function (y /*int*/, row) {
- if (y < 0 || y >= this.getHeight()) {
- throw new _IllegalArgumentException.default('Requested row is outside the image: ' + y);
- }
- var width = this.getWidth();
- var start = y * width;
- if (row === null) {
- row = this.buffer.slice(start, start + width);
- } else {
- if (row.length < width) {
- row = new Uint8ClampedArray(width);
- }
- // The underlying raster of image consists of bytes with the luminance values
- // TODO: can avoid set/slice?
- row.set(this.buffer.slice(start, start + width));
- }
- return row;
- };
- HTMLCanvasElementLuminanceSource.prototype.getMatrix = function () {
- return this.buffer;
- };
- HTMLCanvasElementLuminanceSource.prototype.isCropSupported = function () {
- return true;
- };
- HTMLCanvasElementLuminanceSource.prototype.crop = function (left /*int*/, top /*int*/, width /*int*/, height /*int*/) {
- _super.prototype.crop.call(this, left, top, width, height);
- return this;
- };
- /**
- * This is always true, since the image is a gray-scale image.
- *
- * @return true
- */
- HTMLCanvasElementLuminanceSource.prototype.isRotateSupported = function () {
- return true;
- };
- HTMLCanvasElementLuminanceSource.prototype.rotateCounterClockwise = function () {
- this.rotate(-90);
- return this;
- };
- HTMLCanvasElementLuminanceSource.prototype.rotateCounterClockwise45 = function () {
- this.rotate(-45);
- return this;
- };
- HTMLCanvasElementLuminanceSource.prototype.getTempCanvasElement = function () {
- if (null === this.tempCanvasElement) {
- var tempCanvasElement = this.canvas.ownerDocument.createElement('canvas');
- tempCanvasElement.width = this.canvas.width;
- tempCanvasElement.height = this.canvas.height;
- this.tempCanvasElement = tempCanvasElement;
- }
- return this.tempCanvasElement;
- };
- HTMLCanvasElementLuminanceSource.prototype.rotate = function (angle) {
- var tempCanvasElement = this.getTempCanvasElement();
- var tempContext = tempCanvasElement.getContext('2d');
- var angleRadians = angle * HTMLCanvasElementLuminanceSource.DEGREE_TO_RADIANS;
- // Calculate and set new dimensions for temp canvas
- var width = this.canvas.width;
- var height = this.canvas.height;
- var newWidth = Math.ceil(Math.abs(Math.cos(angleRadians)) * width + Math.abs(Math.sin(angleRadians)) * height);
- var newHeight = Math.ceil(Math.abs(Math.sin(angleRadians)) * width + Math.abs(Math.cos(angleRadians)) * height);
- tempCanvasElement.width = newWidth;
- tempCanvasElement.height = newHeight;
- // Draw at center of temp canvas to prevent clipping of image data
- tempContext.translate(newWidth / 2, newHeight / 2);
- tempContext.rotate(angleRadians);
- tempContext.drawImage(this.canvas, width / -2, height / -2);
- this.buffer = HTMLCanvasElementLuminanceSource.makeBufferFromCanvasImageData(tempCanvasElement);
- return this;
- };
- HTMLCanvasElementLuminanceSource.prototype.invert = function () {
- return new _InvertedLuminanceSource.default(this);
- };
- HTMLCanvasElementLuminanceSource.DEGREE_TO_RADIANS = Math.PI / 180;
- HTMLCanvasElementLuminanceSource.FRAME_INDEX = true;
- return HTMLCanvasElementLuminanceSource;
- }(_LuminanceSource.default);
- exports.HTMLCanvasElementLuminanceSource = HTMLCanvasElementLuminanceSource;
- /***/ }),
- /* 329 */
- /*!*******************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/InvertedLuminanceSource.js ***!
- \*******************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _LuminanceSource = _interopRequireDefault(__webpack_require__(/*! ./LuminanceSource */ 330));
- /*
- * Copyright 2009 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /*namespace com.google.zxing {*/
- /**
- * A wrapper implementation of {@link LuminanceSource} which inverts the luminances it returns -- black becomes
- * white and vice versa, and each value becomes (255-value).
- *
- * @author Sean Owen
- */
- var InvertedLuminanceSource = /** @class */function (_super) {
- __extends(InvertedLuminanceSource, _super);
- function InvertedLuminanceSource(delegate) {
- var _this = _super.call(this, delegate.getWidth(), delegate.getHeight()) || this;
- _this.delegate = delegate;
- return _this;
- }
- /*@Override*/
- InvertedLuminanceSource.prototype.getRow = function (y /*int*/, row) {
- var sourceRow = this.delegate.getRow(y, row);
- var width = this.getWidth();
- for (var i = 0; i < width; i++) {
- sourceRow[i] = /*(byte)*/255 - (sourceRow[i] & 0xFF);
- }
- return sourceRow;
- };
- /*@Override*/
- InvertedLuminanceSource.prototype.getMatrix = function () {
- var matrix = this.delegate.getMatrix();
- var length = this.getWidth() * this.getHeight();
- var invertedMatrix = new Uint8ClampedArray(length);
- for (var i = 0; i < length; i++) {
- invertedMatrix[i] = /*(byte)*/255 - (matrix[i] & 0xFF);
- }
- return invertedMatrix;
- };
- /*@Override*/
- InvertedLuminanceSource.prototype.isCropSupported = function () {
- return this.delegate.isCropSupported();
- };
- /*@Override*/
- InvertedLuminanceSource.prototype.crop = function (left /*int*/, top /*int*/, width /*int*/, height /*int*/) {
- return new InvertedLuminanceSource(this.delegate.crop(left, top, width, height));
- };
- /*@Override*/
- InvertedLuminanceSource.prototype.isRotateSupported = function () {
- return this.delegate.isRotateSupported();
- };
- /**
- * @return original delegate {@link LuminanceSource} since invert undoes itself
- */
- /*@Override*/
- InvertedLuminanceSource.prototype.invert = function () {
- return this.delegate;
- };
- /*@Override*/
- InvertedLuminanceSource.prototype.rotateCounterClockwise = function () {
- return new InvertedLuminanceSource(this.delegate.rotateCounterClockwise());
- };
- /*@Override*/
- InvertedLuminanceSource.prototype.rotateCounterClockwise45 = function () {
- return new InvertedLuminanceSource(this.delegate.rotateCounterClockwise45());
- };
- return InvertedLuminanceSource;
- }(_LuminanceSource.default);
- var _default = InvertedLuminanceSource;
- exports.default = _default;
- /***/ }),
- /* 330 */
- /*!***********************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/LuminanceSource.js ***!
- \***********************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ./util/StringBuilder */ 320));
- var _UnsupportedOperationException = _interopRequireDefault(__webpack_require__(/*! ./UnsupportedOperationException */ 326));
- /*
- * Copyright 2009 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /*namespace com.google.zxing {*/
- /**
- * The purpose of this class hierarchy is to abstract different bitmap implementations across
- * platforms into a standard interface for requesting greyscale luminance values. The interface
- * only provides immutable methods; therefore crop and rotation create copies. This is to ensure
- * that one Reader does not modify the original luminance source and leave it in an unknown state
- * for other Readers in the chain.
- *
- * @author dswitkin@google.com (Daniel Switkin)
- */
- var LuminanceSource = /** @class */function () {
- function LuminanceSource(width /*int*/, height /*int*/) {
- this.width = width;
- this.height = height;
- }
- /**
- * @return The width of the bitmap.
- */
- LuminanceSource.prototype.getWidth = function () {
- return this.width;
- };
- /**
- * @return The height of the bitmap.
- */
- LuminanceSource.prototype.getHeight = function () {
- return this.height;
- };
- /**
- * @return Whether this subclass supports cropping.
- */
- LuminanceSource.prototype.isCropSupported = function () {
- return false;
- };
- /**
- * Returns a new object with cropped image data. Implementations may keep a reference to the
- * original data rather than a copy. Only callable if isCropSupported() is true.
- *
- * @param left The left coordinate, which must be in [0,getWidth())
- * @param top The top coordinate, which must be in [0,getHeight())
- * @param width The width of the rectangle to crop.
- * @param height The height of the rectangle to crop.
- * @return A cropped version of this object.
- */
- LuminanceSource.prototype.crop = function (left /*int*/, top /*int*/, width /*int*/, height /*int*/) {
- throw new _UnsupportedOperationException.default('This luminance source does not support cropping.');
- };
- /**
- * @return Whether this subclass supports counter-clockwise rotation.
- */
- LuminanceSource.prototype.isRotateSupported = function () {
- return false;
- };
- /**
- * Returns a new object with rotated image data by 90 degrees counterclockwise.
- * Only callable if {@link #isRotateSupported()} is true.
- *
- * @return A rotated version of this object.
- */
- LuminanceSource.prototype.rotateCounterClockwise = function () {
- throw new _UnsupportedOperationException.default('This luminance source does not support rotation by 90 degrees.');
- };
- /**
- * Returns a new object with rotated image data by 45 degrees counterclockwise.
- * Only callable if {@link #isRotateSupported()} is true.
- *
- * @return A rotated version of this object.
- */
- LuminanceSource.prototype.rotateCounterClockwise45 = function () {
- throw new _UnsupportedOperationException.default('This luminance source does not support rotation by 45 degrees.');
- };
- /*@Override*/
- LuminanceSource.prototype.toString = function () {
- var row = new Uint8ClampedArray(this.width);
- var result = new _StringBuilder.default();
- for (var y = 0; y < this.height; y++) {
- var sourceRow = this.getRow(y, row);
- for (var x = 0; x < this.width; x++) {
- var luminance = sourceRow[x] & 0xFF;
- var c = void 0;
- if (luminance < 0x40) {
- c = '#';
- } else if (luminance < 0x80) {
- c = '+';
- } else if (luminance < 0xC0) {
- c = '.';
- } else {
- c = ' ';
- }
- result.append(c);
- }
- result.append('\n');
- }
- return result.toString();
- };
- return LuminanceSource;
- }();
- var _default = LuminanceSource;
- exports.default = _default;
- /***/ }),
- /* 331 */
- /*!***************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/browser/VideoInputDevice.js ***!
- \***************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.VideoInputDevice = void 0;
- /**
- * @deprecated Moving to @zxing/browser
- *
- * Video input device metadata containing the id and label of the device if available.
- */
- var VideoInputDevice = /** @class */function () {
- /**
- * Creates an instance of VideoInputDevice.
- *
- * @param {string} deviceId the video input device id
- * @param {string} label the label of the device if available
- */
- function VideoInputDevice(deviceId, label, groupId) {
- this.deviceId = deviceId;
- this.label = label;
- /** @inheritdoc */
- this.kind = 'videoinput';
- this.groupId = groupId || undefined;
- }
- /** @inheritdoc */
- VideoInputDevice.prototype.toJSON = function () {
- return {
- kind: this.kind,
- groupId: this.groupId,
- deviceId: this.deviceId,
- label: this.label
- };
- };
- return VideoInputDevice;
- }();
- exports.VideoInputDevice = VideoInputDevice;
- /***/ }),
- /* 332 */
- /*!*************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/AztecReader.js ***!
- \*************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _Result = _interopRequireDefault(__webpack_require__(/*! ../Result */ 333));
- var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
- var _DecodeHintType = _interopRequireDefault(__webpack_require__(/*! ../DecodeHintType */ 322));
- var _ResultMetadataType = _interopRequireDefault(__webpack_require__(/*! ../ResultMetadataType */ 335));
- var _System = _interopRequireDefault(__webpack_require__(/*! ../util/System */ 315));
- var _Decoder = _interopRequireDefault(__webpack_require__(/*! ./decoder/Decoder */ 336));
- var _Detector = _interopRequireDefault(__webpack_require__(/*! ./detector/Detector */ 345));
- /*
- * Copyright 2010 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- // import java.util.List;
- // import java.util.Map;
- /**
- * This implementation can detect and decode Aztec codes in an image.
- *
- * @author David Olivier
- */
- var AztecReader = /** @class */function () {
- function AztecReader() {}
- /**
- * Locates and decodes a Data Matrix code in an image.
- *
- * @return a String representing the content encoded by the Data Matrix code
- * @throws NotFoundException if a Data Matrix code cannot be found
- * @throws FormatException if a Data Matrix code cannot be decoded
- */
- AztecReader.prototype.decode = function (image, hints) {
- if (hints === void 0) {
- hints = null;
- }
- var exception = null;
- var detector = new _Detector.default(image.getBlackMatrix());
- var points = null;
- var decoderResult = null;
- try {
- var detectorResult = detector.detectMirror(false);
- points = detectorResult.getPoints();
- this.reportFoundResultPoints(hints, points);
- decoderResult = new _Decoder.default().decode(detectorResult);
- } catch (e) {
- exception = e;
- }
- if (decoderResult == null) {
- try {
- var detectorResult = detector.detectMirror(true);
- points = detectorResult.getPoints();
- this.reportFoundResultPoints(hints, points);
- decoderResult = new _Decoder.default().decode(detectorResult);
- } catch (e) {
- if (exception != null) {
- throw exception;
- }
- throw e;
- }
- }
- var result = new _Result.default(decoderResult.getText(), decoderResult.getRawBytes(), decoderResult.getNumBits(), points, _BarcodeFormat.default.AZTEC, _System.default.currentTimeMillis());
- var byteSegments = decoderResult.getByteSegments();
- if (byteSegments != null) {
- result.putMetadata(_ResultMetadataType.default.BYTE_SEGMENTS, byteSegments);
- }
- var ecLevel = decoderResult.getECLevel();
- if (ecLevel != null) {
- result.putMetadata(_ResultMetadataType.default.ERROR_CORRECTION_LEVEL, ecLevel);
- }
- return result;
- };
- AztecReader.prototype.reportFoundResultPoints = function (hints, points) {
- if (hints != null) {
- var rpcb_1 = hints.get(_DecodeHintType.default.NEED_RESULT_POINT_CALLBACK);
- if (rpcb_1 != null) {
- points.forEach(function (point, idx, arr) {
- rpcb_1.foundPossibleResultPoint(point);
- });
- }
- }
- };
- // @Override
- AztecReader.prototype.reset = function () {
- // do nothing
- };
- return AztecReader;
- }();
- var _default = AztecReader;
- exports.default = _default;
- /***/ }),
- /* 333 */
- /*!**************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/Result.js ***!
- \**************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _System = _interopRequireDefault(__webpack_require__(/*! ./util/System */ 315));
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /**
- * <p>Encapsulates the result of decoding a barcode within an image.</p>
- *
- * @author Sean Owen
- */
- var Result = /** @class */function () {
- // public constructor(private text: string,
- // Uint8Array rawBytes,
- // ResultPoconst resultPoints: Int32Array,
- // BarcodeFormat format) {
- // this(text, rawBytes, resultPoints, format, System.currentTimeMillis())
- // }
- // public constructor(text: string,
- // Uint8Array rawBytes,
- // ResultPoconst resultPoints: Int32Array,
- // BarcodeFormat format,
- // long timestamp) {
- // this(text, rawBytes, rawBytes == null ? 0 : 8 * rawBytes.length,
- // resultPoints, format, timestamp)
- // }
- function Result(text, rawBytes, numBits, resultPoints, format, timestamp) {
- if (numBits === void 0) {
- numBits = rawBytes == null ? 0 : 8 * rawBytes.length;
- }
- if (timestamp === void 0) {
- timestamp = _System.default.currentTimeMillis();
- }
- this.text = text;
- this.rawBytes = rawBytes;
- this.numBits = numBits;
- this.resultPoints = resultPoints;
- this.format = format;
- this.timestamp = timestamp;
- this.text = text;
- this.rawBytes = rawBytes;
- if (undefined === numBits || null === numBits) {
- this.numBits = rawBytes === null || rawBytes === undefined ? 0 : 8 * rawBytes.length;
- } else {
- this.numBits = numBits;
- }
- this.resultPoints = resultPoints;
- this.format = format;
- this.resultMetadata = null;
- if (undefined === timestamp || null === timestamp) {
- this.timestamp = _System.default.currentTimeMillis();
- } else {
- this.timestamp = timestamp;
- }
- }
- /**
- * @return raw text encoded by the barcode
- */
- Result.prototype.getText = function () {
- return this.text;
- };
- /**
- * @return raw bytes encoded by the barcode, if applicable, otherwise {@code null}
- */
- Result.prototype.getRawBytes = function () {
- return this.rawBytes;
- };
- /**
- * @return how many bits of {@link #getRawBytes()} are valid; typically 8 times its length
- * @since 3.3.0
- */
- Result.prototype.getNumBits = function () {
- return this.numBits;
- };
- /**
- * @return points related to the barcode in the image. These are typically points
- * identifying finder patterns or the corners of the barcode. The exact meaning is
- * specific to the type of barcode that was decoded.
- */
- Result.prototype.getResultPoints = function () {
- return this.resultPoints;
- };
- /**
- * @return {@link BarcodeFormat} representing the format of the barcode that was decoded
- */
- Result.prototype.getBarcodeFormat = function () {
- return this.format;
- };
- /**
- * @return {@link Map} mapping {@link ResultMetadataType} keys to values. May be
- * {@code null}. This contains optional metadata about what was detected about the barcode,
- * like orientation.
- */
- Result.prototype.getResultMetadata = function () {
- return this.resultMetadata;
- };
- Result.prototype.putMetadata = function (type, value) {
- if (this.resultMetadata === null) {
- this.resultMetadata = new Map();
- }
- this.resultMetadata.set(type, value);
- };
- Result.prototype.putAllMetadata = function (metadata) {
- if (metadata !== null) {
- if (this.resultMetadata === null) {
- this.resultMetadata = metadata;
- } else {
- this.resultMetadata = new Map(metadata);
- }
- }
- };
- Result.prototype.addResultPoints = function (newPoints) {
- var oldPoints = this.resultPoints;
- if (oldPoints === null) {
- this.resultPoints = newPoints;
- } else if (newPoints !== null && newPoints.length > 0) {
- var allPoints = new Array(oldPoints.length + newPoints.length);
- _System.default.arraycopy(oldPoints, 0, allPoints, 0, oldPoints.length);
- _System.default.arraycopy(newPoints, 0, allPoints, oldPoints.length, newPoints.length);
- this.resultPoints = allPoints;
- }
- };
- Result.prototype.getTimestamp = function () {
- return this.timestamp;
- };
- /*@Override*/
- Result.prototype.toString = function () {
- return this.text;
- };
- return Result;
- }();
- var _default = Result;
- exports.default = _default;
- /***/ }),
- /* 334 */
- /*!*********************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/BarcodeFormat.js ***!
- \*********************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- /*
- * Direct port to TypeScript of ZXing by Adrian Toșcă
- */
- /*
- * Copyright 2009 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /*namespace com.google.zxing {*/
- /**
- * Enumerates barcode formats known to this package. Please keep alphabetized.
- *
- * @author Sean Owen
- */
- var BarcodeFormat;
- (function (BarcodeFormat) {
- /** Aztec 2D barcode format. */
- BarcodeFormat[BarcodeFormat["AZTEC"] = 0] = "AZTEC";
- /** CODABAR 1D format. */
- BarcodeFormat[BarcodeFormat["CODABAR"] = 1] = "CODABAR";
- /** Code 39 1D format. */
- BarcodeFormat[BarcodeFormat["CODE_39"] = 2] = "CODE_39";
- /** Code 93 1D format. */
- BarcodeFormat[BarcodeFormat["CODE_93"] = 3] = "CODE_93";
- /** Code 128 1D format. */
- BarcodeFormat[BarcodeFormat["CODE_128"] = 4] = "CODE_128";
- /** Data Matrix 2D barcode format. */
- BarcodeFormat[BarcodeFormat["DATA_MATRIX"] = 5] = "DATA_MATRIX";
- /** EAN-8 1D format. */
- BarcodeFormat[BarcodeFormat["EAN_8"] = 6] = "EAN_8";
- /** EAN-13 1D format. */
- BarcodeFormat[BarcodeFormat["EAN_13"] = 7] = "EAN_13";
- /** ITF (Interleaved Two of Five) 1D format. */
- BarcodeFormat[BarcodeFormat["ITF"] = 8] = "ITF";
- /** MaxiCode 2D barcode format. */
- BarcodeFormat[BarcodeFormat["MAXICODE"] = 9] = "MAXICODE";
- /** PDF417 format. */
- BarcodeFormat[BarcodeFormat["PDF_417"] = 10] = "PDF_417";
- /** QR Code 2D barcode format. */
- BarcodeFormat[BarcodeFormat["QR_CODE"] = 11] = "QR_CODE";
- /** RSS 14 */
- BarcodeFormat[BarcodeFormat["RSS_14"] = 12] = "RSS_14";
- /** RSS EXPANDED */
- BarcodeFormat[BarcodeFormat["RSS_EXPANDED"] = 13] = "RSS_EXPANDED";
- /** UPC-A 1D format. */
- BarcodeFormat[BarcodeFormat["UPC_A"] = 14] = "UPC_A";
- /** UPC-E 1D format. */
- BarcodeFormat[BarcodeFormat["UPC_E"] = 15] = "UPC_E";
- /** UPC/EAN extension format. Not a stand-alone format. */
- BarcodeFormat[BarcodeFormat["UPC_EAN_EXTENSION"] = 16] = "UPC_EAN_EXTENSION";
- })(BarcodeFormat || (BarcodeFormat = {}));
- var _default = BarcodeFormat;
- exports.default = _default;
- /***/ }),
- /* 335 */
- /*!**************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/ResultMetadataType.js ***!
- \**************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- /*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /*namespace com.google.zxing {*/
- /**
- * Represents some type of metadata about the result of the decoding that the decoder
- * wishes to communicate back to the caller.
- *
- * @author Sean Owen
- */
- var ResultMetadataType;
- (function (ResultMetadataType) {
- /**
- * Unspecified, application-specific metadata. Maps to an unspecified {@link Object}.
- */
- ResultMetadataType[ResultMetadataType["OTHER"] = 0] = "OTHER";
- /**
- * Denotes the likely approximate orientation of the barcode in the image. This value
- * is given as degrees rotated clockwise from the normal, upright orientation.
- * For example a 1D barcode which was found by reading top-to-bottom would be
- * said to have orientation "90". This key maps to an {@link Integer} whose
- * value is in the range [0,360).
- */
- ResultMetadataType[ResultMetadataType["ORIENTATION"] = 1] = "ORIENTATION";
- /**
- * <p>2D barcode formats typically encode text, but allow for a sort of 'byte mode'
- * which is sometimes used to encode binary data. While {@link Result} makes available
- * the complete raw bytes in the barcode for these formats, it does not offer the bytes
- * from the byte segments alone.</p>
- *
- * <p>This maps to a {@link java.util.List} of byte arrays corresponding to the
- * raw bytes in the byte segments in the barcode, in order.</p>
- */
- ResultMetadataType[ResultMetadataType["BYTE_SEGMENTS"] = 2] = "BYTE_SEGMENTS";
- /**
- * Error correction level used, if applicable. The value type depends on the
- * format, but is typically a String.
- */
- ResultMetadataType[ResultMetadataType["ERROR_CORRECTION_LEVEL"] = 3] = "ERROR_CORRECTION_LEVEL";
- /**
- * For some periodicals, indicates the issue number as an {@link Integer}.
- */
- ResultMetadataType[ResultMetadataType["ISSUE_NUMBER"] = 4] = "ISSUE_NUMBER";
- /**
- * For some products, indicates the suggested retail price in the barcode as a
- * formatted {@link String}.
- */
- ResultMetadataType[ResultMetadataType["SUGGESTED_PRICE"] = 5] = "SUGGESTED_PRICE";
- /**
- * For some products, the possible country of manufacture as a {@link String} denoting the
- * ISO country code. Some map to multiple possible countries, like "US/CA".
- */
- ResultMetadataType[ResultMetadataType["POSSIBLE_COUNTRY"] = 6] = "POSSIBLE_COUNTRY";
- /**
- * For some products, the extension text
- */
- ResultMetadataType[ResultMetadataType["UPC_EAN_EXTENSION"] = 7] = "UPC_EAN_EXTENSION";
- /**
- * PDF417-specific metadata
- */
- ResultMetadataType[ResultMetadataType["PDF417_EXTRA_METADATA"] = 8] = "PDF417_EXTRA_METADATA";
- /**
- * If the code format supports structured append and the current scanned code is part of one then the
- * sequence number is given with it.
- */
- ResultMetadataType[ResultMetadataType["STRUCTURED_APPEND_SEQUENCE"] = 9] = "STRUCTURED_APPEND_SEQUENCE";
- /**
- * If the code format supports structured append and the current scanned code is part of one then the
- * parity is given with it.
- */
- ResultMetadataType[ResultMetadataType["STRUCTURED_APPEND_PARITY"] = 10] = "STRUCTURED_APPEND_PARITY";
- })(ResultMetadataType || (ResultMetadataType = {}));
- var _default = ResultMetadataType;
- exports.default = _default;
- /***/ }),
- /* 336 */
- /*!*****************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/decoder/Decoder.js ***!
- \*****************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _DecoderResult = _interopRequireDefault(__webpack_require__(/*! ../../common/DecoderResult */ 337));
- var _GenericGF = _interopRequireDefault(__webpack_require__(/*! ../../common/reedsolomon/GenericGF */ 338));
- var _ReedSolomonDecoder = _interopRequireDefault(__webpack_require__(/*! ../../common/reedsolomon/ReedSolomonDecoder */ 342));
- var _IllegalStateException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalStateException */ 344));
- var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../../FormatException */ 324));
- var _StringUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/StringUtils */ 321));
- var _Integer = _interopRequireDefault(__webpack_require__(/*! ../../util/Integer */ 318));
- /*
- * Copyright 2010 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- // import java.util.Arrays;
- var Table;
- (function (Table) {
- Table[Table["UPPER"] = 0] = "UPPER";
- Table[Table["LOWER"] = 1] = "LOWER";
- Table[Table["MIXED"] = 2] = "MIXED";
- Table[Table["DIGIT"] = 3] = "DIGIT";
- Table[Table["PUNCT"] = 4] = "PUNCT";
- Table[Table["BINARY"] = 5] = "BINARY";
- })(Table || (Table = {}));
- /**
- * <p>The main class which implements Aztec Code decoding -- as opposed to locating and extracting
- * the Aztec Code from an image.</p>
- *
- * @author David Olivier
- */
- var Decoder = /** @class */function () {
- function Decoder() {}
- Decoder.prototype.decode = function (detectorResult) {
- this.ddata = detectorResult;
- var matrix = detectorResult.getBits();
- var rawbits = this.extractBits(matrix);
- var correctedBits = this.correctBits(rawbits);
- var rawBytes = Decoder.convertBoolArrayToByteArray(correctedBits);
- var result = Decoder.getEncodedData(correctedBits);
- var decoderResult = new _DecoderResult.default(rawBytes, result, null, null);
- decoderResult.setNumBits(correctedBits.length);
- return decoderResult;
- };
- // This method is used for testing the high-level encoder
- Decoder.highLevelDecode = function (correctedBits) {
- return this.getEncodedData(correctedBits);
- };
- /**
- * Gets the string encoded in the aztec code bits
- *
- * @return the decoded string
- */
- Decoder.getEncodedData = function (correctedBits) {
- var endIndex = correctedBits.length;
- var latchTable = Table.UPPER; // table most recently latched to
- var shiftTable = Table.UPPER; // table to use for the next read
- var result = '';
- var index = 0;
- while (index < endIndex) {
- if (shiftTable === Table.BINARY) {
- if (endIndex - index < 5) {
- break;
- }
- var length_1 = Decoder.readCode(correctedBits, index, 5);
- index += 5;
- if (length_1 === 0) {
- if (endIndex - index < 11) {
- break;
- }
- length_1 = Decoder.readCode(correctedBits, index, 11) + 31;
- index += 11;
- }
- for (var charCount = 0; charCount < length_1; charCount++) {
- if (endIndex - index < 8) {
- index = endIndex; // Force outer loop to exit
- break;
- }
- var code = Decoder.readCode(correctedBits, index, 8);
- result += /*(char)*/_StringUtils.default.castAsNonUtf8Char(code);
- index += 8;
- }
- // Go back to whatever mode we had been in
- shiftTable = latchTable;
- } else {
- var size = shiftTable === Table.DIGIT ? 4 : 5;
- if (endIndex - index < size) {
- break;
- }
- var code = Decoder.readCode(correctedBits, index, size);
- index += size;
- var str = Decoder.getCharacter(shiftTable, code);
- if (str.startsWith('CTRL_')) {
- // Table changes
- // ISO/IEC 24778:2008 prescribes ending a shift sequence in the mode from which it was invoked.
- // That's including when that mode is a shift.
- // Our test case dlusbs.png for issue #642 exercises that.
- latchTable = shiftTable; // Latch the current mode, so as to return to Upper after U/S B/S
- shiftTable = Decoder.getTable(str.charAt(5));
- if (str.charAt(6) === 'L') {
- latchTable = shiftTable;
- }
- } else {
- result += str;
- // Go back to whatever mode we had been in
- shiftTable = latchTable;
- }
- }
- }
- return result;
- };
- /**
- * gets the table corresponding to the char passed
- */
- Decoder.getTable = function (t) {
- switch (t) {
- case 'L':
- return Table.LOWER;
- case 'P':
- return Table.PUNCT;
- case 'M':
- return Table.MIXED;
- case 'D':
- return Table.DIGIT;
- case 'B':
- return Table.BINARY;
- case 'U':
- default:
- return Table.UPPER;
- }
- };
- /**
- * Gets the character (or string) corresponding to the passed code in the given table
- *
- * @param table the table used
- * @param code the code of the character
- */
- Decoder.getCharacter = function (table, code) {
- switch (table) {
- case Table.UPPER:
- return Decoder.UPPER_TABLE[code];
- case Table.LOWER:
- return Decoder.LOWER_TABLE[code];
- case Table.MIXED:
- return Decoder.MIXED_TABLE[code];
- case Table.PUNCT:
- return Decoder.PUNCT_TABLE[code];
- case Table.DIGIT:
- return Decoder.DIGIT_TABLE[code];
- default:
- // Should not reach here.
- throw new _IllegalStateException.default('Bad table');
- }
- };
- /**
- * <p>Performs RS error correction on an array of bits.</p>
- *
- * @return the corrected array
- * @throws FormatException if the input contains too many errors
- */
- Decoder.prototype.correctBits = function (rawbits) {
- var gf;
- var codewordSize;
- if (this.ddata.getNbLayers() <= 2) {
- codewordSize = 6;
- gf = _GenericGF.default.AZTEC_DATA_6;
- } else if (this.ddata.getNbLayers() <= 8) {
- codewordSize = 8;
- gf = _GenericGF.default.AZTEC_DATA_8;
- } else if (this.ddata.getNbLayers() <= 22) {
- codewordSize = 10;
- gf = _GenericGF.default.AZTEC_DATA_10;
- } else {
- codewordSize = 12;
- gf = _GenericGF.default.AZTEC_DATA_12;
- }
- var numDataCodewords = this.ddata.getNbDatablocks();
- var numCodewords = rawbits.length / codewordSize;
- if (numCodewords < numDataCodewords) {
- throw new _FormatException.default();
- }
- var offset = rawbits.length % codewordSize;
- var dataWords = new Int32Array(numCodewords);
- for (var i = 0; i < numCodewords; i++, offset += codewordSize) {
- dataWords[i] = Decoder.readCode(rawbits, offset, codewordSize);
- }
- try {
- var rsDecoder = new _ReedSolomonDecoder.default(gf);
- rsDecoder.decode(dataWords, numCodewords - numDataCodewords);
- } catch (ex) {
- throw new _FormatException.default(ex);
- }
- // Now perform the unstuffing operation.
- // First, count how many bits are going to be thrown out as stuffing
- var mask = (1 << codewordSize) - 1;
- var stuffedBits = 0;
- for (var i = 0; i < numDataCodewords; i++) {
- var dataWord = dataWords[i];
- if (dataWord === 0 || dataWord === mask) {
- throw new _FormatException.default();
- } else if (dataWord === 1 || dataWord === mask - 1) {
- stuffedBits++;
- }
- }
- // Now, actually unpack the bits and remove the stuffing
- var correctedBits = new Array(numDataCodewords * codewordSize - stuffedBits);
- var index = 0;
- for (var i = 0; i < numDataCodewords; i++) {
- var dataWord = dataWords[i];
- if (dataWord === 1 || dataWord === mask - 1) {
- // next codewordSize-1 bits are all zeros or all ones
- correctedBits.fill(dataWord > 1, index, index + codewordSize - 1);
- // Arrays.fill(correctedBits, index, index + codewordSize - 1, dataWord > 1);
- index += codewordSize - 1;
- } else {
- for (var bit = codewordSize - 1; bit >= 0; --bit) {
- correctedBits[index++] = (dataWord & 1 << bit) !== 0;
- }
- }
- }
- return correctedBits;
- };
- /**
- * Gets the array of bits from an Aztec Code matrix
- *
- * @return the array of bits
- */
- Decoder.prototype.extractBits = function (matrix) {
- var compact = this.ddata.isCompact();
- var layers = this.ddata.getNbLayers();
- var baseMatrixSize = (compact ? 11 : 14) + layers * 4; // not including alignment lines
- var alignmentMap = new Int32Array(baseMatrixSize);
- var rawbits = new Array(this.totalBitsInLayer(layers, compact));
- if (compact) {
- for (var i = 0; i < alignmentMap.length; i++) {
- alignmentMap[i] = i;
- }
- } else {
- var matrixSize = baseMatrixSize + 1 + 2 * _Integer.default.truncDivision(_Integer.default.truncDivision(baseMatrixSize, 2) - 1, 15);
- var origCenter = baseMatrixSize / 2;
- var center = _Integer.default.truncDivision(matrixSize, 2);
- for (var i = 0; i < origCenter; i++) {
- var newOffset = i + _Integer.default.truncDivision(i, 15);
- alignmentMap[origCenter - i - 1] = center - newOffset - 1;
- alignmentMap[origCenter + i] = center + newOffset + 1;
- }
- }
- for (var i = 0, rowOffset = 0; i < layers; i++) {
- var rowSize = (layers - i) * 4 + (compact ? 9 : 12);
- // The top-left most point of this layer is <low, low> (not including alignment lines)
- var low = i * 2;
- // The bottom-right most point of this layer is <high, high> (not including alignment lines)
- var high = baseMatrixSize - 1 - low;
- // We pull bits from the two 2 x rowSize columns and two rowSize x 2 rows
- for (var j = 0; j < rowSize; j++) {
- var columnOffset = j * 2;
- for (var k = 0; k < 2; k++) {
- // left column
- rawbits[rowOffset + columnOffset + k] = matrix.get(alignmentMap[low + k], alignmentMap[low + j]);
- // bottom row
- rawbits[rowOffset + 2 * rowSize + columnOffset + k] = matrix.get(alignmentMap[low + j], alignmentMap[high - k]);
- // right column
- rawbits[rowOffset + 4 * rowSize + columnOffset + k] = matrix.get(alignmentMap[high - k], alignmentMap[high - j]);
- // top row
- rawbits[rowOffset + 6 * rowSize + columnOffset + k] = matrix.get(alignmentMap[high - j], alignmentMap[low + k]);
- }
- }
- rowOffset += rowSize * 8;
- }
- return rawbits;
- };
- /**
- * Reads a code of given length and at given index in an array of bits
- */
- Decoder.readCode = function (rawbits, startIndex, length) {
- var res = 0;
- for (var i = startIndex; i < startIndex + length; i++) {
- res <<= 1;
- if (rawbits[i]) {
- res |= 0x01;
- }
- }
- return res;
- };
- /**
- * Reads a code of length 8 in an array of bits, padding with zeros
- */
- Decoder.readByte = function (rawbits, startIndex) {
- var n = rawbits.length - startIndex;
- if (n >= 8) {
- return Decoder.readCode(rawbits, startIndex, 8);
- }
- return Decoder.readCode(rawbits, startIndex, n) << 8 - n;
- };
- /**
- * Packs a bit array into bytes, most significant bit first
- */
- Decoder.convertBoolArrayToByteArray = function (boolArr) {
- var byteArr = new Uint8Array((boolArr.length + 7) / 8);
- for (var i = 0; i < byteArr.length; i++) {
- byteArr[i] = Decoder.readByte(boolArr, 8 * i);
- }
- return byteArr;
- };
- Decoder.prototype.totalBitsInLayer = function (layers, compact) {
- return ((compact ? 88 : 112) + 16 * layers) * layers;
- };
- Decoder.UPPER_TABLE = ['CTRL_PS', ' ', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'CTRL_LL', 'CTRL_ML', 'CTRL_DL', 'CTRL_BS'];
- Decoder.LOWER_TABLE = ['CTRL_PS', ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'CTRL_US', 'CTRL_ML', 'CTRL_DL', 'CTRL_BS'];
- Decoder.MIXED_TABLE = ['CTRL_PS', ' ', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\b', '\t', '\n', '\x0b', '\f', '\r', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', '@', '\\', '^', '_', '`', '|', '~', '\x7f', 'CTRL_LL', 'CTRL_UL', 'CTRL_PL', 'CTRL_BS'];
- Decoder.PUNCT_TABLE = ['', '\r', '\r\n', '. ', ', ', ': ', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '[', ']', '{', '}', 'CTRL_UL'];
- Decoder.DIGIT_TABLE = ['CTRL_PS', ' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ',', '.', 'CTRL_UL', 'CTRL_US'];
- return Decoder;
- }();
- var _default = Decoder;
- exports.default = _default;
- /***/ }),
- /* 337 */
- /*!****************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/DecoderResult.js ***!
- \****************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /*namespace com.google.zxing.common {*/
- /*import java.util.List;*/
- /**
- * <p>Encapsulates the result of decoding a matrix of bits. This typically
- * applies to 2D barcode formats. For now it contains the raw bytes obtained,
- * as well as a String interpretation of those bytes, if applicable.</p>
- *
- * @author Sean Owen
- */
- var DecoderResult = /** @class */function () {
- // public constructor(rawBytes: Uint8Array,
- // text: string,
- // List<Uint8Array> byteSegments,
- // String ecLevel) {
- // this(rawBytes, text, byteSegments, ecLevel, -1, -1)
- // }
- function DecoderResult(rawBytes, text, byteSegments, ecLevel, structuredAppendSequenceNumber, structuredAppendParity) {
- if (structuredAppendSequenceNumber === void 0) {
- structuredAppendSequenceNumber = -1;
- }
- if (structuredAppendParity === void 0) {
- structuredAppendParity = -1;
- }
- this.rawBytes = rawBytes;
- this.text = text;
- this.byteSegments = byteSegments;
- this.ecLevel = ecLevel;
- this.structuredAppendSequenceNumber = structuredAppendSequenceNumber;
- this.structuredAppendParity = structuredAppendParity;
- this.numBits = rawBytes === undefined || rawBytes === null ? 0 : 8 * rawBytes.length;
- }
- /**
- * @return raw bytes representing the result, or {@code null} if not applicable
- */
- DecoderResult.prototype.getRawBytes = function () {
- return this.rawBytes;
- };
- /**
- * @return how many bits of {@link #getRawBytes()} are valid; typically 8 times its length
- * @since 3.3.0
- */
- DecoderResult.prototype.getNumBits = function () {
- return this.numBits;
- };
- /**
- * @param numBits overrides the number of bits that are valid in {@link #getRawBytes()}
- * @since 3.3.0
- */
- DecoderResult.prototype.setNumBits = function (numBits /*int*/) {
- this.numBits = numBits;
- };
- /**
- * @return text representation of the result
- */
- DecoderResult.prototype.getText = function () {
- return this.text;
- };
- /**
- * @return list of byte segments in the result, or {@code null} if not applicable
- */
- DecoderResult.prototype.getByteSegments = function () {
- return this.byteSegments;
- };
- /**
- * @return name of error correction level used, or {@code null} if not applicable
- */
- DecoderResult.prototype.getECLevel = function () {
- return this.ecLevel;
- };
- /**
- * @return number of errors corrected, or {@code null} if not applicable
- */
- DecoderResult.prototype.getErrorsCorrected = function () {
- return this.errorsCorrected;
- };
- DecoderResult.prototype.setErrorsCorrected = function (errorsCorrected /*Integer*/) {
- this.errorsCorrected = errorsCorrected;
- };
- /**
- * @return number of erasures corrected, or {@code null} if not applicable
- */
- DecoderResult.prototype.getErasures = function () {
- return this.erasures;
- };
- DecoderResult.prototype.setErasures = function (erasures /*Integer*/) {
- this.erasures = erasures;
- };
- /**
- * @return arbitrary additional metadata
- */
- DecoderResult.prototype.getOther = function () {
- return this.other;
- };
- DecoderResult.prototype.setOther = function (other) {
- this.other = other;
- };
- DecoderResult.prototype.hasStructuredAppend = function () {
- return this.structuredAppendParity >= 0 && this.structuredAppendSequenceNumber >= 0;
- };
- DecoderResult.prototype.getStructuredAppendParity = function () {
- return this.structuredAppendParity;
- };
- DecoderResult.prototype.getStructuredAppendSequenceNumber = function () {
- return this.structuredAppendSequenceNumber;
- };
- return DecoderResult;
- }();
- var _default = DecoderResult;
- exports.default = _default;
- /***/ }),
- /* 338 */
- /*!************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/reedsolomon/GenericGF.js ***!
- \************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _GenericGFPoly = _interopRequireDefault(__webpack_require__(/*! ./GenericGFPoly */ 339));
- var _AbstractGenericGF = _interopRequireDefault(__webpack_require__(/*! ./AbstractGenericGF */ 340));
- var _Integer = _interopRequireDefault(__webpack_require__(/*! ../../util/Integer */ 318));
- var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalArgumentException */ 308));
- var _ArithmeticException = _interopRequireDefault(__webpack_require__(/*! ../../ArithmeticException */ 341));
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /*namespace com.google.zxing.common.reedsolomon {*/
- /**
- * <p>This class contains utility methods for performing mathematical operations over
- * the Galois Fields. Operations use a given primitive polynomial in calculations.</p>
- *
- * <p>Throughout this package, elements of the GF are represented as an {@code int}
- * for convenience and speed (but at the cost of memory).
- * </p>
- *
- * @author Sean Owen
- * @author David Olivier
- */
- var GenericGF = /** @class */function (_super) {
- __extends(GenericGF, _super);
- /**
- * Create a representation of GF(size) using the given primitive polynomial.
- *
- * @param primitive irreducible polynomial whose coefficients are represented by
- * the bits of an int, where the least-significant bit represents the constant
- * coefficient
- * @param size the size of the field
- * @param b the factor b in the generator polynomial can be 0- or 1-based
- * (g(x) = (x+a^b)(x+a^(b+1))...(x+a^(b+2t-1))).
- * In most cases it should be 1, but for QR code it is 0.
- */
- function GenericGF(primitive /*int*/, size /*int*/, generatorBase /*int*/) {
- var _this = _super.call(this) || this;
- _this.primitive = primitive;
- _this.size = size;
- _this.generatorBase = generatorBase;
- var expTable = new Int32Array(size);
- var x = 1;
- for (var i = 0; i < size; i++) {
- expTable[i] = x;
- x *= 2; // we're assuming the generator alpha is 2
- if (x >= size) {
- x ^= primitive;
- x &= size - 1;
- }
- }
- _this.expTable = expTable;
- var logTable = new Int32Array(size);
- for (var i = 0; i < size - 1; i++) {
- logTable[expTable[i]] = i;
- }
- _this.logTable = logTable;
- // logTable[0] == 0 but this should never be used
- _this.zero = new _GenericGFPoly.default(_this, Int32Array.from([0]));
- _this.one = new _GenericGFPoly.default(_this, Int32Array.from([1]));
- return _this;
- }
- GenericGF.prototype.getZero = function () {
- return this.zero;
- };
- GenericGF.prototype.getOne = function () {
- return this.one;
- };
- /**
- * @return the monomial representing coefficient * x^degree
- */
- GenericGF.prototype.buildMonomial = function (degree /*int*/, coefficient /*int*/) {
- if (degree < 0) {
- throw new _IllegalArgumentException.default();
- }
- if (coefficient === 0) {
- return this.zero;
- }
- var coefficients = new Int32Array(degree + 1);
- coefficients[0] = coefficient;
- return new _GenericGFPoly.default(this, coefficients);
- };
- /**
- * @return multiplicative inverse of a
- */
- GenericGF.prototype.inverse = function (a /*int*/) {
- if (a === 0) {
- throw new _ArithmeticException.default();
- }
- return this.expTable[this.size - this.logTable[a] - 1];
- };
- /**
- * @return product of a and b in GF(size)
- */
- GenericGF.prototype.multiply = function (a /*int*/, b /*int*/) {
- if (a === 0 || b === 0) {
- return 0;
- }
- return this.expTable[(this.logTable[a] + this.logTable[b]) % (this.size - 1)];
- };
- GenericGF.prototype.getSize = function () {
- return this.size;
- };
- GenericGF.prototype.getGeneratorBase = function () {
- return this.generatorBase;
- };
- /*@Override*/
- GenericGF.prototype.toString = function () {
- return 'GF(0x' + _Integer.default.toHexString(this.primitive) + ',' + this.size + ')';
- };
- GenericGF.prototype.equals = function (o) {
- return o === this;
- };
- GenericGF.AZTEC_DATA_12 = new GenericGF(0x1069, 4096, 1); // x^12 + x^6 + x^5 + x^3 + 1
- GenericGF.AZTEC_DATA_10 = new GenericGF(0x409, 1024, 1); // x^10 + x^3 + 1
- GenericGF.AZTEC_DATA_6 = new GenericGF(0x43, 64, 1); // x^6 + x + 1
- GenericGF.AZTEC_PARAM = new GenericGF(0x13, 16, 1); // x^4 + x + 1
- GenericGF.QR_CODE_FIELD_256 = new GenericGF(0x011d, 256, 0); // x^8 + x^4 + x^3 + x^2 + 1
- GenericGF.DATA_MATRIX_FIELD_256 = new GenericGF(0x012d, 256, 1); // x^8 + x^5 + x^3 + x^2 + 1
- GenericGF.AZTEC_DATA_8 = GenericGF.DATA_MATRIX_FIELD_256;
- GenericGF.MAXICODE_FIELD_64 = GenericGF.AZTEC_DATA_6;
- return GenericGF;
- }(_AbstractGenericGF.default);
- var _default = GenericGF;
- exports.default = _default;
- /***/ }),
- /* 339 */
- /*!****************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/reedsolomon/GenericGFPoly.js ***!
- \****************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _AbstractGenericGF = _interopRequireDefault(__webpack_require__(/*! ./AbstractGenericGF */ 340));
- var _System = _interopRequireDefault(__webpack_require__(/*! ../../util/System */ 315));
- var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalArgumentException */ 308));
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /*namespace com.google.zxing.common.reedsolomon {*/
- /**
- * <p>Represents a polynomial whose coefficients are elements of a GF.
- * Instances of this class are immutable.</p>
- *
- * <p>Much credit is due to William Rucklidge since portions of this code are an indirect
- * port of his C++ Reed-Solomon implementation.</p>
- *
- * @author Sean Owen
- */
- var GenericGFPoly = /** @class */function () {
- /**
- * @param field the {@link GenericGF} instance representing the field to use
- * to perform computations
- * @param coefficients coefficients as ints representing elements of GF(size), arranged
- * from most significant (highest-power term) coefficient to least significant
- * @throws IllegalArgumentException if argument is null or empty,
- * or if leading coefficient is 0 and this is not a
- * constant polynomial (that is, it is not the monomial "0")
- */
- function GenericGFPoly(field, coefficients) {
- if (coefficients.length === 0) {
- throw new _IllegalArgumentException.default();
- }
- this.field = field;
- var coefficientsLength = coefficients.length;
- if (coefficientsLength > 1 && coefficients[0] === 0) {
- // Leading term must be non-zero for anything except the constant polynomial "0"
- var firstNonZero = 1;
- while (firstNonZero < coefficientsLength && coefficients[firstNonZero] === 0) {
- firstNonZero++;
- }
- if (firstNonZero === coefficientsLength) {
- this.coefficients = Int32Array.from([0]);
- } else {
- this.coefficients = new Int32Array(coefficientsLength - firstNonZero);
- _System.default.arraycopy(coefficients, firstNonZero, this.coefficients, 0, this.coefficients.length);
- }
- } else {
- this.coefficients = coefficients;
- }
- }
- GenericGFPoly.prototype.getCoefficients = function () {
- return this.coefficients;
- };
- /**
- * @return degree of this polynomial
- */
- GenericGFPoly.prototype.getDegree = function () {
- return this.coefficients.length - 1;
- };
- /**
- * @return true iff this polynomial is the monomial "0"
- */
- GenericGFPoly.prototype.isZero = function () {
- return this.coefficients[0] === 0;
- };
- /**
- * @return coefficient of x^degree term in this polynomial
- */
- GenericGFPoly.prototype.getCoefficient = function (degree /*int*/) {
- return this.coefficients[this.coefficients.length - 1 - degree];
- };
- /**
- * @return evaluation of this polynomial at a given point
- */
- GenericGFPoly.prototype.evaluateAt = function (a /*int*/) {
- if (a === 0) {
- // Just return the x^0 coefficient
- return this.getCoefficient(0);
- }
- var coefficients = this.coefficients;
- var result;
- if (a === 1) {
- // Just the sum of the coefficients
- result = 0;
- for (var i = 0, length_1 = coefficients.length; i !== length_1; i++) {
- var coefficient = coefficients[i];
- result = _AbstractGenericGF.default.addOrSubtract(result, coefficient);
- }
- return result;
- }
- result = coefficients[0];
- var size = coefficients.length;
- var field = this.field;
- for (var i = 1; i < size; i++) {
- result = _AbstractGenericGF.default.addOrSubtract(field.multiply(a, result), coefficients[i]);
- }
- return result;
- };
- GenericGFPoly.prototype.addOrSubtract = function (other) {
- if (!this.field.equals(other.field)) {
- throw new _IllegalArgumentException.default('GenericGFPolys do not have same GenericGF field');
- }
- if (this.isZero()) {
- return other;
- }
- if (other.isZero()) {
- return this;
- }
- var smallerCoefficients = this.coefficients;
- var largerCoefficients = other.coefficients;
- if (smallerCoefficients.length > largerCoefficients.length) {
- var temp = smallerCoefficients;
- smallerCoefficients = largerCoefficients;
- largerCoefficients = temp;
- }
- var sumDiff = new Int32Array(largerCoefficients.length);
- var lengthDiff = largerCoefficients.length - smallerCoefficients.length;
- // Copy high-order terms only found in higher-degree polynomial's coefficients
- _System.default.arraycopy(largerCoefficients, 0, sumDiff, 0, lengthDiff);
- for (var i = lengthDiff; i < largerCoefficients.length; i++) {
- sumDiff[i] = _AbstractGenericGF.default.addOrSubtract(smallerCoefficients[i - lengthDiff], largerCoefficients[i]);
- }
- return new GenericGFPoly(this.field, sumDiff);
- };
- GenericGFPoly.prototype.multiply = function (other) {
- if (!this.field.equals(other.field)) {
- throw new _IllegalArgumentException.default('GenericGFPolys do not have same GenericGF field');
- }
- if (this.isZero() || other.isZero()) {
- return this.field.getZero();
- }
- var aCoefficients = this.coefficients;
- var aLength = aCoefficients.length;
- var bCoefficients = other.coefficients;
- var bLength = bCoefficients.length;
- var product = new Int32Array(aLength + bLength - 1);
- var field = this.field;
- for (var i = 0; i < aLength; i++) {
- var aCoeff = aCoefficients[i];
- for (var j = 0; j < bLength; j++) {
- product[i + j] = _AbstractGenericGF.default.addOrSubtract(product[i + j], field.multiply(aCoeff, bCoefficients[j]));
- }
- }
- return new GenericGFPoly(field, product);
- };
- GenericGFPoly.prototype.multiplyScalar = function (scalar /*int*/) {
- if (scalar === 0) {
- return this.field.getZero();
- }
- if (scalar === 1) {
- return this;
- }
- var size = this.coefficients.length;
- var field = this.field;
- var product = new Int32Array(size);
- var coefficients = this.coefficients;
- for (var i = 0; i < size; i++) {
- product[i] = field.multiply(coefficients[i], scalar);
- }
- return new GenericGFPoly(field, product);
- };
- GenericGFPoly.prototype.multiplyByMonomial = function (degree /*int*/, coefficient /*int*/) {
- if (degree < 0) {
- throw new _IllegalArgumentException.default();
- }
- if (coefficient === 0) {
- return this.field.getZero();
- }
- var coefficients = this.coefficients;
- var size = coefficients.length;
- var product = new Int32Array(size + degree);
- var field = this.field;
- for (var i = 0; i < size; i++) {
- product[i] = field.multiply(coefficients[i], coefficient);
- }
- return new GenericGFPoly(field, product);
- };
- GenericGFPoly.prototype.divide = function (other) {
- if (!this.field.equals(other.field)) {
- throw new _IllegalArgumentException.default('GenericGFPolys do not have same GenericGF field');
- }
- if (other.isZero()) {
- throw new _IllegalArgumentException.default('Divide by 0');
- }
- var field = this.field;
- var quotient = field.getZero();
- var remainder = this;
- var denominatorLeadingTerm = other.getCoefficient(other.getDegree());
- var inverseDenominatorLeadingTerm = field.inverse(denominatorLeadingTerm);
- while (remainder.getDegree() >= other.getDegree() && !remainder.isZero()) {
- var degreeDifference = remainder.getDegree() - other.getDegree();
- var scale = field.multiply(remainder.getCoefficient(remainder.getDegree()), inverseDenominatorLeadingTerm);
- var term = other.multiplyByMonomial(degreeDifference, scale);
- var iterationQuotient = field.buildMonomial(degreeDifference, scale);
- quotient = quotient.addOrSubtract(iterationQuotient);
- remainder = remainder.addOrSubtract(term);
- }
- return [quotient, remainder];
- };
- /*@Override*/
- GenericGFPoly.prototype.toString = function () {
- var result = '';
- for (var degree = this.getDegree(); degree >= 0; degree--) {
- var coefficient = this.getCoefficient(degree);
- if (coefficient !== 0) {
- if (coefficient < 0) {
- result += ' - ';
- coefficient = -coefficient;
- } else {
- if (result.length > 0) {
- result += ' + ';
- }
- }
- if (degree === 0 || coefficient !== 1) {
- var alphaPower = this.field.log(coefficient);
- if (alphaPower === 0) {
- result += '1';
- } else if (alphaPower === 1) {
- result += 'a';
- } else {
- result += 'a^';
- result += alphaPower;
- }
- }
- if (degree !== 0) {
- if (degree === 1) {
- result += 'x';
- } else {
- result += 'x^';
- result += degree;
- }
- }
- }
- }
- return result;
- };
- return GenericGFPoly;
- }();
- var _default = GenericGFPoly;
- exports.default = _default;
- /***/ }),
- /* 340 */
- /*!********************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/reedsolomon/AbstractGenericGF.js ***!
- \********************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalArgumentException */ 308));
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /**
- * <p>This class contains utility methods for performing mathematical operations over
- * the Galois Fields. Operations use a given primitive polynomial in calculations.</p>
- *
- * <p>Throughout this package, elements of the GF are represented as an {@code int}
- * for convenience and speed (but at the cost of memory).
- * </p>
- *
- * @author Sean Owen
- * @author David Olivier
- */
- var AbstractGenericGF = /** @class */function () {
- function AbstractGenericGF() {}
- /**
- * @return 2 to the power of a in GF(size)
- */
- AbstractGenericGF.prototype.exp = function (a) {
- return this.expTable[a];
- };
- /**
- * @return base 2 log of a in GF(size)
- */
- AbstractGenericGF.prototype.log = function (a /*int*/) {
- if (a === 0) {
- throw new _IllegalArgumentException.default();
- }
- return this.logTable[a];
- };
- /**
- * Implements both addition and subtraction -- they are the same in GF(size).
- *
- * @return sum/difference of a and b
- */
- AbstractGenericGF.addOrSubtract = function (a /*int*/, b /*int*/) {
- return a ^ b;
- };
- return AbstractGenericGF;
- }();
- var _default = AbstractGenericGF;
- exports.default = _default;
- /***/ }),
- /* 341 */
- /*!***************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/ArithmeticException.js ***!
- \***************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _Exception = _interopRequireDefault(__webpack_require__(/*! ./Exception */ 305));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /**
- * Custom Error class of type Exception.
- */
- var ArithmeticException = /** @class */function (_super) {
- __extends(ArithmeticException, _super);
- function ArithmeticException() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ArithmeticException.kind = 'ArithmeticException';
- return ArithmeticException;
- }(_Exception.default);
- var _default = ArithmeticException;
- exports.default = _default;
- /***/ }),
- /* 342 */
- /*!*********************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/reedsolomon/ReedSolomonDecoder.js ***!
- \*********************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _GenericGF = _interopRequireDefault(__webpack_require__(/*! ./GenericGF */ 338));
- var _GenericGFPoly = _interopRequireDefault(__webpack_require__(/*! ./GenericGFPoly */ 339));
- var _ReedSolomonException = _interopRequireDefault(__webpack_require__(/*! ../../ReedSolomonException */ 343));
- var _IllegalStateException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalStateException */ 344));
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /*namespace com.google.zxing.common.reedsolomon {*/
- /**
- * <p>Implements Reed-Solomon decoding, as the name implies.</p>
- *
- * <p>The algorithm will not be explained here, but the following references were helpful
- * in creating this implementation:</p>
- *
- * <ul>
- * <li>Bruce Maggs.
- * <a href="http://www.cs.cmu.edu/afs/cs.cmu.edu/project/pscico-guyb/realworld/www/rs_decode.ps">
- * "Decoding Reed-Solomon Codes"</a> (see discussion of Forney's Formula)</li>
- * <li>J.I. Hall. <a href="www.mth.msu.edu/~jhall/classes/codenotes/GRS.pdf">
- * "Chapter 5. Generalized Reed-Solomon Codes"</a>
- * (see discussion of Euclidean algorithm)</li>
- * </ul>
- *
- * <p>Much credit is due to William Rucklidge since portions of this code are an indirect
- * port of his C++ Reed-Solomon implementation.</p>
- *
- * @author Sean Owen
- * @author William Rucklidge
- * @author sanfordsquires
- */
- var ReedSolomonDecoder = /** @class */function () {
- function ReedSolomonDecoder(field) {
- this.field = field;
- }
- /**
- * <p>Decodes given set of received codewords, which include both data and error-correction
- * codewords. Really, this means it uses Reed-Solomon to detect and correct errors, in-place,
- * in the input.</p>
- *
- * @param received data and error-correction codewords
- * @param twoS number of error-correction codewords available
- * @throws ReedSolomonException if decoding fails for any reason
- */
- ReedSolomonDecoder.prototype.decode = function (received, twoS /*int*/) {
- var field = this.field;
- var poly = new _GenericGFPoly.default(field, received);
- var syndromeCoefficients = new Int32Array(twoS);
- var noError = true;
- for (var i = 0; i < twoS; i++) {
- var evalResult = poly.evaluateAt(field.exp(i + field.getGeneratorBase()));
- syndromeCoefficients[syndromeCoefficients.length - 1 - i] = evalResult;
- if (evalResult !== 0) {
- noError = false;
- }
- }
- if (noError) {
- return;
- }
- var syndrome = new _GenericGFPoly.default(field, syndromeCoefficients);
- var sigmaOmega = this.runEuclideanAlgorithm(field.buildMonomial(twoS, 1), syndrome, twoS);
- var sigma = sigmaOmega[0];
- var omega = sigmaOmega[1];
- var errorLocations = this.findErrorLocations(sigma);
- var errorMagnitudes = this.findErrorMagnitudes(omega, errorLocations);
- for (var i = 0; i < errorLocations.length; i++) {
- var position = received.length - 1 - field.log(errorLocations[i]);
- if (position < 0) {
- throw new _ReedSolomonException.default('Bad error location');
- }
- received[position] = _GenericGF.default.addOrSubtract(received[position], errorMagnitudes[i]);
- }
- };
- ReedSolomonDecoder.prototype.runEuclideanAlgorithm = function (a, b, R /*int*/) {
- // Assume a's degree is >= b's
- if (a.getDegree() < b.getDegree()) {
- var temp = a;
- a = b;
- b = temp;
- }
- var field = this.field;
- var rLast = a;
- var r = b;
- var tLast = field.getZero();
- var t = field.getOne();
- // Run Euclidean algorithm until r's degree is less than R/2
- while (r.getDegree() >= (R / 2 | 0)) {
- var rLastLast = rLast;
- var tLastLast = tLast;
- rLast = r;
- tLast = t;
- // Divide rLastLast by rLast, with quotient in q and remainder in r
- if (rLast.isZero()) {
- // Oops, Euclidean algorithm already terminated?
- throw new _ReedSolomonException.default('r_{i-1} was zero');
- }
- r = rLastLast;
- var q = field.getZero();
- var denominatorLeadingTerm = rLast.getCoefficient(rLast.getDegree());
- var dltInverse = field.inverse(denominatorLeadingTerm);
- while (r.getDegree() >= rLast.getDegree() && !r.isZero()) {
- var degreeDiff = r.getDegree() - rLast.getDegree();
- var scale = field.multiply(r.getCoefficient(r.getDegree()), dltInverse);
- q = q.addOrSubtract(field.buildMonomial(degreeDiff, scale));
- r = r.addOrSubtract(rLast.multiplyByMonomial(degreeDiff, scale));
- }
- t = q.multiply(tLast).addOrSubtract(tLastLast);
- if (r.getDegree() >= rLast.getDegree()) {
- throw new _IllegalStateException.default('Division algorithm failed to reduce polynomial?');
- }
- }
- var sigmaTildeAtZero = t.getCoefficient(0);
- if (sigmaTildeAtZero === 0) {
- throw new _ReedSolomonException.default('sigmaTilde(0) was zero');
- }
- var inverse = field.inverse(sigmaTildeAtZero);
- var sigma = t.multiplyScalar(inverse);
- var omega = r.multiplyScalar(inverse);
- return [sigma, omega];
- };
- ReedSolomonDecoder.prototype.findErrorLocations = function (errorLocator) {
- // This is a direct application of Chien's search
- var numErrors = errorLocator.getDegree();
- if (numErrors === 1) {
- // shortcut
- return Int32Array.from([errorLocator.getCoefficient(1)]);
- }
- var result = new Int32Array(numErrors);
- var e = 0;
- var field = this.field;
- for (var i = 1; i < field.getSize() && e < numErrors; i++) {
- if (errorLocator.evaluateAt(i) === 0) {
- result[e] = field.inverse(i);
- e++;
- }
- }
- if (e !== numErrors) {
- throw new _ReedSolomonException.default('Error locator degree does not match number of roots');
- }
- return result;
- };
- ReedSolomonDecoder.prototype.findErrorMagnitudes = function (errorEvaluator, errorLocations) {
- // This is directly applying Forney's Formula
- var s = errorLocations.length;
- var result = new Int32Array(s);
- var field = this.field;
- for (var i = 0; i < s; i++) {
- var xiInverse = field.inverse(errorLocations[i]);
- var denominator = 1;
- for (var j = 0; j < s; j++) {
- if (i !== j) {
- // denominator = field.multiply(denominator,
- // GenericGF.addOrSubtract(1, field.multiply(errorLocations[j], xiInverse)))
- // Above should work but fails on some Apple and Linux JDKs due to a Hotspot bug.
- // Below is a funny-looking workaround from Steven Parkes
- var term = field.multiply(errorLocations[j], xiInverse);
- var termPlus1 = (term & 0x1) === 0 ? term | 1 : term & ~1;
- denominator = field.multiply(denominator, termPlus1);
- }
- }
- result[i] = field.multiply(errorEvaluator.evaluateAt(xiInverse), field.inverse(denominator));
- if (field.getGeneratorBase() !== 0) {
- result[i] = field.multiply(result[i], xiInverse);
- }
- }
- return result;
- };
- return ReedSolomonDecoder;
- }();
- var _default = ReedSolomonDecoder;
- exports.default = _default;
- /***/ }),
- /* 343 */
- /*!****************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/ReedSolomonException.js ***!
- \****************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _Exception = _interopRequireDefault(__webpack_require__(/*! ./Exception */ 305));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /**
- * Custom Error class of type Exception.
- */
- var ReedSolomonException = /** @class */function (_super) {
- __extends(ReedSolomonException, _super);
- function ReedSolomonException() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ReedSolomonException.kind = 'ReedSolomonException';
- return ReedSolomonException;
- }(_Exception.default);
- var _default = ReedSolomonException;
- exports.default = _default;
- /***/ }),
- /* 344 */
- /*!*****************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/IllegalStateException.js ***!
- \*****************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _Exception = _interopRequireDefault(__webpack_require__(/*! ./Exception */ 305));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /**
- * Custom Error class of type Exception.
- */
- var IllegalStateException = /** @class */function (_super) {
- __extends(IllegalStateException, _super);
- function IllegalStateException() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- IllegalStateException.kind = 'IllegalStateException';
- return IllegalStateException;
- }(_Exception.default);
- var _default = IllegalStateException;
- exports.default = _default;
- /***/ }),
- /* 345 */
- /*!*******************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/detector/Detector.js ***!
- \*******************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = exports.Point = void 0;
- var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../../ResultPoint */ 346));
- var _AztecDetectorResult = _interopRequireDefault(__webpack_require__(/*! ../AztecDetectorResult */ 349));
- var _MathUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/detector/MathUtils */ 347));
- var _WhiteRectangleDetector = _interopRequireDefault(__webpack_require__(/*! ../../common/detector/WhiteRectangleDetector */ 351));
- var _GenericGF = _interopRequireDefault(__webpack_require__(/*! ../../common/reedsolomon/GenericGF */ 338));
- var _ReedSolomonDecoder = _interopRequireDefault(__webpack_require__(/*! ../../common/reedsolomon/ReedSolomonDecoder */ 342));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../NotFoundException */ 327));
- var _GridSamplerInstance = _interopRequireDefault(__webpack_require__(/*! ../../common/GridSamplerInstance */ 352));
- var _Integer = _interopRequireDefault(__webpack_require__(/*! ../../util/Integer */ 318));
- /*
- * Copyright 2010 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var Point = /** @class */function () {
- function Point(x, y) {
- this.x = x;
- this.y = y;
- }
- Point.prototype.toResultPoint = function () {
- return new _ResultPoint.default(this.getX(), this.getY());
- };
- Point.prototype.getX = function () {
- return this.x;
- };
- Point.prototype.getY = function () {
- return this.y;
- };
- return Point;
- }();
- exports.Point = Point;
- /**
- * Encapsulates logic that can detect an Aztec Code in an image, even if the Aztec Code
- * is rotated or skewed, or partially obscured.
- *
- * @author David Olivier
- * @author Frank Yellin
- */
- var Detector = /** @class */function () {
- function Detector(image) {
- this.EXPECTED_CORNER_BITS = new Int32Array([0xee0, 0x1dc, 0x83b, 0x707]);
- this.image = image;
- }
- Detector.prototype.detect = function () {
- return this.detectMirror(false);
- };
- /**
- * Detects an Aztec Code in an image.
- *
- * @param isMirror if true, image is a mirror-image of original
- * @return {@link AztecDetectorResult} encapsulating results of detecting an Aztec Code
- * @throws NotFoundException if no Aztec Code can be found
- */
- Detector.prototype.detectMirror = function (isMirror) {
- // 1. Get the center of the aztec matrix
- var pCenter = this.getMatrixCenter();
- // 2. Get the center points of the four diagonal points just outside the bull's eye
- // [topRight, bottomRight, bottomLeft, topLeft]
- var bullsEyeCorners = this.getBullsEyeCorners(pCenter);
- if (isMirror) {
- var temp = bullsEyeCorners[0];
- bullsEyeCorners[0] = bullsEyeCorners[2];
- bullsEyeCorners[2] = temp;
- }
- // 3. Get the size of the matrix and other parameters from the bull's eye
- this.extractParameters(bullsEyeCorners);
- // 4. Sample the grid
- var bits = this.sampleGrid(this.image, bullsEyeCorners[this.shift % 4], bullsEyeCorners[(this.shift + 1) % 4], bullsEyeCorners[(this.shift + 2) % 4], bullsEyeCorners[(this.shift + 3) % 4]);
- // 5. Get the corners of the matrix.
- var corners = this.getMatrixCornerPoints(bullsEyeCorners);
- return new _AztecDetectorResult.default(bits, corners, this.compact, this.nbDataBlocks, this.nbLayers);
- };
- /**
- * Extracts the number of data layers and data blocks from the layer around the bull's eye.
- *
- * @param bullsEyeCorners the array of bull's eye corners
- * @throws NotFoundException in case of too many errors or invalid parameters
- */
- Detector.prototype.extractParameters = function (bullsEyeCorners) {
- if (!this.isValidPoint(bullsEyeCorners[0]) || !this.isValidPoint(bullsEyeCorners[1]) || !this.isValidPoint(bullsEyeCorners[2]) || !this.isValidPoint(bullsEyeCorners[3])) {
- throw new _NotFoundException.default();
- }
- var length = 2 * this.nbCenterLayers;
- // Get the bits around the bull's eye
- var sides = new Int32Array([this.sampleLine(bullsEyeCorners[0], bullsEyeCorners[1], length), this.sampleLine(bullsEyeCorners[1], bullsEyeCorners[2], length), this.sampleLine(bullsEyeCorners[2], bullsEyeCorners[3], length), this.sampleLine(bullsEyeCorners[3], bullsEyeCorners[0], length) // Top
- ]);
- // bullsEyeCorners[shift] is the corner of the bulls'eye that has three
- // orientation marks.
- // sides[shift] is the row/column that goes from the corner with three
- // orientation marks to the corner with two.
- this.shift = this.getRotation(sides, length);
- // Flatten the parameter bits into a single 28- or 40-bit long
- var parameterData = 0;
- for (var i = 0; i < 4; i++) {
- var side = sides[(this.shift + i) % 4];
- if (this.compact) {
- // Each side of the form ..XXXXXXX. where Xs are parameter data
- parameterData <<= 7;
- parameterData += side >> 1 & 0x7F;
- } else {
- // Each side of the form ..XXXXX.XXXXX. where Xs are parameter data
- parameterData <<= 10;
- parameterData += (side >> 2 & 0x1f << 5) + (side >> 1 & 0x1F);
- }
- }
- // Corrects parameter data using RS. Returns just the data portion
- // without the error correction.
- var correctedData = this.getCorrectedParameterData(parameterData, this.compact);
- if (this.compact) {
- // 8 bits: 2 bits layers and 6 bits data blocks
- this.nbLayers = (correctedData >> 6) + 1;
- this.nbDataBlocks = (correctedData & 0x3F) + 1;
- } else {
- // 16 bits: 5 bits layers and 11 bits data blocks
- this.nbLayers = (correctedData >> 11) + 1;
- this.nbDataBlocks = (correctedData & 0x7FF) + 1;
- }
- };
- Detector.prototype.getRotation = function (sides, length) {
- // In a normal pattern, we expect to See
- // ** .* D A
- // * *
- //
- // . *
- // .. .. C B
- //
- // Grab the 3 bits from each of the sides the form the locator pattern and concatenate
- // into a 12-bit integer. Start with the bit at A
- var cornerBits = 0;
- sides.forEach(function (side, idx, arr) {
- // XX......X where X's are orientation marks
- var t = (side >> length - 2 << 1) + (side & 1);
- cornerBits = (cornerBits << 3) + t;
- });
- // for (var side in sides) {
- // // XX......X where X's are orientation marks
- // var t = ((side >> (length - 2)) << 1) + (side & 1);
- // cornerBits = (cornerBits << 3) + t;
- // }
- // Mov the bottom bit to the top, so that the three bits of the locator pattern at A are
- // together. cornerBits is now:
- // 3 orientation bits at A || 3 orientation bits at B || ... || 3 orientation bits at D
- cornerBits = ((cornerBits & 1) << 11) + (cornerBits >> 1);
- // The result shift indicates which element of BullsEyeCorners[] goes into the top-left
- // corner. Since the four rotation values have a Hamming distance of 8, we
- // can easily tolerate two errors.
- for (var shift = 0; shift < 4; shift++) {
- if (_Integer.default.bitCount(cornerBits ^ this.EXPECTED_CORNER_BITS[shift]) <= 2) {
- return shift;
- }
- }
- throw new _NotFoundException.default();
- };
- /**
- * Corrects the parameter bits using Reed-Solomon algorithm.
- *
- * @param parameterData parameter bits
- * @param compact true if this is a compact Aztec code
- * @throws NotFoundException if the array contains too many errors
- */
- Detector.prototype.getCorrectedParameterData = function (parameterData, compact) {
- var numCodewords;
- var numDataCodewords;
- if (compact) {
- numCodewords = 7;
- numDataCodewords = 2;
- } else {
- numCodewords = 10;
- numDataCodewords = 4;
- }
- var numECCodewords = numCodewords - numDataCodewords;
- var parameterWords = new Int32Array(numCodewords);
- for (var i = numCodewords - 1; i >= 0; --i) {
- parameterWords[i] = parameterData & 0xF;
- parameterData >>= 4;
- }
- try {
- var rsDecoder = new _ReedSolomonDecoder.default(_GenericGF.default.AZTEC_PARAM);
- rsDecoder.decode(parameterWords, numECCodewords);
- } catch (ignored) {
- throw new _NotFoundException.default();
- }
- // Toss the error correction. Just return the data as an integer
- var result = 0;
- for (var i = 0; i < numDataCodewords; i++) {
- result = (result << 4) + parameterWords[i];
- }
- return result;
- };
- /**
- * Finds the corners of a bull-eye centered on the passed point.
- * This returns the centers of the diagonal points just outside the bull's eye
- * Returns [topRight, bottomRight, bottomLeft, topLeft]
- *
- * @param pCenter Center point
- * @return The corners of the bull-eye
- * @throws NotFoundException If no valid bull-eye can be found
- */
- Detector.prototype.getBullsEyeCorners = function (pCenter) {
- var pina = pCenter;
- var pinb = pCenter;
- var pinc = pCenter;
- var pind = pCenter;
- var color = true;
- for (this.nbCenterLayers = 1; this.nbCenterLayers < 9; this.nbCenterLayers++) {
- var pouta = this.getFirstDifferent(pina, color, 1, -1);
- var poutb = this.getFirstDifferent(pinb, color, 1, 1);
- var poutc = this.getFirstDifferent(pinc, color, -1, 1);
- var poutd = this.getFirstDifferent(pind, color, -1, -1);
- // d a
- //
- // c b
- if (this.nbCenterLayers > 2) {
- var q = this.distancePoint(poutd, pouta) * this.nbCenterLayers / (this.distancePoint(pind, pina) * (this.nbCenterLayers + 2));
- if (q < 0.75 || q > 1.25 || !this.isWhiteOrBlackRectangle(pouta, poutb, poutc, poutd)) {
- break;
- }
- }
- pina = pouta;
- pinb = poutb;
- pinc = poutc;
- pind = poutd;
- color = !color;
- }
- if (this.nbCenterLayers !== 5 && this.nbCenterLayers !== 7) {
- throw new _NotFoundException.default();
- }
- this.compact = this.nbCenterLayers === 5;
- // Expand the square by .5 pixel in each direction so that we're on the border
- // between the white square and the black square
- var pinax = new _ResultPoint.default(pina.getX() + 0.5, pina.getY() - 0.5);
- var pinbx = new _ResultPoint.default(pinb.getX() + 0.5, pinb.getY() + 0.5);
- var pincx = new _ResultPoint.default(pinc.getX() - 0.5, pinc.getY() + 0.5);
- var pindx = new _ResultPoint.default(pind.getX() - 0.5, pind.getY() - 0.5);
- // Expand the square so that its corners are the centers of the points
- // just outside the bull's eye.
- return this.expandSquare([pinax, pinbx, pincx, pindx], 2 * this.nbCenterLayers - 3, 2 * this.nbCenterLayers);
- };
- /**
- * Finds a candidate center point of an Aztec code from an image
- *
- * @return the center point
- */
- Detector.prototype.getMatrixCenter = function () {
- var pointA;
- var pointB;
- var pointC;
- var pointD;
- // Get a white rectangle that can be the border of the matrix in center bull's eye or
- try {
- var cornerPoints = new _WhiteRectangleDetector.default(this.image).detect();
- pointA = cornerPoints[0];
- pointB = cornerPoints[1];
- pointC = cornerPoints[2];
- pointD = cornerPoints[3];
- } catch (e) {
- // This exception can be in case the initial rectangle is white
- // In that case, surely in the bull's eye, we try to expand the rectangle.
- var cx_1 = this.image.getWidth() / 2;
- var cy_1 = this.image.getHeight() / 2;
- pointA = this.getFirstDifferent(new Point(cx_1 + 7, cy_1 - 7), false, 1, -1).toResultPoint();
- pointB = this.getFirstDifferent(new Point(cx_1 + 7, cy_1 + 7), false, 1, 1).toResultPoint();
- pointC = this.getFirstDifferent(new Point(cx_1 - 7, cy_1 + 7), false, -1, 1).toResultPoint();
- pointD = this.getFirstDifferent(new Point(cx_1 - 7, cy_1 - 7), false, -1, -1).toResultPoint();
- }
- // Compute the center of the rectangle
- var cx = _MathUtils.default.round((pointA.getX() + pointD.getX() + pointB.getX() + pointC.getX()) / 4.0);
- var cy = _MathUtils.default.round((pointA.getY() + pointD.getY() + pointB.getY() + pointC.getY()) / 4.0);
- // Redetermine the white rectangle starting from previously computed center.
- // This will ensure that we end up with a white rectangle in center bull's eye
- // in order to compute a more accurate center.
- try {
- var cornerPoints = new _WhiteRectangleDetector.default(this.image, 15, cx, cy).detect();
- pointA = cornerPoints[0];
- pointB = cornerPoints[1];
- pointC = cornerPoints[2];
- pointD = cornerPoints[3];
- } catch (e) {
- // This exception can be in case the initial rectangle is white
- // In that case we try to expand the rectangle.
- pointA = this.getFirstDifferent(new Point(cx + 7, cy - 7), false, 1, -1).toResultPoint();
- pointB = this.getFirstDifferent(new Point(cx + 7, cy + 7), false, 1, 1).toResultPoint();
- pointC = this.getFirstDifferent(new Point(cx - 7, cy + 7), false, -1, 1).toResultPoint();
- pointD = this.getFirstDifferent(new Point(cx - 7, cy - 7), false, -1, -1).toResultPoint();
- }
- // Recompute the center of the rectangle
- cx = _MathUtils.default.round((pointA.getX() + pointD.getX() + pointB.getX() + pointC.getX()) / 4.0);
- cy = _MathUtils.default.round((pointA.getY() + pointD.getY() + pointB.getY() + pointC.getY()) / 4.0);
- return new Point(cx, cy);
- };
- /**
- * Gets the Aztec code corners from the bull's eye corners and the parameters.
- *
- * @param bullsEyeCorners the array of bull's eye corners
- * @return the array of aztec code corners
- */
- Detector.prototype.getMatrixCornerPoints = function (bullsEyeCorners) {
- return this.expandSquare(bullsEyeCorners, 2 * this.nbCenterLayers, this.getDimension());
- };
- /**
- * Creates a BitMatrix by sampling the provided image.
- * topLeft, topRight, bottomRight, and bottomLeft are the centers of the squares on the
- * diagonal just outside the bull's eye.
- */
- Detector.prototype.sampleGrid = function (image, topLeft, topRight, bottomRight, bottomLeft) {
- var sampler = _GridSamplerInstance.default.getInstance();
- var dimension = this.getDimension();
- var low = dimension / 2 - this.nbCenterLayers;
- var high = dimension / 2 + this.nbCenterLayers;
- return sampler.sampleGrid(image, dimension, dimension, low, low,
- // topleft
- high, low,
- // topright
- high, high,
- // bottomright
- low, high,
- // bottomleft
- topLeft.getX(), topLeft.getY(), topRight.getX(), topRight.getY(), bottomRight.getX(), bottomRight.getY(), bottomLeft.getX(), bottomLeft.getY());
- };
- /**
- * Samples a line.
- *
- * @param p1 start point (inclusive)
- * @param p2 end point (exclusive)
- * @param size number of bits
- * @return the array of bits as an int (first bit is high-order bit of result)
- */
- Detector.prototype.sampleLine = function (p1, p2, size) {
- var result = 0;
- var d = this.distanceResultPoint(p1, p2);
- var moduleSize = d / size;
- var px = p1.getX();
- var py = p1.getY();
- var dx = moduleSize * (p2.getX() - p1.getX()) / d;
- var dy = moduleSize * (p2.getY() - p1.getY()) / d;
- for (var i = 0; i < size; i++) {
- if (this.image.get(_MathUtils.default.round(px + i * dx), _MathUtils.default.round(py + i * dy))) {
- result |= 1 << size - i - 1;
- }
- }
- return result;
- };
- /**
- * @return true if the border of the rectangle passed in parameter is compound of white points only
- * or black points only
- */
- Detector.prototype.isWhiteOrBlackRectangle = function (p1, p2, p3, p4) {
- var corr = 3;
- p1 = new Point(p1.getX() - corr, p1.getY() + corr);
- p2 = new Point(p2.getX() - corr, p2.getY() - corr);
- p3 = new Point(p3.getX() + corr, p3.getY() - corr);
- p4 = new Point(p4.getX() + corr, p4.getY() + corr);
- var cInit = this.getColor(p4, p1);
- if (cInit === 0) {
- return false;
- }
- var c = this.getColor(p1, p2);
- if (c !== cInit) {
- return false;
- }
- c = this.getColor(p2, p3);
- if (c !== cInit) {
- return false;
- }
- c = this.getColor(p3, p4);
- return c === cInit;
- };
- /**
- * Gets the color of a segment
- *
- * @return 1 if segment more than 90% black, -1 if segment is more than 90% white, 0 else
- */
- Detector.prototype.getColor = function (p1, p2) {
- var d = this.distancePoint(p1, p2);
- var dx = (p2.getX() - p1.getX()) / d;
- var dy = (p2.getY() - p1.getY()) / d;
- var error = 0;
- var px = p1.getX();
- var py = p1.getY();
- var colorModel = this.image.get(p1.getX(), p1.getY());
- var iMax = Math.ceil(d);
- for (var i = 0; i < iMax; i++) {
- px += dx;
- py += dy;
- if (this.image.get(_MathUtils.default.round(px), _MathUtils.default.round(py)) !== colorModel) {
- error++;
- }
- }
- var errRatio = error / d;
- if (errRatio > 0.1 && errRatio < 0.9) {
- return 0;
- }
- return errRatio <= 0.1 === colorModel ? 1 : -1;
- };
- /**
- * Gets the coordinate of the first point with a different color in the given direction
- */
- Detector.prototype.getFirstDifferent = function (init, color, dx, dy) {
- var x = init.getX() + dx;
- var y = init.getY() + dy;
- while (this.isValid(x, y) && this.image.get(x, y) === color) {
- x += dx;
- y += dy;
- }
- x -= dx;
- y -= dy;
- while (this.isValid(x, y) && this.image.get(x, y) === color) {
- x += dx;
- }
- x -= dx;
- while (this.isValid(x, y) && this.image.get(x, y) === color) {
- y += dy;
- }
- y -= dy;
- return new Point(x, y);
- };
- /**
- * Expand the square represented by the corner points by pushing out equally in all directions
- *
- * @param cornerPoints the corners of the square, which has the bull's eye at its center
- * @param oldSide the original length of the side of the square in the target bit matrix
- * @param newSide the new length of the size of the square in the target bit matrix
- * @return the corners of the expanded square
- */
- Detector.prototype.expandSquare = function (cornerPoints, oldSide, newSide) {
- var ratio = newSide / (2.0 * oldSide);
- var dx = cornerPoints[0].getX() - cornerPoints[2].getX();
- var dy = cornerPoints[0].getY() - cornerPoints[2].getY();
- var centerx = (cornerPoints[0].getX() + cornerPoints[2].getX()) / 2.0;
- var centery = (cornerPoints[0].getY() + cornerPoints[2].getY()) / 2.0;
- var result0 = new _ResultPoint.default(centerx + ratio * dx, centery + ratio * dy);
- var result2 = new _ResultPoint.default(centerx - ratio * dx, centery - ratio * dy);
- dx = cornerPoints[1].getX() - cornerPoints[3].getX();
- dy = cornerPoints[1].getY() - cornerPoints[3].getY();
- centerx = (cornerPoints[1].getX() + cornerPoints[3].getX()) / 2.0;
- centery = (cornerPoints[1].getY() + cornerPoints[3].getY()) / 2.0;
- var result1 = new _ResultPoint.default(centerx + ratio * dx, centery + ratio * dy);
- var result3 = new _ResultPoint.default(centerx - ratio * dx, centery - ratio * dy);
- var results = [result0, result1, result2, result3];
- return results;
- };
- Detector.prototype.isValid = function (x, y) {
- return x >= 0 && x < this.image.getWidth() && y > 0 && y < this.image.getHeight();
- };
- Detector.prototype.isValidPoint = function (point) {
- var x = _MathUtils.default.round(point.getX());
- var y = _MathUtils.default.round(point.getY());
- return this.isValid(x, y);
- };
- Detector.prototype.distancePoint = function (a, b) {
- return _MathUtils.default.distance(a.getX(), a.getY(), b.getX(), b.getY());
- };
- Detector.prototype.distanceResultPoint = function (a, b) {
- return _MathUtils.default.distance(a.getX(), a.getY(), b.getX(), b.getY());
- };
- Detector.prototype.getDimension = function () {
- if (this.compact) {
- return 4 * this.nbLayers + 11;
- }
- if (this.nbLayers <= 4) {
- return 4 * this.nbLayers + 15;
- }
- return 4 * this.nbLayers + 2 * (_Integer.default.truncDivision(this.nbLayers - 4, 8) + 1) + 15;
- };
- return Detector;
- }();
- var _default = Detector;
- exports.default = _default;
- /***/ }),
- /* 346 */
- /*!*******************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/ResultPoint.js ***!
- \*******************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _MathUtils = _interopRequireDefault(__webpack_require__(/*! ./common/detector/MathUtils */ 347));
- var _Float = _interopRequireDefault(__webpack_require__(/*! ./util/Float */ 348));
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /*namespace com.google.zxing {*/
- /**
- * <p>Encapsulates a point of interest in an image containing a barcode. Typically, this
- * would be the location of a finder pattern or the corner of the barcode, for example.</p>
- *
- * @author Sean Owen
- */
- var ResultPoint = /** @class */function () {
- function ResultPoint(x, y) {
- this.x = x;
- this.y = y;
- }
- ResultPoint.prototype.getX = function () {
- return this.x;
- };
- ResultPoint.prototype.getY = function () {
- return this.y;
- };
- /*@Override*/
- ResultPoint.prototype.equals = function (other) {
- if (other instanceof ResultPoint) {
- var otherPoint = other;
- return this.x === otherPoint.x && this.y === otherPoint.y;
- }
- return false;
- };
- /*@Override*/
- ResultPoint.prototype.hashCode = function () {
- return 31 * _Float.default.floatToIntBits(this.x) + _Float.default.floatToIntBits(this.y);
- };
- /*@Override*/
- ResultPoint.prototype.toString = function () {
- return '(' + this.x + ',' + this.y + ')';
- };
- /**
- * Orders an array of three ResultPoints in an order [A,B,C] such that AB is less than AC
- * and BC is less than AC, and the angle between BC and BA is less than 180 degrees.
- *
- * @param patterns array of three {@code ResultPoint} to order
- */
- ResultPoint.orderBestPatterns = function (patterns) {
- // Find distances between pattern centers
- var zeroOneDistance = this.distance(patterns[0], patterns[1]);
- var oneTwoDistance = this.distance(patterns[1], patterns[2]);
- var zeroTwoDistance = this.distance(patterns[0], patterns[2]);
- var pointA;
- var pointB;
- var pointC;
- // Assume one closest to other two is B; A and C will just be guesses at first
- if (oneTwoDistance >= zeroOneDistance && oneTwoDistance >= zeroTwoDistance) {
- pointB = patterns[0];
- pointA = patterns[1];
- pointC = patterns[2];
- } else if (zeroTwoDistance >= oneTwoDistance && zeroTwoDistance >= zeroOneDistance) {
- pointB = patterns[1];
- pointA = patterns[0];
- pointC = patterns[2];
- } else {
- pointB = patterns[2];
- pointA = patterns[0];
- pointC = patterns[1];
- }
- // Use cross product to figure out whether A and C are correct or flipped.
- // This asks whether BC x BA has a positive z component, which is the arrangement
- // we want for A, B, C. If it's negative, then we've got it flipped around and
- // should swap A and C.
- if (this.crossProductZ(pointA, pointB, pointC) < 0.0) {
- var temp = pointA;
- pointA = pointC;
- pointC = temp;
- }
- patterns[0] = pointA;
- patterns[1] = pointB;
- patterns[2] = pointC;
- };
- /**
- * @param pattern1 first pattern
- * @param pattern2 second pattern
- * @return distance between two points
- */
- ResultPoint.distance = function (pattern1, pattern2) {
- return _MathUtils.default.distance(pattern1.x, pattern1.y, pattern2.x, pattern2.y);
- };
- /**
- * Returns the z component of the cross product between vectors BC and BA.
- */
- ResultPoint.crossProductZ = function (pointA, pointB, pointC) {
- var bX = pointB.x;
- var bY = pointB.y;
- return (pointC.x - bX) * (pointA.y - bY) - (pointC.y - bY) * (pointA.x - bX);
- };
- return ResultPoint;
- }();
- var _default = ResultPoint;
- exports.default = _default;
- /***/ }),
- /* 347 */
- /*!*********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/detector/MathUtils.js ***!
- \*********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- /*
- * Copyright 2012 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /*namespace com.google.zxing.common.detector {*/
- /**
- * General math-related and numeric utility functions.
- */
- var MathUtils = /** @class */function () {
- function MathUtils() {}
- /**
- * Ends up being a bit faster than {@link Math#round(float)}. This merely rounds its
- * argument to the nearest int, where x.5 rounds up to x+1. Semantics of this shortcut
- * differ slightly from {@link Math#round(float)} in that half rounds down for negative
- * values. -2.5 rounds to -3, not -2. For purposes here it makes no difference.
- *
- * @param d real value to round
- * @return nearest {@code int}
- */
- MathUtils.round = function (d /*float*/) {
- if (isNaN(d)) return 0;
- if (d <= Number.MIN_SAFE_INTEGER) return Number.MIN_SAFE_INTEGER;
- if (d >= Number.MAX_SAFE_INTEGER) return Number.MAX_SAFE_INTEGER;
- return (/*(int) */d + (d < 0.0 ? -0.5 : 0.5) | 0
- );
- };
- // TYPESCRIPTPORT: maybe remove round method and call directly Math.round, it looks like it doesn't make sense for js
- /**
- * @param aX point A x coordinate
- * @param aY point A y coordinate
- * @param bX point B x coordinate
- * @param bY point B y coordinate
- * @return Euclidean distance between points A and B
- */
- MathUtils.distance = function (aX /*float|int*/, aY /*float|int*/, bX /*float|int*/, bY /*float|int*/) {
- var xDiff = aX - bX;
- var yDiff = aY - bY;
- return (/*(float) */Math.sqrt(xDiff * xDiff + yDiff * yDiff)
- );
- };
- /**
- * @param aX point A x coordinate
- * @param aY point A y coordinate
- * @param bX point B x coordinate
- * @param bY point B y coordinate
- * @return Euclidean distance between points A and B
- */
- // public static distance(aX: number /*int*/, aY: number /*int*/, bX: number /*int*/, bY: number /*int*/): float {
- // const xDiff = aX - bX
- // const yDiff = aY - bY
- // return (float) Math.sqrt(xDiff * xDiff + yDiff * yDiff);
- // }
- /**
- * @param array values to sum
- * @return sum of values in array
- */
- MathUtils.sum = function (array) {
- var count = 0;
- for (var i = 0, length_1 = array.length; i !== length_1; i++) {
- var a = array[i];
- count += a;
- }
- return count;
- };
- return MathUtils;
- }();
- var _default = MathUtils;
- exports.default = _default;
- /***/ }),
- /* 348 */
- /*!******************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/util/Float.js ***!
- \******************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- /**
- * Ponyfill for Java's Float class.
- */
- var Float = /** @class */function () {
- function Float() {}
- /**
- * SincTS has no difference between int and float, there's all numbers,
- * this is used only to polyfill Java code.
- */
- Float.floatToIntBits = function (f) {
- return f;
- };
- /**
- * The float max value in JS is the number max value.
- */
- Float.MAX_VALUE = Number.MAX_SAFE_INTEGER;
- return Float;
- }();
- var _default = Float;
- exports.default = _default;
- /***/ }),
- /* 349 */
- /*!*********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/AztecDetectorResult.js ***!
- \*********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _DetectorResult = _interopRequireDefault(__webpack_require__(/*! ../common/DetectorResult */ 350));
- /*
- * Copyright 2010 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /**
- * <p>Extends {@link DetectorResult} with more information specific to the Aztec format,
- * like the number of layers and whether it's compact.</p>
- *
- * @author Sean Owen
- */
- var AztecDetectorResult = /** @class */function (_super) {
- __extends(AztecDetectorResult, _super);
- function AztecDetectorResult(bits, points, compact, nbDatablocks, nbLayers) {
- var _this = _super.call(this, bits, points) || this;
- _this.compact = compact;
- _this.nbDatablocks = nbDatablocks;
- _this.nbLayers = nbLayers;
- return _this;
- }
- AztecDetectorResult.prototype.getNbLayers = function () {
- return this.nbLayers;
- };
- AztecDetectorResult.prototype.getNbDatablocks = function () {
- return this.nbDatablocks;
- };
- AztecDetectorResult.prototype.isCompact = function () {
- return this.compact;
- };
- return AztecDetectorResult;
- }(_DetectorResult.default);
- var _default = AztecDetectorResult;
- exports.default = _default;
- /***/ }),
- /* 350 */
- /*!*****************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/DetectorResult.js ***!
- \*****************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /**
- * <p>Encapsulates the result of detecting a barcode in an image. This includes the raw
- * matrix of black/white pixels corresponding to the barcode, and possibly points of interest
- * in the image, like the location of finder patterns or corners of the barcode in the image.</p>
- *
- * @author Sean Owen
- */
- var DetectorResult = /** @class */function () {
- function DetectorResult(bits, points) {
- this.bits = bits;
- this.points = points;
- }
- DetectorResult.prototype.getBits = function () {
- return this.bits;
- };
- DetectorResult.prototype.getPoints = function () {
- return this.points;
- };
- return DetectorResult;
- }();
- var _default = DetectorResult;
- exports.default = _default;
- /***/ }),
- /* 351 */
- /*!**********************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/detector/WhiteRectangleDetector.js ***!
- \**********************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../../ResultPoint */ 346));
- var _MathUtils = _interopRequireDefault(__webpack_require__(/*! ./MathUtils */ 347));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../NotFoundException */ 327));
- /*
- * Copyright 2010 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /*namespace com.google.zxing.common.detector {*/
- /**
- * <p>
- * Detects a candidate barcode-like rectangular region within an image. It
- * starts around the center of the image, increases the size of the candidate
- * region until it finds a white rectangular region. By keeping track of the
- * last black points it encountered, it determines the corners of the barcode.
- * </p>
- *
- * @author David Olivier
- */
- var WhiteRectangleDetector = /** @class */function () {
- // public constructor(private image: BitMatrix) /*throws NotFoundException*/ {
- // this(image, INIT_SIZE, image.getWidth() / 2, image.getHeight() / 2)
- // }
- /**
- * @param image barcode image to find a rectangle in
- * @param initSize initial size of search area around center
- * @param x x position of search center
- * @param y y position of search center
- * @throws NotFoundException if image is too small to accommodate {@code initSize}
- */
- function WhiteRectangleDetector(image, initSize /*int*/, x /*int*/, y /*int*/) {
- this.image = image;
- this.height = image.getHeight();
- this.width = image.getWidth();
- if (undefined === initSize || null === initSize) {
- initSize = WhiteRectangleDetector.INIT_SIZE;
- }
- if (undefined === x || null === x) {
- x = image.getWidth() / 2 | 0;
- }
- if (undefined === y || null === y) {
- y = image.getHeight() / 2 | 0;
- }
- var halfsize = initSize / 2 | 0;
- this.leftInit = x - halfsize;
- this.rightInit = x + halfsize;
- this.upInit = y - halfsize;
- this.downInit = y + halfsize;
- if (this.upInit < 0 || this.leftInit < 0 || this.downInit >= this.height || this.rightInit >= this.width) {
- throw new _NotFoundException.default();
- }
- }
- /**
- * <p>
- * Detects a candidate barcode-like rectangular region within an image. It
- * starts around the center of the image, increases the size of the candidate
- * region until it finds a white rectangular region.
- * </p>
- *
- * @return {@link ResultPoint}[] describing the corners of the rectangular
- * region. The first and last points are opposed on the diagonal, as
- * are the second and third. The first point will be the topmost
- * point and the last, the bottommost. The second point will be
- * leftmost and the third, the rightmost
- * @throws NotFoundException if no Data Matrix Code can be found
- */
- WhiteRectangleDetector.prototype.detect = function () {
- var left = this.leftInit;
- var right = this.rightInit;
- var up = this.upInit;
- var down = this.downInit;
- var sizeExceeded = false;
- var aBlackPointFoundOnBorder = true;
- var atLeastOneBlackPointFoundOnBorder = false;
- var atLeastOneBlackPointFoundOnRight = false;
- var atLeastOneBlackPointFoundOnBottom = false;
- var atLeastOneBlackPointFoundOnLeft = false;
- var atLeastOneBlackPointFoundOnTop = false;
- var width = this.width;
- var height = this.height;
- while (aBlackPointFoundOnBorder) {
- aBlackPointFoundOnBorder = false;
- // .....
- // . |
- // .....
- var rightBorderNotWhite = true;
- while ((rightBorderNotWhite || !atLeastOneBlackPointFoundOnRight) && right < width) {
- rightBorderNotWhite = this.containsBlackPoint(up, down, right, false);
- if (rightBorderNotWhite) {
- right++;
- aBlackPointFoundOnBorder = true;
- atLeastOneBlackPointFoundOnRight = true;
- } else if (!atLeastOneBlackPointFoundOnRight) {
- right++;
- }
- }
- if (right >= width) {
- sizeExceeded = true;
- break;
- }
- // .....
- // . .
- // .___.
- var bottomBorderNotWhite = true;
- while ((bottomBorderNotWhite || !atLeastOneBlackPointFoundOnBottom) && down < height) {
- bottomBorderNotWhite = this.containsBlackPoint(left, right, down, true);
- if (bottomBorderNotWhite) {
- down++;
- aBlackPointFoundOnBorder = true;
- atLeastOneBlackPointFoundOnBottom = true;
- } else if (!atLeastOneBlackPointFoundOnBottom) {
- down++;
- }
- }
- if (down >= height) {
- sizeExceeded = true;
- break;
- }
- // .....
- // | .
- // .....
- var leftBorderNotWhite = true;
- while ((leftBorderNotWhite || !atLeastOneBlackPointFoundOnLeft) && left >= 0) {
- leftBorderNotWhite = this.containsBlackPoint(up, down, left, false);
- if (leftBorderNotWhite) {
- left--;
- aBlackPointFoundOnBorder = true;
- atLeastOneBlackPointFoundOnLeft = true;
- } else if (!atLeastOneBlackPointFoundOnLeft) {
- left--;
- }
- }
- if (left < 0) {
- sizeExceeded = true;
- break;
- }
- // .___.
- // . .
- // .....
- var topBorderNotWhite = true;
- while ((topBorderNotWhite || !atLeastOneBlackPointFoundOnTop) && up >= 0) {
- topBorderNotWhite = this.containsBlackPoint(left, right, up, true);
- if (topBorderNotWhite) {
- up--;
- aBlackPointFoundOnBorder = true;
- atLeastOneBlackPointFoundOnTop = true;
- } else if (!atLeastOneBlackPointFoundOnTop) {
- up--;
- }
- }
- if (up < 0) {
- sizeExceeded = true;
- break;
- }
- if (aBlackPointFoundOnBorder) {
- atLeastOneBlackPointFoundOnBorder = true;
- }
- }
- if (!sizeExceeded && atLeastOneBlackPointFoundOnBorder) {
- var maxSize = right - left;
- var z = null;
- for (var i = 1; z === null && i < maxSize; i++) {
- z = this.getBlackPointOnSegment(left, down - i, left + i, down);
- }
- if (z == null) {
- throw new _NotFoundException.default();
- }
- var t = null;
- // go down right
- for (var i = 1; t === null && i < maxSize; i++) {
- t = this.getBlackPointOnSegment(left, up + i, left + i, up);
- }
- if (t == null) {
- throw new _NotFoundException.default();
- }
- var x = null;
- // go down left
- for (var i = 1; x === null && i < maxSize; i++) {
- x = this.getBlackPointOnSegment(right, up + i, right - i, up);
- }
- if (x == null) {
- throw new _NotFoundException.default();
- }
- var y = null;
- // go up left
- for (var i = 1; y === null && i < maxSize; i++) {
- y = this.getBlackPointOnSegment(right, down - i, right - i, down);
- }
- if (y == null) {
- throw new _NotFoundException.default();
- }
- return this.centerEdges(y, z, x, t);
- } else {
- throw new _NotFoundException.default();
- }
- };
- WhiteRectangleDetector.prototype.getBlackPointOnSegment = function (aX /*float*/, aY /*float*/, bX /*float*/, bY /*float*/) {
- var dist = _MathUtils.default.round(_MathUtils.default.distance(aX, aY, bX, bY));
- var xStep = (bX - aX) / dist;
- var yStep = (bY - aY) / dist;
- var image = this.image;
- for (var i = 0; i < dist; i++) {
- var x = _MathUtils.default.round(aX + i * xStep);
- var y = _MathUtils.default.round(aY + i * yStep);
- if (image.get(x, y)) {
- return new _ResultPoint.default(x, y);
- }
- }
- return null;
- };
- /**
- * recenters the points of a constant distance towards the center
- *
- * @param y bottom most point
- * @param z left most point
- * @param x right most point
- * @param t top most point
- * @return {@link ResultPoint}[] describing the corners of the rectangular
- * region. The first and last points are opposed on the diagonal, as
- * are the second and third. The first point will be the topmost
- * point and the last, the bottommost. The second point will be
- * leftmost and the third, the rightmost
- */
- WhiteRectangleDetector.prototype.centerEdges = function (y, z, x, t) {
- //
- // t t
- // z x
- // x OR z
- // y y
- //
- var yi = y.getX();
- var yj = y.getY();
- var zi = z.getX();
- var zj = z.getY();
- var xi = x.getX();
- var xj = x.getY();
- var ti = t.getX();
- var tj = t.getY();
- var CORR = WhiteRectangleDetector.CORR;
- if (yi < this.width / 2.0) {
- return [new _ResultPoint.default(ti - CORR, tj + CORR), new _ResultPoint.default(zi + CORR, zj + CORR), new _ResultPoint.default(xi - CORR, xj - CORR), new _ResultPoint.default(yi + CORR, yj - CORR)];
- } else {
- return [new _ResultPoint.default(ti + CORR, tj + CORR), new _ResultPoint.default(zi + CORR, zj - CORR), new _ResultPoint.default(xi - CORR, xj + CORR), new _ResultPoint.default(yi - CORR, yj - CORR)];
- }
- };
- /**
- * Determines whether a segment contains a black point
- *
- * @param a min value of the scanned coordinate
- * @param b max value of the scanned coordinate
- * @param fixed value of fixed coordinate
- * @param horizontal set to true if scan must be horizontal, false if vertical
- * @return true if a black point has been found, else false.
- */
- WhiteRectangleDetector.prototype.containsBlackPoint = function (a /*int*/, b /*int*/, fixed /*int*/, horizontal) {
- var image = this.image;
- if (horizontal) {
- for (var x = a; x <= b; x++) {
- if (image.get(x, fixed)) {
- return true;
- }
- }
- } else {
- for (var y = a; y <= b; y++) {
- if (image.get(fixed, y)) {
- return true;
- }
- }
- }
- return false;
- };
- WhiteRectangleDetector.INIT_SIZE = 10;
- WhiteRectangleDetector.CORR = 1;
- return WhiteRectangleDetector;
- }();
- var _default = WhiteRectangleDetector;
- exports.default = _default;
- /***/ }),
- /* 352 */
- /*!**********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/GridSamplerInstance.js ***!
- \**********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _DefaultGridSampler = _interopRequireDefault(__webpack_require__(/*! ./DefaultGridSampler */ 353));
- var GridSamplerInstance = /** @class */function () {
- function GridSamplerInstance() {}
- /**
- * Sets the implementation of GridSampler used by the library. One global
- * instance is stored, which may sound problematic. But, the implementation provided
- * ought to be appropriate for the entire platform, and all uses of this library
- * in the whole lifetime of the JVM. For instance, an Android activity can swap in
- * an implementation that takes advantage of native platform libraries.
- *
- * @param newGridSampler The platform-specific object to install.
- */
- GridSamplerInstance.setGridSampler = function (newGridSampler) {
- GridSamplerInstance.gridSampler = newGridSampler;
- };
- /**
- * @return the current implementation of GridSampler
- */
- GridSamplerInstance.getInstance = function () {
- return GridSamplerInstance.gridSampler;
- };
- GridSamplerInstance.gridSampler = new _DefaultGridSampler.default();
- return GridSamplerInstance;
- }();
- var _default = GridSamplerInstance;
- exports.default = _default;
- /***/ }),
- /* 353 */
- /*!*********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/DefaultGridSampler.js ***!
- \*********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _GridSampler = _interopRequireDefault(__webpack_require__(/*! ./GridSampler */ 354));
- var _BitMatrix = _interopRequireDefault(__webpack_require__(/*! ./BitMatrix */ 319));
- var _PerspectiveTransform = _interopRequireDefault(__webpack_require__(/*! ./PerspectiveTransform */ 355));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /*namespace com.google.zxing.common {*/
- /**
- * @author Sean Owen
- */
- var DefaultGridSampler = /** @class */function (_super) {
- __extends(DefaultGridSampler, _super);
- function DefaultGridSampler() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- /*@Override*/
- DefaultGridSampler.prototype.sampleGrid = function (image, dimensionX /*int*/, dimensionY /*int*/, p1ToX /*float*/, p1ToY /*float*/, p2ToX /*float*/, p2ToY /*float*/, p3ToX /*float*/, p3ToY /*float*/, p4ToX /*float*/, p4ToY /*float*/, p1FromX /*float*/, p1FromY /*float*/, p2FromX /*float*/, p2FromY /*float*/, p3FromX /*float*/, p3FromY /*float*/, p4FromX /*float*/, p4FromY /*float*/) {
- var transform = _PerspectiveTransform.default.quadrilateralToQuadrilateral(p1ToX, p1ToY, p2ToX, p2ToY, p3ToX, p3ToY, p4ToX, p4ToY, p1FromX, p1FromY, p2FromX, p2FromY, p3FromX, p3FromY, p4FromX, p4FromY);
- return this.sampleGridWithTransform(image, dimensionX, dimensionY, transform);
- };
- /*@Override*/
- DefaultGridSampler.prototype.sampleGridWithTransform = function (image, dimensionX /*int*/, dimensionY /*int*/, transform) {
- if (dimensionX <= 0 || dimensionY <= 0) {
- throw new _NotFoundException.default();
- }
- var bits = new _BitMatrix.default(dimensionX, dimensionY);
- var points = new Float32Array(2 * dimensionX);
- for (var y = 0; y < dimensionY; y++) {
- var max = points.length;
- var iValue = y + 0.5;
- for (var x = 0; x < max; x += 2) {
- points[x] = x / 2 + 0.5;
- points[x + 1] = iValue;
- }
- transform.transformPoints(points);
- // Quick check to see if points transformed to something inside the image
- // sufficient to check the endpoints
- _GridSampler.default.checkAndNudgePoints(image, points);
- try {
- for (var x = 0; x < max; x += 2) {
- if (image.get(Math.floor(points[x]), Math.floor(points[x + 1]))) {
- // Black(-ish) pixel
- bits.set(x / 2, y);
- }
- }
- } catch (aioobe /*: ArrayIndexOutOfBoundsException*/) {
- // This feels wrong, but, sometimes if the finder patterns are misidentified, the resulting
- // transform gets "twisted" such that it maps a straight line of points to a set of points
- // whose endpoints are in bounds, but others are not. There is probably some mathematical
- // way to detect this about the transformation that I don't know yet.
- // This results in an ugly runtime exception despite our clever checks above -- can't have
- // that. We could check each point's coordinates but that feels duplicative. We settle for
- // catching and wrapping ArrayIndexOutOfBoundsException.
- throw new _NotFoundException.default();
- }
- }
- return bits;
- };
- return DefaultGridSampler;
- }(_GridSampler.default);
- var _default = DefaultGridSampler;
- exports.default = _default;
- /***/ }),
- /* 354 */
- /*!**************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/GridSampler.js ***!
- \**************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /**
- * Implementations of this class can, given locations of finder patterns for a QR code in an
- * image, sample the right points in the image to reconstruct the QR code, accounting for
- * perspective distortion. It is abstracted since it is relatively expensive and should be allowed
- * to take advantage of platform-specific optimized implementations, like Sun's Java Advanced
- * Imaging library, but which may not be available in other environments such as J2ME, and vice
- * versa.
- *
- * The implementation used can be controlled by calling {@link #setGridSampler(GridSampler)}
- * with an instance of a class which implements this interface.
- *
- * @author Sean Owen
- */
- var GridSampler = /** @class */function () {
- function GridSampler() {}
- /**
- * <p>Checks a set of points that have been transformed to sample points on an image against
- * the image's dimensions to see if the point are even within the image.</p>
- *
- * <p>This method will actually "nudge" the endpoints back onto the image if they are found to be
- * barely (less than 1 pixel) off the image. This accounts for imperfect detection of finder
- * patterns in an image where the QR Code runs all the way to the image border.</p>
- *
- * <p>For efficiency, the method will check points from either end of the line until one is found
- * to be within the image. Because the set of points are assumed to be linear, this is valid.</p>
- *
- * @param image image into which the points should map
- * @param points actual points in x1,y1,...,xn,yn form
- * @throws NotFoundException if an endpoint is lies outside the image boundaries
- */
- GridSampler.checkAndNudgePoints = function (image, points) {
- var width = image.getWidth();
- var height = image.getHeight();
- // Check and nudge points from start until we see some that are OK:
- var nudged = true;
- for (var offset = 0; offset < points.length && nudged; offset += 2) {
- var x = Math.floor(points[offset]);
- var y = Math.floor(points[offset + 1]);
- if (x < -1 || x > width || y < -1 || y > height) {
- throw new _NotFoundException.default();
- }
- nudged = false;
- if (x === -1) {
- points[offset] = 0.0;
- nudged = true;
- } else if (x === width) {
- points[offset] = width - 1;
- nudged = true;
- }
- if (y === -1) {
- points[offset + 1] = 0.0;
- nudged = true;
- } else if (y === height) {
- points[offset + 1] = height - 1;
- nudged = true;
- }
- }
- // Check and nudge points from end:
- nudged = true;
- for (var offset = points.length - 2; offset >= 0 && nudged; offset -= 2) {
- var x = Math.floor(points[offset]);
- var y = Math.floor(points[offset + 1]);
- if (x < -1 || x > width || y < -1 || y > height) {
- throw new _NotFoundException.default();
- }
- nudged = false;
- if (x === -1) {
- points[offset] = 0.0;
- nudged = true;
- } else if (x === width) {
- points[offset] = width - 1;
- nudged = true;
- }
- if (y === -1) {
- points[offset + 1] = 0.0;
- nudged = true;
- } else if (y === height) {
- points[offset + 1] = height - 1;
- nudged = true;
- }
- }
- };
- return GridSampler;
- }();
- var _default = GridSampler;
- exports.default = _default;
- /***/ }),
- /* 355 */
- /*!***********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/PerspectiveTransform.js ***!
- \***********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /*namespace com.google.zxing.common {*/
- /**
- * <p>This class implements a perspective transform in two dimensions. Given four source and four
- * destination points, it will compute the transformation implied between them. The code is based
- * directly upon section 3.4.2 of George Wolberg's "Digital Image Warping"; see pages 54-56.</p>
- *
- * @author Sean Owen
- */
- var PerspectiveTransform = /** @class */function () {
- function PerspectiveTransform(a11 /*float*/, a21 /*float*/, a31 /*float*/, a12 /*float*/, a22 /*float*/, a32 /*float*/, a13 /*float*/, a23 /*float*/, a33 /*float*/) {
- this.a11 = a11;
- this.a21 = a21;
- this.a31 = a31;
- this.a12 = a12;
- this.a22 = a22;
- this.a32 = a32;
- this.a13 = a13;
- this.a23 = a23;
- this.a33 = a33;
- }
- PerspectiveTransform.quadrilateralToQuadrilateral = function (x0 /*float*/, y0 /*float*/, x1 /*float*/, y1 /*float*/, x2 /*float*/, y2 /*float*/, x3 /*float*/, y3 /*float*/, x0p /*float*/, y0p /*float*/, x1p /*float*/, y1p /*float*/, x2p /*float*/, y2p /*float*/, x3p /*float*/, y3p /*float*/) {
- var qToS = PerspectiveTransform.quadrilateralToSquare(x0, y0, x1, y1, x2, y2, x3, y3);
- var sToQ = PerspectiveTransform.squareToQuadrilateral(x0p, y0p, x1p, y1p, x2p, y2p, x3p, y3p);
- return sToQ.times(qToS);
- };
- PerspectiveTransform.prototype.transformPoints = function (points) {
- var max = points.length;
- var a11 = this.a11;
- var a12 = this.a12;
- var a13 = this.a13;
- var a21 = this.a21;
- var a22 = this.a22;
- var a23 = this.a23;
- var a31 = this.a31;
- var a32 = this.a32;
- var a33 = this.a33;
- for (var i = 0; i < max; i += 2) {
- var x = points[i];
- var y = points[i + 1];
- var denominator = a13 * x + a23 * y + a33;
- points[i] = (a11 * x + a21 * y + a31) / denominator;
- points[i + 1] = (a12 * x + a22 * y + a32) / denominator;
- }
- };
- PerspectiveTransform.prototype.transformPointsWithValues = function (xValues, yValues) {
- var a11 = this.a11;
- var a12 = this.a12;
- var a13 = this.a13;
- var a21 = this.a21;
- var a22 = this.a22;
- var a23 = this.a23;
- var a31 = this.a31;
- var a32 = this.a32;
- var a33 = this.a33;
- var n = xValues.length;
- for (var i = 0; i < n; i++) {
- var x = xValues[i];
- var y = yValues[i];
- var denominator = a13 * x + a23 * y + a33;
- xValues[i] = (a11 * x + a21 * y + a31) / denominator;
- yValues[i] = (a12 * x + a22 * y + a32) / denominator;
- }
- };
- PerspectiveTransform.squareToQuadrilateral = function (x0 /*float*/, y0 /*float*/, x1 /*float*/, y1 /*float*/, x2 /*float*/, y2 /*float*/, x3 /*float*/, y3 /*float*/) {
- var dx3 = x0 - x1 + x2 - x3;
- var dy3 = y0 - y1 + y2 - y3;
- if (dx3 === 0.0 && dy3 === 0.0) {
- // Affine
- return new PerspectiveTransform(x1 - x0, x2 - x1, x0, y1 - y0, y2 - y1, y0, 0.0, 0.0, 1.0);
- } else {
- var dx1 = x1 - x2;
- var dx2 = x3 - x2;
- var dy1 = y1 - y2;
- var dy2 = y3 - y2;
- var denominator = dx1 * dy2 - dx2 * dy1;
- var a13 = (dx3 * dy2 - dx2 * dy3) / denominator;
- var a23 = (dx1 * dy3 - dx3 * dy1) / denominator;
- return new PerspectiveTransform(x1 - x0 + a13 * x1, x3 - x0 + a23 * x3, x0, y1 - y0 + a13 * y1, y3 - y0 + a23 * y3, y0, a13, a23, 1.0);
- }
- };
- PerspectiveTransform.quadrilateralToSquare = function (x0 /*float*/, y0 /*float*/, x1 /*float*/, y1 /*float*/, x2 /*float*/, y2 /*float*/, x3 /*float*/, y3 /*float*/) {
- // Here, the adjoint serves as the inverse:
- return PerspectiveTransform.squareToQuadrilateral(x0, y0, x1, y1, x2, y2, x3, y3).buildAdjoint();
- };
- PerspectiveTransform.prototype.buildAdjoint = function () {
- // Adjoint is the transpose of the cofactor matrix:
- return new PerspectiveTransform(this.a22 * this.a33 - this.a23 * this.a32, this.a23 * this.a31 - this.a21 * this.a33, this.a21 * this.a32 - this.a22 * this.a31, this.a13 * this.a32 - this.a12 * this.a33, this.a11 * this.a33 - this.a13 * this.a31, this.a12 * this.a31 - this.a11 * this.a32, this.a12 * this.a23 - this.a13 * this.a22, this.a13 * this.a21 - this.a11 * this.a23, this.a11 * this.a22 - this.a12 * this.a21);
- };
- PerspectiveTransform.prototype.times = function (other) {
- return new PerspectiveTransform(this.a11 * other.a11 + this.a21 * other.a12 + this.a31 * other.a13, this.a11 * other.a21 + this.a21 * other.a22 + this.a31 * other.a23, this.a11 * other.a31 + this.a21 * other.a32 + this.a31 * other.a33, this.a12 * other.a11 + this.a22 * other.a12 + this.a32 * other.a13, this.a12 * other.a21 + this.a22 * other.a22 + this.a32 * other.a23, this.a12 * other.a31 + this.a22 * other.a32 + this.a32 * other.a33, this.a13 * other.a11 + this.a23 * other.a12 + this.a33 * other.a13, this.a13 * other.a21 + this.a23 * other.a22 + this.a33 * other.a23, this.a13 * other.a31 + this.a23 * other.a32 + this.a33 * other.a33);
- };
- return PerspectiveTransform;
- }();
- var _default = PerspectiveTransform;
- exports.default = _default;
- /***/ }),
- /* 356 */
- /*!*******************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/browser/BrowserBarcodeReader.js ***!
- \*******************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.BrowserBarcodeReader = void 0;
- var _BrowserCodeReader = __webpack_require__(/*! ./BrowserCodeReader */ 303);
- var _MultiFormatOneDReader = _interopRequireDefault(__webpack_require__(/*! ../core/oned/MultiFormatOneDReader */ 357));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /**
- * @deprecated Moving to @zxing/browser
- *
- * Barcode reader reader to use from browser.
- */
- var BrowserBarcodeReader = /** @class */function (_super) {
- __extends(BrowserBarcodeReader, _super);
- /**
- * Creates an instance of BrowserBarcodeReader.
- * @param {number} [timeBetweenScansMillis=500] the time delay between subsequent decode tries
- * @param {Map<DecodeHintType, any>} hints
- */
- function BrowserBarcodeReader(timeBetweenScansMillis, hints) {
- if (timeBetweenScansMillis === void 0) {
- timeBetweenScansMillis = 500;
- }
- return _super.call(this, new _MultiFormatOneDReader.default(hints), timeBetweenScansMillis, hints) || this;
- }
- return BrowserBarcodeReader;
- }(_BrowserCodeReader.BrowserCodeReader);
- exports.BrowserBarcodeReader = BrowserBarcodeReader;
- /***/ }),
- /* 357 */
- /*!**********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/MultiFormatOneDReader.js ***!
- \**********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
- var _DecodeHintType = _interopRequireDefault(__webpack_require__(/*! ../DecodeHintType */ 322));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
- var _Code128Reader = _interopRequireDefault(__webpack_require__(/*! ./Code128Reader */ 358));
- var _Code39Reader = _interopRequireDefault(__webpack_require__(/*! ./Code39Reader */ 360));
- var _Code93Reader = _interopRequireDefault(__webpack_require__(/*! ./Code93Reader */ 361));
- var _ITFReader = _interopRequireDefault(__webpack_require__(/*! ./ITFReader */ 362));
- var _MultiFormatUPCEANReader = _interopRequireDefault(__webpack_require__(/*! ./MultiFormatUPCEANReader */ 363));
- var _OneDReader = _interopRequireDefault(__webpack_require__(/*! ./OneDReader */ 359));
- var _CodaBarReader = _interopRequireDefault(__webpack_require__(/*! ./CodaBarReader */ 373));
- var _RSSExpandedReader = _interopRequireDefault(__webpack_require__(/*! ./rss/expanded/RSSExpandedReader */ 374));
- var _RSS14Reader = _interopRequireDefault(__webpack_require__(/*! ./rss/RSS14Reader */ 401));
- /*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /*namespace com.google.zxing.oned {*/
- /**
- * @author Daniel Switkin <dswitkin@google.com>
- * @author Sean Owen
- */
- var MultiFormatOneDReader = /** @class */function (_super) {
- __extends(MultiFormatOneDReader, _super);
- function MultiFormatOneDReader(hints) {
- var _this = _super.call(this) || this;
- _this.readers = [];
- var possibleFormats = !hints ? null : hints.get(_DecodeHintType.default.POSSIBLE_FORMATS);
- var useCode39CheckDigit = hints && hints.get(_DecodeHintType.default.ASSUME_CODE_39_CHECK_DIGIT) !== undefined;
- var useCode39ExtendedMode = hints && hints.get(_DecodeHintType.default.ENABLE_CODE_39_EXTENDED_MODE) !== undefined;
- if (possibleFormats) {
- if (possibleFormats.includes(_BarcodeFormat.default.EAN_13) || possibleFormats.includes(_BarcodeFormat.default.UPC_A) || possibleFormats.includes(_BarcodeFormat.default.EAN_8) || possibleFormats.includes(_BarcodeFormat.default.UPC_E)) {
- _this.readers.push(new _MultiFormatUPCEANReader.default(hints));
- }
- if (possibleFormats.includes(_BarcodeFormat.default.CODE_39)) {
- _this.readers.push(new _Code39Reader.default(useCode39CheckDigit, useCode39ExtendedMode));
- }
- if (possibleFormats.includes(_BarcodeFormat.default.CODE_93)) {
- _this.readers.push(new _Code93Reader.default());
- }
- if (possibleFormats.includes(_BarcodeFormat.default.CODE_128)) {
- _this.readers.push(new _Code128Reader.default());
- }
- if (possibleFormats.includes(_BarcodeFormat.default.ITF)) {
- _this.readers.push(new _ITFReader.default());
- }
- if (possibleFormats.includes(_BarcodeFormat.default.CODABAR)) {
- _this.readers.push(new _CodaBarReader.default());
- }
- if (possibleFormats.includes(_BarcodeFormat.default.RSS_14)) {
- _this.readers.push(new _RSS14Reader.default());
- }
- if (possibleFormats.includes(_BarcodeFormat.default.RSS_EXPANDED)) {
- console.warn('RSS Expanded reader IS NOT ready for production yet! use at your own risk.');
- _this.readers.push(new _RSSExpandedReader.default());
- }
- }
- if (_this.readers.length === 0) {
- _this.readers.push(new _MultiFormatUPCEANReader.default(hints));
- _this.readers.push(new _Code39Reader.default());
- // this.readers.push(new CodaBarReader());
- _this.readers.push(new _Code93Reader.default());
- _this.readers.push(new _MultiFormatUPCEANReader.default(hints));
- _this.readers.push(new _Code128Reader.default());
- _this.readers.push(new _ITFReader.default());
- _this.readers.push(new _RSS14Reader.default());
- // this.readers.push(new RSSExpandedReader());
- }
- return _this;
- }
- // @Override
- MultiFormatOneDReader.prototype.decodeRow = function (rowNumber, row, hints) {
- for (var i = 0; i < this.readers.length; i++) {
- try {
- return this.readers[i].decodeRow(rowNumber, row, hints);
- } catch (re) {
- // continue
- }
- }
- throw new _NotFoundException.default();
- };
- // @Override
- MultiFormatOneDReader.prototype.reset = function () {
- this.readers.forEach(function (reader) {
- return reader.reset();
- });
- };
- return MultiFormatOneDReader;
- }(_OneDReader.default);
- var _default = MultiFormatOneDReader;
- exports.default = _default;
- /***/ }),
- /* 358 */
- /*!**************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/Code128Reader.js ***!
- \**************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
- var _ChecksumException = _interopRequireDefault(__webpack_require__(/*! ../ChecksumException */ 309));
- var _DecodeHintType = _interopRequireDefault(__webpack_require__(/*! ../DecodeHintType */ 322));
- var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../FormatException */ 324));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
- var _Result = _interopRequireDefault(__webpack_require__(/*! ../Result */ 333));
- var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../ResultPoint */ 346));
- var _OneDReader = _interopRequireDefault(__webpack_require__(/*! ./OneDReader */ 359));
- /*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /*namespace com.google.zxing.oned {*/
- /**
- * <p>Decodes Code 128 barcodes.</p>
- *
- * @author Sean Owen
- */
- var Code128Reader = /** @class */function (_super) {
- __extends(Code128Reader, _super);
- function Code128Reader() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- Code128Reader.findStartPattern = function (row) {
- var width = row.getSize();
- var rowOffset = row.getNextSet(0);
- var counterPosition = 0;
- var counters = Int32Array.from([0, 0, 0, 0, 0, 0]);
- var patternStart = rowOffset;
- var isWhite = false;
- var patternLength = 6;
- for (var i = rowOffset; i < width; i++) {
- if (row.get(i) !== isWhite) {
- counters[counterPosition]++;
- } else {
- if (counterPosition === patternLength - 1) {
- var bestVariance = Code128Reader.MAX_AVG_VARIANCE;
- var bestMatch = -1;
- for (var startCode = Code128Reader.CODE_START_A; startCode <= Code128Reader.CODE_START_C; startCode++) {
- var variance = _OneDReader.default.patternMatchVariance(counters, Code128Reader.CODE_PATTERNS[startCode], Code128Reader.MAX_INDIVIDUAL_VARIANCE);
- if (variance < bestVariance) {
- bestVariance = variance;
- bestMatch = startCode;
- }
- }
- // Look for whitespace before start pattern, >= 50% of width of start pattern
- if (bestMatch >= 0 && row.isRange(Math.max(0, patternStart - (i - patternStart) / 2), patternStart, false)) {
- return Int32Array.from([patternStart, i, bestMatch]);
- }
- patternStart += counters[0] + counters[1];
- counters = counters.slice(2, counters.length);
- counters[counterPosition - 1] = 0;
- counters[counterPosition] = 0;
- counterPosition--;
- } else {
- counterPosition++;
- }
- counters[counterPosition] = 1;
- isWhite = !isWhite;
- }
- }
- throw new _NotFoundException.default();
- };
- Code128Reader.decodeCode = function (row, counters, rowOffset) {
- _OneDReader.default.recordPattern(row, rowOffset, counters);
- var bestVariance = Code128Reader.MAX_AVG_VARIANCE; // worst variance we'll accept
- var bestMatch = -1;
- for (var d = 0; d < Code128Reader.CODE_PATTERNS.length; d++) {
- var pattern = Code128Reader.CODE_PATTERNS[d];
- var variance = this.patternMatchVariance(counters, pattern, Code128Reader.MAX_INDIVIDUAL_VARIANCE);
- if (variance < bestVariance) {
- bestVariance = variance;
- bestMatch = d;
- }
- }
- // TODO We're overlooking the fact that the STOP pattern has 7 values, not 6.
- if (bestMatch >= 0) {
- return bestMatch;
- } else {
- throw new _NotFoundException.default();
- }
- };
- Code128Reader.prototype.decodeRow = function (rowNumber, row, hints) {
- var convertFNC1 = hints && hints.get(_DecodeHintType.default.ASSUME_GS1) === true;
- var startPatternInfo = Code128Reader.findStartPattern(row);
- var startCode = startPatternInfo[2];
- var currentRawCodesIndex = 0;
- var rawCodes = new Uint8Array(20);
- rawCodes[currentRawCodesIndex++] = startCode;
- var codeSet;
- switch (startCode) {
- case Code128Reader.CODE_START_A:
- codeSet = Code128Reader.CODE_CODE_A;
- break;
- case Code128Reader.CODE_START_B:
- codeSet = Code128Reader.CODE_CODE_B;
- break;
- case Code128Reader.CODE_START_C:
- codeSet = Code128Reader.CODE_CODE_C;
- break;
- default:
- throw new _FormatException.default();
- }
- var done = false;
- var isNextShifted = false;
- var result = '';
- var lastStart = startPatternInfo[0];
- var nextStart = startPatternInfo[1];
- var counters = Int32Array.from([0, 0, 0, 0, 0, 0]);
- var lastCode = 0;
- var code = 0;
- var checksumTotal = startCode;
- var multiplier = 0;
- var lastCharacterWasPrintable = true;
- var upperMode = false;
- var shiftUpperMode = false;
- while (!done) {
- var unshift = isNextShifted;
- isNextShifted = false;
- // Save off last code
- lastCode = code;
- // Decode another code from image
- code = Code128Reader.decodeCode(row, counters, nextStart);
- rawCodes[currentRawCodesIndex++] = code;
- // Remember whether the last code was printable or not (excluding CODE_STOP)
- if (code !== Code128Reader.CODE_STOP) {
- lastCharacterWasPrintable = true;
- }
- // Add to checksum computation (if not CODE_STOP of course)
- if (code !== Code128Reader.CODE_STOP) {
- multiplier++;
- checksumTotal += multiplier * code;
- }
- // Advance to where the next code will to start
- lastStart = nextStart;
- nextStart += counters.reduce(function (previous, current) {
- return previous + current;
- }, 0);
- // Take care of illegal start codes
- switch (code) {
- case Code128Reader.CODE_START_A:
- case Code128Reader.CODE_START_B:
- case Code128Reader.CODE_START_C:
- throw new _FormatException.default();
- }
- switch (codeSet) {
- case Code128Reader.CODE_CODE_A:
- if (code < 64) {
- if (shiftUpperMode === upperMode) {
- result += String.fromCharCode(' '.charCodeAt(0) + code);
- } else {
- result += String.fromCharCode(' '.charCodeAt(0) + code + 128);
- }
- shiftUpperMode = false;
- } else if (code < 96) {
- if (shiftUpperMode === upperMode) {
- result += String.fromCharCode(code - 64);
- } else {
- result += String.fromCharCode(code + 64);
- }
- shiftUpperMode = false;
- } else {
- // Don't let CODE_STOP, which always appears, affect whether whether we think the last
- // code was printable or not.
- if (code !== Code128Reader.CODE_STOP) {
- lastCharacterWasPrintable = false;
- }
- switch (code) {
- case Code128Reader.CODE_FNC_1:
- if (convertFNC1) {
- if (result.length === 0) {
- // GS1 specification 5.4.3.7. and 5.4.6.4. If the first char after the start code
- // is FNC1 then this is GS1-128. We add the symbology identifier.
- result += ']C1';
- } else {
- // GS1 specification 5.4.7.5. Every subsequent FNC1 is returned as ASCII 29 (GS)
- result += String.fromCharCode(29);
- }
- }
- break;
- case Code128Reader.CODE_FNC_2:
- case Code128Reader.CODE_FNC_3:
- // do nothing?
- break;
- case Code128Reader.CODE_FNC_4_A:
- if (!upperMode && shiftUpperMode) {
- upperMode = true;
- shiftUpperMode = false;
- } else if (upperMode && shiftUpperMode) {
- upperMode = false;
- shiftUpperMode = false;
- } else {
- shiftUpperMode = true;
- }
- break;
- case Code128Reader.CODE_SHIFT:
- isNextShifted = true;
- codeSet = Code128Reader.CODE_CODE_B;
- break;
- case Code128Reader.CODE_CODE_B:
- codeSet = Code128Reader.CODE_CODE_B;
- break;
- case Code128Reader.CODE_CODE_C:
- codeSet = Code128Reader.CODE_CODE_C;
- break;
- case Code128Reader.CODE_STOP:
- done = true;
- break;
- }
- }
- break;
- case Code128Reader.CODE_CODE_B:
- if (code < 96) {
- if (shiftUpperMode === upperMode) {
- result += String.fromCharCode(' '.charCodeAt(0) + code);
- } else {
- result += String.fromCharCode(' '.charCodeAt(0) + code + 128);
- }
- shiftUpperMode = false;
- } else {
- if (code !== Code128Reader.CODE_STOP) {
- lastCharacterWasPrintable = false;
- }
- switch (code) {
- case Code128Reader.CODE_FNC_1:
- if (convertFNC1) {
- if (result.length === 0) {
- // GS1 specification 5.4.3.7. and 5.4.6.4. If the first char after the start code
- // is FNC1 then this is GS1-128. We add the symbology identifier.
- result += ']C1';
- } else {
- // GS1 specification 5.4.7.5. Every subsequent FNC1 is returned as ASCII 29 (GS)
- result += String.fromCharCode(29);
- }
- }
- break;
- case Code128Reader.CODE_FNC_2:
- case Code128Reader.CODE_FNC_3:
- // do nothing?
- break;
- case Code128Reader.CODE_FNC_4_B:
- if (!upperMode && shiftUpperMode) {
- upperMode = true;
- shiftUpperMode = false;
- } else if (upperMode && shiftUpperMode) {
- upperMode = false;
- shiftUpperMode = false;
- } else {
- shiftUpperMode = true;
- }
- break;
- case Code128Reader.CODE_SHIFT:
- isNextShifted = true;
- codeSet = Code128Reader.CODE_CODE_A;
- break;
- case Code128Reader.CODE_CODE_A:
- codeSet = Code128Reader.CODE_CODE_A;
- break;
- case Code128Reader.CODE_CODE_C:
- codeSet = Code128Reader.CODE_CODE_C;
- break;
- case Code128Reader.CODE_STOP:
- done = true;
- break;
- }
- }
- break;
- case Code128Reader.CODE_CODE_C:
- if (code < 100) {
- if (code < 10) {
- result += '0';
- }
- result += code;
- } else {
- if (code !== Code128Reader.CODE_STOP) {
- lastCharacterWasPrintable = false;
- }
- switch (code) {
- case Code128Reader.CODE_FNC_1:
- if (convertFNC1) {
- if (result.length === 0) {
- // GS1 specification 5.4.3.7. and 5.4.6.4. If the first char after the start code
- // is FNC1 then this is GS1-128. We add the symbology identifier.
- result += ']C1';
- } else {
- // GS1 specification 5.4.7.5. Every subsequent FNC1 is returned as ASCII 29 (GS)
- result += String.fromCharCode(29);
- }
- }
- break;
- case Code128Reader.CODE_CODE_A:
- codeSet = Code128Reader.CODE_CODE_A;
- break;
- case Code128Reader.CODE_CODE_B:
- codeSet = Code128Reader.CODE_CODE_B;
- break;
- case Code128Reader.CODE_STOP:
- done = true;
- break;
- }
- }
- break;
- }
- // Unshift back to another code set if we were shifted
- if (unshift) {
- codeSet = codeSet === Code128Reader.CODE_CODE_A ? Code128Reader.CODE_CODE_B : Code128Reader.CODE_CODE_A;
- }
- }
- var lastPatternSize = nextStart - lastStart;
- // Check for ample whitespace following pattern, but, to do this we first need to remember that
- // we fudged decoding CODE_STOP since it actually has 7 bars, not 6. There is a black bar left
- // to read off. Would be slightly better to properly read. Here we just skip it:
- nextStart = row.getNextUnset(nextStart);
- if (!row.isRange(nextStart, Math.min(row.getSize(), nextStart + (nextStart - lastStart) / 2), false)) {
- throw new _NotFoundException.default();
- }
- // Pull out from sum the value of the penultimate check code
- checksumTotal -= multiplier * lastCode;
- // lastCode is the checksum then:
- if (checksumTotal % 103 !== lastCode) {
- throw new _ChecksumException.default();
- }
- // Need to pull out the check digits from string
- var resultLength = result.length;
- if (resultLength === 0) {
- // false positive
- throw new _NotFoundException.default();
- }
- // Only bother if the result had at least one character, and if the checksum digit happened to
- // be a printable character. If it was just interpreted as a control code, nothing to remove.
- if (resultLength > 0 && lastCharacterWasPrintable) {
- if (codeSet === Code128Reader.CODE_CODE_C) {
- result = result.substring(0, resultLength - 2);
- } else {
- result = result.substring(0, resultLength - 1);
- }
- }
- var left = (startPatternInfo[1] + startPatternInfo[0]) / 2.0;
- var right = lastStart + lastPatternSize / 2.0;
- var rawCodesSize = rawCodes.length;
- var rawBytes = new Uint8Array(rawCodesSize);
- for (var i = 0; i < rawCodesSize; i++) {
- rawBytes[i] = rawCodes[i];
- }
- var points = [new _ResultPoint.default(left, rowNumber), new _ResultPoint.default(right, rowNumber)];
- return new _Result.default(result, rawBytes, 0, points, _BarcodeFormat.default.CODE_128, new Date().getTime());
- };
- Code128Reader.CODE_PATTERNS = [Int32Array.from([2, 1, 2, 2, 2, 2]), Int32Array.from([2, 2, 2, 1, 2, 2]), Int32Array.from([2, 2, 2, 2, 2, 1]), Int32Array.from([1, 2, 1, 2, 2, 3]), Int32Array.from([1, 2, 1, 3, 2, 2]), Int32Array.from([1, 3, 1, 2, 2, 2]), Int32Array.from([1, 2, 2, 2, 1, 3]), Int32Array.from([1, 2, 2, 3, 1, 2]), Int32Array.from([1, 3, 2, 2, 1, 2]), Int32Array.from([2, 2, 1, 2, 1, 3]), Int32Array.from([2, 2, 1, 3, 1, 2]), Int32Array.from([2, 3, 1, 2, 1, 2]), Int32Array.from([1, 1, 2, 2, 3, 2]), Int32Array.from([1, 2, 2, 1, 3, 2]), Int32Array.from([1, 2, 2, 2, 3, 1]), Int32Array.from([1, 1, 3, 2, 2, 2]), Int32Array.from([1, 2, 3, 1, 2, 2]), Int32Array.from([1, 2, 3, 2, 2, 1]), Int32Array.from([2, 2, 3, 2, 1, 1]), Int32Array.from([2, 2, 1, 1, 3, 2]), Int32Array.from([2, 2, 1, 2, 3, 1]), Int32Array.from([2, 1, 3, 2, 1, 2]), Int32Array.from([2, 2, 3, 1, 1, 2]), Int32Array.from([3, 1, 2, 1, 3, 1]), Int32Array.from([3, 1, 1, 2, 2, 2]), Int32Array.from([3, 2, 1, 1, 2, 2]), Int32Array.from([3, 2, 1, 2, 2, 1]), Int32Array.from([3, 1, 2, 2, 1, 2]), Int32Array.from([3, 2, 2, 1, 1, 2]), Int32Array.from([3, 2, 2, 2, 1, 1]), Int32Array.from([2, 1, 2, 1, 2, 3]), Int32Array.from([2, 1, 2, 3, 2, 1]), Int32Array.from([2, 3, 2, 1, 2, 1]), Int32Array.from([1, 1, 1, 3, 2, 3]), Int32Array.from([1, 3, 1, 1, 2, 3]), Int32Array.from([1, 3, 1, 3, 2, 1]), Int32Array.from([1, 1, 2, 3, 1, 3]), Int32Array.from([1, 3, 2, 1, 1, 3]), Int32Array.from([1, 3, 2, 3, 1, 1]), Int32Array.from([2, 1, 1, 3, 1, 3]), Int32Array.from([2, 3, 1, 1, 1, 3]), Int32Array.from([2, 3, 1, 3, 1, 1]), Int32Array.from([1, 1, 2, 1, 3, 3]), Int32Array.from([1, 1, 2, 3, 3, 1]), Int32Array.from([1, 3, 2, 1, 3, 1]), Int32Array.from([1, 1, 3, 1, 2, 3]), Int32Array.from([1, 1, 3, 3, 2, 1]), Int32Array.from([1, 3, 3, 1, 2, 1]), Int32Array.from([3, 1, 3, 1, 2, 1]), Int32Array.from([2, 1, 1, 3, 3, 1]), Int32Array.from([2, 3, 1, 1, 3, 1]), Int32Array.from([2, 1, 3, 1, 1, 3]), Int32Array.from([2, 1, 3, 3, 1, 1]), Int32Array.from([2, 1, 3, 1, 3, 1]), Int32Array.from([3, 1, 1, 1, 2, 3]), Int32Array.from([3, 1, 1, 3, 2, 1]), Int32Array.from([3, 3, 1, 1, 2, 1]), Int32Array.from([3, 1, 2, 1, 1, 3]), Int32Array.from([3, 1, 2, 3, 1, 1]), Int32Array.from([3, 3, 2, 1, 1, 1]), Int32Array.from([3, 1, 4, 1, 1, 1]), Int32Array.from([2, 2, 1, 4, 1, 1]), Int32Array.from([4, 3, 1, 1, 1, 1]), Int32Array.from([1, 1, 1, 2, 2, 4]), Int32Array.from([1, 1, 1, 4, 2, 2]), Int32Array.from([1, 2, 1, 1, 2, 4]), Int32Array.from([1, 2, 1, 4, 2, 1]), Int32Array.from([1, 4, 1, 1, 2, 2]), Int32Array.from([1, 4, 1, 2, 2, 1]), Int32Array.from([1, 1, 2, 2, 1, 4]), Int32Array.from([1, 1, 2, 4, 1, 2]), Int32Array.from([1, 2, 2, 1, 1, 4]), Int32Array.from([1, 2, 2, 4, 1, 1]), Int32Array.from([1, 4, 2, 1, 1, 2]), Int32Array.from([1, 4, 2, 2, 1, 1]), Int32Array.from([2, 4, 1, 2, 1, 1]), Int32Array.from([2, 2, 1, 1, 1, 4]), Int32Array.from([4, 1, 3, 1, 1, 1]), Int32Array.from([2, 4, 1, 1, 1, 2]), Int32Array.from([1, 3, 4, 1, 1, 1]), Int32Array.from([1, 1, 1, 2, 4, 2]), Int32Array.from([1, 2, 1, 1, 4, 2]), Int32Array.from([1, 2, 1, 2, 4, 1]), Int32Array.from([1, 1, 4, 2, 1, 2]), Int32Array.from([1, 2, 4, 1, 1, 2]), Int32Array.from([1, 2, 4, 2, 1, 1]), Int32Array.from([4, 1, 1, 2, 1, 2]), Int32Array.from([4, 2, 1, 1, 1, 2]), Int32Array.from([4, 2, 1, 2, 1, 1]), Int32Array.from([2, 1, 2, 1, 4, 1]), Int32Array.from([2, 1, 4, 1, 2, 1]), Int32Array.from([4, 1, 2, 1, 2, 1]), Int32Array.from([1, 1, 1, 1, 4, 3]), Int32Array.from([1, 1, 1, 3, 4, 1]), Int32Array.from([1, 3, 1, 1, 4, 1]), Int32Array.from([1, 1, 4, 1, 1, 3]), Int32Array.from([1, 1, 4, 3, 1, 1]), Int32Array.from([4, 1, 1, 1, 1, 3]), Int32Array.from([4, 1, 1, 3, 1, 1]), Int32Array.from([1, 1, 3, 1, 4, 1]), Int32Array.from([1, 1, 4, 1, 3, 1]), Int32Array.from([3, 1, 1, 1, 4, 1]), Int32Array.from([4, 1, 1, 1, 3, 1]), Int32Array.from([2, 1, 1, 4, 1, 2]), Int32Array.from([2, 1, 1, 2, 1, 4]), Int32Array.from([2, 1, 1, 2, 3, 2]), Int32Array.from([2, 3, 3, 1, 1, 1, 2])];
- Code128Reader.MAX_AVG_VARIANCE = 0.25;
- Code128Reader.MAX_INDIVIDUAL_VARIANCE = 0.7;
- Code128Reader.CODE_SHIFT = 98;
- Code128Reader.CODE_CODE_C = 99;
- Code128Reader.CODE_CODE_B = 100;
- Code128Reader.CODE_CODE_A = 101;
- Code128Reader.CODE_FNC_1 = 102;
- Code128Reader.CODE_FNC_2 = 97;
- Code128Reader.CODE_FNC_3 = 96;
- Code128Reader.CODE_FNC_4_A = 101;
- Code128Reader.CODE_FNC_4_B = 100;
- Code128Reader.CODE_START_A = 103;
- Code128Reader.CODE_START_B = 104;
- Code128Reader.CODE_START_C = 105;
- Code128Reader.CODE_STOP = 106;
- return Code128Reader;
- }(_OneDReader.default);
- var _default = Code128Reader;
- exports.default = _default;
- /***/ }),
- /* 359 */
- /*!***********************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/OneDReader.js ***!
- \***********************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
- var _BitArray = _interopRequireDefault(__webpack_require__(/*! ../common/BitArray */ 313));
- var _DecodeHintType = _interopRequireDefault(__webpack_require__(/*! ../DecodeHintType */ 322));
- var _ResultMetadataType = _interopRequireDefault(__webpack_require__(/*! ../ResultMetadataType */ 335));
- var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../ResultPoint */ 346));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
- /*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /**
- * Encapsulates functionality and implementation that is common to all families
- * of one-dimensional barcodes.
- *
- * @author dswitkin@google.com (Daniel Switkin)
- * @author Sean Owen
- */
- var OneDReader = /** @class */function () {
- function OneDReader() {}
- /*
- @Override
- public Result decode(BinaryBitmap image) throws NotFoundException, FormatException {
- return decode(image, null);
- }
- */
- // Note that we don't try rotation without the try harder flag, even if rotation was supported.
- // @Override
- OneDReader.prototype.decode = function (image, hints) {
- try {
- return this.doDecode(image, hints);
- } catch (nfe) {
- var tryHarder = hints && hints.get(_DecodeHintType.default.TRY_HARDER) === true;
- if (tryHarder && image.isRotateSupported()) {
- var rotatedImage = image.rotateCounterClockwise();
- var result = this.doDecode(rotatedImage, hints);
- // Record that we found it rotated 90 degrees CCW / 270 degrees CW
- var metadata = result.getResultMetadata();
- var orientation_1 = 270;
- if (metadata !== null && metadata.get(_ResultMetadataType.default.ORIENTATION) === true) {
- // But if we found it reversed in doDecode(), add in that result here:
- orientation_1 = orientation_1 + metadata.get(_ResultMetadataType.default.ORIENTATION) % 360;
- }
- result.putMetadata(_ResultMetadataType.default.ORIENTATION, orientation_1);
- // Update result points
- var points = result.getResultPoints();
- if (points !== null) {
- var height = rotatedImage.getHeight();
- for (var i = 0; i < points.length; i++) {
- points[i] = new _ResultPoint.default(height - points[i].getY() - 1, points[i].getX());
- }
- }
- return result;
- } else {
- throw new _NotFoundException.default();
- }
- }
- };
- // @Override
- OneDReader.prototype.reset = function () {
- // do nothing
- };
- /**
- * We're going to examine rows from the middle outward, searching alternately above and below the
- * middle, and farther out each time. rowStep is the number of rows between each successive
- * attempt above and below the middle. So we'd scan row middle, then middle - rowStep, then
- * middle + rowStep, then middle - (2 * rowStep), etc.
- * rowStep is bigger as the image is taller, but is always at least 1. We've somewhat arbitrarily
- * decided that moving up and down by about 1/16 of the image is pretty good; we try more of the
- * image if "trying harder".
- *
- * @param image The image to decode
- * @param hints Any hints that were requested
- * @return The contents of the decoded barcode
- * @throws NotFoundException Any spontaneous errors which occur
- */
- OneDReader.prototype.doDecode = function (image, hints) {
- var width = image.getWidth();
- var height = image.getHeight();
- var row = new _BitArray.default(width);
- var tryHarder = hints && hints.get(_DecodeHintType.default.TRY_HARDER) === true;
- var rowStep = Math.max(1, height >> (tryHarder ? 8 : 5));
- var maxLines;
- if (tryHarder) {
- maxLines = height; // Look at the whole image, not just the center
- } else {
- maxLines = 15; // 15 rows spaced 1/32 apart is roughly the middle half of the image
- }
- var middle = Math.trunc(height / 2);
- for (var x = 0; x < maxLines; x++) {
- // Scanning from the middle out. Determine which row we're looking at next:
- var rowStepsAboveOrBelow = Math.trunc((x + 1) / 2);
- var isAbove = (x & 0x01) === 0; // i.e. is x even?
- var rowNumber = middle + rowStep * (isAbove ? rowStepsAboveOrBelow : -rowStepsAboveOrBelow);
- if (rowNumber < 0 || rowNumber >= height) {
- // Oops, if we run off the top or bottom, stop
- break;
- }
- // Estimate black point for this row and load it:
- try {
- row = image.getBlackRow(rowNumber, row);
- } catch (ignored) {
- continue;
- }
- var _loop_1 = function _loop_1(attempt) {
- if (attempt === 1) {
- // trying again?
- row.reverse(); // reverse the row and continue
- // This means we will only ever draw result points *once* in the life of this method
- // since we want to avoid drawing the wrong points after flipping the row, and,
- // don't want to clutter with noise from every single row scan -- just the scans
- // that start on the center line.
- if (hints && hints.get(_DecodeHintType.default.NEED_RESULT_POINT_CALLBACK) === true) {
- var newHints_1 = new Map();
- hints.forEach(function (hint, key) {
- return newHints_1.set(key, hint);
- });
- newHints_1.delete(_DecodeHintType.default.NEED_RESULT_POINT_CALLBACK);
- hints = newHints_1;
- }
- }
- try {
- // Look for a barcode
- var result = this_1.decodeRow(rowNumber, row, hints);
- // We found our barcode
- if (attempt === 1) {
- // But it was upside down, so note that
- result.putMetadata(_ResultMetadataType.default.ORIENTATION, 180);
- // And remember to flip the result points horizontally.
- var points = result.getResultPoints();
- if (points !== null) {
- points[0] = new _ResultPoint.default(width - points[0].getX() - 1, points[0].getY());
- points[1] = new _ResultPoint.default(width - points[1].getX() - 1, points[1].getY());
- }
- }
- return {
- value: result
- };
- } catch (re) {
- // continue -- just couldn't decode this row
- }
- };
- var this_1 = this;
- // While we have the image data in a BitArray, it's fairly cheap to reverse it in place to
- // handle decoding upside down barcodes.
- for (var attempt = 0; attempt < 2; attempt++) {
- var state_1 = _loop_1(attempt);
- if ((0, _typeof2.default)(state_1) === "object") return state_1.value;
- }
- }
- throw new _NotFoundException.default();
- };
- /**
- * Records the size of successive runs of white and black pixels in a row, starting at a given point.
- * The values are recorded in the given array, and the number of runs recorded is equal to the size
- * of the array. If the row starts on a white pixel at the given start point, then the first count
- * recorded is the run of white pixels starting from that point; likewise it is the count of a run
- * of black pixels if the row begin on a black pixels at that point.
- *
- * @param row row to count from
- * @param start offset into row to start at
- * @param counters array into which to record counts
- * @throws NotFoundException if counters cannot be filled entirely from row before running out
- * of pixels
- */
- OneDReader.recordPattern = function (row, start, counters) {
- var numCounters = counters.length;
- for (var index = 0; index < numCounters; index++) {
- counters[index] = 0;
- }
- var end = row.getSize();
- if (start >= end) {
- throw new _NotFoundException.default();
- }
- var isWhite = !row.get(start);
- var counterPosition = 0;
- var i = start;
- while (i < end) {
- if (row.get(i) !== isWhite) {
- counters[counterPosition]++;
- } else {
- if (++counterPosition === numCounters) {
- break;
- } else {
- counters[counterPosition] = 1;
- isWhite = !isWhite;
- }
- }
- i++;
- }
- // If we read fully the last section of pixels and filled up our counters -- or filled
- // the last counter but ran off the side of the image, OK. Otherwise, a problem.
- if (!(counterPosition === numCounters || counterPosition === numCounters - 1 && i === end)) {
- throw new _NotFoundException.default();
- }
- };
- OneDReader.recordPatternInReverse = function (row, start, counters) {
- // This could be more efficient I guess
- var numTransitionsLeft = counters.length;
- var last = row.get(start);
- while (start > 0 && numTransitionsLeft >= 0) {
- if (row.get(--start) !== last) {
- numTransitionsLeft--;
- last = !last;
- }
- }
- if (numTransitionsLeft >= 0) {
- throw new _NotFoundException.default();
- }
- OneDReader.recordPattern(row, start + 1, counters);
- };
- /**
- * Determines how closely a set of observed counts of runs of black/white values matches a given
- * target pattern. This is reported as the ratio of the total variance from the expected pattern
- * proportions across all pattern elements, to the length of the pattern.
- *
- * @param counters observed counters
- * @param pattern expected pattern
- * @param maxIndividualVariance The most any counter can differ before we give up
- * @return ratio of total variance between counters and pattern compared to total pattern size
- */
- OneDReader.patternMatchVariance = function (counters, pattern, maxIndividualVariance) {
- var numCounters = counters.length;
- var total = 0;
- var patternLength = 0;
- for (var i = 0; i < numCounters; i++) {
- total += counters[i];
- patternLength += pattern[i];
- }
- if (total < patternLength) {
- // If we don't even have one pixel per unit of bar width, assume this is too small
- // to reliably match, so fail:
- return Number.POSITIVE_INFINITY;
- }
- var unitBarWidth = total / patternLength;
- maxIndividualVariance *= unitBarWidth;
- var totalVariance = 0.0;
- for (var x = 0; x < numCounters; x++) {
- var counter = counters[x];
- var scaledPattern = pattern[x] * unitBarWidth;
- var variance = counter > scaledPattern ? counter - scaledPattern : scaledPattern - counter;
- if (variance > maxIndividualVariance) {
- return Number.POSITIVE_INFINITY;
- }
- totalVariance += variance;
- }
- return totalVariance / total;
- };
- return OneDReader;
- }();
- var _default = OneDReader;
- exports.default = _default;
- /***/ }),
- /* 360 */
- /*!*************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/Code39Reader.js ***!
- \*************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
- var _ChecksumException = _interopRequireDefault(__webpack_require__(/*! ../ChecksumException */ 309));
- var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../FormatException */ 324));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
- var _OneDReader = _interopRequireDefault(__webpack_require__(/*! ./OneDReader */ 359));
- var _Result = _interopRequireDefault(__webpack_require__(/*! ../Result */ 333));
- var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../ResultPoint */ 346));
- /*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- /*namespace com.google.zxing.oned {*/
- /**
- * <p>Decodes Code 39 barcodes. Supports "Full ASCII Code 39" if USE_CODE_39_EXTENDED_MODE is set.</p>
- *
- * @author Sean Owen
- * @see Code93Reader
- */
- var Code39Reader = /** @class */function (_super) {
- __extends(Code39Reader, _super);
- /**
- * Creates a reader that assumes all encoded data is data, and does not treat the final
- * character as a check digit. It will not decoded "extended Code 39" sequences.
- */
- // public Code39Reader() {
- // this(false);
- // }
- /**
- * Creates a reader that can be configured to check the last character as a check digit.
- * It will not decoded "extended Code 39" sequences.
- *
- * @param usingCheckDigit if true, treat the last data character as a check digit, not
- * data, and verify that the checksum passes.
- */
- // public Code39Reader(boolean usingCheckDigit) {
- // this(usingCheckDigit, false);
- // }
- /**
- * Creates a reader that can be configured to check the last character as a check digit,
- * or optionally attempt to decode "extended Code 39" sequences that are used to encode
- * the full ASCII character set.
- *
- * @param usingCheckDigit if true, treat the last data character as a check digit, not
- * data, and verify that the checksum passes.
- * @param extendedMode if true, will attempt to decode extended Code 39 sequences in the
- * text.
- */
- function Code39Reader(usingCheckDigit, extendedMode) {
- if (usingCheckDigit === void 0) {
- usingCheckDigit = false;
- }
- if (extendedMode === void 0) {
- extendedMode = false;
- }
- var _this = _super.call(this) || this;
- _this.usingCheckDigit = usingCheckDigit;
- _this.extendedMode = extendedMode;
- _this.decodeRowResult = '';
- _this.counters = new Int32Array(9);
- return _this;
- }
- Code39Reader.prototype.decodeRow = function (rowNumber, row, hints) {
- var e_1, _a, e_2, _b;
- var theCounters = this.counters;
- theCounters.fill(0);
- this.decodeRowResult = '';
- var start = Code39Reader.findAsteriskPattern(row, theCounters);
- // Read off white space
- var nextStart = row.getNextSet(start[1]);
- var end = row.getSize();
- var decodedChar;
- var lastStart;
- do {
- Code39Reader.recordPattern(row, nextStart, theCounters);
- var pattern = Code39Reader.toNarrowWidePattern(theCounters);
- if (pattern < 0) {
- throw new _NotFoundException.default();
- }
- decodedChar = Code39Reader.patternToChar(pattern);
- this.decodeRowResult += decodedChar;
- lastStart = nextStart;
- try {
- for (var theCounters_1 = (e_1 = void 0, __values(theCounters)), theCounters_1_1 = theCounters_1.next(); !theCounters_1_1.done; theCounters_1_1 = theCounters_1.next()) {
- var counter = theCounters_1_1.value;
- nextStart += counter;
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (theCounters_1_1 && !theCounters_1_1.done && (_a = theCounters_1.return)) _a.call(theCounters_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- // Read off white space
- nextStart = row.getNextSet(nextStart);
- } while (decodedChar !== '*');
- this.decodeRowResult = this.decodeRowResult.substring(0, this.decodeRowResult.length - 1); // remove asterisk
- // Look for whitespace after pattern:
- var lastPatternSize = 0;
- try {
- for (var theCounters_2 = __values(theCounters), theCounters_2_1 = theCounters_2.next(); !theCounters_2_1.done; theCounters_2_1 = theCounters_2.next()) {
- var counter = theCounters_2_1.value;
- lastPatternSize += counter;
- }
- } catch (e_2_1) {
- e_2 = {
- error: e_2_1
- };
- } finally {
- try {
- if (theCounters_2_1 && !theCounters_2_1.done && (_b = theCounters_2.return)) _b.call(theCounters_2);
- } finally {
- if (e_2) throw e_2.error;
- }
- }
- var whiteSpaceAfterEnd = nextStart - lastStart - lastPatternSize;
- // If 50% of last pattern size, following last pattern, is not whitespace, fail
- // (but if it's whitespace to the very end of the image, that's OK)
- if (nextStart !== end && whiteSpaceAfterEnd * 2 < lastPatternSize) {
- throw new _NotFoundException.default();
- }
- if (this.usingCheckDigit) {
- var max = this.decodeRowResult.length - 1;
- var total = 0;
- for (var i = 0; i < max; i++) {
- total += Code39Reader.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(i));
- }
- if (this.decodeRowResult.charAt(max) !== Code39Reader.ALPHABET_STRING.charAt(total % 43)) {
- throw new _ChecksumException.default();
- }
- this.decodeRowResult = this.decodeRowResult.substring(0, max);
- }
- if (this.decodeRowResult.length === 0) {
- // false positive
- throw new _NotFoundException.default();
- }
- var resultString;
- if (this.extendedMode) {
- resultString = Code39Reader.decodeExtended(this.decodeRowResult);
- } else {
- resultString = this.decodeRowResult;
- }
- var left = (start[1] + start[0]) / 2.0;
- var right = lastStart + lastPatternSize / 2.0;
- return new _Result.default(resultString, null, 0, [new _ResultPoint.default(left, rowNumber), new _ResultPoint.default(right, rowNumber)], _BarcodeFormat.default.CODE_39, new Date().getTime());
- };
- Code39Reader.findAsteriskPattern = function (row, counters) {
- var width = row.getSize();
- var rowOffset = row.getNextSet(0);
- var counterPosition = 0;
- var patternStart = rowOffset;
- var isWhite = false;
- var patternLength = counters.length;
- for (var i = rowOffset; i < width; i++) {
- if (row.get(i) !== isWhite) {
- counters[counterPosition]++;
- } else {
- if (counterPosition === patternLength - 1) {
- // Look for whitespace before start pattern, >= 50% of width of start pattern
- if (this.toNarrowWidePattern(counters) === Code39Reader.ASTERISK_ENCODING && row.isRange(Math.max(0, patternStart - Math.floor((i - patternStart) / 2)), patternStart, false)) {
- return [patternStart, i];
- }
- patternStart += counters[0] + counters[1];
- counters.copyWithin(0, 2, 2 + counterPosition - 1);
- counters[counterPosition - 1] = 0;
- counters[counterPosition] = 0;
- counterPosition--;
- } else {
- counterPosition++;
- }
- counters[counterPosition] = 1;
- isWhite = !isWhite;
- }
- }
- throw new _NotFoundException.default();
- };
- // For efficiency, returns -1 on failure. Not throwing here saved as many as 700 exceptions
- // per image when using some of our blackbox images.
- Code39Reader.toNarrowWidePattern = function (counters) {
- var e_3, _a;
- var numCounters = counters.length;
- var maxNarrowCounter = 0;
- var wideCounters;
- do {
- var minCounter = 0x7fffffff;
- try {
- for (var counters_1 = (e_3 = void 0, __values(counters)), counters_1_1 = counters_1.next(); !counters_1_1.done; counters_1_1 = counters_1.next()) {
- var counter = counters_1_1.value;
- if (counter < minCounter && counter > maxNarrowCounter) {
- minCounter = counter;
- }
- }
- } catch (e_3_1) {
- e_3 = {
- error: e_3_1
- };
- } finally {
- try {
- if (counters_1_1 && !counters_1_1.done && (_a = counters_1.return)) _a.call(counters_1);
- } finally {
- if (e_3) throw e_3.error;
- }
- }
- maxNarrowCounter = minCounter;
- wideCounters = 0;
- var totalWideCountersWidth = 0;
- var pattern = 0;
- for (var i = 0; i < numCounters; i++) {
- var counter = counters[i];
- if (counter > maxNarrowCounter) {
- pattern |= 1 << numCounters - 1 - i;
- wideCounters++;
- totalWideCountersWidth += counter;
- }
- }
- if (wideCounters === 3) {
- // Found 3 wide counters, but are they close enough in width?
- // We can perform a cheap, conservative check to see if any individual
- // counter is more than 1.5 times the average:
- for (var i = 0; i < numCounters && wideCounters > 0; i++) {
- var counter = counters[i];
- if (counter > maxNarrowCounter) {
- wideCounters--;
- // totalWideCountersWidth = 3 * average, so this checks if counter >= 3/2 * average
- if (counter * 2 >= totalWideCountersWidth) {
- return -1;
- }
- }
- }
- return pattern;
- }
- } while (wideCounters > 3);
- return -1;
- };
- Code39Reader.patternToChar = function (pattern) {
- for (var i = 0; i < Code39Reader.CHARACTER_ENCODINGS.length; i++) {
- if (Code39Reader.CHARACTER_ENCODINGS[i] === pattern) {
- return Code39Reader.ALPHABET_STRING.charAt(i);
- }
- }
- if (pattern === Code39Reader.ASTERISK_ENCODING) {
- return '*';
- }
- throw new _NotFoundException.default();
- };
- Code39Reader.decodeExtended = function (encoded) {
- var length = encoded.length;
- var decoded = '';
- for (var i = 0; i < length; i++) {
- var c = encoded.charAt(i);
- if (c === '+' || c === '$' || c === '%' || c === '/') {
- var next = encoded.charAt(i + 1);
- var decodedChar = '\0';
- switch (c) {
- case '+':
- // +A to +Z map to a to z
- if (next >= 'A' && next <= 'Z') {
- decodedChar = String.fromCharCode(next.charCodeAt(0) + 32);
- } else {
- throw new _FormatException.default();
- }
- break;
- case '$':
- // $A to $Z map to control codes SH to SB
- if (next >= 'A' && next <= 'Z') {
- decodedChar = String.fromCharCode(next.charCodeAt(0) - 64);
- } else {
- throw new _FormatException.default();
- }
- break;
- case '%':
- // %A to %E map to control codes ESC to US
- if (next >= 'A' && next <= 'E') {
- decodedChar = String.fromCharCode(next.charCodeAt(0) - 38);
- } else if (next >= 'F' && next <= 'J') {
- decodedChar = String.fromCharCode(next.charCodeAt(0) - 11);
- } else if (next >= 'K' && next <= 'O') {
- decodedChar = String.fromCharCode(next.charCodeAt(0) + 16);
- } else if (next >= 'P' && next <= 'T') {
- decodedChar = String.fromCharCode(next.charCodeAt(0) + 43);
- } else if (next === 'U') {
- decodedChar = '\0';
- } else if (next === 'V') {
- decodedChar = '@';
- } else if (next === 'W') {
- decodedChar = '`';
- } else if (next === 'X' || next === 'Y' || next === 'Z') {
- decodedChar = '\x7f';
- } else {
- throw new _FormatException.default();
- }
- break;
- case '/':
- // /A to /O map to ! to , and /Z maps to :
- if (next >= 'A' && next <= 'O') {
- decodedChar = String.fromCharCode(next.charCodeAt(0) - 32);
- } else if (next === 'Z') {
- decodedChar = ':';
- } else {
- throw new _FormatException.default();
- }
- break;
- }
- decoded += decodedChar;
- // bump up i again since we read two characters
- i++;
- } else {
- decoded += c;
- }
- }
- return decoded;
- };
- Code39Reader.ALPHABET_STRING = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%';
- /**
- * These represent the encodings of characters, as patterns of wide and narrow bars.
- * The 9 least-significant bits of each int correspond to the pattern of wide and narrow,
- * with 1s representing "wide" and 0s representing narrow.
- */
- Code39Reader.CHARACTER_ENCODINGS = [0x034, 0x121, 0x061, 0x160, 0x031, 0x130, 0x070, 0x025, 0x124, 0x064, 0x109, 0x049, 0x148, 0x019, 0x118, 0x058, 0x00D, 0x10C, 0x04C, 0x01C, 0x103, 0x043, 0x142, 0x013, 0x112, 0x052, 0x007, 0x106, 0x046, 0x016, 0x181, 0x0C1, 0x1C0, 0x091, 0x190, 0x0D0, 0x085, 0x184, 0x0C4, 0x0A8, 0x0A2, 0x08A, 0x02A // /-%
- ];
- Code39Reader.ASTERISK_ENCODING = 0x094;
- return Code39Reader;
- }(_OneDReader.default);
- var _default = Code39Reader;
- exports.default = _default;
- /***/ }),
- /* 361 */
- /*!*************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/Code93Reader.js ***!
- \*************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
- var _ChecksumException = _interopRequireDefault(__webpack_require__(/*! ../ChecksumException */ 309));
- var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../FormatException */ 324));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
- var _OneDReader = _interopRequireDefault(__webpack_require__(/*! ./OneDReader */ 359));
- var _Result = _interopRequireDefault(__webpack_require__(/*! ../Result */ 333));
- var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../ResultPoint */ 346));
- /*
- * Copyright 2010 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- /*namespace com.google.zxing.oned {*/
- /**
- * <p>Decodes Code 93 barcodes.</p>
- *
- * @author Sean Owen
- * @see Code39Reader
- */
- var Code93Reader = /** @class */function (_super) {
- __extends(Code93Reader, _super);
- //public Code93Reader() {
- // decodeRowResult = new StringBuilder(20);
- // counters = new int[6];
- //}
- function Code93Reader() {
- var _this = _super.call(this) || this;
- _this.decodeRowResult = '';
- _this.counters = new Int32Array(6);
- return _this;
- }
- Code93Reader.prototype.decodeRow = function (rowNumber, row, hints) {
- var e_1, _a, e_2, _b;
- var start = this.findAsteriskPattern(row);
- // Read off white space
- var nextStart = row.getNextSet(start[1]);
- var end = row.getSize();
- var theCounters = this.counters;
- theCounters.fill(0);
- this.decodeRowResult = '';
- var decodedChar;
- var lastStart;
- do {
- Code93Reader.recordPattern(row, nextStart, theCounters);
- var pattern = this.toPattern(theCounters);
- if (pattern < 0) {
- throw new _NotFoundException.default();
- }
- decodedChar = this.patternToChar(pattern);
- this.decodeRowResult += decodedChar;
- lastStart = nextStart;
- try {
- for (var theCounters_1 = (e_1 = void 0, __values(theCounters)), theCounters_1_1 = theCounters_1.next(); !theCounters_1_1.done; theCounters_1_1 = theCounters_1.next()) {
- var counter = theCounters_1_1.value;
- nextStart += counter;
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (theCounters_1_1 && !theCounters_1_1.done && (_a = theCounters_1.return)) _a.call(theCounters_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- // Read off white space
- nextStart = row.getNextSet(nextStart);
- } while (decodedChar !== '*');
- this.decodeRowResult = this.decodeRowResult.substring(0, this.decodeRowResult.length - 1); // remove asterisk
- var lastPatternSize = 0;
- try {
- for (var theCounters_2 = __values(theCounters), theCounters_2_1 = theCounters_2.next(); !theCounters_2_1.done; theCounters_2_1 = theCounters_2.next()) {
- var counter = theCounters_2_1.value;
- lastPatternSize += counter;
- }
- } catch (e_2_1) {
- e_2 = {
- error: e_2_1
- };
- } finally {
- try {
- if (theCounters_2_1 && !theCounters_2_1.done && (_b = theCounters_2.return)) _b.call(theCounters_2);
- } finally {
- if (e_2) throw e_2.error;
- }
- }
- // Should be at least one more black module
- if (nextStart === end || !row.get(nextStart)) {
- throw new _NotFoundException.default();
- }
- if (this.decodeRowResult.length < 2) {
- // false positive -- need at least 2 checksum digits
- throw new _NotFoundException.default();
- }
- this.checkChecksums(this.decodeRowResult);
- // Remove checksum digits
- this.decodeRowResult = this.decodeRowResult.substring(0, this.decodeRowResult.length - 2);
- var resultString = this.decodeExtended(this.decodeRowResult);
- var left = (start[1] + start[0]) / 2.0;
- var right = lastStart + lastPatternSize / 2.0;
- return new _Result.default(resultString, null, 0, [new _ResultPoint.default(left, rowNumber), new _ResultPoint.default(right, rowNumber)], _BarcodeFormat.default.CODE_93, new Date().getTime());
- };
- Code93Reader.prototype.findAsteriskPattern = function (row) {
- var width = row.getSize();
- var rowOffset = row.getNextSet(0);
- this.counters.fill(0);
- var theCounters = this.counters;
- var patternStart = rowOffset;
- var isWhite = false;
- var patternLength = theCounters.length;
- var counterPosition = 0;
- for (var i = rowOffset; i < width; i++) {
- if (row.get(i) !== isWhite) {
- theCounters[counterPosition]++;
- } else {
- if (counterPosition === patternLength - 1) {
- if (this.toPattern(theCounters) === Code93Reader.ASTERISK_ENCODING) {
- return new Int32Array([patternStart, i]);
- }
- patternStart += theCounters[0] + theCounters[1];
- theCounters.copyWithin(0, 2, 2 + counterPosition - 1);
- theCounters[counterPosition - 1] = 0;
- theCounters[counterPosition] = 0;
- counterPosition--;
- } else {
- counterPosition++;
- }
- theCounters[counterPosition] = 1;
- isWhite = !isWhite;
- }
- }
- throw new _NotFoundException.default();
- };
- Code93Reader.prototype.toPattern = function (counters) {
- var e_3, _a;
- var sum = 0;
- try {
- for (var counters_1 = __values(counters), counters_1_1 = counters_1.next(); !counters_1_1.done; counters_1_1 = counters_1.next()) {
- var counter = counters_1_1.value;
- sum += counter;
- }
- } catch (e_3_1) {
- e_3 = {
- error: e_3_1
- };
- } finally {
- try {
- if (counters_1_1 && !counters_1_1.done && (_a = counters_1.return)) _a.call(counters_1);
- } finally {
- if (e_3) throw e_3.error;
- }
- }
- var pattern = 0;
- var max = counters.length;
- for (var i = 0; i < max; i++) {
- var scaled = Math.round(counters[i] * 9.0 / sum);
- if (scaled < 1 || scaled > 4) {
- return -1;
- }
- if ((i & 0x01) === 0) {
- for (var j = 0; j < scaled; j++) {
- pattern = pattern << 1 | 0x01;
- }
- } else {
- pattern <<= scaled;
- }
- }
- return pattern;
- };
- Code93Reader.prototype.patternToChar = function (pattern) {
- for (var i = 0; i < Code93Reader.CHARACTER_ENCODINGS.length; i++) {
- if (Code93Reader.CHARACTER_ENCODINGS[i] === pattern) {
- return Code93Reader.ALPHABET_STRING.charAt(i);
- }
- }
- throw new _NotFoundException.default();
- };
- Code93Reader.prototype.decodeExtended = function (encoded) {
- var length = encoded.length;
- var decoded = '';
- for (var i = 0; i < length; i++) {
- var c = encoded.charAt(i);
- if (c >= 'a' && c <= 'd') {
- if (i >= length - 1) {
- throw new _FormatException.default();
- }
- var next = encoded.charAt(i + 1);
- var decodedChar = '\0';
- switch (c) {
- case 'd':
- // +A to +Z map to a to z
- if (next >= 'A' && next <= 'Z') {
- decodedChar = String.fromCharCode(next.charCodeAt(0) + 32);
- } else {
- throw new _FormatException.default();
- }
- break;
- case 'a':
- // $A to $Z map to control codes SH to SB
- if (next >= 'A' && next <= 'Z') {
- decodedChar = String.fromCharCode(next.charCodeAt(0) - 64);
- } else {
- throw new _FormatException.default();
- }
- break;
- case 'b':
- if (next >= 'A' && next <= 'E') {
- // %A to %E map to control codes ESC to USep
- decodedChar = String.fromCharCode(next.charCodeAt(0) - 38);
- } else if (next >= 'F' && next <= 'J') {
- // %F to %J map to ; < = > ?
- decodedChar = String.fromCharCode(next.charCodeAt(0) - 11);
- } else if (next >= 'K' && next <= 'O') {
- // %K to %O map to [ \ ] ^ _
- decodedChar = String.fromCharCode(next.charCodeAt(0) + 16);
- } else if (next >= 'P' && next <= 'T') {
- // %P to %T map to { | } ~ DEL
- decodedChar = String.fromCharCode(next.charCodeAt(0) + 43);
- } else if (next === 'U') {
- // %U map to NUL
- decodedChar = '\0';
- } else if (next === 'V') {
- // %V map to @
- decodedChar = '@';
- } else if (next === 'W') {
- // %W map to `
- decodedChar = '`';
- } else if (next >= 'X' && next <= 'Z') {
- // %X to %Z all map to DEL (127)
- decodedChar = String.fromCharCode(127);
- } else {
- throw new _FormatException.default();
- }
- break;
- case 'c':
- // /A to /O map to ! to , and /Z maps to :
- if (next >= 'A' && next <= 'O') {
- decodedChar = String.fromCharCode(next.charCodeAt(0) - 32);
- } else if (next === 'Z') {
- decodedChar = ':';
- } else {
- throw new _FormatException.default();
- }
- break;
- }
- decoded += decodedChar;
- // bump up i again since we read two characters
- i++;
- } else {
- decoded += c;
- }
- }
- return decoded;
- };
- Code93Reader.prototype.checkChecksums = function (result) {
- var length = result.length;
- this.checkOneChecksum(result, length - 2, 20);
- this.checkOneChecksum(result, length - 1, 15);
- };
- Code93Reader.prototype.checkOneChecksum = function (result, checkPosition, weightMax) {
- var weight = 1;
- var total = 0;
- for (var i = checkPosition - 1; i >= 0; i--) {
- total += weight * Code93Reader.ALPHABET_STRING.indexOf(result.charAt(i));
- if (++weight > weightMax) {
- weight = 1;
- }
- }
- if (result.charAt(checkPosition) !== Code93Reader.ALPHABET_STRING[total % 47]) {
- throw new _ChecksumException.default();
- }
- };
- // Note that 'abcd' are dummy characters in place of control characters.
- Code93Reader.ALPHABET_STRING = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*";
- /**
- * These represent the encodings of characters, as patterns of wide and narrow bars.
- * The 9 least-significant bits of each int correspond to the pattern of wide and narrow.
- */
- Code93Reader.CHARACTER_ENCODINGS = [0x114, 0x148, 0x144, 0x142, 0x128, 0x124, 0x122, 0x150, 0x112, 0x10A, 0x1A8, 0x1A4, 0x1A2, 0x194, 0x192, 0x18A, 0x168, 0x164, 0x162, 0x134, 0x11A, 0x158, 0x14C, 0x146, 0x12C, 0x116, 0x1B4, 0x1B2, 0x1AC, 0x1A6, 0x196, 0x19A, 0x16C, 0x166, 0x136, 0x13A, 0x12E, 0x1D4, 0x1D2, 0x1CA, 0x16E, 0x176, 0x1AE, 0x126, 0x1DA, 0x1D6, 0x132, 0x15E];
- Code93Reader.ASTERISK_ENCODING = Code93Reader.CHARACTER_ENCODINGS[47];
- return Code93Reader;
- }(_OneDReader.default);
- var _default = Code93Reader;
- exports.default = _default;
- /***/ }),
- /* 362 */
- /*!**********************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/ITFReader.js ***!
- \**********************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
- var _DecodeHintType = _interopRequireDefault(__webpack_require__(/*! ../DecodeHintType */ 322));
- var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../FormatException */ 324));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
- var _Result = _interopRequireDefault(__webpack_require__(/*! ../Result */ 333));
- var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../ResultPoint */ 346));
- var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../util/StringBuilder */ 320));
- var _System = _interopRequireDefault(__webpack_require__(/*! ../util/System */ 315));
- var _OneDReader = _interopRequireDefault(__webpack_require__(/*! ./OneDReader */ 359));
- /*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- /*namespace com.google.zxing.oned {*/
- /**
- * <p>Decodes ITF barcodes.</p>
- *
- * @author Tjieco
- */
- var ITFReader = /** @class */function (_super) {
- __extends(ITFReader, _super);
- function ITFReader() {
- // private static W = 3; // Pixel width of a 3x wide line
- // private static w = 2; // Pixel width of a 2x wide line
- // private static N = 1; // Pixed width of a narrow line
- var _this = _super !== null && _super.apply(this, arguments) || this;
- // Stores the actual narrow line width of the image being decoded.
- _this.narrowLineWidth = -1;
- return _this;
- }
- // See ITFWriter.PATTERNS
- /*
- /!**
- * Patterns of Wide / Narrow lines to indicate each digit
- *!/
- */
- ITFReader.prototype.decodeRow = function (rowNumber, row, hints) {
- var e_1, _a;
- // Find out where the Middle section (payload) starts & ends
- var startRange = this.decodeStart(row);
- var endRange = this.decodeEnd(row);
- var result = new _StringBuilder.default();
- ITFReader.decodeMiddle(row, startRange[1], endRange[0], result);
- var resultString = result.toString();
- var allowedLengths = null;
- if (hints != null) {
- allowedLengths = hints.get(_DecodeHintType.default.ALLOWED_LENGTHS);
- }
- if (allowedLengths == null) {
- allowedLengths = ITFReader.DEFAULT_ALLOWED_LENGTHS;
- }
- // To avoid false positives with 2D barcodes (and other patterns), make
- // an assumption that the decoded string must be a 'standard' length if it's short
- var length = resultString.length;
- var lengthOK = false;
- var maxAllowedLength = 0;
- try {
- for (var allowedLengths_1 = __values(allowedLengths), allowedLengths_1_1 = allowedLengths_1.next(); !allowedLengths_1_1.done; allowedLengths_1_1 = allowedLengths_1.next()) {
- var value = allowedLengths_1_1.value;
- if (length === value) {
- lengthOK = true;
- break;
- }
- if (value > maxAllowedLength) {
- maxAllowedLength = value;
- }
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (allowedLengths_1_1 && !allowedLengths_1_1.done && (_a = allowedLengths_1.return)) _a.call(allowedLengths_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- if (!lengthOK && length > maxAllowedLength) {
- lengthOK = true;
- }
- if (!lengthOK) {
- throw new _FormatException.default();
- }
- var points = [new _ResultPoint.default(startRange[1], rowNumber), new _ResultPoint.default(endRange[0], rowNumber)];
- var resultReturn = new _Result.default(resultString, null,
- // no natural byte representation for these barcodes
- 0, points, _BarcodeFormat.default.ITF, new Date().getTime());
- return resultReturn;
- };
- /*
- /!**
- * @param row row of black/white values to search
- * @param payloadStart offset of start pattern
- * @param resultString {@link StringBuilder} to append decoded chars to
- * @throws NotFoundException if decoding could not complete successfully
- *!/*/
- ITFReader.decodeMiddle = function (row, payloadStart, payloadEnd, resultString) {
- // Digits are interleaved in pairs - 5 black lines for one digit, and the
- // 5
- // interleaved white lines for the second digit.
- // Therefore, need to scan 10 lines and then
- // split these into two arrays
- var counterDigitPair = new Int32Array(10); // 10
- var counterBlack = new Int32Array(5); // 5
- var counterWhite = new Int32Array(5); // 5
- counterDigitPair.fill(0);
- counterBlack.fill(0);
- counterWhite.fill(0);
- while (payloadStart < payloadEnd) {
- // Get 10 runs of black/white.
- _OneDReader.default.recordPattern(row, payloadStart, counterDigitPair);
- // Split them into each array
- for (var k = 0; k < 5; k++) {
- var twoK = 2 * k;
- counterBlack[k] = counterDigitPair[twoK];
- counterWhite[k] = counterDigitPair[twoK + 1];
- }
- var bestMatch = ITFReader.decodeDigit(counterBlack);
- resultString.append(bestMatch.toString());
- bestMatch = this.decodeDigit(counterWhite);
- resultString.append(bestMatch.toString());
- counterDigitPair.forEach(function (counterDigit) {
- payloadStart += counterDigit;
- });
- }
- };
- /*/!**
- * Identify where the start of the middle / payload section starts.
- *
- * @param row row of black/white values to search
- * @return Array, containing index of start of 'start block' and end of
- * 'start block'
- *!/*/
- ITFReader.prototype.decodeStart = function (row) {
- var endStart = ITFReader.skipWhiteSpace(row);
- var startPattern = ITFReader.findGuardPattern(row, endStart, ITFReader.START_PATTERN);
- // Determine the width of a narrow line in pixels. We can do this by
- // getting the width of the start pattern and dividing by 4 because its
- // made up of 4 narrow lines.
- this.narrowLineWidth = (startPattern[1] - startPattern[0]) / 4;
- this.validateQuietZone(row, startPattern[0]);
- return startPattern;
- };
- /*/!**
- * The start & end patterns must be pre/post fixed by a quiet zone. This
- * zone must be at least 10 times the width of a narrow line. Scan back until
- * we either get to the start of the barcode or match the necessary number of
- * quiet zone pixels.
- *
- * Note: Its assumed the row is reversed when using this method to find
- * quiet zone after the end pattern.
- *
- * ref: http://www.barcode-1.net/i25code.html
- *
- * @param row bit array representing the scanned barcode.
- * @param startPattern index into row of the start or end pattern.
- * @throws NotFoundException if the quiet zone cannot be found
- *!/*/
- ITFReader.prototype.validateQuietZone = function (row, startPattern) {
- var quietCount = this.narrowLineWidth * 10; // expect to find this many pixels of quiet zone
- // if there are not so many pixel at all let's try as many as possible
- quietCount = quietCount < startPattern ? quietCount : startPattern;
- for (var i = startPattern - 1; quietCount > 0 && i >= 0; i--) {
- if (row.get(i)) {
- break;
- }
- quietCount--;
- }
- if (quietCount !== 0) {
- // Unable to find the necessary number of quiet zone pixels.
- throw new _NotFoundException.default();
- }
- };
- /*
- /!**
- * Skip all whitespace until we get to the first black line.
- *
- * @param row row of black/white values to search
- * @return index of the first black line.
- * @throws NotFoundException Throws exception if no black lines are found in the row
- *!/*/
- ITFReader.skipWhiteSpace = function (row) {
- var width = row.getSize();
- var endStart = row.getNextSet(0);
- if (endStart === width) {
- throw new _NotFoundException.default();
- }
- return endStart;
- };
- /*/!**
- * Identify where the end of the middle / payload section ends.
- *
- * @param row row of black/white values to search
- * @return Array, containing index of start of 'end block' and end of 'end
- * block'
- *!/*/
- ITFReader.prototype.decodeEnd = function (row) {
- // For convenience, reverse the row and then
- // search from 'the start' for the end block
- row.reverse();
- try {
- var endStart = ITFReader.skipWhiteSpace(row);
- var endPattern = void 0;
- try {
- endPattern = ITFReader.findGuardPattern(row, endStart, ITFReader.END_PATTERN_REVERSED[0]);
- } catch (error) {
- if (error instanceof _NotFoundException.default) {
- endPattern = ITFReader.findGuardPattern(row, endStart, ITFReader.END_PATTERN_REVERSED[1]);
- }
- }
- // The start & end patterns must be pre/post fixed by a quiet zone. This
- // zone must be at least 10 times the width of a narrow line.
- // ref: http://www.barcode-1.net/i25code.html
- this.validateQuietZone(row, endPattern[0]);
- // Now recalculate the indices of where the 'endblock' starts & stops to
- // accommodate
- // the reversed nature of the search
- var temp = endPattern[0];
- endPattern[0] = row.getSize() - endPattern[1];
- endPattern[1] = row.getSize() - temp;
- return endPattern;
- } finally {
- // Put the row back the right way.
- row.reverse();
- }
- };
- /*
- /!**
- * @param row row of black/white values to search
- * @param rowOffset position to start search
- * @param pattern pattern of counts of number of black and white pixels that are
- * being searched for as a pattern
- * @return start/end horizontal offset of guard pattern, as an array of two
- * ints
- * @throws NotFoundException if pattern is not found
- *!/*/
- ITFReader.findGuardPattern = function (row, rowOffset, pattern) {
- var patternLength = pattern.length;
- var counters = new Int32Array(patternLength);
- var width = row.getSize();
- var isWhite = false;
- var counterPosition = 0;
- var patternStart = rowOffset;
- counters.fill(0);
- for (var x = rowOffset; x < width; x++) {
- if (row.get(x) !== isWhite) {
- counters[counterPosition]++;
- } else {
- if (counterPosition === patternLength - 1) {
- if (_OneDReader.default.patternMatchVariance(counters, pattern, ITFReader.MAX_INDIVIDUAL_VARIANCE) < ITFReader.MAX_AVG_VARIANCE) {
- return [patternStart, x];
- }
- patternStart += counters[0] + counters[1];
- _System.default.arraycopy(counters, 2, counters, 0, counterPosition - 1);
- counters[counterPosition - 1] = 0;
- counters[counterPosition] = 0;
- counterPosition--;
- } else {
- counterPosition++;
- }
- counters[counterPosition] = 1;
- isWhite = !isWhite;
- }
- }
- throw new _NotFoundException.default();
- };
- /*/!**
- * Attempts to decode a sequence of ITF black/white lines into single
- * digit.
- *
- * @param counters the counts of runs of observed black/white/black/... values
- * @return The decoded digit
- * @throws NotFoundException if digit cannot be decoded
- *!/*/
- ITFReader.decodeDigit = function (counters) {
- var bestVariance = ITFReader.MAX_AVG_VARIANCE; // worst variance we'll accept
- var bestMatch = -1;
- var max = ITFReader.PATTERNS.length;
- for (var i = 0; i < max; i++) {
- var pattern = ITFReader.PATTERNS[i];
- var variance = _OneDReader.default.patternMatchVariance(counters, pattern, ITFReader.MAX_INDIVIDUAL_VARIANCE);
- if (variance < bestVariance) {
- bestVariance = variance;
- bestMatch = i;
- } else if (variance === bestVariance) {
- // if we find a second 'best match' with the same variance, we can not reliably report to have a suitable match
- bestMatch = -1;
- }
- }
- if (bestMatch >= 0) {
- return bestMatch % 10;
- } else {
- throw new _NotFoundException.default();
- }
- };
- ITFReader.PATTERNS = [Int32Array.from([1, 1, 2, 2, 1]), Int32Array.from([2, 1, 1, 1, 2]), Int32Array.from([1, 2, 1, 1, 2]), Int32Array.from([2, 2, 1, 1, 1]), Int32Array.from([1, 1, 2, 1, 2]), Int32Array.from([2, 1, 2, 1, 1]), Int32Array.from([1, 2, 2, 1, 1]), Int32Array.from([1, 1, 1, 2, 2]), Int32Array.from([2, 1, 1, 2, 1]), Int32Array.from([1, 2, 1, 2, 1]), Int32Array.from([1, 1, 3, 3, 1]), Int32Array.from([3, 1, 1, 1, 3]), Int32Array.from([1, 3, 1, 1, 3]), Int32Array.from([3, 3, 1, 1, 1]), Int32Array.from([1, 1, 3, 1, 3]), Int32Array.from([3, 1, 3, 1, 1]), Int32Array.from([1, 3, 3, 1, 1]), Int32Array.from([1, 1, 1, 3, 3]), Int32Array.from([3, 1, 1, 3, 1]), Int32Array.from([1, 3, 1, 3, 1]) // 9
- ];
- ITFReader.MAX_AVG_VARIANCE = 0.38;
- ITFReader.MAX_INDIVIDUAL_VARIANCE = 0.5;
- /* /!** Valid ITF lengths. Anything longer than the largest value is also allowed. *!/*/
- ITFReader.DEFAULT_ALLOWED_LENGTHS = [6, 8, 10, 12, 14];
- /*/!**
- * Start/end guard pattern.
- *
- * Note: The end pattern is reversed because the row is reversed before
- * searching for the END_PATTERN
- *!/*/
- ITFReader.START_PATTERN = Int32Array.from([1, 1, 1, 1]);
- ITFReader.END_PATTERN_REVERSED = [Int32Array.from([1, 1, 2]), Int32Array.from([1, 1, 3]) // 3x
- ];
- return ITFReader;
- }(_OneDReader.default);
- var _default = ITFReader;
- exports.default = _default;
- /***/ }),
- /* 363 */
- /*!************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/MultiFormatUPCEANReader.js ***!
- \************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
- var _DecodeHintType = _interopRequireDefault(__webpack_require__(/*! ../DecodeHintType */ 322));
- var _Result = _interopRequireDefault(__webpack_require__(/*! ../Result */ 333));
- var _OneDReader = _interopRequireDefault(__webpack_require__(/*! ./OneDReader */ 359));
- var _EAN13Reader = _interopRequireDefault(__webpack_require__(/*! ./EAN13Reader */ 364));
- var _EAN8Reader = _interopRequireDefault(__webpack_require__(/*! ./EAN8Reader */ 370));
- var _UPCAReader = _interopRequireDefault(__webpack_require__(/*! ./UPCAReader */ 371));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
- var _UPCEReader = _interopRequireDefault(__webpack_require__(/*! ./UPCEReader */ 372));
- /*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- /**
- * <p>A reader that can read all available UPC/EAN formats. If a caller wants to try to
- * read all such formats, it is most efficient to use this implementation rather than invoke
- * individual readers.</p>
- *
- * @author Sean Owen
- */
- var MultiFormatUPCEANReader = /** @class */function (_super) {
- __extends(MultiFormatUPCEANReader, _super);
- function MultiFormatUPCEANReader(hints) {
- var _this = _super.call(this) || this;
- var possibleFormats = hints == null ? null : hints.get(_DecodeHintType.default.POSSIBLE_FORMATS);
- var readers = [];
- if (possibleFormats != null) {
- if (possibleFormats.indexOf(_BarcodeFormat.default.EAN_13) > -1) {
- readers.push(new _EAN13Reader.default());
- }
- if (possibleFormats.indexOf(_BarcodeFormat.default.UPC_A) > -1) {
- readers.push(new _UPCAReader.default());
- }
- if (possibleFormats.indexOf(_BarcodeFormat.default.EAN_8) > -1) {
- readers.push(new _EAN8Reader.default());
- }
- if (possibleFormats.indexOf(_BarcodeFormat.default.UPC_E) > -1) {
- readers.push(new _UPCEReader.default());
- }
- }
- if (readers.length === 0) {
- readers.push(new _EAN13Reader.default());
- readers.push(new _UPCAReader.default());
- readers.push(new _EAN8Reader.default());
- readers.push(new _UPCEReader.default());
- }
- _this.readers = readers;
- return _this;
- }
- MultiFormatUPCEANReader.prototype.decodeRow = function (rowNumber, row, hints) {
- var e_1, _a;
- try {
- for (var _b = __values(this.readers), _c = _b.next(); !_c.done; _c = _b.next()) {
- var reader = _c.value;
- try {
- // const result: Result = reader.decodeRow(rowNumber, row, startGuardPattern, hints);
- var result = reader.decodeRow(rowNumber, row, hints);
- // Special case: a 12-digit code encoded in UPC-A is identical to a "0"
- // followed by those 12 digits encoded as EAN-13. Each will recognize such a code,
- // UPC-A as a 12-digit string and EAN-13 as a 13-digit string starting with "0".
- // Individually these are correct and their readers will both read such a code
- // and correctly call it EAN-13, or UPC-A, respectively.
- //
- // In this case, if we've been looking for both types, we'd like to call it
- // a UPC-A code. But for efficiency we only run the EAN-13 decoder to also read
- // UPC-A. So we special case it here, and convert an EAN-13 result to a UPC-A
- // result if appropriate.
- //
- // But, don't return UPC-A if UPC-A was not a requested format!
- var ean13MayBeUPCA = result.getBarcodeFormat() === _BarcodeFormat.default.EAN_13 && result.getText().charAt(0) === '0';
- // @SuppressWarnings("unchecked")
- var possibleFormats = hints == null ? null : hints.get(_DecodeHintType.default.POSSIBLE_FORMATS);
- var canReturnUPCA = possibleFormats == null || possibleFormats.includes(_BarcodeFormat.default.UPC_A);
- if (ean13MayBeUPCA && canReturnUPCA) {
- var rawBytes = result.getRawBytes();
- // Transfer the metadata across
- var resultUPCA = new _Result.default(result.getText().substring(1), rawBytes, rawBytes ? rawBytes.length : null, result.getResultPoints(), _BarcodeFormat.default.UPC_A);
- resultUPCA.putAllMetadata(result.getResultMetadata());
- return resultUPCA;
- }
- return result;
- } catch (err) {
- // continue;
- }
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- throw new _NotFoundException.default();
- };
- MultiFormatUPCEANReader.prototype.reset = function () {
- var e_2, _a;
- try {
- for (var _b = __values(this.readers), _c = _b.next(); !_c.done; _c = _b.next()) {
- var reader = _c.value;
- reader.reset();
- }
- } catch (e_2_1) {
- e_2 = {
- error: e_2_1
- };
- } finally {
- try {
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
- } finally {
- if (e_2) throw e_2.error;
- }
- }
- };
- return MultiFormatUPCEANReader;
- }(_OneDReader.default);
- var _default = MultiFormatUPCEANReader;
- exports.default = _default;
- /***/ }),
- /* 364 */
- /*!************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/EAN13Reader.js ***!
- \************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
- var _UPCEANReader = _interopRequireDefault(__webpack_require__(/*! ./UPCEANReader */ 365));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
- /*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- /**
- * <p>Implements decoding of the EAN-13 format.</p>
- *
- * @author dswitkin@google.com (Daniel Switkin)
- * @author Sean Owen
- * @author alasdair@google.com (Alasdair Mackintosh)
- */
- var EAN13Reader = /** @class */function (_super) {
- __extends(EAN13Reader, _super);
- function EAN13Reader() {
- var _this = _super.call(this) || this;
- _this.decodeMiddleCounters = Int32Array.from([0, 0, 0, 0]);
- return _this;
- }
- EAN13Reader.prototype.decodeMiddle = function (row, startRange, resultString) {
- var e_1, _a, e_2, _b;
- var counters = this.decodeMiddleCounters;
- counters[0] = 0;
- counters[1] = 0;
- counters[2] = 0;
- counters[3] = 0;
- var end = row.getSize();
- var rowOffset = startRange[1];
- var lgPatternFound = 0;
- for (var x = 0; x < 6 && rowOffset < end; x++) {
- var bestMatch = _UPCEANReader.default.decodeDigit(row, counters, rowOffset, _UPCEANReader.default.L_AND_G_PATTERNS);
- resultString += String.fromCharCode('0'.charCodeAt(0) + bestMatch % 10);
- try {
- for (var counters_1 = (e_1 = void 0, __values(counters)), counters_1_1 = counters_1.next(); !counters_1_1.done; counters_1_1 = counters_1.next()) {
- var counter = counters_1_1.value;
- rowOffset += counter;
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (counters_1_1 && !counters_1_1.done && (_a = counters_1.return)) _a.call(counters_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- if (bestMatch >= 10) {
- lgPatternFound |= 1 << 5 - x;
- }
- }
- resultString = EAN13Reader.determineFirstDigit(resultString, lgPatternFound);
- var middleRange = _UPCEANReader.default.findGuardPattern(row, rowOffset, true, _UPCEANReader.default.MIDDLE_PATTERN, new Int32Array(_UPCEANReader.default.MIDDLE_PATTERN.length).fill(0));
- rowOffset = middleRange[1];
- for (var x = 0; x < 6 && rowOffset < end; x++) {
- var bestMatch = _UPCEANReader.default.decodeDigit(row, counters, rowOffset, _UPCEANReader.default.L_PATTERNS);
- resultString += String.fromCharCode('0'.charCodeAt(0) + bestMatch);
- try {
- for (var counters_2 = (e_2 = void 0, __values(counters)), counters_2_1 = counters_2.next(); !counters_2_1.done; counters_2_1 = counters_2.next()) {
- var counter = counters_2_1.value;
- rowOffset += counter;
- }
- } catch (e_2_1) {
- e_2 = {
- error: e_2_1
- };
- } finally {
- try {
- if (counters_2_1 && !counters_2_1.done && (_b = counters_2.return)) _b.call(counters_2);
- } finally {
- if (e_2) throw e_2.error;
- }
- }
- }
- return {
- rowOffset: rowOffset,
- resultString: resultString
- };
- };
- EAN13Reader.prototype.getBarcodeFormat = function () {
- return _BarcodeFormat.default.EAN_13;
- };
- EAN13Reader.determineFirstDigit = function (resultString, lgPatternFound) {
- for (var d = 0; d < 10; d++) {
- if (lgPatternFound === this.FIRST_DIGIT_ENCODINGS[d]) {
- resultString = String.fromCharCode('0'.charCodeAt(0) + d) + resultString;
- return resultString;
- }
- }
- throw new _NotFoundException.default();
- };
- EAN13Reader.FIRST_DIGIT_ENCODINGS = [0x00, 0x0B, 0x0D, 0xE, 0x13, 0x19, 0x1C, 0x15, 0x16, 0x1A];
- return EAN13Reader;
- }(_UPCEANReader.default);
- var _default = EAN13Reader;
- exports.default = _default;
- /***/ }),
- /* 365 */
- /*!*************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/UPCEANReader.js ***!
- \*************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
- var _DecodeHintType = _interopRequireDefault(__webpack_require__(/*! ../DecodeHintType */ 322));
- var _Result = _interopRequireDefault(__webpack_require__(/*! ../Result */ 333));
- var _ResultMetadataType = _interopRequireDefault(__webpack_require__(/*! ../ResultMetadataType */ 335));
- var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../ResultPoint */ 346));
- var _UPCEANExtensionSupport = _interopRequireDefault(__webpack_require__(/*! ./UPCEANExtensionSupport */ 366));
- var _AbstractUPCEANReader = _interopRequireDefault(__webpack_require__(/*! ./AbstractUPCEANReader */ 367));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
- var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../FormatException */ 324));
- var _ChecksumException = _interopRequireDefault(__webpack_require__(/*! ../ChecksumException */ 309));
- /*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /**
- * <p>Encapsulates functionality and implementation that is common to UPC and EAN families
- * of one-dimensional barcodes.</p>
- *
- * @author dswitkin@google.com (Daniel Switkin)
- * @author Sean Owen
- * @author alasdair@google.com (Alasdair Mackintosh)
- */
- var UPCEANReader = /** @class */function (_super) {
- __extends(UPCEANReader, _super);
- function UPCEANReader() {
- var _this = _super.call(this) || this;
- _this.decodeRowStringBuffer = '';
- UPCEANReader.L_AND_G_PATTERNS = UPCEANReader.L_PATTERNS.map(function (arr) {
- return Int32Array.from(arr);
- });
- for (var i = 10; i < 20; i++) {
- var widths = UPCEANReader.L_PATTERNS[i - 10];
- var reversedWidths = new Int32Array(widths.length);
- for (var j = 0; j < widths.length; j++) {
- reversedWidths[j] = widths[widths.length - j - 1];
- }
- UPCEANReader.L_AND_G_PATTERNS[i] = reversedWidths;
- }
- return _this;
- }
- UPCEANReader.prototype.decodeRow = function (rowNumber, row, hints) {
- var startGuardRange = UPCEANReader.findStartGuardPattern(row);
- var resultPointCallback = hints == null ? null : hints.get(_DecodeHintType.default.NEED_RESULT_POINT_CALLBACK);
- if (resultPointCallback != null) {
- var resultPoint_1 = new _ResultPoint.default((startGuardRange[0] + startGuardRange[1]) / 2.0, rowNumber);
- resultPointCallback.foundPossibleResultPoint(resultPoint_1);
- }
- var budello = this.decodeMiddle(row, startGuardRange, this.decodeRowStringBuffer);
- var endStart = budello.rowOffset;
- var result = budello.resultString;
- if (resultPointCallback != null) {
- var resultPoint_2 = new _ResultPoint.default(endStart, rowNumber);
- resultPointCallback.foundPossibleResultPoint(resultPoint_2);
- }
- var endRange = UPCEANReader.decodeEnd(row, endStart);
- if (resultPointCallback != null) {
- var resultPoint_3 = new _ResultPoint.default((endRange[0] + endRange[1]) / 2.0, rowNumber);
- resultPointCallback.foundPossibleResultPoint(resultPoint_3);
- }
- // Make sure there is a quiet zone at least as big as the end pattern after the barcode. The
- // spec might want more whitespace, but in practice this is the maximum we can count on.
- var end = endRange[1];
- var quietEnd = end + (end - endRange[0]);
- if (quietEnd >= row.getSize() || !row.isRange(end, quietEnd, false)) {
- throw new _NotFoundException.default();
- }
- var resultString = result.toString();
- // UPC/EAN should never be less than 8 chars anyway
- if (resultString.length < 8) {
- throw new _FormatException.default();
- }
- if (!UPCEANReader.checkChecksum(resultString)) {
- throw new _ChecksumException.default();
- }
- var left = (startGuardRange[1] + startGuardRange[0]) / 2.0;
- var right = (endRange[1] + endRange[0]) / 2.0;
- var format = this.getBarcodeFormat();
- var resultPoint = [new _ResultPoint.default(left, rowNumber), new _ResultPoint.default(right, rowNumber)];
- var decodeResult = new _Result.default(resultString, null, 0, resultPoint, format, new Date().getTime());
- var extensionLength = 0;
- try {
- var extensionResult = _UPCEANExtensionSupport.default.decodeRow(rowNumber, row, endRange[1]);
- decodeResult.putMetadata(_ResultMetadataType.default.UPC_EAN_EXTENSION, extensionResult.getText());
- decodeResult.putAllMetadata(extensionResult.getResultMetadata());
- decodeResult.addResultPoints(extensionResult.getResultPoints());
- extensionLength = extensionResult.getText().length;
- } catch (err) {}
- var allowedExtensions = hints == null ? null : hints.get(_DecodeHintType.default.ALLOWED_EAN_EXTENSIONS);
- if (allowedExtensions != null) {
- var valid = false;
- for (var length_1 in allowedExtensions) {
- if (extensionLength.toString() === length_1) {
- // check me
- valid = true;
- break;
- }
- }
- if (!valid) {
- throw new _NotFoundException.default();
- }
- }
- if (format === _BarcodeFormat.default.EAN_13 || format === _BarcodeFormat.default.UPC_A) {
- // let countryID = eanManSupport.lookupContryIdentifier(resultString); todo
- // if (countryID != null) {
- // decodeResult.putMetadata(ResultMetadataType.POSSIBLE_COUNTRY, countryID);
- // }
- }
- return decodeResult;
- };
- UPCEANReader.checkChecksum = function (s) {
- return UPCEANReader.checkStandardUPCEANChecksum(s);
- };
- UPCEANReader.checkStandardUPCEANChecksum = function (s) {
- var length = s.length;
- if (length === 0) return false;
- var check = parseInt(s.charAt(length - 1), 10);
- return UPCEANReader.getStandardUPCEANChecksum(s.substring(0, length - 1)) === check;
- };
- UPCEANReader.getStandardUPCEANChecksum = function (s) {
- var length = s.length;
- var sum = 0;
- for (var i = length - 1; i >= 0; i -= 2) {
- var digit = s.charAt(i).charCodeAt(0) - '0'.charCodeAt(0);
- if (digit < 0 || digit > 9) {
- throw new _FormatException.default();
- }
- sum += digit;
- }
- sum *= 3;
- for (var i = length - 2; i >= 0; i -= 2) {
- var digit = s.charAt(i).charCodeAt(0) - '0'.charCodeAt(0);
- if (digit < 0 || digit > 9) {
- throw new _FormatException.default();
- }
- sum += digit;
- }
- return (1000 - sum) % 10;
- };
- UPCEANReader.decodeEnd = function (row, endStart) {
- return UPCEANReader.findGuardPattern(row, endStart, false, UPCEANReader.START_END_PATTERN, new Int32Array(UPCEANReader.START_END_PATTERN.length).fill(0));
- };
- return UPCEANReader;
- }(_AbstractUPCEANReader.default);
- var _default = UPCEANReader;
- exports.default = _default;
- /***/ }),
- /* 366 */
- /*!***********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/UPCEANExtensionSupport.js ***!
- \***********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _AbstractUPCEANReader = _interopRequireDefault(__webpack_require__(/*! ./AbstractUPCEANReader */ 367));
- var _UPCEANExtension5Support = _interopRequireDefault(__webpack_require__(/*! ./UPCEANExtension5Support */ 368));
- var _UPCEANExtension2Support = _interopRequireDefault(__webpack_require__(/*! ./UPCEANExtension2Support */ 369));
- /*
- * Copyright (C) 2010 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var UPCEANExtensionSupport = /** @class */function () {
- function UPCEANExtensionSupport() {}
- UPCEANExtensionSupport.decodeRow = function (rowNumber, row, rowOffset) {
- var extensionStartRange = _AbstractUPCEANReader.default.findGuardPattern(row, rowOffset, false, this.EXTENSION_START_PATTERN, new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));
- try {
- // return null;
- var fiveSupport = new _UPCEANExtension5Support.default();
- return fiveSupport.decodeRow(rowNumber, row, extensionStartRange);
- } catch (err) {
- // return null;
- var twoSupport = new _UPCEANExtension2Support.default();
- return twoSupport.decodeRow(rowNumber, row, extensionStartRange);
- }
- };
- UPCEANExtensionSupport.EXTENSION_START_PATTERN = Int32Array.from([1, 1, 2]);
- return UPCEANExtensionSupport;
- }();
- var _default = UPCEANExtensionSupport;
- exports.default = _default;
- /***/ }),
- /* 367 */
- /*!*********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/AbstractUPCEANReader.js ***!
- \*********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _OneDReader = _interopRequireDefault(__webpack_require__(/*! ./OneDReader */ 359));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
- var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../FormatException */ 324));
- /*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /**
- * <p>Encapsulates functionality and implementation that is common to UPC and EAN families
- * of one-dimensional barcodes.</p>
- *
- * @author dswitkin@google.com (Daniel Switkin)
- * @author Sean Owen
- * @author alasdair@google.com (Alasdair Mackintosh)
- */
- var AbstractUPCEANReader = /** @class */function (_super) {
- __extends(AbstractUPCEANReader, _super);
- function AbstractUPCEANReader() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- _this.decodeRowStringBuffer = '';
- return _this;
- }
- // private final UPCEANExtensionSupport extensionReader;
- // private final EANManufacturerOrgSupport eanManSupport;
- /*
- protected UPCEANReader() {
- decodeRowStringBuffer = new StringBuilder(20);
- extensionReader = new UPCEANExtensionSupport();
- eanManSupport = new EANManufacturerOrgSupport();
- }
- */
- AbstractUPCEANReader.findStartGuardPattern = function (row) {
- var foundStart = false;
- var startRange;
- var nextStart = 0;
- var counters = Int32Array.from([0, 0, 0]);
- while (!foundStart) {
- counters = Int32Array.from([0, 0, 0]);
- startRange = AbstractUPCEANReader.findGuardPattern(row, nextStart, false, this.START_END_PATTERN, counters);
- var start = startRange[0];
- nextStart = startRange[1];
- var quietStart = start - (nextStart - start);
- if (quietStart >= 0) {
- foundStart = row.isRange(quietStart, start, false);
- }
- }
- return startRange;
- };
- AbstractUPCEANReader.checkChecksum = function (s) {
- return AbstractUPCEANReader.checkStandardUPCEANChecksum(s);
- };
- AbstractUPCEANReader.checkStandardUPCEANChecksum = function (s) {
- var length = s.length;
- if (length === 0) return false;
- var check = parseInt(s.charAt(length - 1), 10);
- return AbstractUPCEANReader.getStandardUPCEANChecksum(s.substring(0, length - 1)) === check;
- };
- AbstractUPCEANReader.getStandardUPCEANChecksum = function (s) {
- var length = s.length;
- var sum = 0;
- for (var i = length - 1; i >= 0; i -= 2) {
- var digit = s.charAt(i).charCodeAt(0) - '0'.charCodeAt(0);
- if (digit < 0 || digit > 9) {
- throw new _FormatException.default();
- }
- sum += digit;
- }
- sum *= 3;
- for (var i = length - 2; i >= 0; i -= 2) {
- var digit = s.charAt(i).charCodeAt(0) - '0'.charCodeAt(0);
- if (digit < 0 || digit > 9) {
- throw new _FormatException.default();
- }
- sum += digit;
- }
- return (1000 - sum) % 10;
- };
- AbstractUPCEANReader.decodeEnd = function (row, endStart) {
- return AbstractUPCEANReader.findGuardPattern(row, endStart, false, AbstractUPCEANReader.START_END_PATTERN, new Int32Array(AbstractUPCEANReader.START_END_PATTERN.length).fill(0));
- };
- /**
- * @throws NotFoundException
- */
- AbstractUPCEANReader.findGuardPatternWithoutCounters = function (row, rowOffset, whiteFirst, pattern) {
- return this.findGuardPattern(row, rowOffset, whiteFirst, pattern, new Int32Array(pattern.length));
- };
- /**
- * @param row row of black/white values to search
- * @param rowOffset position to start search
- * @param whiteFirst if true, indicates that the pattern specifies white/black/white/...
- * pixel counts, otherwise, it is interpreted as black/white/black/...
- * @param pattern pattern of counts of number of black and white pixels that are being
- * searched for as a pattern
- * @param counters array of counters, as long as pattern, to re-use
- * @return start/end horizontal offset of guard pattern, as an array of two ints
- * @throws NotFoundException if pattern is not found
- */
- AbstractUPCEANReader.findGuardPattern = function (row, rowOffset, whiteFirst, pattern, counters) {
- var width = row.getSize();
- rowOffset = whiteFirst ? row.getNextUnset(rowOffset) : row.getNextSet(rowOffset);
- var counterPosition = 0;
- var patternStart = rowOffset;
- var patternLength = pattern.length;
- var isWhite = whiteFirst;
- for (var x = rowOffset; x < width; x++) {
- if (row.get(x) !== isWhite) {
- counters[counterPosition]++;
- } else {
- if (counterPosition === patternLength - 1) {
- if (_OneDReader.default.patternMatchVariance(counters, pattern, AbstractUPCEANReader.MAX_INDIVIDUAL_VARIANCE) < AbstractUPCEANReader.MAX_AVG_VARIANCE) {
- return Int32Array.from([patternStart, x]);
- }
- patternStart += counters[0] + counters[1];
- var slice = counters.slice(2, counters.length);
- for (var i = 0; i < counterPosition - 1; i++) {
- counters[i] = slice[i];
- }
- counters[counterPosition - 1] = 0;
- counters[counterPosition] = 0;
- counterPosition--;
- } else {
- counterPosition++;
- }
- counters[counterPosition] = 1;
- isWhite = !isWhite;
- }
- }
- throw new _NotFoundException.default();
- };
- AbstractUPCEANReader.decodeDigit = function (row, counters, rowOffset, patterns) {
- this.recordPattern(row, rowOffset, counters);
- var bestVariance = this.MAX_AVG_VARIANCE;
- var bestMatch = -1;
- var max = patterns.length;
- for (var i = 0; i < max; i++) {
- var pattern = patterns[i];
- var variance = _OneDReader.default.patternMatchVariance(counters, pattern, AbstractUPCEANReader.MAX_INDIVIDUAL_VARIANCE);
- if (variance < bestVariance) {
- bestVariance = variance;
- bestMatch = i;
- }
- }
- if (bestMatch >= 0) {
- return bestMatch;
- } else {
- throw new _NotFoundException.default();
- }
- };
- // These two values are critical for determining how permissive the decoding will be.
- // We've arrived at these values through a lot of trial and error. Setting them any higher
- // lets false positives creep in quickly.
- AbstractUPCEANReader.MAX_AVG_VARIANCE = 0.48;
- AbstractUPCEANReader.MAX_INDIVIDUAL_VARIANCE = 0.7;
- /**
- * Start/end guard pattern.
- */
- AbstractUPCEANReader.START_END_PATTERN = Int32Array.from([1, 1, 1]);
- /**
- * Pattern marking the middle of a UPC/EAN pattern, separating the two halves.
- */
- AbstractUPCEANReader.MIDDLE_PATTERN = Int32Array.from([1, 1, 1, 1, 1]);
- /**
- * end guard pattern.
- */
- AbstractUPCEANReader.END_PATTERN = Int32Array.from([1, 1, 1, 1, 1, 1]);
- /**
- * "Odd", or "L" patterns used to encode UPC/EAN digits.
- */
- AbstractUPCEANReader.L_PATTERNS = [Int32Array.from([3, 2, 1, 1]), Int32Array.from([2, 2, 2, 1]), Int32Array.from([2, 1, 2, 2]), Int32Array.from([1, 4, 1, 1]), Int32Array.from([1, 1, 3, 2]), Int32Array.from([1, 2, 3, 1]), Int32Array.from([1, 1, 1, 4]), Int32Array.from([1, 3, 1, 2]), Int32Array.from([1, 2, 1, 3]), Int32Array.from([3, 1, 1, 2])];
- return AbstractUPCEANReader;
- }(_OneDReader.default);
- var _default = AbstractUPCEANReader;
- exports.default = _default;
- /***/ }),
- /* 368 */
- /*!************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/UPCEANExtension5Support.js ***!
- \************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
- var _AbstractUPCEANReader = _interopRequireDefault(__webpack_require__(/*! ./AbstractUPCEANReader */ 367));
- var _Result = _interopRequireDefault(__webpack_require__(/*! ../Result */ 333));
- var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../ResultPoint */ 346));
- var _ResultMetadataType = _interopRequireDefault(__webpack_require__(/*! ../ResultMetadataType */ 335));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
- /*
- * Copyright (C) 2010 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- /**
- * @see UPCEANExtension2Support
- */
- var UPCEANExtension5Support = /** @class */function () {
- function UPCEANExtension5Support() {
- this.CHECK_DIGIT_ENCODINGS = [0x18, 0x14, 0x12, 0x11, 0x0C, 0x06, 0x03, 0x0A, 0x09, 0x05];
- this.decodeMiddleCounters = Int32Array.from([0, 0, 0, 0]);
- this.decodeRowStringBuffer = '';
- }
- UPCEANExtension5Support.prototype.decodeRow = function (rowNumber, row, extensionStartRange) {
- var result = this.decodeRowStringBuffer;
- var end = this.decodeMiddle(row, extensionStartRange, result);
- var resultString = result.toString();
- var extensionData = UPCEANExtension5Support.parseExtensionString(resultString);
- var resultPoints = [new _ResultPoint.default((extensionStartRange[0] + extensionStartRange[1]) / 2.0, rowNumber), new _ResultPoint.default(end, rowNumber)];
- var extensionResult = new _Result.default(resultString, null, 0, resultPoints, _BarcodeFormat.default.UPC_EAN_EXTENSION, new Date().getTime());
- if (extensionData != null) {
- extensionResult.putAllMetadata(extensionData);
- }
- return extensionResult;
- };
- UPCEANExtension5Support.prototype.decodeMiddle = function (row, startRange, resultString) {
- var e_1, _a;
- var counters = this.decodeMiddleCounters;
- counters[0] = 0;
- counters[1] = 0;
- counters[2] = 0;
- counters[3] = 0;
- var end = row.getSize();
- var rowOffset = startRange[1];
- var lgPatternFound = 0;
- for (var x = 0; x < 5 && rowOffset < end; x++) {
- var bestMatch = _AbstractUPCEANReader.default.decodeDigit(row, counters, rowOffset, _AbstractUPCEANReader.default.L_AND_G_PATTERNS);
- resultString += String.fromCharCode('0'.charCodeAt(0) + bestMatch % 10);
- try {
- for (var counters_1 = (e_1 = void 0, __values(counters)), counters_1_1 = counters_1.next(); !counters_1_1.done; counters_1_1 = counters_1.next()) {
- var counter = counters_1_1.value;
- rowOffset += counter;
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (counters_1_1 && !counters_1_1.done && (_a = counters_1.return)) _a.call(counters_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- if (bestMatch >= 10) {
- lgPatternFound |= 1 << 4 - x;
- }
- if (x !== 4) {
- // Read off separator if not last
- rowOffset = row.getNextSet(rowOffset);
- rowOffset = row.getNextUnset(rowOffset);
- }
- }
- if (resultString.length !== 5) {
- throw new _NotFoundException.default();
- }
- var checkDigit = this.determineCheckDigit(lgPatternFound);
- if (UPCEANExtension5Support.extensionChecksum(resultString.toString()) !== checkDigit) {
- throw new _NotFoundException.default();
- }
- return rowOffset;
- };
- UPCEANExtension5Support.extensionChecksum = function (s) {
- var length = s.length;
- var sum = 0;
- for (var i = length - 2; i >= 0; i -= 2) {
- sum += s.charAt(i).charCodeAt(0) - '0'.charCodeAt(0);
- }
- sum *= 3;
- for (var i = length - 1; i >= 0; i -= 2) {
- sum += s.charAt(i).charCodeAt(0) - '0'.charCodeAt(0);
- }
- sum *= 3;
- return sum % 10;
- };
- UPCEANExtension5Support.prototype.determineCheckDigit = function (lgPatternFound) {
- for (var d = 0; d < 10; d++) {
- if (lgPatternFound === this.CHECK_DIGIT_ENCODINGS[d]) {
- return d;
- }
- }
- throw new _NotFoundException.default();
- };
- UPCEANExtension5Support.parseExtensionString = function (raw) {
- if (raw.length !== 5) {
- return null;
- }
- var value = UPCEANExtension5Support.parseExtension5String(raw);
- if (value == null) {
- return null;
- }
- return new Map([[_ResultMetadataType.default.SUGGESTED_PRICE, value]]);
- };
- UPCEANExtension5Support.parseExtension5String = function (raw) {
- var currency;
- switch (raw.charAt(0)) {
- case '0':
- currency = '£';
- break;
- case '5':
- currency = '$';
- break;
- case '9':
- // Reference: http://www.jollytech.com
- switch (raw) {
- case '90000':
- // No suggested retail price
- return null;
- case '99991':
- // Complementary
- return '0.00';
- case '99990':
- return 'Used';
- }
- // Otherwise... unknown currency?
- currency = '';
- break;
- default:
- currency = '';
- break;
- }
- var rawAmount = parseInt(raw.substring(1));
- var unitsString = (rawAmount / 100).toString();
- var hundredths = rawAmount % 100;
- var hundredthsString = hundredths < 10 ? '0' + hundredths : hundredths.toString(); // fixme
- return currency + unitsString + '.' + hundredthsString;
- };
- return UPCEANExtension5Support;
- }();
- var _default = UPCEANExtension5Support;
- exports.default = _default;
- /***/ }),
- /* 369 */
- /*!************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/UPCEANExtension2Support.js ***!
- \************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
- var _AbstractUPCEANReader = _interopRequireDefault(__webpack_require__(/*! ./AbstractUPCEANReader */ 367));
- var _Result = _interopRequireDefault(__webpack_require__(/*! ../Result */ 333));
- var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../ResultPoint */ 346));
- var _ResultMetadataType = _interopRequireDefault(__webpack_require__(/*! ../ResultMetadataType */ 335));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
- /*
- * Copyright (C) 2012 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- /**
- * @see UPCEANExtension5Support
- */
- var UPCEANExtension2Support = /** @class */function () {
- function UPCEANExtension2Support() {
- this.decodeMiddleCounters = Int32Array.from([0, 0, 0, 0]);
- this.decodeRowStringBuffer = '';
- }
- UPCEANExtension2Support.prototype.decodeRow = function (rowNumber, row, extensionStartRange) {
- var result = this.decodeRowStringBuffer;
- var end = this.decodeMiddle(row, extensionStartRange, result);
- var resultString = result.toString();
- var extensionData = UPCEANExtension2Support.parseExtensionString(resultString);
- var resultPoints = [new _ResultPoint.default((extensionStartRange[0] + extensionStartRange[1]) / 2.0, rowNumber), new _ResultPoint.default(end, rowNumber)];
- var extensionResult = new _Result.default(resultString, null, 0, resultPoints, _BarcodeFormat.default.UPC_EAN_EXTENSION, new Date().getTime());
- if (extensionData != null) {
- extensionResult.putAllMetadata(extensionData);
- }
- return extensionResult;
- };
- UPCEANExtension2Support.prototype.decodeMiddle = function (row, startRange, resultString) {
- var e_1, _a;
- var counters = this.decodeMiddleCounters;
- counters[0] = 0;
- counters[1] = 0;
- counters[2] = 0;
- counters[3] = 0;
- var end = row.getSize();
- var rowOffset = startRange[1];
- var checkParity = 0;
- for (var x = 0; x < 2 && rowOffset < end; x++) {
- var bestMatch = _AbstractUPCEANReader.default.decodeDigit(row, counters, rowOffset, _AbstractUPCEANReader.default.L_AND_G_PATTERNS);
- resultString += String.fromCharCode('0'.charCodeAt(0) + bestMatch % 10);
- try {
- for (var counters_1 = (e_1 = void 0, __values(counters)), counters_1_1 = counters_1.next(); !counters_1_1.done; counters_1_1 = counters_1.next()) {
- var counter = counters_1_1.value;
- rowOffset += counter;
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (counters_1_1 && !counters_1_1.done && (_a = counters_1.return)) _a.call(counters_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- if (bestMatch >= 10) {
- checkParity |= 1 << 1 - x;
- }
- if (x !== 1) {
- // Read off separator if not last
- rowOffset = row.getNextSet(rowOffset);
- rowOffset = row.getNextUnset(rowOffset);
- }
- }
- if (resultString.length !== 2) {
- throw new _NotFoundException.default();
- }
- if (parseInt(resultString.toString()) % 4 !== checkParity) {
- throw new _NotFoundException.default();
- }
- return rowOffset;
- };
- UPCEANExtension2Support.parseExtensionString = function (raw) {
- if (raw.length !== 2) {
- return null;
- }
- return new Map([[_ResultMetadataType.default.ISSUE_NUMBER, parseInt(raw)]]);
- };
- return UPCEANExtension2Support;
- }();
- var _default = UPCEANExtension2Support;
- exports.default = _default;
- /***/ }),
- /* 370 */
- /*!***********************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/EAN8Reader.js ***!
- \***********************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
- var _UPCEANReader = _interopRequireDefault(__webpack_require__(/*! ./UPCEANReader */ 365));
- /*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- /**
- * <p>Implements decoding of the EAN-8 format.</p>
- *
- * @author Sean Owen
- */
- var EAN8Reader = /** @class */function (_super) {
- __extends(EAN8Reader, _super);
- function EAN8Reader() {
- var _this = _super.call(this) || this;
- _this.decodeMiddleCounters = Int32Array.from([0, 0, 0, 0]);
- return _this;
- }
- EAN8Reader.prototype.decodeMiddle = function (row, startRange, resultString) {
- var e_1, _a, e_2, _b;
- var counters = this.decodeMiddleCounters;
- counters[0] = 0;
- counters[1] = 0;
- counters[2] = 0;
- counters[3] = 0;
- var end = row.getSize();
- var rowOffset = startRange[1];
- for (var x = 0; x < 4 && rowOffset < end; x++) {
- var bestMatch = _UPCEANReader.default.decodeDigit(row, counters, rowOffset, _UPCEANReader.default.L_PATTERNS);
- resultString += String.fromCharCode('0'.charCodeAt(0) + bestMatch);
- try {
- for (var counters_1 = (e_1 = void 0, __values(counters)), counters_1_1 = counters_1.next(); !counters_1_1.done; counters_1_1 = counters_1.next()) {
- var counter = counters_1_1.value;
- rowOffset += counter;
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (counters_1_1 && !counters_1_1.done && (_a = counters_1.return)) _a.call(counters_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- }
- var middleRange = _UPCEANReader.default.findGuardPattern(row, rowOffset, true, _UPCEANReader.default.MIDDLE_PATTERN, new Int32Array(_UPCEANReader.default.MIDDLE_PATTERN.length).fill(0));
- rowOffset = middleRange[1];
- for (var x = 0; x < 4 && rowOffset < end; x++) {
- var bestMatch = _UPCEANReader.default.decodeDigit(row, counters, rowOffset, _UPCEANReader.default.L_PATTERNS);
- resultString += String.fromCharCode('0'.charCodeAt(0) + bestMatch);
- try {
- for (var counters_2 = (e_2 = void 0, __values(counters)), counters_2_1 = counters_2.next(); !counters_2_1.done; counters_2_1 = counters_2.next()) {
- var counter = counters_2_1.value;
- rowOffset += counter;
- }
- } catch (e_2_1) {
- e_2 = {
- error: e_2_1
- };
- } finally {
- try {
- if (counters_2_1 && !counters_2_1.done && (_b = counters_2.return)) _b.call(counters_2);
- } finally {
- if (e_2) throw e_2.error;
- }
- }
- }
- return {
- rowOffset: rowOffset,
- resultString: resultString
- };
- };
- EAN8Reader.prototype.getBarcodeFormat = function () {
- return _BarcodeFormat.default.EAN_8;
- };
- return EAN8Reader;
- }(_UPCEANReader.default);
- var _default = EAN8Reader;
- exports.default = _default;
- /***/ }),
- /* 371 */
- /*!***********************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/UPCAReader.js ***!
- \***********************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
- var _Result = _interopRequireDefault(__webpack_require__(/*! ../Result */ 333));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
- var _EAN13Reader = _interopRequireDefault(__webpack_require__(/*! ./EAN13Reader */ 364));
- var _UPCEANReader = _interopRequireDefault(__webpack_require__(/*! ./UPCEANReader */ 365));
- /*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /*namespace com.google.zxing.oned {*/
- /**
- * Encapsulates functionality and implementation that is common to all families
- * of one-dimensional barcodes.
- *
- * @author dswitkin@google.com (Daniel Switkin)
- * @author Sean Owen
- * @author sam2332 (Sam Rudloff)
- *
- * @source https://github.com/zxing/zxing/blob/3c96923276dd5785d58eb970b6ba3f80d36a9505/core/src/main/java/com/google/zxing/oned/UPCAReader.java
- *
- * @experimental
- */
- var UPCAReader = /** @class */function (_super) {
- __extends(UPCAReader, _super);
- function UPCAReader() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- _this.ean13Reader = new _EAN13Reader.default();
- return _this;
- }
- // @Override
- UPCAReader.prototype.getBarcodeFormat = function () {
- return _BarcodeFormat.default.UPC_A;
- };
- // Note that we don't try rotation without the try harder flag, even if rotation was supported.
- // @Override
- UPCAReader.prototype.decode = function (image, hints) {
- return this.maybeReturnResult(this.ean13Reader.decode(image));
- };
- // @Override
- UPCAReader.prototype.decodeRow = function (rowNumber, row, hints) {
- return this.maybeReturnResult(this.ean13Reader.decodeRow(rowNumber, row, hints));
- };
- // @Override
- UPCAReader.prototype.decodeMiddle = function (row, startRange, resultString) {
- return this.ean13Reader.decodeMiddle(row, startRange, resultString);
- };
- UPCAReader.prototype.maybeReturnResult = function (result) {
- var text = result.getText();
- if (text.charAt(0) === '0') {
- var upcaResult = new _Result.default(text.substring(1), null, null, result.getResultPoints(), _BarcodeFormat.default.UPC_A);
- if (result.getResultMetadata() != null) {
- upcaResult.putAllMetadata(result.getResultMetadata());
- }
- return upcaResult;
- } else {
- throw new _NotFoundException.default();
- }
- };
- UPCAReader.prototype.reset = function () {
- this.ean13Reader.reset();
- };
- return UPCAReader;
- }(_UPCEANReader.default);
- var _default = UPCAReader;
- exports.default = _default;
- /***/ }),
- /* 372 */
- /*!***********************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/UPCEReader.js ***!
- \***********************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _UPCEANReader = _interopRequireDefault(__webpack_require__(/*! ./UPCEANReader */ 365));
- var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../util/StringBuilder */ 320));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
- var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
- /*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- // package com.google.zxing.oned;
- // import com.google.zxing.BarcodeFormat;
- // import com.google.zxing.FormatException;
- // import com.google.zxing.NotFoundException;
- // import com.google.zxing.common.BitArray;
- /**
- * <p>Implements decoding of the UPC-E format.</p>
- * <p><a href="http://www.barcodeisland.com/upce.phtml">This</a> is a great reference for
- * UPC-E information.</p>
- *
- * @author Sean Owen
- *
- * @source https://github.com/zxing/zxing/blob/3c96923276dd5785d58eb970b6ba3f80d36a9505/core/src/main/java/com/google/zxing/oned/UPCEReader.java
- *
- * @experimental
- */
- var UPCEReader = /** @class */function (_super) {
- __extends(UPCEReader, _super);
- function UPCEReader() {
- var _this = _super.call(this) || this;
- _this.decodeMiddleCounters = new Int32Array(4);
- return _this;
- }
- /**
- * @throws NotFoundException
- */
- // @Override
- UPCEReader.prototype.decodeMiddle = function (row, startRange, result) {
- var e_1, _a;
- var counters = this.decodeMiddleCounters.map(function (x) {
- return x;
- });
- counters[0] = 0;
- counters[1] = 0;
- counters[2] = 0;
- counters[3] = 0;
- var end = row.getSize();
- var rowOffset = startRange[1];
- var lgPatternFound = 0;
- for (var x = 0; x < 6 && rowOffset < end; x++) {
- var bestMatch = UPCEReader.decodeDigit(row, counters, rowOffset, UPCEReader.L_AND_G_PATTERNS);
- result += String.fromCharCode('0'.charCodeAt(0) + bestMatch % 10);
- try {
- for (var counters_1 = (e_1 = void 0, __values(counters)), counters_1_1 = counters_1.next(); !counters_1_1.done; counters_1_1 = counters_1.next()) {
- var counter = counters_1_1.value;
- rowOffset += counter;
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (counters_1_1 && !counters_1_1.done && (_a = counters_1.return)) _a.call(counters_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- if (bestMatch >= 10) {
- lgPatternFound |= 1 << 5 - x;
- }
- }
- UPCEReader.determineNumSysAndCheckDigit(new _StringBuilder.default(result), lgPatternFound);
- return rowOffset;
- };
- /**
- * @throws NotFoundException
- */
- // @Override
- UPCEReader.prototype.decodeEnd = function (row, endStart) {
- return UPCEReader.findGuardPatternWithoutCounters(row, endStart, true, UPCEReader.MIDDLE_END_PATTERN);
- };
- /**
- * @throws FormatException
- */
- // @Override
- UPCEReader.prototype.checkChecksum = function (s) {
- return _UPCEANReader.default.checkChecksum(UPCEReader.convertUPCEtoUPCA(s));
- };
- /**
- * @throws NotFoundException
- */
- UPCEReader.determineNumSysAndCheckDigit = function (resultString, lgPatternFound) {
- for (var numSys = 0; numSys <= 1; numSys++) {
- for (var d = 0; d < 10; d++) {
- if (lgPatternFound === this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[numSys][d]) {
- resultString.insert(0, /*(char)*/'0' + numSys);
- resultString.append( /*(char)*/'0' + d);
- return;
- }
- }
- }
- throw _NotFoundException.default.getNotFoundInstance();
- };
- // @Override
- UPCEReader.prototype.getBarcodeFormat = function () {
- return _BarcodeFormat.default.UPC_E;
- };
- /**
- * Expands a UPC-E value back into its full, equivalent UPC-A code value.
- *
- * @param upce UPC-E code as string of digits
- * @return equivalent UPC-A code as string of digits
- */
- UPCEReader.convertUPCEtoUPCA = function (upce) {
- // the following line is equivalent to upce.getChars(1, 7, upceChars, 0);
- var upceChars = upce.slice(1, 7).split('').map(function (x) {
- return x.charCodeAt(0);
- });
- var result = new _StringBuilder.default( /*12*/);
- result.append(upce.charAt(0));
- var lastChar = upceChars[5];
- switch (lastChar) {
- case 0:
- case 1:
- case 2:
- result.appendChars(upceChars, 0, 2);
- result.append(lastChar);
- result.append('0000');
- result.appendChars(upceChars, 2, 3);
- break;
- case 3:
- result.appendChars(upceChars, 0, 3);
- result.append('00000');
- result.appendChars(upceChars, 3, 2);
- break;
- case 4:
- result.appendChars(upceChars, 0, 4);
- result.append('00000');
- result.append(upceChars[4]);
- break;
- default:
- result.appendChars(upceChars, 0, 5);
- result.append('0000');
- result.append(lastChar);
- break;
- }
- // Only append check digit in conversion if supplied
- if (upce.length >= 8) {
- result.append(upce.charAt(7));
- }
- return result.toString();
- };
- /**
- * The pattern that marks the middle, and end, of a UPC-E pattern.
- * There is no "second half" to a UPC-E barcode.
- */
- UPCEReader.MIDDLE_END_PATTERN = Int32Array.from([1, 1, 1, 1, 1, 1]);
- // For an UPC-E barcode, the final digit is represented by the parities used
- // to encode the middle six digits, according to the table below.
- //
- // Parity of next 6 digits
- // Digit 0 1 2 3 4 5
- // 0 Even Even Even Odd Odd Odd
- // 1 Even Even Odd Even Odd Odd
- // 2 Even Even Odd Odd Even Odd
- // 3 Even Even Odd Odd Odd Even
- // 4 Even Odd Even Even Odd Odd
- // 5 Even Odd Odd Even Even Odd
- // 6 Even Odd Odd Odd Even Even
- // 7 Even Odd Even Odd Even Odd
- // 8 Even Odd Even Odd Odd Even
- // 9 Even Odd Odd Even Odd Even
- //
- // The encoding is represented by the following array, which is a bit pattern
- // using Odd = 0 and Even = 1. For example, 5 is represented by:
- //
- // Odd Even Even Odd Odd Even
- // in binary:
- // 0 1 1 0 0 1 == 0x19
- //
- /**
- * See {@link #L_AND_G_PATTERNS}; these values similarly represent patterns of
- * even-odd parity encodings of digits that imply both the number system (0 or 1)
- * used, and the check digit.
- */
- UPCEReader.NUMSYS_AND_CHECK_DIGIT_PATTERNS = [Int32Array.from([0x38, 0x34, 0x32, 0x31, 0x2C, 0x26, 0x23, 0x2A, 0x29, 0x25]), Int32Array.from([0x07, 0x0B, 0x0D, 0x0E, 0x13, 0x19, 0x1C, 0x15, 0x16, 0x1])];
- return UPCEReader;
- }(_UPCEANReader.default);
- var _default = UPCEReader;
- exports.default = _default;
- /***/ }),
- /* 373 */
- /*!**************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/CodaBarReader.js ***!
- \**************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
- var _OneDReader = _interopRequireDefault(__webpack_require__(/*! ./OneDReader */ 359));
- var _Result = _interopRequireDefault(__webpack_require__(/*! ../Result */ 333));
- var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../ResultPoint */ 346));
- /*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /*namespace com.google.zxing.oned {*/
- /**
- * <p>Decodes CodaBar barcodes. </p>
- *
- * @author Evan @dodobelieve
- * @see CodaBarReader
- */
- var CodaBarReader = /** @class */function (_super) {
- __extends(CodaBarReader, _super);
- function CodaBarReader() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- _this.CODA_BAR_CHAR_SET = {
- nnnnnww: '0',
- nnnnwwn: '1',
- nnnwnnw: '2',
- wwnnnnn: '3',
- nnwnnwn: '4',
- wnnnnwn: '5',
- nwnnnnw: '6',
- nwnnwnn: '7',
- nwwnnnn: '8',
- wnnwnnn: '9',
- nnnwwnn: '-',
- nnwwnnn: '$',
- wnnnwnw: ':',
- wnwnnnw: '/',
- wnwnwnn: '.',
- nnwwwww: '+',
- nnwwnwn: 'A',
- nwnwnnw: 'B',
- nnnwnww: 'C',
- nnnwwwn: 'D'
- };
- return _this;
- }
- CodaBarReader.prototype.decodeRow = function (rowNumber, row, hints) {
- var validRowData = this.getValidRowData(row);
- if (!validRowData) throw new _NotFoundException.default();
- var retStr = this.codaBarDecodeRow(validRowData.row);
- if (!retStr) throw new _NotFoundException.default();
- return new _Result.default(retStr, null, 0, [new _ResultPoint.default(validRowData.left, rowNumber), new _ResultPoint.default(validRowData.right, rowNumber)], _BarcodeFormat.default.CODABAR, new Date().getTime());
- };
- /**
- * converts bit array to valid data array(lengths of black bits and white bits)
- * @param row bit array to convert
- */
- CodaBarReader.prototype.getValidRowData = function (row) {
- var booleanArr = row.toArray();
- var startIndex = booleanArr.indexOf(true);
- if (startIndex === -1) return null;
- var lastIndex = booleanArr.lastIndexOf(true);
- if (lastIndex <= startIndex) return null;
- booleanArr = booleanArr.slice(startIndex, lastIndex + 1);
- var result = [];
- var lastBit = booleanArr[0];
- var bitLength = 1;
- for (var i = 1; i < booleanArr.length; i++) {
- if (booleanArr[i] === lastBit) {
- bitLength++;
- } else {
- lastBit = booleanArr[i];
- result.push(bitLength);
- bitLength = 1;
- }
- }
- result.push(bitLength);
- // CodaBar code data valid
- if (result.length < 23 && (result.length + 1) % 8 !== 0) return null;
- return {
- row: result,
- left: startIndex,
- right: lastIndex
- };
- };
- /**
- * decode codabar code
- * @param row row to cecode
- */
- CodaBarReader.prototype.codaBarDecodeRow = function (row) {
- var code = [];
- var barThreshold = Math.ceil(row.reduce(function (pre, item) {
- return (pre + item) / 2;
- }, 0));
- // Read one encoded character at a time.
- while (row.length > 0) {
- var seg = row.splice(0, 8).splice(0, 7);
- var key = seg.map(function (len) {
- return len < barThreshold ? 'n' : 'w';
- }).join('');
- if (this.CODA_BAR_CHAR_SET[key] === undefined) return null;
- code.push(this.CODA_BAR_CHAR_SET[key]);
- }
- var strCode = code.join('');
- if (this.validCodaBarString(strCode)) return strCode;
- return null;
- };
- /**
- * check if the string is a CodaBar string
- * @param src string to determine
- */
- CodaBarReader.prototype.validCodaBarString = function (src) {
- var reg = /^[A-D].{1,}[A-D]$/;
- return reg.test(src);
- };
- return CodaBarReader;
- }(_OneDReader.default);
- var _default = CodaBarReader;
- exports.default = _default;
- /***/ }),
- /* 374 */
- /*!*******************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/RSSExpandedReader.js ***!
- \*******************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../../../BarcodeFormat */ 334));
- var _MathUtils = _interopRequireDefault(__webpack_require__(/*! ../../../common/detector/MathUtils */ 347));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../../NotFoundException */ 327));
- var _Result = _interopRequireDefault(__webpack_require__(/*! ../../../Result */ 333));
- var _System = _interopRequireDefault(__webpack_require__(/*! ../../../util/System */ 315));
- var _AbstractRSSReader = _interopRequireDefault(__webpack_require__(/*! ../../rss/AbstractRSSReader */ 375));
- var _DataCharacter = _interopRequireDefault(__webpack_require__(/*! ../../rss/DataCharacter */ 376));
- var _FinderPattern = _interopRequireDefault(__webpack_require__(/*! ../../rss/FinderPattern */ 377));
- var _RSSUtils = _interopRequireDefault(__webpack_require__(/*! ../../rss/RSSUtils */ 378));
- var _BitArrayBuilder = _interopRequireDefault(__webpack_require__(/*! ./BitArrayBuilder */ 379));
- var _AbstractExpandedDecoderComplement = __webpack_require__(/*! ./decoders/AbstractExpandedDecoderComplement */ 380);
- var _ExpandedPair = _interopRequireDefault(__webpack_require__(/*! ./ExpandedPair */ 399));
- var _ExpandedRow = _interopRequireDefault(__webpack_require__(/*! ./ExpandedRow */ 400));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- // import java.util.ArrayList;
- // import java.util.Iterator;
- // import java.util.List;
- // import java.util.Map;
- // import java.util.Collections;
- /** @experimental */
- var RSSExpandedReader = /** @class */function (_super) {
- __extends(RSSExpandedReader, _super);
- function RSSExpandedReader() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- _this.pairs = new Array(RSSExpandedReader.MAX_PAIRS);
- _this.rows = new Array();
- _this.startEnd = [2];
- return _this;
- }
- RSSExpandedReader.prototype.decodeRow = function (rowNumber, row, hints) {
- // Rows can start with even pattern in case in prev rows there where odd number of patters.
- // So lets try twice
- // this.pairs.clear();
- this.pairs.length = 0;
- this.startFromEven = false;
- try {
- return RSSExpandedReader.constructResult(this.decodeRow2pairs(rowNumber, row));
- } catch (e) {
- // OK
- // console.log(e);
- }
- this.pairs.length = 0;
- this.startFromEven = true;
- return RSSExpandedReader.constructResult(this.decodeRow2pairs(rowNumber, row));
- };
- RSSExpandedReader.prototype.reset = function () {
- this.pairs.length = 0;
- this.rows.length = 0;
- };
- // Not private for testing
- RSSExpandedReader.prototype.decodeRow2pairs = function (rowNumber, row) {
- var done = false;
- while (!done) {
- try {
- this.pairs.push(this.retrieveNextPair(row, this.pairs, rowNumber));
- } catch (error) {
- if (error instanceof _NotFoundException.default) {
- if (!this.pairs.length) {
- throw new _NotFoundException.default();
- }
- // exit this loop when retrieveNextPair() fails and throws
- done = true;
- }
- }
- }
- // TODO: verify sequence of finder patterns as in checkPairSequence()
- if (this.checkChecksum()) {
- return this.pairs;
- }
- var tryStackedDecode;
- if (this.rows.length) {
- tryStackedDecode = true;
- } else {
- tryStackedDecode = false;
- }
- // let tryStackedDecode = !this.rows.isEmpty();
- this.storeRow(rowNumber, false); // TODO: deal with reversed rows
- if (tryStackedDecode) {
- // When the image is 180-rotated, then rows are sorted in wrong direction.
- // Try twice with both the directions.
- var ps = this.checkRowsBoolean(false);
- if (ps != null) {
- return ps;
- }
- ps = this.checkRowsBoolean(true);
- if (ps != null) {
- return ps;
- }
- }
- throw new _NotFoundException.default();
- };
- // Need to Verify
- RSSExpandedReader.prototype.checkRowsBoolean = function (reverse) {
- // Limit number of rows we are checking
- // We use recursive algorithm with pure complexity and don't want it to take forever
- // Stacked barcode can have up to 11 rows, so 25 seems reasonable enough
- if (this.rows.length > 25) {
- this.rows.length = 0; // We will never have a chance to get result, so clear it
- return null;
- }
- this.pairs.length = 0;
- if (reverse) {
- this.rows = this.rows.reverse();
- // Collections.reverse(this.rows);
- }
- var ps = null;
- try {
- ps = this.checkRows(new Array(), 0);
- } catch (e) {
- // OK
- console.log(e);
- }
- if (reverse) {
- this.rows = this.rows.reverse();
- // Collections.reverse(this.rows);
- }
- return ps;
- };
- // Try to construct a valid rows sequence
- // Recursion is used to implement backtracking
- RSSExpandedReader.prototype.checkRows = function (collectedRows, currentRow) {
- var e_1, _a;
- for (var i = currentRow; i < this.rows.length; i++) {
- var row = this.rows[i];
- this.pairs.length = 0;
- try {
- for (var collectedRows_1 = (e_1 = void 0, __values(collectedRows)), collectedRows_1_1 = collectedRows_1.next(); !collectedRows_1_1.done; collectedRows_1_1 = collectedRows_1.next()) {
- var collectedRow = collectedRows_1_1.value;
- this.pairs.push(collectedRow.getPairs());
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (collectedRows_1_1 && !collectedRows_1_1.done && (_a = collectedRows_1.return)) _a.call(collectedRows_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- this.pairs.push(row.getPairs());
- if (!RSSExpandedReader.isValidSequence(this.pairs)) {
- continue;
- }
- if (this.checkChecksum()) {
- return this.pairs;
- }
- var rs = new Array(collectedRows);
- rs.push(row);
- try {
- // Recursion: try to add more rows
- return this.checkRows(rs, i + 1);
- } catch (e) {
- // We failed, try the next candidate
- console.log(e);
- }
- }
- throw new _NotFoundException.default();
- };
- // Whether the pairs form a valid find pattern sequence,
- // either complete or a prefix
- RSSExpandedReader.isValidSequence = function (pairs) {
- var e_2, _a;
- try {
- for (var _b = __values(RSSExpandedReader.FINDER_PATTERN_SEQUENCES), _c = _b.next(); !_c.done; _c = _b.next()) {
- var sequence = _c.value;
- if (pairs.length > sequence.length) {
- continue;
- }
- var stop_1 = true;
- for (var j = 0; j < pairs.length; j++) {
- if (pairs[j].getFinderPattern().getValue() !== sequence[j]) {
- stop_1 = false;
- break;
- }
- }
- if (stop_1) {
- return true;
- }
- }
- } catch (e_2_1) {
- e_2 = {
- error: e_2_1
- };
- } finally {
- try {
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
- } finally {
- if (e_2) throw e_2.error;
- }
- }
- return false;
- };
- RSSExpandedReader.prototype.storeRow = function (rowNumber, wasReversed) {
- // Discard if duplicate above or below; otherwise insert in order by row number.
- var insertPos = 0;
- var prevIsSame = false;
- var nextIsSame = false;
- while (insertPos < this.rows.length) {
- var erow = this.rows[insertPos];
- if (erow.getRowNumber() > rowNumber) {
- nextIsSame = erow.isEquivalent(this.pairs);
- break;
- }
- prevIsSame = erow.isEquivalent(this.pairs);
- insertPos++;
- }
- if (nextIsSame || prevIsSame) {
- return;
- }
- // When the row was partially decoded (e.g. 2 pairs found instead of 3),
- // it will prevent us from detecting the barcode.
- // Try to merge partial rows
- // Check whether the row is part of an allready detected row
- if (RSSExpandedReader.isPartialRow(this.pairs, this.rows)) {
- return;
- }
- this.rows.push(insertPos, new _ExpandedRow.default(this.pairs, rowNumber, wasReversed));
- this.removePartialRows(this.pairs, this.rows);
- };
- // Remove all the rows that contains only specified pairs
- RSSExpandedReader.prototype.removePartialRows = function (pairs, rows) {
- var e_3, _a, e_4, _b, e_5, _c;
- try {
- // for (Iterator<ExpandedRow> iterator = rows.iterator(); iterator.hasNext();) {
- // ExpandedRow r = iterator.next();
- // if (r.getPairs().size() == pairs.size()) {
- // continue;
- // }
- // boolean allFound = true;
- // for (ExpandedPair p : r.getPairs()) {
- // boolean found = false;
- // for (ExpandedPair pp : pairs) {
- // if (p.equals(pp)) {
- // found = true;
- // break;
- // }
- // }
- // if (!found) {
- // allFound = false;
- // break;
- // }
- // }
- // if (allFound) {
- // // 'pairs' contains all the pairs from the row 'r'
- // iterator.remove();
- // }
- // }
- for (var rows_1 = __values(rows), rows_1_1 = rows_1.next(); !rows_1_1.done; rows_1_1 = rows_1.next()) {
- var row = rows_1_1.value;
- if (row.getPairs().length === pairs.length) {
- continue;
- }
- var allFound = true;
- try {
- for (var _d = (e_4 = void 0, __values(row.getPairs())), _e = _d.next(); !_e.done; _e = _d.next()) {
- var p = _e.value;
- var found = false;
- try {
- for (var pairs_1 = (e_5 = void 0, __values(pairs)), pairs_1_1 = pairs_1.next(); !pairs_1_1.done; pairs_1_1 = pairs_1.next()) {
- var pp = pairs_1_1.value;
- if (_ExpandedPair.default.equals(p, pp)) {
- found = true;
- break;
- }
- }
- } catch (e_5_1) {
- e_5 = {
- error: e_5_1
- };
- } finally {
- try {
- if (pairs_1_1 && !pairs_1_1.done && (_c = pairs_1.return)) _c.call(pairs_1);
- } finally {
- if (e_5) throw e_5.error;
- }
- }
- if (!found) {
- allFound = false;
- }
- }
- } catch (e_4_1) {
- e_4 = {
- error: e_4_1
- };
- } finally {
- try {
- if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
- } finally {
- if (e_4) throw e_4.error;
- }
- }
- }
- } catch (e_3_1) {
- e_3 = {
- error: e_3_1
- };
- } finally {
- try {
- if (rows_1_1 && !rows_1_1.done && (_a = rows_1.return)) _a.call(rows_1);
- } finally {
- if (e_3) throw e_3.error;
- }
- }
- };
- // Returns true when one of the rows already contains all the pairs
- RSSExpandedReader.isPartialRow = function (pairs, rows) {
- var e_6, _a, e_7, _b, e_8, _c;
- try {
- for (var rows_2 = __values(rows), rows_2_1 = rows_2.next(); !rows_2_1.done; rows_2_1 = rows_2.next()) {
- var r = rows_2_1.value;
- var allFound = true;
- try {
- for (var pairs_2 = (e_7 = void 0, __values(pairs)), pairs_2_1 = pairs_2.next(); !pairs_2_1.done; pairs_2_1 = pairs_2.next()) {
- var p = pairs_2_1.value;
- var found = false;
- try {
- for (var _d = (e_8 = void 0, __values(r.getPairs())), _e = _d.next(); !_e.done; _e = _d.next()) {
- var pp = _e.value;
- if (p.equals(pp)) {
- found = true;
- break;
- }
- }
- } catch (e_8_1) {
- e_8 = {
- error: e_8_1
- };
- } finally {
- try {
- if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
- } finally {
- if (e_8) throw e_8.error;
- }
- }
- if (!found) {
- allFound = false;
- break;
- }
- }
- } catch (e_7_1) {
- e_7 = {
- error: e_7_1
- };
- } finally {
- try {
- if (pairs_2_1 && !pairs_2_1.done && (_b = pairs_2.return)) _b.call(pairs_2);
- } finally {
- if (e_7) throw e_7.error;
- }
- }
- if (allFound) {
- // the row 'r' contain all the pairs from 'pairs'
- return true;
- }
- }
- } catch (e_6_1) {
- e_6 = {
- error: e_6_1
- };
- } finally {
- try {
- if (rows_2_1 && !rows_2_1.done && (_a = rows_2.return)) _a.call(rows_2);
- } finally {
- if (e_6) throw e_6.error;
- }
- }
- return false;
- };
- // Only used for unit testing
- RSSExpandedReader.prototype.getRows = function () {
- return this.rows;
- };
- // Not private for unit testing
- RSSExpandedReader.constructResult = function (pairs) {
- var binary = _BitArrayBuilder.default.buildBitArray(pairs);
- var decoder = (0, _AbstractExpandedDecoderComplement.createDecoder)(binary);
- var resultingString = decoder.parseInformation();
- var firstPoints = pairs[0].getFinderPattern().getResultPoints();
- var lastPoints = pairs[pairs.length - 1].getFinderPattern().getResultPoints();
- var points = [firstPoints[0], firstPoints[1], lastPoints[0], lastPoints[1]];
- return new _Result.default(resultingString, null, null, points, _BarcodeFormat.default.RSS_EXPANDED, null);
- };
- RSSExpandedReader.prototype.checkChecksum = function () {
- var firstPair = this.pairs.get(0);
- var checkCharacter = firstPair.getLeftChar();
- var firstCharacter = firstPair.getRightChar();
- if (firstCharacter === null) {
- return false;
- }
- var checksum = firstCharacter.getChecksumPortion();
- var s = 2;
- for (var i = 1; i < this.pairs.size(); ++i) {
- var currentPair = this.pairs.get(i);
- checksum += currentPair.getLeftChar().getChecksumPortion();
- s++;
- var currentRightChar = currentPair.getRightChar();
- if (currentRightChar != null) {
- checksum += currentRightChar.getChecksumPortion();
- s++;
- }
- }
- checksum %= 211;
- var checkCharacterValue = 211 * (s - 4) + checksum;
- return checkCharacterValue === checkCharacter.getValue();
- };
- RSSExpandedReader.getNextSecondBar = function (row, initialPos) {
- var currentPos;
- if (row.get(initialPos)) {
- currentPos = row.getNextUnset(initialPos);
- currentPos = row.getNextSet(currentPos);
- } else {
- currentPos = row.getNextSet(initialPos);
- currentPos = row.getNextUnset(currentPos);
- }
- return currentPos;
- };
- // not private for testing
- RSSExpandedReader.prototype.retrieveNextPair = function (row, previousPairs, rowNumber) {
- var isOddPattern = previousPairs.length % 2 === 0;
- if (this.startFromEven) {
- isOddPattern = !isOddPattern;
- }
- var pattern;
- var keepFinding = true;
- var forcedOffset = -1;
- do {
- this.findNextPair(row, previousPairs, forcedOffset);
- pattern = this.parseFoundFinderPattern(row, rowNumber, isOddPattern);
- if (pattern === null) {
- forcedOffset = RSSExpandedReader.getNextSecondBar(row, this.startEnd[0]);
- } else {
- keepFinding = false;
- }
- } while (keepFinding);
- // When stacked symbol is split over multiple rows, there's no way to guess if this pair can be last or not.
- // boolean mayBeLast = checkPairSequence(previousPairs, pattern);
- var leftChar = this.decodeDataCharacter(row, pattern, isOddPattern, true);
- if (!this.isEmptyPair(previousPairs) && previousPairs[previousPairs.length - 1].mustBeLast()) {
- throw new _NotFoundException.default();
- }
- var rightChar;
- try {
- rightChar = this.decodeDataCharacter(row, pattern, isOddPattern, false);
- } catch (e) {
- rightChar = null;
- console.log(e);
- }
- return new _ExpandedPair.default(leftChar, rightChar, pattern, true);
- };
- RSSExpandedReader.prototype.isEmptyPair = function (pairs) {
- if (pairs.length === 0) {
- return true;
- }
- return false;
- };
- RSSExpandedReader.prototype.findNextPair = function (row, previousPairs, forcedOffset) {
- var counters = this.getDecodeFinderCounters();
- counters[0] = 0;
- counters[1] = 0;
- counters[2] = 0;
- counters[3] = 0;
- var width = row.getSize();
- var rowOffset;
- if (forcedOffset >= 0) {
- rowOffset = forcedOffset;
- } else if (this.isEmptyPair(previousPairs)) {
- rowOffset = 0;
- } else {
- var lastPair = previousPairs[previousPairs.length - 1];
- rowOffset = lastPair.getFinderPattern().getStartEnd()[1];
- }
- var searchingEvenPair = previousPairs.length % 2 !== 0;
- if (this.startFromEven) {
- searchingEvenPair = !searchingEvenPair;
- }
- var isWhite = false;
- while (rowOffset < width) {
- isWhite = !row.get(rowOffset);
- if (!isWhite) {
- break;
- }
- rowOffset++;
- }
- var counterPosition = 0;
- var patternStart = rowOffset;
- for (var x = rowOffset; x < width; x++) {
- if (row.get(x) !== isWhite) {
- counters[counterPosition]++;
- } else {
- if (counterPosition === 3) {
- if (searchingEvenPair) {
- RSSExpandedReader.reverseCounters(counters);
- }
- if (RSSExpandedReader.isFinderPattern(counters)) {
- this.startEnd[0] = patternStart;
- this.startEnd[1] = x;
- return;
- }
- if (searchingEvenPair) {
- RSSExpandedReader.reverseCounters(counters);
- }
- patternStart += counters[0] + counters[1];
- counters[0] = counters[2];
- counters[1] = counters[3];
- counters[2] = 0;
- counters[3] = 0;
- counterPosition--;
- } else {
- counterPosition++;
- }
- counters[counterPosition] = 1;
- isWhite = !isWhite;
- }
- }
- throw new _NotFoundException.default();
- };
- RSSExpandedReader.reverseCounters = function (counters) {
- var length = counters.length;
- for (var i = 0; i < length / 2; ++i) {
- var tmp = counters[i];
- counters[i] = counters[length - i - 1];
- counters[length - i - 1] = tmp;
- }
- };
- RSSExpandedReader.prototype.parseFoundFinderPattern = function (row, rowNumber, oddPattern) {
- // Actually we found elements 2-5.
- var firstCounter;
- var start;
- var end;
- if (oddPattern) {
- // If pattern number is odd, we need to locate element 1 *before* the current block.
- var firstElementStart = this.startEnd[0] - 1;
- // Locate element 1
- while (firstElementStart >= 0 && !row.get(firstElementStart)) {
- firstElementStart--;
- }
- firstElementStart++;
- firstCounter = this.startEnd[0] - firstElementStart;
- start = firstElementStart;
- end = this.startEnd[1];
- } else {
- // If pattern number is even, the pattern is reversed, so we need to locate element 1 *after* the current block.
- start = this.startEnd[0];
- end = row.getNextUnset(this.startEnd[1] + 1);
- firstCounter = end - this.startEnd[1];
- }
- // Make 'counters' hold 1-4
- var counters = this.getDecodeFinderCounters();
- _System.default.arraycopy(counters, 0, counters, 1, counters.length - 1);
- counters[0] = firstCounter;
- var value;
- try {
- value = this.parseFinderValue(counters, RSSExpandedReader.FINDER_PATTERNS);
- } catch (e) {
- return null;
- }
- // return new FinderPattern(value, new int[] { start, end }, start, end, rowNumber});
- return new _FinderPattern.default(value, [start, end], start, end, rowNumber);
- };
- RSSExpandedReader.prototype.decodeDataCharacter = function (row, pattern, isOddPattern, leftChar) {
- var counters = this.getDataCharacterCounters();
- for (var x = 0; x < counters.length; x++) {
- counters[x] = 0;
- }
- if (leftChar) {
- RSSExpandedReader.recordPatternInReverse(row, pattern.getStartEnd()[0], counters);
- } else {
- RSSExpandedReader.recordPattern(row, pattern.getStartEnd()[1], counters);
- // reverse it
- for (var i = 0, j = counters.length - 1; i < j; i++, j--) {
- var temp = counters[i];
- counters[i] = counters[j];
- counters[j] = temp;
- }
- } // counters[] has the pixels of the module
- var numModules = 17; // left and right data characters have all the same length
- var elementWidth = _MathUtils.default.sum(new Int32Array(counters)) / numModules;
- // Sanity check: element width for pattern and the character should match
- var expectedElementWidth = (pattern.getStartEnd()[1] - pattern.getStartEnd()[0]) / 15.0;
- if (Math.abs(elementWidth - expectedElementWidth) / expectedElementWidth > 0.3) {
- throw new _NotFoundException.default();
- }
- var oddCounts = this.getOddCounts();
- var evenCounts = this.getEvenCounts();
- var oddRoundingErrors = this.getOddRoundingErrors();
- var evenRoundingErrors = this.getEvenRoundingErrors();
- for (var i = 0; i < counters.length; i++) {
- var value_1 = 1.0 * counters[i] / elementWidth;
- var count = value_1 + 0.5; // Round
- if (count < 1) {
- if (value_1 < 0.3) {
- throw new _NotFoundException.default();
- }
- count = 1;
- } else if (count > 8) {
- if (value_1 > 8.7) {
- throw new _NotFoundException.default();
- }
- count = 8;
- }
- var offset = i / 2;
- if ((i & 0x01) === 0) {
- oddCounts[offset] = count;
- oddRoundingErrors[offset] = value_1 - count;
- } else {
- evenCounts[offset] = count;
- evenRoundingErrors[offset] = value_1 - count;
- }
- }
- this.adjustOddEvenCounts(numModules);
- var weightRowNumber = 4 * pattern.getValue() + (isOddPattern ? 0 : 2) + (leftChar ? 0 : 1) - 1;
- var oddSum = 0;
- var oddChecksumPortion = 0;
- for (var i = oddCounts.length - 1; i >= 0; i--) {
- if (RSSExpandedReader.isNotA1left(pattern, isOddPattern, leftChar)) {
- var weight = RSSExpandedReader.WEIGHTS[weightRowNumber][2 * i];
- oddChecksumPortion += oddCounts[i] * weight;
- }
- oddSum += oddCounts[i];
- }
- var evenChecksumPortion = 0;
- // int evenSum = 0;
- for (var i = evenCounts.length - 1; i >= 0; i--) {
- if (RSSExpandedReader.isNotA1left(pattern, isOddPattern, leftChar)) {
- var weight = RSSExpandedReader.WEIGHTS[weightRowNumber][2 * i + 1];
- evenChecksumPortion += evenCounts[i] * weight;
- }
- // evenSum += evenCounts[i];
- }
- var checksumPortion = oddChecksumPortion + evenChecksumPortion;
- if ((oddSum & 0x01) !== 0 || oddSum > 13 || oddSum < 4) {
- throw new _NotFoundException.default();
- }
- var group = (13 - oddSum) / 2;
- var oddWidest = RSSExpandedReader.SYMBOL_WIDEST[group];
- var evenWidest = 9 - oddWidest;
- var vOdd = _RSSUtils.default.getRSSvalue(oddCounts, oddWidest, true);
- var vEven = _RSSUtils.default.getRSSvalue(evenCounts, evenWidest, false);
- var tEven = RSSExpandedReader.EVEN_TOTAL_SUBSET[group];
- var gSum = RSSExpandedReader.GSUM[group];
- var value = vOdd * tEven + vEven + gSum;
- return new _DataCharacter.default(value, checksumPortion);
- };
- RSSExpandedReader.isNotA1left = function (pattern, isOddPattern, leftChar) {
- // A1: pattern.getValue is 0 (A), and it's an oddPattern, and it is a left char
- return !(pattern.getValue() === 0 && isOddPattern && leftChar);
- };
- RSSExpandedReader.prototype.adjustOddEvenCounts = function (numModules) {
- var oddSum = _MathUtils.default.sum(new Int32Array(this.getOddCounts()));
- var evenSum = _MathUtils.default.sum(new Int32Array(this.getEvenCounts()));
- var incrementOdd = false;
- var decrementOdd = false;
- if (oddSum > 13) {
- decrementOdd = true;
- } else if (oddSum < 4) {
- incrementOdd = true;
- }
- var incrementEven = false;
- var decrementEven = false;
- if (evenSum > 13) {
- decrementEven = true;
- } else if (evenSum < 4) {
- incrementEven = true;
- }
- var mismatch = oddSum + evenSum - numModules;
- var oddParityBad = (oddSum & 0x01) === 1;
- var evenParityBad = (evenSum & 0x01) === 0;
- if (mismatch === 1) {
- if (oddParityBad) {
- if (evenParityBad) {
- throw new _NotFoundException.default();
- }
- decrementOdd = true;
- } else {
- if (!evenParityBad) {
- throw new _NotFoundException.default();
- }
- decrementEven = true;
- }
- } else if (mismatch === -1) {
- if (oddParityBad) {
- if (evenParityBad) {
- throw new _NotFoundException.default();
- }
- incrementOdd = true;
- } else {
- if (!evenParityBad) {
- throw new _NotFoundException.default();
- }
- incrementEven = true;
- }
- } else if (mismatch === 0) {
- if (oddParityBad) {
- if (!evenParityBad) {
- throw new _NotFoundException.default();
- }
- // Both bad
- if (oddSum < evenSum) {
- incrementOdd = true;
- decrementEven = true;
- } else {
- decrementOdd = true;
- incrementEven = true;
- }
- } else {
- if (evenParityBad) {
- throw new _NotFoundException.default();
- }
- // Nothing to do!
- }
- } else {
- throw new _NotFoundException.default();
- }
- if (incrementOdd) {
- if (decrementOdd) {
- throw new _NotFoundException.default();
- }
- RSSExpandedReader.increment(this.getOddCounts(), this.getOddRoundingErrors());
- }
- if (decrementOdd) {
- RSSExpandedReader.decrement(this.getOddCounts(), this.getOddRoundingErrors());
- }
- if (incrementEven) {
- if (decrementEven) {
- throw new _NotFoundException.default();
- }
- RSSExpandedReader.increment(this.getEvenCounts(), this.getOddRoundingErrors());
- }
- if (decrementEven) {
- RSSExpandedReader.decrement(this.getEvenCounts(), this.getEvenRoundingErrors());
- }
- };
- RSSExpandedReader.SYMBOL_WIDEST = [7, 5, 4, 3, 1];
- RSSExpandedReader.EVEN_TOTAL_SUBSET = [4, 20, 52, 104, 204];
- RSSExpandedReader.GSUM = [0, 348, 1388, 2948, 3988];
- RSSExpandedReader.FINDER_PATTERNS = [Int32Array.from([1, 8, 4, 1]), Int32Array.from([3, 6, 4, 1]), Int32Array.from([3, 4, 6, 1]), Int32Array.from([3, 2, 8, 1]), Int32Array.from([2, 6, 5, 1]), Int32Array.from([2, 2, 9, 1])];
- RSSExpandedReader.WEIGHTS = [[1, 3, 9, 27, 81, 32, 96, 77], [20, 60, 180, 118, 143, 7, 21, 63], [189, 145, 13, 39, 117, 140, 209, 205], [193, 157, 49, 147, 19, 57, 171, 91], [62, 186, 136, 197, 169, 85, 44, 132], [185, 133, 188, 142, 4, 12, 36, 108], [113, 128, 173, 97, 80, 29, 87, 50], [150, 28, 84, 41, 123, 158, 52, 156], [46, 138, 203, 187, 139, 206, 196, 166], [76, 17, 51, 153, 37, 111, 122, 155], [43, 129, 176, 106, 107, 110, 119, 146], [16, 48, 144, 10, 30, 90, 59, 177], [109, 116, 137, 200, 178, 112, 125, 164], [70, 210, 208, 202, 184, 130, 179, 115], [134, 191, 151, 31, 93, 68, 204, 190], [148, 22, 66, 198, 172, 94, 71, 2], [6, 18, 54, 162, 64, 192, 154, 40], [120, 149, 25, 75, 14, 42, 126, 167], [79, 26, 78, 23, 69, 207, 199, 175], [103, 98, 83, 38, 114, 131, 182, 124], [161, 61, 183, 127, 170, 88, 53, 159], [55, 165, 73, 8, 24, 72, 5, 15], [45, 135, 194, 160, 58, 174, 100, 89]];
- RSSExpandedReader.FINDER_PAT_A = 0;
- RSSExpandedReader.FINDER_PAT_B = 1;
- RSSExpandedReader.FINDER_PAT_C = 2;
- RSSExpandedReader.FINDER_PAT_D = 3;
- RSSExpandedReader.FINDER_PAT_E = 4;
- RSSExpandedReader.FINDER_PAT_F = 5;
- RSSExpandedReader.FINDER_PATTERN_SEQUENCES = [[RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_A], [RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_B], [RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_C, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_D], [RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_E, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_D, RSSExpandedReader.FINDER_PAT_C], [RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_E, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_D, RSSExpandedReader.FINDER_PAT_D, RSSExpandedReader.FINDER_PAT_F], [RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_E, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_D, RSSExpandedReader.FINDER_PAT_E, RSSExpandedReader.FINDER_PAT_F, RSSExpandedReader.FINDER_PAT_F], [RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_C, RSSExpandedReader.FINDER_PAT_C, RSSExpandedReader.FINDER_PAT_D, RSSExpandedReader.FINDER_PAT_D], [RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_C, RSSExpandedReader.FINDER_PAT_C, RSSExpandedReader.FINDER_PAT_D, RSSExpandedReader.FINDER_PAT_E, RSSExpandedReader.FINDER_PAT_E], [RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_C, RSSExpandedReader.FINDER_PAT_C, RSSExpandedReader.FINDER_PAT_D, RSSExpandedReader.FINDER_PAT_E, RSSExpandedReader.FINDER_PAT_F, RSSExpandedReader.FINDER_PAT_F], [RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_C, RSSExpandedReader.FINDER_PAT_D, RSSExpandedReader.FINDER_PAT_D, RSSExpandedReader.FINDER_PAT_E, RSSExpandedReader.FINDER_PAT_E, RSSExpandedReader.FINDER_PAT_F, RSSExpandedReader.FINDER_PAT_F]];
- RSSExpandedReader.MAX_PAIRS = 11;
- return RSSExpandedReader;
- }(_AbstractRSSReader.default);
- var _default = RSSExpandedReader;
- exports.default = _default;
- /***/ }),
- /* 375 */
- /*!**********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/AbstractRSSReader.js ***!
- \**********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _MathUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/detector/MathUtils */ 347));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../NotFoundException */ 327));
- var _OneDReader = _interopRequireDefault(__webpack_require__(/*! ../OneDReader */ 359));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- // import Integer from '../../util/Integer';
- // import Float from '../../util/Float';
- var AbstractRSSReader = /** @class */function (_super) {
- __extends(AbstractRSSReader, _super);
- function AbstractRSSReader() {
- var _this = _super.call(this) || this;
- _this.decodeFinderCounters = new Int32Array(4);
- _this.dataCharacterCounters = new Int32Array(8);
- _this.oddRoundingErrors = new Array(4);
- _this.evenRoundingErrors = new Array(4);
- _this.oddCounts = new Array(_this.dataCharacterCounters.length / 2);
- _this.evenCounts = new Array(_this.dataCharacterCounters.length / 2);
- return _this;
- }
- AbstractRSSReader.prototype.getDecodeFinderCounters = function () {
- return this.decodeFinderCounters;
- };
- AbstractRSSReader.prototype.getDataCharacterCounters = function () {
- return this.dataCharacterCounters;
- };
- AbstractRSSReader.prototype.getOddRoundingErrors = function () {
- return this.oddRoundingErrors;
- };
- AbstractRSSReader.prototype.getEvenRoundingErrors = function () {
- return this.evenRoundingErrors;
- };
- AbstractRSSReader.prototype.getOddCounts = function () {
- return this.oddCounts;
- };
- AbstractRSSReader.prototype.getEvenCounts = function () {
- return this.evenCounts;
- };
- AbstractRSSReader.prototype.parseFinderValue = function (counters, finderPatterns) {
- for (var value = 0; value < finderPatterns.length; value++) {
- if (_OneDReader.default.patternMatchVariance(counters, finderPatterns[value], AbstractRSSReader.MAX_INDIVIDUAL_VARIANCE) < AbstractRSSReader.MAX_AVG_VARIANCE) {
- return value;
- }
- }
- throw new _NotFoundException.default();
- };
- /**
- * @param array values to sum
- * @return sum of values
- * @deprecated call {@link MathUtils#sum(int[])}
- */
- AbstractRSSReader.count = function (array) {
- return _MathUtils.default.sum(new Int32Array(array));
- };
- AbstractRSSReader.increment = function (array, errors) {
- var index = 0;
- var biggestError = errors[0];
- for (var i = 1; i < array.length; i++) {
- if (errors[i] > biggestError) {
- biggestError = errors[i];
- index = i;
- }
- }
- array[index]++;
- };
- AbstractRSSReader.decrement = function (array, errors) {
- var index = 0;
- var biggestError = errors[0];
- for (var i = 1; i < array.length; i++) {
- if (errors[i] < biggestError) {
- biggestError = errors[i];
- index = i;
- }
- }
- array[index]--;
- };
- AbstractRSSReader.isFinderPattern = function (counters) {
- var e_1, _a;
- var firstTwoSum = counters[0] + counters[1];
- var sum = firstTwoSum + counters[2] + counters[3];
- var ratio = firstTwoSum / sum;
- if (ratio >= AbstractRSSReader.MIN_FINDER_PATTERN_RATIO && ratio <= AbstractRSSReader.MAX_FINDER_PATTERN_RATIO) {
- // passes ratio test in spec, but see if the counts are unreasonable
- var minCounter = Number.MAX_SAFE_INTEGER;
- var maxCounter = Number.MIN_SAFE_INTEGER;
- try {
- for (var counters_1 = __values(counters), counters_1_1 = counters_1.next(); !counters_1_1.done; counters_1_1 = counters_1.next()) {
- var counter = counters_1_1.value;
- if (counter > maxCounter) {
- maxCounter = counter;
- }
- if (counter < minCounter) {
- minCounter = counter;
- }
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (counters_1_1 && !counters_1_1.done && (_a = counters_1.return)) _a.call(counters_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- return maxCounter < 10 * minCounter;
- }
- return false;
- };
- AbstractRSSReader.MAX_AVG_VARIANCE = 0.2;
- AbstractRSSReader.MAX_INDIVIDUAL_VARIANCE = 0.45;
- AbstractRSSReader.MIN_FINDER_PATTERN_RATIO = 9.5 / 12.0;
- AbstractRSSReader.MAX_FINDER_PATTERN_RATIO = 12.5 / 14.0;
- return AbstractRSSReader;
- }(_OneDReader.default);
- var _default = AbstractRSSReader;
- exports.default = _default;
- /***/ }),
- /* 376 */
- /*!******************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/DataCharacter.js ***!
- \******************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var DataCharacter = /** @class */function () {
- function DataCharacter(value, checksumPortion) {
- this.value = value;
- this.checksumPortion = checksumPortion;
- }
- DataCharacter.prototype.getValue = function () {
- return this.value;
- };
- DataCharacter.prototype.getChecksumPortion = function () {
- return this.checksumPortion;
- };
- DataCharacter.prototype.toString = function () {
- return this.value + '(' + this.checksumPortion + ')';
- };
- DataCharacter.prototype.equals = function (o) {
- if (!(o instanceof DataCharacter)) {
- return false;
- }
- var that = o;
- return this.value === that.value && this.checksumPortion === that.checksumPortion;
- };
- DataCharacter.prototype.hashCode = function () {
- return this.value ^ this.checksumPortion;
- };
- return DataCharacter;
- }();
- var _default = DataCharacter;
- exports.default = _default;
- /***/ }),
- /* 377 */
- /*!******************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/FinderPattern.js ***!
- \******************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../../ResultPoint */ 346));
- var FinderPattern = /** @class */function () {
- function FinderPattern(value, startEnd, start, end, rowNumber) {
- this.value = value;
- this.startEnd = startEnd;
- this.value = value;
- this.startEnd = startEnd;
- this.resultPoints = new Array();
- this.resultPoints.push(new _ResultPoint.default(start, rowNumber));
- this.resultPoints.push(new _ResultPoint.default(end, rowNumber));
- }
- FinderPattern.prototype.getValue = function () {
- return this.value;
- };
- FinderPattern.prototype.getStartEnd = function () {
- return this.startEnd;
- };
- FinderPattern.prototype.getResultPoints = function () {
- return this.resultPoints;
- };
- FinderPattern.prototype.equals = function (o) {
- if (!(o instanceof FinderPattern)) {
- return false;
- }
- var that = o;
- return this.value === that.value;
- };
- FinderPattern.prototype.hashCode = function () {
- return this.value;
- };
- return FinderPattern;
- }();
- var _default = FinderPattern;
- exports.default = _default;
- /***/ }),
- /* 378 */
- /*!*************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/RSSUtils.js ***!
- \*************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- /**
- * RSS util functions.
- */
- var RSSUtils = /** @class */function () {
- function RSSUtils() {}
- RSSUtils.getRSSvalue = function (widths, maxWidth, noNarrow) {
- var e_1, _a;
- var n = 0;
- try {
- for (var widths_1 = __values(widths), widths_1_1 = widths_1.next(); !widths_1_1.done; widths_1_1 = widths_1.next()) {
- var width = widths_1_1.value;
- n += width;
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (widths_1_1 && !widths_1_1.done && (_a = widths_1.return)) _a.call(widths_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- var val = 0;
- var narrowMask = 0;
- var elements = widths.length;
- for (var bar = 0; bar < elements - 1; bar++) {
- var elmWidth = void 0;
- for (elmWidth = 1, narrowMask |= 1 << bar; elmWidth < widths[bar]; elmWidth++, narrowMask &= ~(1 << bar)) {
- var subVal = RSSUtils.combins(n - elmWidth - 1, elements - bar - 2);
- if (noNarrow && narrowMask === 0 && n - elmWidth - (elements - bar - 1) >= elements - bar - 1) {
- subVal -= RSSUtils.combins(n - elmWidth - (elements - bar), elements - bar - 2);
- }
- if (elements - bar - 1 > 1) {
- var lessVal = 0;
- for (var mxwElement = n - elmWidth - (elements - bar - 2); mxwElement > maxWidth; mxwElement--) {
- lessVal += RSSUtils.combins(n - elmWidth - mxwElement - 1, elements - bar - 3);
- }
- subVal -= lessVal * (elements - 1 - bar);
- } else if (n - elmWidth > maxWidth) {
- subVal--;
- }
- val += subVal;
- }
- n -= elmWidth;
- }
- return val;
- };
- RSSUtils.combins = function (n, r) {
- var maxDenom;
- var minDenom;
- if (n - r > r) {
- minDenom = r;
- maxDenom = n - r;
- } else {
- minDenom = n - r;
- maxDenom = r;
- }
- var val = 1;
- var j = 1;
- for (var i = n; i > maxDenom; i--) {
- val *= i;
- if (j <= minDenom) {
- val /= j;
- j++;
- }
- }
- while (j <= minDenom) {
- val /= j;
- j++;
- }
- return val;
- };
- return RSSUtils;
- }();
- var _default = RSSUtils;
- exports.default = _default;
- /***/ }),
- /* 379 */
- /*!*****************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/BitArrayBuilder.js ***!
- \*****************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _BitArray = _interopRequireDefault(__webpack_require__(/*! ../../../common/BitArray */ 313));
- var BitArrayBuilder = /** @class */function () {
- function BitArrayBuilder() {}
- BitArrayBuilder.buildBitArray = function (pairs) {
- var charNumber = pairs.length * 2 - 1;
- if (pairs[pairs.length - 1].getRightChar() == null) {
- charNumber -= 1;
- }
- var size = 12 * charNumber;
- var binary = new _BitArray.default(size);
- var accPos = 0;
- var firstPair = pairs[0];
- var firstValue = firstPair.getRightChar().getValue();
- for (var i = 11; i >= 0; --i) {
- if ((firstValue & 1 << i) !== 0) {
- binary.set(accPos);
- }
- accPos++;
- }
- for (var i = 1; i < pairs.length; ++i) {
- var currentPair = pairs[i];
- var leftValue = currentPair.getLeftChar().getValue();
- for (var j = 11; j >= 0; --j) {
- if ((leftValue & 1 << j) !== 0) {
- binary.set(accPos);
- }
- accPos++;
- }
- if (currentPair.getRightChar() !== null) {
- var rightValue = currentPair.getRightChar().getValue();
- for (var j = 11; j >= 0; --j) {
- if ((rightValue & 1 << j) !== 0) {
- binary.set(accPos);
- }
- accPos++;
- }
- }
- }
- return binary;
- };
- return BitArrayBuilder;
- }();
- var _default = BitArrayBuilder;
- exports.default = _default;
- /***/ }),
- /* 380 */
- /*!********************************************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/AbstractExpandedDecoderComplement.js ***!
- \********************************************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.createDecoder = createDecoder;
- var _IllegalStateException = _interopRequireDefault(__webpack_require__(/*! ../../../../IllegalStateException */ 344));
- var _GeneralAppIdDecoder = _interopRequireDefault(__webpack_require__(/*! ./GeneralAppIdDecoder */ 381));
- var _AI01AndOtherAIs = _interopRequireDefault(__webpack_require__(/*! ./AI01AndOtherAIs */ 388));
- var _AnyAIDecoder = _interopRequireDefault(__webpack_require__(/*! ./AnyAIDecoder */ 391));
- var _AI013103decoder = _interopRequireDefault(__webpack_require__(/*! ./AI013103decoder */ 392));
- var _AI01320xDecoder = _interopRequireDefault(__webpack_require__(/*! ./AI01320xDecoder */ 395));
- var _AI01392xDecoder = _interopRequireDefault(__webpack_require__(/*! ./AI01392xDecoder */ 396));
- var _AI01393xDecoder = _interopRequireDefault(__webpack_require__(/*! ./AI01393xDecoder */ 397));
- var _AI013x0x1xDecoder = _interopRequireDefault(__webpack_require__(/*! ./AI013x0x1xDecoder */ 398));
- function createDecoder(information) {
- try {
- if (information.get(1)) {
- return new _AI01AndOtherAIs.default(information);
- }
- if (!information.get(2)) {
- return new _AnyAIDecoder.default(information);
- }
- var fourBitEncodationMethod = _GeneralAppIdDecoder.default.extractNumericValueFromBitArray(information, 1, 4);
- switch (fourBitEncodationMethod) {
- case 4:
- return new _AI013103decoder.default(information);
- case 5:
- return new _AI01320xDecoder.default(information);
- }
- var fiveBitEncodationMethod = _GeneralAppIdDecoder.default.extractNumericValueFromBitArray(information, 1, 5);
- switch (fiveBitEncodationMethod) {
- case 12:
- return new _AI01392xDecoder.default(information);
- case 13:
- return new _AI01393xDecoder.default(information);
- }
- var sevenBitEncodationMethod = _GeneralAppIdDecoder.default.extractNumericValueFromBitArray(information, 1, 7);
- switch (sevenBitEncodationMethod) {
- case 56:
- return new _AI013x0x1xDecoder.default(information, '310', '11');
- case 57:
- return new _AI013x0x1xDecoder.default(information, '320', '11');
- case 58:
- return new _AI013x0x1xDecoder.default(information, '310', '13');
- case 59:
- return new _AI013x0x1xDecoder.default(information, '320', '13');
- case 60:
- return new _AI013x0x1xDecoder.default(information, '310', '15');
- case 61:
- return new _AI013x0x1xDecoder.default(information, '320', '15');
- case 62:
- return new _AI013x0x1xDecoder.default(information, '310', '17');
- case 63:
- return new _AI013x0x1xDecoder.default(information, '320', '17');
- }
- } catch (e) {
- console.log(e);
- throw new _IllegalStateException.default('unknown decoder: ' + information);
- }
- }
- /***/ }),
- /* 381 */
- /*!******************************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/GeneralAppIdDecoder.js ***!
- \******************************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../../../../FormatException */ 324));
- var _IllegalStateException = _interopRequireDefault(__webpack_require__(/*! ../../../../IllegalStateException */ 344));
- var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../../../util/StringBuilder */ 320));
- var _BlockParsedResult = _interopRequireDefault(__webpack_require__(/*! ./BlockParsedResult */ 382));
- var _DecodedChar = _interopRequireDefault(__webpack_require__(/*! ./DecodedChar */ 383));
- var _DecodedInformation = _interopRequireDefault(__webpack_require__(/*! ./DecodedInformation */ 385));
- var _DecodedNumeric = _interopRequireDefault(__webpack_require__(/*! ./DecodedNumeric */ 386));
- var _FieldParser = _interopRequireDefault(__webpack_require__(/*! ./FieldParser */ 387));
- var GeneralAppIdDecoder = /** @class */function () {
- function GeneralAppIdDecoder(information) {
- this.buffer = new _StringBuilder.default();
- this.information = information;
- }
- GeneralAppIdDecoder.prototype.decodeAllCodes = function (buff, initialPosition) {
- var currentPosition = initialPosition;
- var remaining = null;
- do {
- var info = this.decodeGeneralPurposeField(currentPosition, remaining);
- var parsedFields = _FieldParser.default.parseFieldsInGeneralPurpose(info.getNewString());
- if (parsedFields != null) {
- buff.append(parsedFields);
- }
- if (info.isRemaining()) {
- remaining = '' + info.getRemainingValue();
- } else {
- remaining = null;
- }
- if (currentPosition === info.getNewPosition()) {
- // No step forward!
- break;
- }
- currentPosition = info.getNewPosition();
- } while (true);
- return buff.toString();
- };
- GeneralAppIdDecoder.prototype.isStillNumeric = function (pos) {
- // It's numeric if it still has 7 positions
- // and one of the first 4 bits is "1".
- if (pos + 7 > this.information.getSize()) {
- return pos + 4 <= this.information.getSize();
- }
- for (var i = pos; i < pos + 3; ++i) {
- if (this.information.get(i)) {
- return true;
- }
- }
- return this.information.get(pos + 3);
- };
- GeneralAppIdDecoder.prototype.decodeNumeric = function (pos) {
- if (pos + 7 > this.information.getSize()) {
- var numeric_1 = this.extractNumericValueFromBitArray(pos, 4);
- if (numeric_1 === 0) {
- return new _DecodedNumeric.default(this.information.getSize(), _DecodedNumeric.default.FNC1, _DecodedNumeric.default.FNC1);
- }
- return new _DecodedNumeric.default(this.information.getSize(), numeric_1 - 1, _DecodedNumeric.default.FNC1);
- }
- var numeric = this.extractNumericValueFromBitArray(pos, 7);
- var digit1 = (numeric - 8) / 11;
- var digit2 = (numeric - 8) % 11;
- return new _DecodedNumeric.default(pos + 7, digit1, digit2);
- };
- GeneralAppIdDecoder.prototype.extractNumericValueFromBitArray = function (pos, bits) {
- return GeneralAppIdDecoder.extractNumericValueFromBitArray(this.information, pos, bits);
- };
- GeneralAppIdDecoder.extractNumericValueFromBitArray = function (information, pos, bits) {
- var value = 0;
- for (var i = 0; i < bits; ++i) {
- if (information.get(pos + i)) {
- value |= 1 << bits - i - 1;
- }
- }
- return value;
- };
- GeneralAppIdDecoder.prototype.decodeGeneralPurposeField = function (pos, remaining) {
- // this.buffer.setLength(0);
- this.buffer.setLengthToZero();
- if (remaining != null) {
- this.buffer.append(remaining);
- }
- this.current.setPosition(pos);
- var lastDecoded = this.parseBlocks();
- if (lastDecoded != null && lastDecoded.isRemaining()) {
- return new _DecodedInformation.default(this.current.getPosition(), this.buffer.toString(), lastDecoded.getRemainingValue());
- }
- return new _DecodedInformation.default(this.current.getPosition(), this.buffer.toString());
- };
- GeneralAppIdDecoder.prototype.parseBlocks = function () {
- var isFinished;
- var result;
- do {
- var initialPosition = this.current.getPosition();
- if (this.current.isAlpha()) {
- result = this.parseAlphaBlock();
- isFinished = result.isFinished();
- } else if (this.current.isIsoIec646()) {
- result = this.parseIsoIec646Block();
- isFinished = result.isFinished();
- } else {
- // it must be numeric
- result = this.parseNumericBlock();
- isFinished = result.isFinished();
- }
- var positionChanged = initialPosition !== this.current.getPosition();
- if (!positionChanged && !isFinished) {
- break;
- }
- } while (!isFinished);
- return result.getDecodedInformation();
- };
- GeneralAppIdDecoder.prototype.parseNumericBlock = function () {
- while (this.isStillNumeric(this.current.getPosition())) {
- var numeric = this.decodeNumeric(this.current.getPosition());
- this.current.setPosition(numeric.getNewPosition());
- if (numeric.isFirstDigitFNC1()) {
- var information = void 0;
- if (numeric.isSecondDigitFNC1()) {
- information = new _DecodedInformation.default(this.current.getPosition(), this.buffer.toString());
- } else {
- information = new _DecodedInformation.default(this.current.getPosition(), this.buffer.toString(), numeric.getSecondDigit());
- }
- return new _BlockParsedResult.default(true, information);
- }
- this.buffer.append(numeric.getFirstDigit());
- if (numeric.isSecondDigitFNC1()) {
- var information = new _DecodedInformation.default(this.current.getPosition(), this.buffer.toString());
- return new _BlockParsedResult.default(true, information);
- }
- this.buffer.append(numeric.getSecondDigit());
- }
- if (this.isNumericToAlphaNumericLatch(this.current.getPosition())) {
- this.current.setAlpha();
- this.current.incrementPosition(4);
- }
- return new _BlockParsedResult.default(false);
- };
- GeneralAppIdDecoder.prototype.parseIsoIec646Block = function () {
- while (this.isStillIsoIec646(this.current.getPosition())) {
- var iso = this.decodeIsoIec646(this.current.getPosition());
- this.current.setPosition(iso.getNewPosition());
- if (iso.isFNC1()) {
- var information = new _DecodedInformation.default(this.current.getPosition(), this.buffer.toString());
- return new _BlockParsedResult.default(true, information);
- }
- this.buffer.append(iso.getValue());
- }
- if (this.isAlphaOr646ToNumericLatch(this.current.getPosition())) {
- this.current.incrementPosition(3);
- this.current.setNumeric();
- } else if (this.isAlphaTo646ToAlphaLatch(this.current.getPosition())) {
- if (this.current.getPosition() + 5 < this.information.getSize()) {
- this.current.incrementPosition(5);
- } else {
- this.current.setPosition(this.information.getSize());
- }
- this.current.setAlpha();
- }
- return new _BlockParsedResult.default(false);
- };
- GeneralAppIdDecoder.prototype.parseAlphaBlock = function () {
- while (this.isStillAlpha(this.current.getPosition())) {
- var alpha = this.decodeAlphanumeric(this.current.getPosition());
- this.current.setPosition(alpha.getNewPosition());
- if (alpha.isFNC1()) {
- var information = new _DecodedInformation.default(this.current.getPosition(), this.buffer.toString());
- return new _BlockParsedResult.default(true, information); // end of the char block
- }
- this.buffer.append(alpha.getValue());
- }
- if (this.isAlphaOr646ToNumericLatch(this.current.getPosition())) {
- this.current.incrementPosition(3);
- this.current.setNumeric();
- } else if (this.isAlphaTo646ToAlphaLatch(this.current.getPosition())) {
- if (this.current.getPosition() + 5 < this.information.getSize()) {
- this.current.incrementPosition(5);
- } else {
- this.current.setPosition(this.information.getSize());
- }
- this.current.setIsoIec646();
- }
- return new _BlockParsedResult.default(false);
- };
- GeneralAppIdDecoder.prototype.isStillIsoIec646 = function (pos) {
- if (pos + 5 > this.information.getSize()) {
- return false;
- }
- var fiveBitValue = this.extractNumericValueFromBitArray(pos, 5);
- if (fiveBitValue >= 5 && fiveBitValue < 16) {
- return true;
- }
- if (pos + 7 > this.information.getSize()) {
- return false;
- }
- var sevenBitValue = this.extractNumericValueFromBitArray(pos, 7);
- if (sevenBitValue >= 64 && sevenBitValue < 116) {
- return true;
- }
- if (pos + 8 > this.information.getSize()) {
- return false;
- }
- var eightBitValue = this.extractNumericValueFromBitArray(pos, 8);
- return eightBitValue >= 232 && eightBitValue < 253;
- };
- GeneralAppIdDecoder.prototype.decodeIsoIec646 = function (pos) {
- var fiveBitValue = this.extractNumericValueFromBitArray(pos, 5);
- if (fiveBitValue === 15) {
- return new _DecodedChar.default(pos + 5, _DecodedChar.default.FNC1);
- }
- if (fiveBitValue >= 5 && fiveBitValue < 15) {
- return new _DecodedChar.default(pos + 5, '0' + (fiveBitValue - 5));
- }
- var sevenBitValue = this.extractNumericValueFromBitArray(pos, 7);
- if (sevenBitValue >= 64 && sevenBitValue < 90) {
- return new _DecodedChar.default(pos + 7, '' + (sevenBitValue + 1));
- }
- if (sevenBitValue >= 90 && sevenBitValue < 116) {
- return new _DecodedChar.default(pos + 7, '' + (sevenBitValue + 7));
- }
- var eightBitValue = this.extractNumericValueFromBitArray(pos, 8);
- var c;
- switch (eightBitValue) {
- case 232:
- c = '!';
- break;
- case 233:
- c = '"';
- break;
- case 234:
- c = '%';
- break;
- case 235:
- c = '&';
- break;
- case 236:
- c = '\'';
- break;
- case 237:
- c = '(';
- break;
- case 238:
- c = ')';
- break;
- case 239:
- c = '*';
- break;
- case 240:
- c = '+';
- break;
- case 241:
- c = ',';
- break;
- case 242:
- c = '-';
- break;
- case 243:
- c = '.';
- break;
- case 244:
- c = '/';
- break;
- case 245:
- c = ':';
- break;
- case 246:
- c = ';';
- break;
- case 247:
- c = '<';
- break;
- case 248:
- c = '=';
- break;
- case 249:
- c = '>';
- break;
- case 250:
- c = '?';
- break;
- case 251:
- c = '_';
- break;
- case 252:
- c = ' ';
- break;
- default:
- throw new _FormatException.default();
- }
- return new _DecodedChar.default(pos + 8, c);
- };
- GeneralAppIdDecoder.prototype.isStillAlpha = function (pos) {
- if (pos + 5 > this.information.getSize()) {
- return false;
- }
- // We now check if it's a valid 5-bit value (0..9 and FNC1)
- var fiveBitValue = this.extractNumericValueFromBitArray(pos, 5);
- if (fiveBitValue >= 5 && fiveBitValue < 16) {
- return true;
- }
- if (pos + 6 > this.information.getSize()) {
- return false;
- }
- var sixBitValue = this.extractNumericValueFromBitArray(pos, 6);
- return sixBitValue >= 16 && sixBitValue < 63; // 63 not included
- };
- GeneralAppIdDecoder.prototype.decodeAlphanumeric = function (pos) {
- var fiveBitValue = this.extractNumericValueFromBitArray(pos, 5);
- if (fiveBitValue === 15) {
- return new _DecodedChar.default(pos + 5, _DecodedChar.default.FNC1);
- }
- if (fiveBitValue >= 5 && fiveBitValue < 15) {
- return new _DecodedChar.default(pos + 5, '0' + (fiveBitValue - 5));
- }
- var sixBitValue = this.extractNumericValueFromBitArray(pos, 6);
- if (sixBitValue >= 32 && sixBitValue < 58) {
- return new _DecodedChar.default(pos + 6, '' + (sixBitValue + 33));
- }
- var c;
- switch (sixBitValue) {
- case 58:
- c = '*';
- break;
- case 59:
- c = ',';
- break;
- case 60:
- c = '-';
- break;
- case 61:
- c = '.';
- break;
- case 62:
- c = '/';
- break;
- default:
- throw new _IllegalStateException.default('Decoding invalid alphanumeric value: ' + sixBitValue);
- }
- return new _DecodedChar.default(pos + 6, c);
- };
- GeneralAppIdDecoder.prototype.isAlphaTo646ToAlphaLatch = function (pos) {
- if (pos + 1 > this.information.getSize()) {
- return false;
- }
- for (var i = 0; i < 5 && i + pos < this.information.getSize(); ++i) {
- if (i === 2) {
- if (!this.information.get(pos + 2)) {
- return false;
- }
- } else if (this.information.get(pos + i)) {
- return false;
- }
- }
- return true;
- };
- GeneralAppIdDecoder.prototype.isAlphaOr646ToNumericLatch = function (pos) {
- // Next is alphanumeric if there are 3 positions and they are all zeros
- if (pos + 3 > this.information.getSize()) {
- return false;
- }
- for (var i = pos; i < pos + 3; ++i) {
- if (this.information.get(i)) {
- return false;
- }
- }
- return true;
- };
- GeneralAppIdDecoder.prototype.isNumericToAlphaNumericLatch = function (pos) {
- // Next is alphanumeric if there are 4 positions and they are all zeros, or
- // if there is a subset of this just before the end of the symbol
- if (pos + 1 > this.information.getSize()) {
- return false;
- }
- for (var i = 0; i < 4 && i + pos < this.information.getSize(); ++i) {
- if (this.information.get(pos + i)) {
- return false;
- }
- }
- return true;
- };
- return GeneralAppIdDecoder;
- }();
- var _default = GeneralAppIdDecoder;
- exports.default = _default;
- /***/ }),
- /* 382 */
- /*!****************************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/BlockParsedResult.js ***!
- \****************************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var BlockParsedResult = /** @class */function () {
- function BlockParsedResult(finished, decodedInformation) {
- if (decodedInformation) {
- this.decodedInformation = null;
- } else {
- this.finished = finished;
- this.decodedInformation = decodedInformation;
- }
- }
- BlockParsedResult.prototype.getDecodedInformation = function () {
- return this.decodedInformation;
- };
- BlockParsedResult.prototype.isFinished = function () {
- return this.finished;
- };
- return BlockParsedResult;
- }();
- var _default = BlockParsedResult;
- exports.default = _default;
- /***/ }),
- /* 383 */
- /*!**********************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/DecodedChar.js ***!
- \**********************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _DecodedObject = _interopRequireDefault(__webpack_require__(/*! ./DecodedObject */ 384));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var DecodedChar = /** @class */function (_super) {
- __extends(DecodedChar, _super);
- function DecodedChar(newPosition, value) {
- var _this = _super.call(this, newPosition) || this;
- _this.value = value;
- return _this;
- }
- DecodedChar.prototype.getValue = function () {
- return this.value;
- };
- DecodedChar.prototype.isFNC1 = function () {
- return this.value === DecodedChar.FNC1;
- };
- DecodedChar.FNC1 = '$';
- return DecodedChar;
- }(_DecodedObject.default);
- var _default = DecodedChar;
- exports.default = _default;
- /***/ }),
- /* 384 */
- /*!************************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/DecodedObject.js ***!
- \************************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var DecodedObject = /** @class */function () {
- function DecodedObject(newPosition) {
- this.newPosition = newPosition;
- }
- DecodedObject.prototype.getNewPosition = function () {
- return this.newPosition;
- };
- return DecodedObject;
- }();
- var _default = DecodedObject;
- exports.default = _default;
- /***/ }),
- /* 385 */
- /*!*****************************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/DecodedInformation.js ***!
- \*****************************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _DecodedObject = _interopRequireDefault(__webpack_require__(/*! ./DecodedObject */ 384));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var DecodedInformation = /** @class */function (_super) {
- __extends(DecodedInformation, _super);
- function DecodedInformation(newPosition, newString, remainingValue) {
- var _this = _super.call(this, newPosition) || this;
- if (remainingValue) {
- _this.remaining = true;
- _this.remainingValue = _this.remainingValue;
- } else {
- _this.remaining = false;
- _this.remainingValue = 0;
- }
- _this.newString = newString;
- return _this;
- }
- DecodedInformation.prototype.getNewString = function () {
- return this.newString;
- };
- DecodedInformation.prototype.isRemaining = function () {
- return this.remaining;
- };
- DecodedInformation.prototype.getRemainingValue = function () {
- return this.remainingValue;
- };
- return DecodedInformation;
- }(_DecodedObject.default);
- var _default = DecodedInformation;
- exports.default = _default;
- /***/ }),
- /* 386 */
- /*!*************************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/DecodedNumeric.js ***!
- \*************************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../../../../FormatException */ 324));
- var _DecodedObject = _interopRequireDefault(__webpack_require__(/*! ./DecodedObject */ 384));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var DecodedNumeric = /** @class */function (_super) {
- __extends(DecodedNumeric, _super);
- function DecodedNumeric(newPosition, firstDigit, secondDigit) {
- var _this = _super.call(this, newPosition) || this;
- if (firstDigit < 0 || firstDigit > 10 || secondDigit < 0 || secondDigit > 10) {
- throw new _FormatException.default();
- }
- _this.firstDigit = firstDigit;
- _this.secondDigit = secondDigit;
- return _this;
- }
- DecodedNumeric.prototype.getFirstDigit = function () {
- return this.firstDigit;
- };
- DecodedNumeric.prototype.getSecondDigit = function () {
- return this.secondDigit;
- };
- DecodedNumeric.prototype.getValue = function () {
- return this.firstDigit * 10 + this.secondDigit;
- };
- DecodedNumeric.prototype.isFirstDigitFNC1 = function () {
- return this.firstDigit === DecodedNumeric.FNC1;
- };
- DecodedNumeric.prototype.isSecondDigitFNC1 = function () {
- return this.secondDigit === DecodedNumeric.FNC1;
- };
- DecodedNumeric.prototype.isAnyFNC1 = function () {
- return this.firstDigit === DecodedNumeric.FNC1 || this.secondDigit === DecodedNumeric.FNC1;
- };
- DecodedNumeric.FNC1 = 10;
- return DecodedNumeric;
- }(_DecodedObject.default);
- var _default = DecodedNumeric;
- exports.default = _default;
- /***/ }),
- /* 387 */
- /*!**********************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/FieldParser.js ***!
- \**********************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../../../NotFoundException */ 327));
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- var FieldParser = /** @class */function () {
- function FieldParser() {}
- FieldParser.parseFieldsInGeneralPurpose = function (rawInformation) {
- var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
- if (!rawInformation) {
- return null;
- }
- // Processing 2-digit AIs
- if (rawInformation.length < 2) {
- throw new _NotFoundException.default();
- }
- var firstTwoDigits = rawInformation.substring(0, 2);
- try {
- for (var _e = __values(FieldParser.TWO_DIGIT_DATA_LENGTH), _f = _e.next(); !_f.done; _f = _e.next()) {
- var dataLength = _f.value;
- if (dataLength[0] === firstTwoDigits) {
- if (dataLength[1] === FieldParser.VARIABLE_LENGTH) {
- return FieldParser.processVariableAI(2, dataLength[2], rawInformation);
- }
- return FieldParser.processFixedAI(2, dataLength[1], rawInformation);
- }
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (_f && !_f.done && (_a = _e.return)) _a.call(_e);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- if (rawInformation.length < 3) {
- throw new _NotFoundException.default();
- }
- var firstThreeDigits = rawInformation.substring(0, 3);
- try {
- for (var _g = __values(FieldParser.THREE_DIGIT_DATA_LENGTH), _h = _g.next(); !_h.done; _h = _g.next()) {
- var dataLength = _h.value;
- if (dataLength[0] === firstThreeDigits) {
- if (dataLength[1] === FieldParser.VARIABLE_LENGTH) {
- return FieldParser.processVariableAI(3, dataLength[2], rawInformation);
- }
- return FieldParser.processFixedAI(3, dataLength[1], rawInformation);
- }
- }
- } catch (e_2_1) {
- e_2 = {
- error: e_2_1
- };
- } finally {
- try {
- if (_h && !_h.done && (_b = _g.return)) _b.call(_g);
- } finally {
- if (e_2) throw e_2.error;
- }
- }
- try {
- for (var _j = __values(FieldParser.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH), _k = _j.next(); !_k.done; _k = _j.next()) {
- var dataLength = _k.value;
- if (dataLength[0] === firstThreeDigits) {
- if (dataLength[1] === FieldParser.VARIABLE_LENGTH) {
- return FieldParser.processVariableAI(4, dataLength[2], rawInformation);
- }
- return FieldParser.processFixedAI(4, dataLength[1], rawInformation);
- }
- }
- } catch (e_3_1) {
- e_3 = {
- error: e_3_1
- };
- } finally {
- try {
- if (_k && !_k.done && (_c = _j.return)) _c.call(_j);
- } finally {
- if (e_3) throw e_3.error;
- }
- }
- if (rawInformation.length < 4) {
- throw new _NotFoundException.default();
- }
- var firstFourDigits = rawInformation.substring(0, 4);
- try {
- for (var _l = __values(FieldParser.FOUR_DIGIT_DATA_LENGTH), _m = _l.next(); !_m.done; _m = _l.next()) {
- var dataLength = _m.value;
- if (dataLength[0] === firstFourDigits) {
- if (dataLength[1] === FieldParser.VARIABLE_LENGTH) {
- return FieldParser.processVariableAI(4, dataLength[2], rawInformation);
- }
- return FieldParser.processFixedAI(4, dataLength[1], rawInformation);
- }
- }
- } catch (e_4_1) {
- e_4 = {
- error: e_4_1
- };
- } finally {
- try {
- if (_m && !_m.done && (_d = _l.return)) _d.call(_l);
- } finally {
- if (e_4) throw e_4.error;
- }
- }
- throw new _NotFoundException.default();
- };
- FieldParser.processFixedAI = function (aiSize, fieldSize, rawInformation) {
- if (rawInformation.length < aiSize) {
- throw new _NotFoundException.default();
- }
- var ai = rawInformation.substring(0, aiSize);
- if (rawInformation.length < aiSize + fieldSize) {
- throw new _NotFoundException.default();
- }
- var field = rawInformation.substring(aiSize, aiSize + fieldSize);
- var remaining = rawInformation.substring(aiSize + fieldSize);
- var result = '(' + ai + ')' + field;
- var parsedAI = FieldParser.parseFieldsInGeneralPurpose(remaining);
- return parsedAI == null ? result : result + parsedAI;
- };
- FieldParser.processVariableAI = function (aiSize, variableFieldSize, rawInformation) {
- var ai = rawInformation.substring(0, aiSize);
- var maxSize;
- if (rawInformation.length < aiSize + variableFieldSize) {
- maxSize = rawInformation.length;
- } else {
- maxSize = aiSize + variableFieldSize;
- }
- var field = rawInformation.substring(aiSize, maxSize);
- var remaining = rawInformation.substring(maxSize);
- var result = '(' + ai + ')' + field;
- var parsedAI = FieldParser.parseFieldsInGeneralPurpose(remaining);
- return parsedAI == null ? result : result + parsedAI;
- };
- FieldParser.VARIABLE_LENGTH = [];
- FieldParser.TWO_DIGIT_DATA_LENGTH = [['00', 18], ['01', 14], ['02', 14], ['10', FieldParser.VARIABLE_LENGTH, 20], ['11', 6], ['12', 6], ['13', 6], ['15', 6], ['17', 6], ['20', 2], ['21', FieldParser.VARIABLE_LENGTH, 20], ['22', FieldParser.VARIABLE_LENGTH, 29], ['30', FieldParser.VARIABLE_LENGTH, 8], ['37', FieldParser.VARIABLE_LENGTH, 8],
- // internal company codes
- ['90', FieldParser.VARIABLE_LENGTH, 30], ['91', FieldParser.VARIABLE_LENGTH, 30], ['92', FieldParser.VARIABLE_LENGTH, 30], ['93', FieldParser.VARIABLE_LENGTH, 30], ['94', FieldParser.VARIABLE_LENGTH, 30], ['95', FieldParser.VARIABLE_LENGTH, 30], ['96', FieldParser.VARIABLE_LENGTH, 30], ['97', FieldParser.VARIABLE_LENGTH, 3], ['98', FieldParser.VARIABLE_LENGTH, 30], ['99', FieldParser.VARIABLE_LENGTH, 30]];
- FieldParser.THREE_DIGIT_DATA_LENGTH = [
- // Same format as above
- ['240', FieldParser.VARIABLE_LENGTH, 30], ['241', FieldParser.VARIABLE_LENGTH, 30], ['242', FieldParser.VARIABLE_LENGTH, 6], ['250', FieldParser.VARIABLE_LENGTH, 30], ['251', FieldParser.VARIABLE_LENGTH, 30], ['253', FieldParser.VARIABLE_LENGTH, 17], ['254', FieldParser.VARIABLE_LENGTH, 20], ['400', FieldParser.VARIABLE_LENGTH, 30], ['401', FieldParser.VARIABLE_LENGTH, 30], ['402', 17], ['403', FieldParser.VARIABLE_LENGTH, 30], ['410', 13], ['411', 13], ['412', 13], ['413', 13], ['414', 13], ['420', FieldParser.VARIABLE_LENGTH, 20], ['421', FieldParser.VARIABLE_LENGTH, 15], ['422', 3], ['423', FieldParser.VARIABLE_LENGTH, 15], ['424', 3], ['425', 3], ['426', 3]];
- FieldParser.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH = [
- // Same format as above
- ['310', 6], ['311', 6], ['312', 6], ['313', 6], ['314', 6], ['315', 6], ['316', 6], ['320', 6], ['321', 6], ['322', 6], ['323', 6], ['324', 6], ['325', 6], ['326', 6], ['327', 6], ['328', 6], ['329', 6], ['330', 6], ['331', 6], ['332', 6], ['333', 6], ['334', 6], ['335', 6], ['336', 6], ['340', 6], ['341', 6], ['342', 6], ['343', 6], ['344', 6], ['345', 6], ['346', 6], ['347', 6], ['348', 6], ['349', 6], ['350', 6], ['351', 6], ['352', 6], ['353', 6], ['354', 6], ['355', 6], ['356', 6], ['357', 6], ['360', 6], ['361', 6], ['362', 6], ['363', 6], ['364', 6], ['365', 6], ['366', 6], ['367', 6], ['368', 6], ['369', 6], ['390', FieldParser.VARIABLE_LENGTH, 15], ['391', FieldParser.VARIABLE_LENGTH, 18], ['392', FieldParser.VARIABLE_LENGTH, 15], ['393', FieldParser.VARIABLE_LENGTH, 18], ['703', FieldParser.VARIABLE_LENGTH, 30]];
- FieldParser.FOUR_DIGIT_DATA_LENGTH = [
- // Same format as above
- ['7001', 13], ['7002', FieldParser.VARIABLE_LENGTH, 30], ['7003', 10], ['8001', 14], ['8002', FieldParser.VARIABLE_LENGTH, 20], ['8003', FieldParser.VARIABLE_LENGTH, 30], ['8004', FieldParser.VARIABLE_LENGTH, 30], ['8005', 6], ['8006', 18], ['8007', FieldParser.VARIABLE_LENGTH, 30], ['8008', FieldParser.VARIABLE_LENGTH, 12], ['8018', 18], ['8020', FieldParser.VARIABLE_LENGTH, 25], ['8100', 6], ['8101', 10], ['8102', 2], ['8110', FieldParser.VARIABLE_LENGTH, 70], ['8200', FieldParser.VARIABLE_LENGTH, 70]];
- return FieldParser;
- }();
- var _default = FieldParser;
- exports.default = _default;
- /***/ }),
- /* 388 */
- /*!**************************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/AI01AndOtherAIs.js ***!
- \**************************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _AI01decoder = _interopRequireDefault(__webpack_require__(/*! ./AI01decoder */ 389));
- var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../../../util/StringBuilder */ 320));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var AI01AndOtherAIs = /** @class */function (_super) {
- __extends(AI01AndOtherAIs, _super);
- // the second one is the encodation method, and the other two are for the variable length
- function AI01AndOtherAIs(information) {
- return _super.call(this, information) || this;
- }
- AI01AndOtherAIs.prototype.parseInformation = function () {
- var buff = new _StringBuilder.default();
- buff.append('(01)');
- var initialGtinPosition = buff.length();
- var firstGtinDigit = this.getGeneralDecoder().extractNumericValueFromBitArray(AI01AndOtherAIs.HEADER_SIZE, 4);
- buff.append(firstGtinDigit);
- this.encodeCompressedGtinWithoutAI(buff, AI01AndOtherAIs.HEADER_SIZE + 4, initialGtinPosition);
- return this.getGeneralDecoder().decodeAllCodes(buff, AI01AndOtherAIs.HEADER_SIZE + 44);
- };
- AI01AndOtherAIs.HEADER_SIZE = 1 + 1 + 2; // first bit encodes the linkage flag,
- return AI01AndOtherAIs;
- }(_AI01decoder.default);
- var _default = AI01AndOtherAIs;
- exports.default = _default;
- /***/ }),
- /* 389 */
- /*!**********************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/AI01decoder.js ***!
- \**********************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _AbstractExpandedDecoder = _interopRequireDefault(__webpack_require__(/*! ./AbstractExpandedDecoder */ 390));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var AI01decoder = /** @class */function (_super) {
- __extends(AI01decoder, _super);
- function AI01decoder(information) {
- return _super.call(this, information) || this;
- }
- AI01decoder.prototype.encodeCompressedGtin = function (buf, currentPos) {
- buf.append('(01)');
- var initialPosition = buf.length();
- buf.append('9');
- this.encodeCompressedGtinWithoutAI(buf, currentPos, initialPosition);
- };
- AI01decoder.prototype.encodeCompressedGtinWithoutAI = function (buf, currentPos, initialBufferPosition) {
- for (var i = 0; i < 4; ++i) {
- var currentBlock = this.getGeneralDecoder().extractNumericValueFromBitArray(currentPos + 10 * i, 10);
- if (currentBlock / 100 === 0) {
- buf.append('0');
- }
- if (currentBlock / 10 === 0) {
- buf.append('0');
- }
- buf.append(currentBlock);
- }
- AI01decoder.appendCheckDigit(buf, initialBufferPosition);
- };
- AI01decoder.appendCheckDigit = function (buf, currentPos) {
- var checkDigit = 0;
- for (var i = 0; i < 13; i++) {
- // let digit = buf.charAt(i + currentPos) - '0';
- // To be checked
- var digit = buf.charAt(i + currentPos).charCodeAt(0) - '0'.charCodeAt(0);
- checkDigit += (i & 0x01) === 0 ? 3 * digit : digit;
- }
- checkDigit = 10 - checkDigit % 10;
- if (checkDigit === 10) {
- checkDigit = 0;
- }
- buf.append(checkDigit);
- };
- AI01decoder.GTIN_SIZE = 40;
- return AI01decoder;
- }(_AbstractExpandedDecoder.default);
- var _default = AI01decoder;
- exports.default = _default;
- /***/ }),
- /* 390 */
- /*!**********************************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/AbstractExpandedDecoder.js ***!
- \**********************************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _GeneralAppIdDecoder = _interopRequireDefault(__webpack_require__(/*! ./GeneralAppIdDecoder */ 381));
- var AbstractExpandedDecoder = /** @class */function () {
- function AbstractExpandedDecoder(information) {
- this.information = information;
- this.generalDecoder = new _GeneralAppIdDecoder.default(information);
- }
- AbstractExpandedDecoder.prototype.getInformation = function () {
- return this.information;
- };
- AbstractExpandedDecoder.prototype.getGeneralDecoder = function () {
- return this.generalDecoder;
- };
- return AbstractExpandedDecoder;
- }();
- var _default = AbstractExpandedDecoder;
- exports.default = _default;
- /***/ }),
- /* 391 */
- /*!***********************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/AnyAIDecoder.js ***!
- \***********************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../../../util/StringBuilder */ 320));
- var _AbstractExpandedDecoder = _interopRequireDefault(__webpack_require__(/*! ./AbstractExpandedDecoder */ 390));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var AnyAIDecoder = /** @class */function (_super) {
- __extends(AnyAIDecoder, _super);
- function AnyAIDecoder(information) {
- return _super.call(this, information) || this;
- }
- AnyAIDecoder.prototype.parseInformation = function () {
- var buf = new _StringBuilder.default();
- return this.getGeneralDecoder().decodeAllCodes(buf, AnyAIDecoder.HEADER_SIZE);
- };
- AnyAIDecoder.HEADER_SIZE = 2 + 1 + 2;
- return AnyAIDecoder;
- }(_AbstractExpandedDecoder.default);
- var _default = AnyAIDecoder;
- exports.default = _default;
- /***/ }),
- /* 392 */
- /*!**************************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/AI013103decoder.js ***!
- \**************************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _AI013x0xDecoder = _interopRequireDefault(__webpack_require__(/*! ./AI013x0xDecoder */ 393));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var AI013103decoder = /** @class */function (_super) {
- __extends(AI013103decoder, _super);
- function AI013103decoder(information) {
- return _super.call(this, information) || this;
- }
- AI013103decoder.prototype.addWeightCode = function (buf, weight) {
- buf.append('(3103)');
- };
- AI013103decoder.prototype.checkWeight = function (weight) {
- return weight;
- };
- return AI013103decoder;
- }(_AI013x0xDecoder.default);
- var _default = AI013103decoder;
- exports.default = _default;
- /***/ }),
- /* 393 */
- /*!**************************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/AI013x0xDecoder.js ***!
- \**************************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _AI01weightDecoder = _interopRequireDefault(__webpack_require__(/*! ./AI01weightDecoder */ 394));
- var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../../../util/StringBuilder */ 320));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../../../NotFoundException */ 327));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var AI013x0xDecoder = /** @class */function (_super) {
- __extends(AI013x0xDecoder, _super);
- function AI013x0xDecoder(information) {
- return _super.call(this, information) || this;
- }
- AI013x0xDecoder.prototype.parseInformation = function () {
- if (this.getInformation().getSize() !== AI013x0xDecoder.HEADER_SIZE + _AI01weightDecoder.default.GTIN_SIZE + AI013x0xDecoder.WEIGHT_SIZE) {
- throw new _NotFoundException.default();
- }
- var buf = new _StringBuilder.default();
- this.encodeCompressedGtin(buf, AI013x0xDecoder.HEADER_SIZE);
- this.encodeCompressedWeight(buf, AI013x0xDecoder.HEADER_SIZE + _AI01weightDecoder.default.GTIN_SIZE, AI013x0xDecoder.WEIGHT_SIZE);
- return buf.toString();
- };
- AI013x0xDecoder.HEADER_SIZE = 4 + 1;
- AI013x0xDecoder.WEIGHT_SIZE = 15;
- return AI013x0xDecoder;
- }(_AI01weightDecoder.default);
- var _default = AI013x0xDecoder;
- exports.default = _default;
- /***/ }),
- /* 394 */
- /*!****************************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/AI01weightDecoder.js ***!
- \****************************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _AI01decoder = _interopRequireDefault(__webpack_require__(/*! ./AI01decoder */ 389));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var AI01weightDecoder = /** @class */function (_super) {
- __extends(AI01weightDecoder, _super);
- function AI01weightDecoder(information) {
- return _super.call(this, information) || this;
- }
- AI01weightDecoder.prototype.encodeCompressedWeight = function (buf, currentPos, weightSize) {
- var originalWeightNumeric = this.getGeneralDecoder().extractNumericValueFromBitArray(currentPos, weightSize);
- this.addWeightCode(buf, originalWeightNumeric);
- var weightNumeric = this.checkWeight(originalWeightNumeric);
- var currentDivisor = 100000;
- for (var i = 0; i < 5; ++i) {
- if (weightNumeric / currentDivisor === 0) {
- buf.append('0');
- }
- currentDivisor /= 10;
- }
- buf.append(weightNumeric);
- };
- return AI01weightDecoder;
- }(_AI01decoder.default);
- var _default = AI01weightDecoder;
- exports.default = _default;
- /***/ }),
- /* 395 */
- /*!**************************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/AI01320xDecoder.js ***!
- \**************************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _AI013x0xDecoder = _interopRequireDefault(__webpack_require__(/*! ./AI013x0xDecoder */ 393));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var AI01320xDecoder = /** @class */function (_super) {
- __extends(AI01320xDecoder, _super);
- function AI01320xDecoder(information) {
- return _super.call(this, information) || this;
- }
- AI01320xDecoder.prototype.addWeightCode = function (buf, weight) {
- if (weight < 10000) {
- buf.append('(3202)');
- } else {
- buf.append('(3203)');
- }
- };
- AI01320xDecoder.prototype.checkWeight = function (weight) {
- if (weight < 10000) {
- return weight;
- }
- return weight - 10000;
- };
- return AI01320xDecoder;
- }(_AI013x0xDecoder.default);
- var _default = AI01320xDecoder;
- exports.default = _default;
- /***/ }),
- /* 396 */
- /*!**************************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/AI01392xDecoder.js ***!
- \**************************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _AI01decoder = _interopRequireDefault(__webpack_require__(/*! ./AI01decoder */ 389));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../../../NotFoundException */ 327));
- var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../../../util/StringBuilder */ 320));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var AI01392xDecoder = /** @class */function (_super) {
- __extends(AI01392xDecoder, _super);
- function AI01392xDecoder(information) {
- return _super.call(this, information) || this;
- }
- AI01392xDecoder.prototype.parseInformation = function () {
- if (this.getInformation().getSize() < AI01392xDecoder.HEADER_SIZE + _AI01decoder.default.GTIN_SIZE) {
- throw new _NotFoundException.default();
- }
- var buf = new _StringBuilder.default();
- this.encodeCompressedGtin(buf, AI01392xDecoder.HEADER_SIZE);
- var lastAIdigit = this.getGeneralDecoder().extractNumericValueFromBitArray(AI01392xDecoder.HEADER_SIZE + _AI01decoder.default.GTIN_SIZE, AI01392xDecoder.LAST_DIGIT_SIZE);
- buf.append('(392');
- buf.append(lastAIdigit);
- buf.append(')');
- var decodedInformation = this.getGeneralDecoder().decodeGeneralPurposeField(AI01392xDecoder.HEADER_SIZE + _AI01decoder.default.GTIN_SIZE + AI01392xDecoder.LAST_DIGIT_SIZE, null);
- buf.append(decodedInformation.getNewString());
- return buf.toString();
- };
- AI01392xDecoder.HEADER_SIZE = 5 + 1 + 2;
- AI01392xDecoder.LAST_DIGIT_SIZE = 2;
- return AI01392xDecoder;
- }(_AI01decoder.default);
- var _default = AI01392xDecoder;
- exports.default = _default;
- /***/ }),
- /* 397 */
- /*!**************************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/AI01393xDecoder.js ***!
- \**************************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _AI01decoder = _interopRequireDefault(__webpack_require__(/*! ./AI01decoder */ 389));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../../../NotFoundException */ 327));
- var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../../../util/StringBuilder */ 320));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var AI01393xDecoder = /** @class */function (_super) {
- __extends(AI01393xDecoder, _super);
- function AI01393xDecoder(information) {
- return _super.call(this, information) || this;
- }
- AI01393xDecoder.prototype.parseInformation = function () {
- if (this.getInformation().getSize() < AI01393xDecoder.HEADER_SIZE + _AI01decoder.default.GTIN_SIZE) {
- throw new _NotFoundException.default();
- }
- var buf = new _StringBuilder.default();
- this.encodeCompressedGtin(buf, AI01393xDecoder.HEADER_SIZE);
- var lastAIdigit = this.getGeneralDecoder().extractNumericValueFromBitArray(AI01393xDecoder.HEADER_SIZE + _AI01decoder.default.GTIN_SIZE, AI01393xDecoder.LAST_DIGIT_SIZE);
- buf.append('(393');
- buf.append(lastAIdigit);
- buf.append(')');
- var firstThreeDigits = this.getGeneralDecoder().extractNumericValueFromBitArray(AI01393xDecoder.HEADER_SIZE + _AI01decoder.default.GTIN_SIZE + AI01393xDecoder.LAST_DIGIT_SIZE, AI01393xDecoder.FIRST_THREE_DIGITS_SIZE);
- if (firstThreeDigits / 100 === 0) {
- buf.append('0');
- }
- if (firstThreeDigits / 10 === 0) {
- buf.append('0');
- }
- buf.append(firstThreeDigits);
- var generalInformation = this.getGeneralDecoder().decodeGeneralPurposeField(AI01393xDecoder.HEADER_SIZE + _AI01decoder.default.GTIN_SIZE + AI01393xDecoder.LAST_DIGIT_SIZE + AI01393xDecoder.FIRST_THREE_DIGITS_SIZE, null);
- buf.append(generalInformation.getNewString());
- return buf.toString();
- };
- AI01393xDecoder.HEADER_SIZE = 5 + 1 + 2;
- AI01393xDecoder.LAST_DIGIT_SIZE = 2;
- AI01393xDecoder.FIRST_THREE_DIGITS_SIZE = 10;
- return AI01393xDecoder;
- }(_AI01decoder.default);
- var _default = AI01393xDecoder;
- exports.default = _default;
- /***/ }),
- /* 398 */
- /*!****************************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/AI013x0x1xDecoder.js ***!
- \****************************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _AI01weightDecoder = _interopRequireDefault(__webpack_require__(/*! ./AI01weightDecoder */ 394));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../../../NotFoundException */ 327));
- var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../../../util/StringBuilder */ 320));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var AI013x0x1xDecoder = /** @class */function (_super) {
- __extends(AI013x0x1xDecoder, _super);
- function AI013x0x1xDecoder(information, firstAIdigits, dateCode) {
- var _this = _super.call(this, information) || this;
- _this.dateCode = dateCode;
- _this.firstAIdigits = firstAIdigits;
- return _this;
- }
- AI013x0x1xDecoder.prototype.parseInformation = function () {
- if (this.getInformation().getSize() !== AI013x0x1xDecoder.HEADER_SIZE + AI013x0x1xDecoder.GTIN_SIZE + AI013x0x1xDecoder.WEIGHT_SIZE + AI013x0x1xDecoder.DATE_SIZE) {
- throw new _NotFoundException.default();
- }
- var buf = new _StringBuilder.default();
- this.encodeCompressedGtin(buf, AI013x0x1xDecoder.HEADER_SIZE);
- this.encodeCompressedWeight(buf, AI013x0x1xDecoder.HEADER_SIZE + AI013x0x1xDecoder.GTIN_SIZE, AI013x0x1xDecoder.WEIGHT_SIZE);
- this.encodeCompressedDate(buf, AI013x0x1xDecoder.HEADER_SIZE + AI013x0x1xDecoder.GTIN_SIZE + AI013x0x1xDecoder.WEIGHT_SIZE);
- return buf.toString();
- };
- AI013x0x1xDecoder.prototype.encodeCompressedDate = function (buf, currentPos) {
- var numericDate = this.getGeneralDecoder().extractNumericValueFromBitArray(currentPos, AI013x0x1xDecoder.DATE_SIZE);
- if (numericDate === 38400) {
- return;
- }
- buf.append('(');
- buf.append(this.dateCode);
- buf.append(')');
- var day = numericDate % 32;
- numericDate /= 32;
- var month = numericDate % 12 + 1;
- numericDate /= 12;
- var year = numericDate;
- if (year / 10 === 0) {
- buf.append('0');
- }
- buf.append(year);
- if (month / 10 === 0) {
- buf.append('0');
- }
- buf.append(month);
- if (day / 10 === 0) {
- buf.append('0');
- }
- buf.append(day);
- };
- AI013x0x1xDecoder.prototype.addWeightCode = function (buf, weight) {
- buf.append('(');
- buf.append(this.firstAIdigits);
- buf.append(weight / 100000);
- buf.append(')');
- };
- AI013x0x1xDecoder.prototype.checkWeight = function (weight) {
- return weight % 100000;
- };
- AI013x0x1xDecoder.HEADER_SIZE = 7 + 1;
- AI013x0x1xDecoder.WEIGHT_SIZE = 20;
- AI013x0x1xDecoder.DATE_SIZE = 16;
- return AI013x0x1xDecoder;
- }(_AI01weightDecoder.default);
- var _default = AI013x0x1xDecoder;
- exports.default = _default;
- /***/ }),
- /* 399 */
- /*!**************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/ExpandedPair.js ***!
- \**************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var ExpandedPair = /** @class */function () {
- function ExpandedPair(leftChar, rightChar, finderPatter, mayBeLast) {
- this.leftchar = leftChar;
- this.rightchar = rightChar;
- this.finderpattern = finderPatter;
- this.maybeLast = mayBeLast;
- }
- ExpandedPair.prototype.mayBeLast = function () {
- return this.maybeLast;
- };
- ExpandedPair.prototype.getLeftChar = function () {
- return this.leftchar;
- };
- ExpandedPair.prototype.getRightChar = function () {
- return this.rightchar;
- };
- ExpandedPair.prototype.getFinderPattern = function () {
- return this.finderpattern;
- };
- ExpandedPair.prototype.mustBeLast = function () {
- return this.rightchar == null;
- };
- ExpandedPair.prototype.toString = function () {
- return '[ ' + this.leftchar + ', ' + this.rightchar + ' : ' + (this.finderpattern == null ? 'null' : this.finderpattern.getValue()) + ' ]';
- };
- ExpandedPair.equals = function (o1, o2) {
- if (!(o1 instanceof ExpandedPair)) {
- return false;
- }
- return ExpandedPair.equalsOrNull(o1.leftchar, o2.leftchar) && ExpandedPair.equalsOrNull(o1.rightchar, o2.rightchar) && ExpandedPair.equalsOrNull(o1.finderpattern, o2.finderpattern);
- };
- ExpandedPair.equalsOrNull = function (o1, o2) {
- return o1 === null ? o2 === null : ExpandedPair.equals(o1, o2);
- };
- ExpandedPair.prototype.hashCode = function () {
- // return ExpandedPair.hashNotNull(leftChar) ^ hashNotNull(rightChar) ^ hashNotNull(finderPattern);
- var value = this.leftchar.getValue() ^ this.rightchar.getValue() ^ this.finderpattern.getValue();
- return value;
- };
- return ExpandedPair;
- }();
- var _default = ExpandedPair;
- exports.default = _default;
- /***/ }),
- /* 400 */
- /*!*************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/ExpandedRow.js ***!
- \*************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var ExpandedRow = /** @class */function () {
- function ExpandedRow(pairs, rowNumber, wasReversed) {
- this.pairs = pairs;
- this.rowNumber = rowNumber;
- this.wasReversed = wasReversed;
- }
- ExpandedRow.prototype.getPairs = function () {
- return this.pairs;
- };
- ExpandedRow.prototype.getRowNumber = function () {
- return this.rowNumber;
- };
- ExpandedRow.prototype.isReversed = function () {
- return this.wasReversed;
- };
- // check implementation
- ExpandedRow.prototype.isEquivalent = function (otherPairs) {
- return this.checkEqualitity(this, otherPairs);
- };
- // @Override
- ExpandedRow.prototype.toString = function () {
- return '{ ' + this.pairs + ' }';
- };
- /**
- * Two rows are equal if they contain the same pairs in the same order.
- */
- // @Override
- // check implementation
- ExpandedRow.prototype.equals = function (o1, o2) {
- if (!(o1 instanceof ExpandedRow)) {
- return false;
- }
- return this.checkEqualitity(o1, o2) && o1.wasReversed === o2.wasReversed;
- };
- ExpandedRow.prototype.checkEqualitity = function (pair1, pair2) {
- if (!pair1 || !pair2) return;
- var result;
- pair1.forEach(function (e1, i) {
- pair2.forEach(function (e2) {
- if (e1.getLeftChar().getValue() === e2.getLeftChar().getValue() && e1.getRightChar().getValue() === e2.getRightChar().getValue() && e1.getFinderPatter().getValue() === e2.getFinderPatter().getValue()) {
- result = true;
- }
- });
- });
- return result;
- };
- return ExpandedRow;
- }();
- var _default = ExpandedRow;
- exports.default = _default;
- /***/ }),
- /* 401 */
- /*!****************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/RSS14Reader.js ***!
- \****************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _AbstractRSSReader = _interopRequireDefault(__webpack_require__(/*! ./AbstractRSSReader */ 375));
- var _Pair = _interopRequireDefault(__webpack_require__(/*! ./Pair */ 402));
- var _Result = _interopRequireDefault(__webpack_require__(/*! ../../Result */ 333));
- var _DecodeHintType = _interopRequireDefault(__webpack_require__(/*! ../../DecodeHintType */ 322));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../NotFoundException */ 327));
- var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../util/StringBuilder */ 320));
- var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../../BarcodeFormat */ 334));
- var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../../ResultPoint */ 346));
- var _FinderPattern = _interopRequireDefault(__webpack_require__(/*! ./FinderPattern */ 377));
- var _DataCharacter = _interopRequireDefault(__webpack_require__(/*! ./DataCharacter */ 376));
- var _MathUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/detector/MathUtils */ 347));
- var _RSSUtils = _interopRequireDefault(__webpack_require__(/*! ./RSSUtils */ 378));
- var _System = _interopRequireDefault(__webpack_require__(/*! ../../util/System */ 315));
- var _OneDReader = _interopRequireDefault(__webpack_require__(/*! ../OneDReader */ 359));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- var RSS14Reader = /** @class */function (_super) {
- __extends(RSS14Reader, _super);
- function RSS14Reader() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- _this.possibleLeftPairs = [];
- _this.possibleRightPairs = [];
- return _this;
- }
- RSS14Reader.prototype.decodeRow = function (rowNumber, row, hints) {
- var e_1, _a, e_2, _b;
- var leftPair = this.decodePair(row, false, rowNumber, hints);
- RSS14Reader.addOrTally(this.possibleLeftPairs, leftPair);
- row.reverse();
- var rightPair = this.decodePair(row, true, rowNumber, hints);
- RSS14Reader.addOrTally(this.possibleRightPairs, rightPair);
- row.reverse();
- try {
- for (var _c = __values(this.possibleLeftPairs), _d = _c.next(); !_d.done; _d = _c.next()) {
- var left = _d.value;
- if (left.getCount() > 1) {
- try {
- for (var _e = (e_2 = void 0, __values(this.possibleRightPairs)), _f = _e.next(); !_f.done; _f = _e.next()) {
- var right = _f.value;
- if (right.getCount() > 1 && RSS14Reader.checkChecksum(left, right)) {
- return RSS14Reader.constructResult(left, right);
- }
- }
- } catch (e_2_1) {
- e_2 = {
- error: e_2_1
- };
- } finally {
- try {
- if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
- } finally {
- if (e_2) throw e_2.error;
- }
- }
- }
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- throw new _NotFoundException.default();
- };
- RSS14Reader.addOrTally = function (possiblePairs, pair) {
- var e_3, _a;
- if (pair == null) {
- return;
- }
- var found = false;
- try {
- for (var possiblePairs_1 = __values(possiblePairs), possiblePairs_1_1 = possiblePairs_1.next(); !possiblePairs_1_1.done; possiblePairs_1_1 = possiblePairs_1.next()) {
- var other = possiblePairs_1_1.value;
- if (other.getValue() === pair.getValue()) {
- other.incrementCount();
- found = true;
- break;
- }
- }
- } catch (e_3_1) {
- e_3 = {
- error: e_3_1
- };
- } finally {
- try {
- if (possiblePairs_1_1 && !possiblePairs_1_1.done && (_a = possiblePairs_1.return)) _a.call(possiblePairs_1);
- } finally {
- if (e_3) throw e_3.error;
- }
- }
- if (!found) {
- possiblePairs.push(pair);
- }
- };
- RSS14Reader.prototype.reset = function () {
- this.possibleLeftPairs.length = 0;
- this.possibleRightPairs.length = 0;
- };
- RSS14Reader.constructResult = function (leftPair, rightPair) {
- var symbolValue = 4537077 * leftPair.getValue() + rightPair.getValue();
- var text = new String(symbolValue).toString();
- var buffer = new _StringBuilder.default();
- for (var i = 13 - text.length; i > 0; i--) {
- buffer.append('0');
- }
- buffer.append(text);
- var checkDigit = 0;
- for (var i = 0; i < 13; i++) {
- var digit = buffer.charAt(i).charCodeAt(0) - '0'.charCodeAt(0);
- checkDigit += (i & 0x01) === 0 ? 3 * digit : digit;
- }
- checkDigit = 10 - checkDigit % 10;
- if (checkDigit === 10) {
- checkDigit = 0;
- }
- buffer.append(checkDigit.toString());
- var leftPoints = leftPair.getFinderPattern().getResultPoints();
- var rightPoints = rightPair.getFinderPattern().getResultPoints();
- return new _Result.default(buffer.toString(), null, 0, [leftPoints[0], leftPoints[1], rightPoints[0], rightPoints[1]], _BarcodeFormat.default.RSS_14, new Date().getTime());
- };
- RSS14Reader.checkChecksum = function (leftPair, rightPair) {
- var checkValue = (leftPair.getChecksumPortion() + 16 * rightPair.getChecksumPortion()) % 79;
- var targetCheckValue = 9 * leftPair.getFinderPattern().getValue() + rightPair.getFinderPattern().getValue();
- if (targetCheckValue > 72) {
- targetCheckValue--;
- }
- if (targetCheckValue > 8) {
- targetCheckValue--;
- }
- return checkValue === targetCheckValue;
- };
- RSS14Reader.prototype.decodePair = function (row, right, rowNumber, hints) {
- try {
- var startEnd = this.findFinderPattern(row, right);
- var pattern = this.parseFoundFinderPattern(row, rowNumber, right, startEnd);
- var resultPointCallback = hints == null ? null : hints.get(_DecodeHintType.default.NEED_RESULT_POINT_CALLBACK);
- if (resultPointCallback != null) {
- var center = (startEnd[0] + startEnd[1]) / 2.0;
- if (right) {
- // row is actually reversed
- center = row.getSize() - 1 - center;
- }
- resultPointCallback.foundPossibleResultPoint(new _ResultPoint.default(center, rowNumber));
- }
- var outside = this.decodeDataCharacter(row, pattern, true);
- var inside = this.decodeDataCharacter(row, pattern, false);
- return new _Pair.default(1597 * outside.getValue() + inside.getValue(), outside.getChecksumPortion() + 4 * inside.getChecksumPortion(), pattern);
- } catch (err) {
- return null;
- }
- };
- RSS14Reader.prototype.decodeDataCharacter = function (row, pattern, outsideChar) {
- var counters = this.getDataCharacterCounters();
- for (var x = 0; x < counters.length; x++) {
- counters[x] = 0;
- }
- if (outsideChar) {
- _OneDReader.default.recordPatternInReverse(row, pattern.getStartEnd()[0], counters);
- } else {
- _OneDReader.default.recordPattern(row, pattern.getStartEnd()[1] + 1, counters);
- // reverse it
- for (var i = 0, j = counters.length - 1; i < j; i++, j--) {
- var temp = counters[i];
- counters[i] = counters[j];
- counters[j] = temp;
- }
- }
- var numModules = outsideChar ? 16 : 15;
- var elementWidth = _MathUtils.default.sum(new Int32Array(counters)) / numModules;
- var oddCounts = this.getOddCounts();
- var evenCounts = this.getEvenCounts();
- var oddRoundingErrors = this.getOddRoundingErrors();
- var evenRoundingErrors = this.getEvenRoundingErrors();
- for (var i = 0; i < counters.length; i++) {
- var value = counters[i] / elementWidth;
- var count = Math.floor(value + 0.5);
- if (count < 1) {
- count = 1;
- } else if (count > 8) {
- count = 8;
- }
- var offset = Math.floor(i / 2);
- if ((i & 0x01) === 0) {
- oddCounts[offset] = count;
- oddRoundingErrors[offset] = value - count;
- } else {
- evenCounts[offset] = count;
- evenRoundingErrors[offset] = value - count;
- }
- }
- this.adjustOddEvenCounts(outsideChar, numModules);
- var oddSum = 0;
- var oddChecksumPortion = 0;
- for (var i = oddCounts.length - 1; i >= 0; i--) {
- oddChecksumPortion *= 9;
- oddChecksumPortion += oddCounts[i];
- oddSum += oddCounts[i];
- }
- var evenChecksumPortion = 0;
- var evenSum = 0;
- for (var i = evenCounts.length - 1; i >= 0; i--) {
- evenChecksumPortion *= 9;
- evenChecksumPortion += evenCounts[i];
- evenSum += evenCounts[i];
- }
- var checksumPortion = oddChecksumPortion + 3 * evenChecksumPortion;
- if (outsideChar) {
- if ((oddSum & 0x01) !== 0 || oddSum > 12 || oddSum < 4) {
- throw new _NotFoundException.default();
- }
- var group = (12 - oddSum) / 2;
- var oddWidest = RSS14Reader.OUTSIDE_ODD_WIDEST[group];
- var evenWidest = 9 - oddWidest;
- var vOdd = _RSSUtils.default.getRSSvalue(oddCounts, oddWidest, false);
- var vEven = _RSSUtils.default.getRSSvalue(evenCounts, evenWidest, true);
- var tEven = RSS14Reader.OUTSIDE_EVEN_TOTAL_SUBSET[group];
- var gSum = RSS14Reader.OUTSIDE_GSUM[group];
- return new _DataCharacter.default(vOdd * tEven + vEven + gSum, checksumPortion);
- } else {
- if ((evenSum & 0x01) !== 0 || evenSum > 10 || evenSum < 4) {
- throw new _NotFoundException.default();
- }
- var group = (10 - evenSum) / 2;
- var oddWidest = RSS14Reader.INSIDE_ODD_WIDEST[group];
- var evenWidest = 9 - oddWidest;
- var vOdd = _RSSUtils.default.getRSSvalue(oddCounts, oddWidest, true);
- var vEven = _RSSUtils.default.getRSSvalue(evenCounts, evenWidest, false);
- var tOdd = RSS14Reader.INSIDE_ODD_TOTAL_SUBSET[group];
- var gSum = RSS14Reader.INSIDE_GSUM[group];
- return new _DataCharacter.default(vEven * tOdd + vOdd + gSum, checksumPortion);
- }
- };
- RSS14Reader.prototype.findFinderPattern = function (row, rightFinderPattern) {
- var counters = this.getDecodeFinderCounters();
- counters[0] = 0;
- counters[1] = 0;
- counters[2] = 0;
- counters[3] = 0;
- var width = row.getSize();
- var isWhite = false;
- var rowOffset = 0;
- while (rowOffset < width) {
- isWhite = !row.get(rowOffset);
- if (rightFinderPattern === isWhite) {
- // Will encounter white first when searching for right finder pattern
- break;
- }
- rowOffset++;
- }
- var counterPosition = 0;
- var patternStart = rowOffset;
- for (var x = rowOffset; x < width; x++) {
- if (row.get(x) !== isWhite) {
- counters[counterPosition]++;
- } else {
- if (counterPosition === 3) {
- if (_AbstractRSSReader.default.isFinderPattern(counters)) {
- return [patternStart, x];
- }
- patternStart += counters[0] + counters[1];
- counters[0] = counters[2];
- counters[1] = counters[3];
- counters[2] = 0;
- counters[3] = 0;
- counterPosition--;
- } else {
- counterPosition++;
- }
- counters[counterPosition] = 1;
- isWhite = !isWhite;
- }
- }
- throw new _NotFoundException.default();
- };
- RSS14Reader.prototype.parseFoundFinderPattern = function (row, rowNumber, right, startEnd) {
- // Actually we found elements 2-5
- var firstIsBlack = row.get(startEnd[0]);
- var firstElementStart = startEnd[0] - 1;
- // Locate element 1
- while (firstElementStart >= 0 && firstIsBlack !== row.get(firstElementStart)) {
- firstElementStart--;
- }
- firstElementStart++;
- var firstCounter = startEnd[0] - firstElementStart;
- // Make 'counters' hold 1-4
- var counters = this.getDecodeFinderCounters();
- var copy = new Int32Array(counters.length);
- _System.default.arraycopy(counters, 0, copy, 1, counters.length - 1);
- copy[0] = firstCounter;
- var value = this.parseFinderValue(copy, RSS14Reader.FINDER_PATTERNS);
- var start = firstElementStart;
- var end = startEnd[1];
- if (right) {
- // row is actually reversed
- start = row.getSize() - 1 - start;
- end = row.getSize() - 1 - end;
- }
- return new _FinderPattern.default(value, [firstElementStart, startEnd[1]], start, end, rowNumber);
- };
- RSS14Reader.prototype.adjustOddEvenCounts = function (outsideChar, numModules) {
- var oddSum = _MathUtils.default.sum(new Int32Array(this.getOddCounts()));
- var evenSum = _MathUtils.default.sum(new Int32Array(this.getEvenCounts()));
- var incrementOdd = false;
- var decrementOdd = false;
- var incrementEven = false;
- var decrementEven = false;
- if (outsideChar) {
- if (oddSum > 12) {
- decrementOdd = true;
- } else if (oddSum < 4) {
- incrementOdd = true;
- }
- if (evenSum > 12) {
- decrementEven = true;
- } else if (evenSum < 4) {
- incrementEven = true;
- }
- } else {
- if (oddSum > 11) {
- decrementOdd = true;
- } else if (oddSum < 5) {
- incrementOdd = true;
- }
- if (evenSum > 10) {
- decrementEven = true;
- } else if (evenSum < 4) {
- incrementEven = true;
- }
- }
- var mismatch = oddSum + evenSum - numModules;
- var oddParityBad = (oddSum & 0x01) === (outsideChar ? 1 : 0);
- var evenParityBad = (evenSum & 0x01) === 1;
- if (mismatch === 1) {
- if (oddParityBad) {
- if (evenParityBad) {
- throw new _NotFoundException.default();
- }
- decrementOdd = true;
- } else {
- if (!evenParityBad) {
- throw new _NotFoundException.default();
- }
- decrementEven = true;
- }
- } else if (mismatch === -1) {
- if (oddParityBad) {
- if (evenParityBad) {
- throw new _NotFoundException.default();
- }
- incrementOdd = true;
- } else {
- if (!evenParityBad) {
- throw new _NotFoundException.default();
- }
- incrementEven = true;
- }
- } else if (mismatch === 0) {
- if (oddParityBad) {
- if (!evenParityBad) {
- throw new _NotFoundException.default();
- }
- // Both bad
- if (oddSum < evenSum) {
- incrementOdd = true;
- decrementEven = true;
- } else {
- decrementOdd = true;
- incrementEven = true;
- }
- } else {
- if (evenParityBad) {
- throw new _NotFoundException.default();
- }
- // Nothing to do!
- }
- } else {
- throw new _NotFoundException.default();
- }
- if (incrementOdd) {
- if (decrementOdd) {
- throw new _NotFoundException.default();
- }
- _AbstractRSSReader.default.increment(this.getOddCounts(), this.getOddRoundingErrors());
- }
- if (decrementOdd) {
- _AbstractRSSReader.default.decrement(this.getOddCounts(), this.getOddRoundingErrors());
- }
- if (incrementEven) {
- if (decrementEven) {
- throw new _NotFoundException.default();
- }
- _AbstractRSSReader.default.increment(this.getEvenCounts(), this.getOddRoundingErrors());
- }
- if (decrementEven) {
- _AbstractRSSReader.default.decrement(this.getEvenCounts(), this.getEvenRoundingErrors());
- }
- };
- RSS14Reader.OUTSIDE_EVEN_TOTAL_SUBSET = [1, 10, 34, 70, 126];
- RSS14Reader.INSIDE_ODD_TOTAL_SUBSET = [4, 20, 48, 81];
- RSS14Reader.OUTSIDE_GSUM = [0, 161, 961, 2015, 2715];
- RSS14Reader.INSIDE_GSUM = [0, 336, 1036, 1516];
- RSS14Reader.OUTSIDE_ODD_WIDEST = [8, 6, 4, 3, 1];
- RSS14Reader.INSIDE_ODD_WIDEST = [2, 4, 6, 8];
- RSS14Reader.FINDER_PATTERNS = [Int32Array.from([3, 8, 2, 1]), Int32Array.from([3, 5, 5, 1]), Int32Array.from([3, 3, 7, 1]), Int32Array.from([3, 1, 9, 1]), Int32Array.from([2, 7, 4, 1]), Int32Array.from([2, 5, 6, 1]), Int32Array.from([2, 3, 8, 1]), Int32Array.from([1, 5, 7, 1]), Int32Array.from([1, 3, 9, 1])];
- return RSS14Reader;
- }(_AbstractRSSReader.default);
- var _default = RSS14Reader;
- exports.default = _default;
- /***/ }),
- /* 402 */
- /*!*********************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/Pair.js ***!
- \*********************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _DataCharacter = _interopRequireDefault(__webpack_require__(/*! ./DataCharacter */ 376));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var Pair = /** @class */function (_super) {
- __extends(Pair, _super);
- function Pair(value, checksumPortion, finderPattern) {
- var _this = _super.call(this, value, checksumPortion) || this;
- _this.count = 0;
- _this.finderPattern = finderPattern;
- return _this;
- }
- Pair.prototype.getFinderPattern = function () {
- return this.finderPattern;
- };
- Pair.prototype.getCount = function () {
- return this.count;
- };
- Pair.prototype.incrementCount = function () {
- this.count++;
- };
- return Pair;
- }(_DataCharacter.default);
- var _default = Pair;
- exports.default = _default;
- /***/ }),
- /* 403 */
- /*!**************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/browser/BrowserDatamatrixCodeReader.js ***!
- \**************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.BrowserDatamatrixCodeReader = void 0;
- var _BrowserCodeReader = __webpack_require__(/*! ./BrowserCodeReader */ 303);
- var _DataMatrixReader = _interopRequireDefault(__webpack_require__(/*! ../core/datamatrix/DataMatrixReader */ 404));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /**
- * @deprecated Moving to @zxing/browser
- *
- * QR Code reader to use from browser.
- */
- var BrowserDatamatrixCodeReader = /** @class */function (_super) {
- __extends(BrowserDatamatrixCodeReader, _super);
- /**
- * Creates an instance of BrowserQRCodeReader.
- * @param {number} [timeBetweenScansMillis=500] the time delay between subsequent decode tries
- */
- function BrowserDatamatrixCodeReader(timeBetweenScansMillis) {
- if (timeBetweenScansMillis === void 0) {
- timeBetweenScansMillis = 500;
- }
- return _super.call(this, new _DataMatrixReader.default(), timeBetweenScansMillis) || this;
- }
- return BrowserDatamatrixCodeReader;
- }(_BrowserCodeReader.BrowserCodeReader);
- exports.BrowserDatamatrixCodeReader = BrowserDatamatrixCodeReader;
- /***/ }),
- /* 404 */
- /*!***********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/DataMatrixReader.js ***!
- \***********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
- var _BitMatrix = _interopRequireDefault(__webpack_require__(/*! ../common/BitMatrix */ 319));
- var _DecodeHintType = _interopRequireDefault(__webpack_require__(/*! ../DecodeHintType */ 322));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
- var _Result = _interopRequireDefault(__webpack_require__(/*! ../Result */ 333));
- var _ResultMetadataType = _interopRequireDefault(__webpack_require__(/*! ../ResultMetadataType */ 335));
- var _System = _interopRequireDefault(__webpack_require__(/*! ../util/System */ 315));
- var _Decoder = _interopRequireDefault(__webpack_require__(/*! ./decoder/Decoder */ 405));
- var _Detector = _interopRequireDefault(__webpack_require__(/*! ./detector/Detector */ 411));
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /**
- * This implementation can detect and decode Data Matrix codes in an image.
- *
- * @author bbrown@google.com (Brian Brown)
- */
- var DataMatrixReader = /** @class */function () {
- function DataMatrixReader() {
- this.decoder = new _Decoder.default();
- }
- /**
- * Locates and decodes a Data Matrix code in an image.
- *
- * @return a String representing the content encoded by the Data Matrix code
- * @throws NotFoundException if a Data Matrix code cannot be found
- * @throws FormatException if a Data Matrix code cannot be decoded
- * @throws ChecksumException if error correction fails
- */
- // @Override
- // public Result decode(BinaryBitmap image) throws NotFoundException, ChecksumException, FormatException {
- // return decode(image, null);
- // }
- // @Override
- DataMatrixReader.prototype.decode = function (image, hints) {
- if (hints === void 0) {
- hints = null;
- }
- var decoderResult;
- var points;
- if (hints != null && hints.has(_DecodeHintType.default.PURE_BARCODE)) {
- var bits = DataMatrixReader.extractPureBits(image.getBlackMatrix());
- decoderResult = this.decoder.decode(bits);
- points = DataMatrixReader.NO_POINTS;
- } else {
- var detectorResult = new _Detector.default(image.getBlackMatrix()).detect();
- decoderResult = this.decoder.decode(detectorResult.getBits());
- points = detectorResult.getPoints();
- }
- var rawBytes = decoderResult.getRawBytes();
- var result = new _Result.default(decoderResult.getText(), rawBytes, 8 * rawBytes.length, points, _BarcodeFormat.default.DATA_MATRIX, _System.default.currentTimeMillis());
- var byteSegments = decoderResult.getByteSegments();
- if (byteSegments != null) {
- result.putMetadata(_ResultMetadataType.default.BYTE_SEGMENTS, byteSegments);
- }
- var ecLevel = decoderResult.getECLevel();
- if (ecLevel != null) {
- result.putMetadata(_ResultMetadataType.default.ERROR_CORRECTION_LEVEL, ecLevel);
- }
- return result;
- };
- // @Override
- DataMatrixReader.prototype.reset = function () {
- // do nothing
- };
- /**
- * This method detects a code in a "pure" image -- that is, pure monochrome image
- * which contains only an unrotated, unskewed, image of a code, with some white border
- * around it. This is a specialized method that works exceptionally fast in this special
- * case.
- *
- * @see com.google.zxing.qrcode.QRCodeReader#extractPureBits(BitMatrix)
- */
- DataMatrixReader.extractPureBits = function (image) {
- var leftTopBlack = image.getTopLeftOnBit();
- var rightBottomBlack = image.getBottomRightOnBit();
- if (leftTopBlack == null || rightBottomBlack == null) {
- throw new _NotFoundException.default();
- }
- var moduleSize = this.moduleSize(leftTopBlack, image);
- var top = leftTopBlack[1];
- var bottom = rightBottomBlack[1];
- var left = leftTopBlack[0];
- var right = rightBottomBlack[0];
- var matrixWidth = (right - left + 1) / moduleSize;
- var matrixHeight = (bottom - top + 1) / moduleSize;
- if (matrixWidth <= 0 || matrixHeight <= 0) {
- throw new _NotFoundException.default();
- }
- // Push in the "border" by half the module width so that we start
- // sampling in the middle of the module. Just in case the image is a
- // little off, this will help recover.
- var nudge = moduleSize / 2;
- top += nudge;
- left += nudge;
- // Now just read off the bits
- var bits = new _BitMatrix.default(matrixWidth, matrixHeight);
- for (var y = 0; y < matrixHeight; y++) {
- var iOffset = top + y * moduleSize;
- for (var x = 0; x < matrixWidth; x++) {
- if (image.get(left + x * moduleSize, iOffset)) {
- bits.set(x, y);
- }
- }
- }
- return bits;
- };
- DataMatrixReader.moduleSize = function (leftTopBlack, image) {
- var width = image.getWidth();
- var x = leftTopBlack[0];
- var y = leftTopBlack[1];
- while (x < width && image.get(x, y)) {
- x++;
- }
- if (x === width) {
- throw new _NotFoundException.default();
- }
- var moduleSize = x - leftTopBlack[0];
- if (moduleSize === 0) {
- throw new _NotFoundException.default();
- }
- return moduleSize;
- };
- DataMatrixReader.NO_POINTS = [];
- return DataMatrixReader;
- }();
- var _default = DataMatrixReader;
- exports.default = _default;
- /***/ }),
- /* 405 */
- /*!**********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/decoder/Decoder.js ***!
- \**********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _ChecksumException = _interopRequireDefault(__webpack_require__(/*! ../../ChecksumException */ 309));
- var _GenericGF = _interopRequireDefault(__webpack_require__(/*! ../../common/reedsolomon/GenericGF */ 338));
- var _ReedSolomonDecoder = _interopRequireDefault(__webpack_require__(/*! ../../common/reedsolomon/ReedSolomonDecoder */ 342));
- var _BitMatrixParser = _interopRequireDefault(__webpack_require__(/*! ./BitMatrixParser */ 406));
- var _DataBlock = _interopRequireDefault(__webpack_require__(/*! ./DataBlock */ 408));
- var _DecodedBitStreamParser = _interopRequireDefault(__webpack_require__(/*! ./DecodedBitStreamParser */ 409));
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /**
- * <p>The main class which implements Data Matrix Code decoding -- as opposed to locating and extracting
- * the Data Matrix Code from an image.</p>
- *
- * @author bbrown@google.com (Brian Brown)
- */
- var Decoder = /** @class */function () {
- function Decoder() {
- this.rsDecoder = new _ReedSolomonDecoder.default(_GenericGF.default.DATA_MATRIX_FIELD_256);
- }
- /**
- * <p>Decodes a Data Matrix Code represented as a {@link BitMatrix}. A 1 or "true" is taken
- * to mean a black module.</p>
- *
- * @param bits booleans representing white/black Data Matrix Code modules
- * @return text and bytes encoded within the Data Matrix Code
- * @throws FormatException if the Data Matrix Code cannot be decoded
- * @throws ChecksumException if error correction fails
- */
- Decoder.prototype.decode = function (bits) {
- var e_1, _a;
- // Construct a parser and read version, error-correction level
- var parser = new _BitMatrixParser.default(bits);
- var version = parser.getVersion();
- // Read codewords
- var codewords = parser.readCodewords();
- // Separate into data blocks
- var dataBlocks = _DataBlock.default.getDataBlocks(codewords, version);
- // Count total number of data bytes
- var totalBytes = 0;
- try {
- for (var dataBlocks_1 = __values(dataBlocks), dataBlocks_1_1 = dataBlocks_1.next(); !dataBlocks_1_1.done; dataBlocks_1_1 = dataBlocks_1.next()) {
- var db = dataBlocks_1_1.value;
- totalBytes += db.getNumDataCodewords();
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (dataBlocks_1_1 && !dataBlocks_1_1.done && (_a = dataBlocks_1.return)) _a.call(dataBlocks_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- var resultBytes = new Uint8Array(totalBytes);
- var dataBlocksCount = dataBlocks.length;
- // Error-correct and copy data blocks together into a stream of bytes
- for (var j = 0; j < dataBlocksCount; j++) {
- var dataBlock = dataBlocks[j];
- var codewordBytes = dataBlock.getCodewords();
- var numDataCodewords = dataBlock.getNumDataCodewords();
- this.correctErrors(codewordBytes, numDataCodewords);
- for (var i = 0; i < numDataCodewords; i++) {
- // De-interlace data blocks.
- resultBytes[i * dataBlocksCount + j] = codewordBytes[i];
- }
- }
- // Decode the contents of that stream of bytes
- return _DecodedBitStreamParser.default.decode(resultBytes);
- };
- /**
- * <p>Given data and error-correction codewords received, possibly corrupted by errors, attempts to
- * correct the errors in-place using Reed-Solomon error correction.</p>
- *
- * @param codewordBytes data and error correction codewords
- * @param numDataCodewords number of codewords that are data bytes
- * @throws ChecksumException if error correction fails
- */
- Decoder.prototype.correctErrors = function (codewordBytes, numDataCodewords) {
- // const numCodewords = codewordBytes.length;
- // First read into an array of ints
- var codewordsInts = new Int32Array(codewordBytes);
- // for (let i = 0; i < numCodewords; i++) {
- // codewordsInts[i] = codewordBytes[i] & 0xFF;
- // }
- try {
- this.rsDecoder.decode(codewordsInts, codewordBytes.length - numDataCodewords);
- } catch (ignored /* ReedSolomonException */) {
- throw new _ChecksumException.default();
- }
- // Copy back into array of bytes -- only need to worry about the bytes that were data
- // We don't care about errors in the error-correction codewords
- for (var i = 0; i < numDataCodewords; i++) {
- codewordBytes[i] = codewordsInts[i];
- }
- };
- return Decoder;
- }();
- var _default = Decoder;
- exports.default = _default;
- /***/ }),
- /* 406 */
- /*!******************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/decoder/BitMatrixParser.js ***!
- \******************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _BitMatrix = _interopRequireDefault(__webpack_require__(/*! ../../common/BitMatrix */ 319));
- var _Version = _interopRequireDefault(__webpack_require__(/*! ./Version */ 407));
- var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../../FormatException */ 324));
- var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalArgumentException */ 308));
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /**
- * @author bbrown@google.com (Brian Brown)
- */
- var BitMatrixParser = /** @class */function () {
- /**
- * @param bitMatrix {@link BitMatrix} to parse
- * @throws FormatException if dimension is < 8 or > 144 or not 0 mod 2
- */
- function BitMatrixParser(bitMatrix) {
- var dimension = bitMatrix.getHeight();
- if (dimension < 8 || dimension > 144 || (dimension & 0x01) !== 0) {
- throw new _FormatException.default();
- }
- this.version = BitMatrixParser.readVersion(bitMatrix);
- this.mappingBitMatrix = this.extractDataRegion(bitMatrix);
- this.readMappingMatrix = new _BitMatrix.default(this.mappingBitMatrix.getWidth(), this.mappingBitMatrix.getHeight());
- }
- BitMatrixParser.prototype.getVersion = function () {
- return this.version;
- };
- /**
- * <p>Creates the version object based on the dimension of the original bit matrix from
- * the datamatrix code.</p>
- *
- * <p>See ISO 16022:2006 Table 7 - ECC 200 symbol attributes</p>
- *
- * @param bitMatrix Original {@link BitMatrix} including alignment patterns
- * @return {@link Version} encapsulating the Data Matrix Code's "version"
- * @throws FormatException if the dimensions of the mapping matrix are not valid
- * Data Matrix dimensions.
- */
- BitMatrixParser.readVersion = function (bitMatrix) {
- var numRows = bitMatrix.getHeight();
- var numColumns = bitMatrix.getWidth();
- return _Version.default.getVersionForDimensions(numRows, numColumns);
- };
- /**
- * <p>Reads the bits in the {@link BitMatrix} representing the mapping matrix (No alignment patterns)
- * in the correct order in order to reconstitute the codewords bytes contained within the
- * Data Matrix Code.</p>
- *
- * @return bytes encoded within the Data Matrix Code
- * @throws FormatException if the exact number of bytes expected is not read
- */
- BitMatrixParser.prototype.readCodewords = function () {
- var result = new Int8Array(this.version.getTotalCodewords());
- var resultOffset = 0;
- var row = 4;
- var column = 0;
- var numRows = this.mappingBitMatrix.getHeight();
- var numColumns = this.mappingBitMatrix.getWidth();
- var corner1Read = false;
- var corner2Read = false;
- var corner3Read = false;
- var corner4Read = false;
- // Read all of the codewords
- do {
- // Check the four corner cases
- if (row === numRows && column === 0 && !corner1Read) {
- result[resultOffset++] = this.readCorner1(numRows, numColumns) & 0xff;
- row -= 2;
- column += 2;
- corner1Read = true;
- } else if (row === numRows - 2 && column === 0 && (numColumns & 0x03) !== 0 && !corner2Read) {
- result[resultOffset++] = this.readCorner2(numRows, numColumns) & 0xff;
- row -= 2;
- column += 2;
- corner2Read = true;
- } else if (row === numRows + 4 && column === 2 && (numColumns & 0x07) === 0 && !corner3Read) {
- result[resultOffset++] = this.readCorner3(numRows, numColumns) & 0xff;
- row -= 2;
- column += 2;
- corner3Read = true;
- } else if (row === numRows - 2 && column === 0 && (numColumns & 0x07) === 4 && !corner4Read) {
- result[resultOffset++] = this.readCorner4(numRows, numColumns) & 0xff;
- row -= 2;
- column += 2;
- corner4Read = true;
- } else {
- // Sweep upward diagonally to the right
- do {
- if (row < numRows && column >= 0 && !this.readMappingMatrix.get(column, row)) {
- result[resultOffset++] = this.readUtah(row, column, numRows, numColumns) & 0xff;
- }
- row -= 2;
- column += 2;
- } while (row >= 0 && column < numColumns);
- row += 1;
- column += 3;
- // Sweep downward diagonally to the left
- do {
- if (row >= 0 && column < numColumns && !this.readMappingMatrix.get(column, row)) {
- result[resultOffset++] = this.readUtah(row, column, numRows, numColumns) & 0xff;
- }
- row += 2;
- column -= 2;
- } while (row < numRows && column >= 0);
- row += 3;
- column += 1;
- }
- } while (row < numRows || column < numColumns);
- if (resultOffset !== this.version.getTotalCodewords()) {
- throw new _FormatException.default();
- }
- return result;
- };
- /**
- * <p>Reads a bit of the mapping matrix accounting for boundary wrapping.</p>
- *
- * @param row Row to read in the mapping matrix
- * @param column Column to read in the mapping matrix
- * @param numRows Number of rows in the mapping matrix
- * @param numColumns Number of columns in the mapping matrix
- * @return value of the given bit in the mapping matrix
- */
- BitMatrixParser.prototype.readModule = function (row, column, numRows, numColumns) {
- // Adjust the row and column indices based on boundary wrapping
- if (row < 0) {
- row += numRows;
- column += 4 - (numRows + 4 & 0x07);
- }
- if (column < 0) {
- column += numColumns;
- row += 4 - (numColumns + 4 & 0x07);
- }
- this.readMappingMatrix.set(column, row);
- return this.mappingBitMatrix.get(column, row);
- };
- /**
- * <p>Reads the 8 bits of the standard Utah-shaped pattern.</p>
- *
- * <p>See ISO 16022:2006, 5.8.1 Figure 6</p>
- *
- * @param row Current row in the mapping matrix, anchored at the 8th bit (LSB) of the pattern
- * @param column Current column in the mapping matrix, anchored at the 8th bit (LSB) of the pattern
- * @param numRows Number of rows in the mapping matrix
- * @param numColumns Number of columns in the mapping matrix
- * @return byte from the utah shape
- */
- BitMatrixParser.prototype.readUtah = function (row, column, numRows, numColumns) {
- var currentByte = 0;
- if (this.readModule(row - 2, column - 2, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(row - 2, column - 1, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(row - 1, column - 2, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(row - 1, column - 1, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(row - 1, column, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(row, column - 2, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(row, column - 1, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(row, column, numRows, numColumns)) {
- currentByte |= 1;
- }
- return currentByte;
- };
- /**
- * <p>Reads the 8 bits of the special corner condition 1.</p>
- *
- * <p>See ISO 16022:2006, Figure F.3</p>
- *
- * @param numRows Number of rows in the mapping matrix
- * @param numColumns Number of columns in the mapping matrix
- * @return byte from the Corner condition 1
- */
- BitMatrixParser.prototype.readCorner1 = function (numRows, numColumns) {
- var currentByte = 0;
- if (this.readModule(numRows - 1, 0, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(numRows - 1, 1, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(numRows - 1, 2, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(0, numColumns - 2, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(0, numColumns - 1, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(1, numColumns - 1, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(2, numColumns - 1, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(3, numColumns - 1, numRows, numColumns)) {
- currentByte |= 1;
- }
- return currentByte;
- };
- /**
- * <p>Reads the 8 bits of the special corner condition 2.</p>
- *
- * <p>See ISO 16022:2006, Figure F.4</p>
- *
- * @param numRows Number of rows in the mapping matrix
- * @param numColumns Number of columns in the mapping matrix
- * @return byte from the Corner condition 2
- */
- BitMatrixParser.prototype.readCorner2 = function (numRows, numColumns) {
- var currentByte = 0;
- if (this.readModule(numRows - 3, 0, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(numRows - 2, 0, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(numRows - 1, 0, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(0, numColumns - 4, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(0, numColumns - 3, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(0, numColumns - 2, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(0, numColumns - 1, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(1, numColumns - 1, numRows, numColumns)) {
- currentByte |= 1;
- }
- return currentByte;
- };
- /**
- * <p>Reads the 8 bits of the special corner condition 3.</p>
- *
- * <p>See ISO 16022:2006, Figure F.5</p>
- *
- * @param numRows Number of rows in the mapping matrix
- * @param numColumns Number of columns in the mapping matrix
- * @return byte from the Corner condition 3
- */
- BitMatrixParser.prototype.readCorner3 = function (numRows, numColumns) {
- var currentByte = 0;
- if (this.readModule(numRows - 1, 0, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(numRows - 1, numColumns - 1, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(0, numColumns - 3, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(0, numColumns - 2, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(0, numColumns - 1, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(1, numColumns - 3, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(1, numColumns - 2, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(1, numColumns - 1, numRows, numColumns)) {
- currentByte |= 1;
- }
- return currentByte;
- };
- /**
- * <p>Reads the 8 bits of the special corner condition 4.</p>
- *
- * <p>See ISO 16022:2006, Figure F.6</p>
- *
- * @param numRows Number of rows in the mapping matrix
- * @param numColumns Number of columns in the mapping matrix
- * @return byte from the Corner condition 4
- */
- BitMatrixParser.prototype.readCorner4 = function (numRows, numColumns) {
- var currentByte = 0;
- if (this.readModule(numRows - 3, 0, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(numRows - 2, 0, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(numRows - 1, 0, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(0, numColumns - 2, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(0, numColumns - 1, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(1, numColumns - 1, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(2, numColumns - 1, numRows, numColumns)) {
- currentByte |= 1;
- }
- currentByte <<= 1;
- if (this.readModule(3, numColumns - 1, numRows, numColumns)) {
- currentByte |= 1;
- }
- return currentByte;
- };
- /**
- * <p>Extracts the data region from a {@link BitMatrix} that contains
- * alignment patterns.</p>
- *
- * @param bitMatrix Original {@link BitMatrix} with alignment patterns
- * @return BitMatrix that has the alignment patterns removed
- */
- BitMatrixParser.prototype.extractDataRegion = function (bitMatrix) {
- var symbolSizeRows = this.version.getSymbolSizeRows();
- var symbolSizeColumns = this.version.getSymbolSizeColumns();
- if (bitMatrix.getHeight() !== symbolSizeRows) {
- throw new _IllegalArgumentException.default('Dimension of bitMatrix must match the version size');
- }
- var dataRegionSizeRows = this.version.getDataRegionSizeRows();
- var dataRegionSizeColumns = this.version.getDataRegionSizeColumns();
- var numDataRegionsRow = symbolSizeRows / dataRegionSizeRows | 0;
- var numDataRegionsColumn = symbolSizeColumns / dataRegionSizeColumns | 0;
- var sizeDataRegionRow = numDataRegionsRow * dataRegionSizeRows;
- var sizeDataRegionColumn = numDataRegionsColumn * dataRegionSizeColumns;
- var bitMatrixWithoutAlignment = new _BitMatrix.default(sizeDataRegionColumn, sizeDataRegionRow);
- for (var dataRegionRow = 0; dataRegionRow < numDataRegionsRow; ++dataRegionRow) {
- var dataRegionRowOffset = dataRegionRow * dataRegionSizeRows;
- for (var dataRegionColumn = 0; dataRegionColumn < numDataRegionsColumn; ++dataRegionColumn) {
- var dataRegionColumnOffset = dataRegionColumn * dataRegionSizeColumns;
- for (var i = 0; i < dataRegionSizeRows; ++i) {
- var readRowOffset = dataRegionRow * (dataRegionSizeRows + 2) + 1 + i;
- var writeRowOffset = dataRegionRowOffset + i;
- for (var j = 0; j < dataRegionSizeColumns; ++j) {
- var readColumnOffset = dataRegionColumn * (dataRegionSizeColumns + 2) + 1 + j;
- if (bitMatrix.get(readColumnOffset, readRowOffset)) {
- var writeColumnOffset = dataRegionColumnOffset + j;
- bitMatrixWithoutAlignment.set(writeColumnOffset, writeRowOffset);
- }
- }
- }
- }
- }
- return bitMatrixWithoutAlignment;
- };
- return BitMatrixParser;
- }();
- var _default = BitMatrixParser;
- exports.default = _default;
- /***/ }),
- /* 407 */
- /*!**********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/decoder/Version.js ***!
- \**********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = exports.ECBlocks = exports.ECB = void 0;
- var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../../FormatException */ 324));
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /**
- * <p>Encapsulates a set of error-correction blocks in one symbol version. Most versions will
- * use blocks of differing sizes within one version, so, this encapsulates the parameters for
- * each set of blocks. It also holds the number of error-correction codewords per block since it
- * will be the same across all blocks within one version.</p>
- */
- var ECBlocks = /** @class */function () {
- function ECBlocks(ecCodewords, ecBlocks1, ecBlocks2) {
- this.ecCodewords = ecCodewords;
- this.ecBlocks = [ecBlocks1];
- ecBlocks2 && this.ecBlocks.push(ecBlocks2);
- }
- ECBlocks.prototype.getECCodewords = function () {
- return this.ecCodewords;
- };
- ECBlocks.prototype.getECBlocks = function () {
- return this.ecBlocks;
- };
- return ECBlocks;
- }();
- exports.ECBlocks = ECBlocks;
- /**
- * <p>Encapsulates the parameters for one error-correction block in one symbol version.
- * This includes the number of data codewords, and the number of times a block with these
- * parameters is used consecutively in the Data Matrix code version's format.</p>
- */
- var ECB = /** @class */function () {
- function ECB(count, dataCodewords) {
- this.count = count;
- this.dataCodewords = dataCodewords;
- }
- ECB.prototype.getCount = function () {
- return this.count;
- };
- ECB.prototype.getDataCodewords = function () {
- return this.dataCodewords;
- };
- return ECB;
- }();
- exports.ECB = ECB;
- /**
- * The Version object encapsulates attributes about a particular
- * size Data Matrix Code.
- *
- * @author bbrown@google.com (Brian Brown)
- */
- var Version = /** @class */function () {
- function Version(versionNumber, symbolSizeRows, symbolSizeColumns, dataRegionSizeRows, dataRegionSizeColumns, ecBlocks) {
- var e_1, _a;
- this.versionNumber = versionNumber;
- this.symbolSizeRows = symbolSizeRows;
- this.symbolSizeColumns = symbolSizeColumns;
- this.dataRegionSizeRows = dataRegionSizeRows;
- this.dataRegionSizeColumns = dataRegionSizeColumns;
- this.ecBlocks = ecBlocks;
- // Calculate the total number of codewords
- var total = 0;
- var ecCodewords = ecBlocks.getECCodewords();
- var ecbArray = ecBlocks.getECBlocks();
- try {
- for (var ecbArray_1 = __values(ecbArray), ecbArray_1_1 = ecbArray_1.next(); !ecbArray_1_1.done; ecbArray_1_1 = ecbArray_1.next()) {
- var ecBlock = ecbArray_1_1.value;
- total += ecBlock.getCount() * (ecBlock.getDataCodewords() + ecCodewords);
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (ecbArray_1_1 && !ecbArray_1_1.done && (_a = ecbArray_1.return)) _a.call(ecbArray_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- this.totalCodewords = total;
- }
- Version.prototype.getVersionNumber = function () {
- return this.versionNumber;
- };
- Version.prototype.getSymbolSizeRows = function () {
- return this.symbolSizeRows;
- };
- Version.prototype.getSymbolSizeColumns = function () {
- return this.symbolSizeColumns;
- };
- Version.prototype.getDataRegionSizeRows = function () {
- return this.dataRegionSizeRows;
- };
- Version.prototype.getDataRegionSizeColumns = function () {
- return this.dataRegionSizeColumns;
- };
- Version.prototype.getTotalCodewords = function () {
- return this.totalCodewords;
- };
- Version.prototype.getECBlocks = function () {
- return this.ecBlocks;
- };
- /**
- * <p>Deduces version information from Data Matrix dimensions.</p>
- *
- * @param numRows Number of rows in modules
- * @param numColumns Number of columns in modules
- * @return Version for a Data Matrix Code of those dimensions
- * @throws FormatException if dimensions do correspond to a valid Data Matrix size
- */
- Version.getVersionForDimensions = function (numRows, numColumns) {
- var e_2, _a;
- if ((numRows & 0x01) !== 0 || (numColumns & 0x01) !== 0) {
- throw new _FormatException.default();
- }
- try {
- for (var _b = __values(Version.VERSIONS), _c = _b.next(); !_c.done; _c = _b.next()) {
- var version = _c.value;
- if (version.symbolSizeRows === numRows && version.symbolSizeColumns === numColumns) {
- return version;
- }
- }
- } catch (e_2_1) {
- e_2 = {
- error: e_2_1
- };
- } finally {
- try {
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
- } finally {
- if (e_2) throw e_2.error;
- }
- }
- throw new _FormatException.default();
- };
- // @Override
- Version.prototype.toString = function () {
- return '' + this.versionNumber;
- };
- /**
- * See ISO 16022:2006 5.5.1 Table 7
- */
- Version.buildVersions = function () {
- return [new Version(1, 10, 10, 8, 8, new ECBlocks(5, new ECB(1, 3))), new Version(2, 12, 12, 10, 10, new ECBlocks(7, new ECB(1, 5))), new Version(3, 14, 14, 12, 12, new ECBlocks(10, new ECB(1, 8))), new Version(4, 16, 16, 14, 14, new ECBlocks(12, new ECB(1, 12))), new Version(5, 18, 18, 16, 16, new ECBlocks(14, new ECB(1, 18))), new Version(6, 20, 20, 18, 18, new ECBlocks(18, new ECB(1, 22))), new Version(7, 22, 22, 20, 20, new ECBlocks(20, new ECB(1, 30))), new Version(8, 24, 24, 22, 22, new ECBlocks(24, new ECB(1, 36))), new Version(9, 26, 26, 24, 24, new ECBlocks(28, new ECB(1, 44))), new Version(10, 32, 32, 14, 14, new ECBlocks(36, new ECB(1, 62))), new Version(11, 36, 36, 16, 16, new ECBlocks(42, new ECB(1, 86))), new Version(12, 40, 40, 18, 18, new ECBlocks(48, new ECB(1, 114))), new Version(13, 44, 44, 20, 20, new ECBlocks(56, new ECB(1, 144))), new Version(14, 48, 48, 22, 22, new ECBlocks(68, new ECB(1, 174))), new Version(15, 52, 52, 24, 24, new ECBlocks(42, new ECB(2, 102))), new Version(16, 64, 64, 14, 14, new ECBlocks(56, new ECB(2, 140))), new Version(17, 72, 72, 16, 16, new ECBlocks(36, new ECB(4, 92))), new Version(18, 80, 80, 18, 18, new ECBlocks(48, new ECB(4, 114))), new Version(19, 88, 88, 20, 20, new ECBlocks(56, new ECB(4, 144))), new Version(20, 96, 96, 22, 22, new ECBlocks(68, new ECB(4, 174))), new Version(21, 104, 104, 24, 24, new ECBlocks(56, new ECB(6, 136))), new Version(22, 120, 120, 18, 18, new ECBlocks(68, new ECB(6, 175))), new Version(23, 132, 132, 20, 20, new ECBlocks(62, new ECB(8, 163))), new Version(24, 144, 144, 22, 22, new ECBlocks(62, new ECB(8, 156), new ECB(2, 155))), new Version(25, 8, 18, 6, 16, new ECBlocks(7, new ECB(1, 5))), new Version(26, 8, 32, 6, 14, new ECBlocks(11, new ECB(1, 10))), new Version(27, 12, 26, 10, 24, new ECBlocks(14, new ECB(1, 16))), new Version(28, 12, 36, 10, 16, new ECBlocks(18, new ECB(1, 22))), new Version(29, 16, 36, 14, 16, new ECBlocks(24, new ECB(1, 32))), new Version(30, 16, 48, 14, 22, new ECBlocks(28, new ECB(1, 49)))];
- };
- Version.VERSIONS = Version.buildVersions();
- return Version;
- }();
- var _default = Version;
- exports.default = _default;
- /***/ }),
- /* 408 */
- /*!************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/decoder/DataBlock.js ***!
- \************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalArgumentException */ 308));
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- /*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /**
- * <p>Encapsulates a block of data within a Data Matrix Code. Data Matrix Codes may split their data into
- * multiple blocks, each of which is a unit of data and error-correction codewords. Each
- * is represented by an instance of this class.</p>
- *
- * @author bbrown@google.com (Brian Brown)
- */
- var DataBlock = /** @class */function () {
- function DataBlock(numDataCodewords, codewords) {
- this.numDataCodewords = numDataCodewords;
- this.codewords = codewords;
- }
- /**
- * <p>When Data Matrix Codes use multiple data blocks, they actually interleave the bytes of each of them.
- * That is, the first byte of data block 1 to n is written, then the second bytes, and so on. This
- * method will separate the data into original blocks.</p>
- *
- * @param rawCodewords bytes as read directly from the Data Matrix Code
- * @param version version of the Data Matrix Code
- * @return DataBlocks containing original bytes, "de-interleaved" from representation in the
- * Data Matrix Code
- */
- DataBlock.getDataBlocks = function (rawCodewords, version) {
- var e_1, _a, e_2, _b;
- // Figure out the number and size of data blocks used by this version
- var ecBlocks = version.getECBlocks();
- // First count the total number of data blocks
- var totalBlocks = 0;
- var ecBlockArray = ecBlocks.getECBlocks();
- try {
- for (var ecBlockArray_1 = __values(ecBlockArray), ecBlockArray_1_1 = ecBlockArray_1.next(); !ecBlockArray_1_1.done; ecBlockArray_1_1 = ecBlockArray_1.next()) {
- var ecBlock = ecBlockArray_1_1.value;
- totalBlocks += ecBlock.getCount();
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (ecBlockArray_1_1 && !ecBlockArray_1_1.done && (_a = ecBlockArray_1.return)) _a.call(ecBlockArray_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- // Now establish DataBlocks of the appropriate size and number of data codewords
- var result = new Array(totalBlocks);
- var numResultBlocks = 0;
- try {
- for (var ecBlockArray_2 = __values(ecBlockArray), ecBlockArray_2_1 = ecBlockArray_2.next(); !ecBlockArray_2_1.done; ecBlockArray_2_1 = ecBlockArray_2.next()) {
- var ecBlock = ecBlockArray_2_1.value;
- for (var i = 0; i < ecBlock.getCount(); i++) {
- var numDataCodewords = ecBlock.getDataCodewords();
- var numBlockCodewords = ecBlocks.getECCodewords() + numDataCodewords;
- result[numResultBlocks++] = new DataBlock(numDataCodewords, new Uint8Array(numBlockCodewords));
- }
- }
- } catch (e_2_1) {
- e_2 = {
- error: e_2_1
- };
- } finally {
- try {
- if (ecBlockArray_2_1 && !ecBlockArray_2_1.done && (_b = ecBlockArray_2.return)) _b.call(ecBlockArray_2);
- } finally {
- if (e_2) throw e_2.error;
- }
- }
- // All blocks have the same amount of data, except that the last n
- // (where n may be 0) have 1 less byte. Figure out where these start.
- // TODO(bbrown): There is only one case where there is a difference for Data Matrix for size 144
- var longerBlocksTotalCodewords = result[0].codewords.length;
- // int shorterBlocksTotalCodewords = longerBlocksTotalCodewords - 1;
- var longerBlocksNumDataCodewords = longerBlocksTotalCodewords - ecBlocks.getECCodewords();
- var shorterBlocksNumDataCodewords = longerBlocksNumDataCodewords - 1;
- // The last elements of result may be 1 element shorter for 144 matrix
- // first fill out as many elements as all of them have minus 1
- var rawCodewordsOffset = 0;
- for (var i = 0; i < shorterBlocksNumDataCodewords; i++) {
- for (var j = 0; j < numResultBlocks; j++) {
- result[j].codewords[i] = rawCodewords[rawCodewordsOffset++];
- }
- }
- // Fill out the last data block in the longer ones
- var specialVersion = version.getVersionNumber() === 24;
- var numLongerBlocks = specialVersion ? 8 : numResultBlocks;
- for (var j = 0; j < numLongerBlocks; j++) {
- result[j].codewords[longerBlocksNumDataCodewords - 1] = rawCodewords[rawCodewordsOffset++];
- }
- // Now add in error correction blocks
- var max = result[0].codewords.length;
- for (var i = longerBlocksNumDataCodewords; i < max; i++) {
- for (var j = 0; j < numResultBlocks; j++) {
- var jOffset = specialVersion ? (j + 8) % numResultBlocks : j;
- var iOffset = specialVersion && jOffset > 7 ? i - 1 : i;
- result[jOffset].codewords[iOffset] = rawCodewords[rawCodewordsOffset++];
- }
- }
- if (rawCodewordsOffset !== rawCodewords.length) {
- throw new _IllegalArgumentException.default();
- }
- return result;
- };
- DataBlock.prototype.getNumDataCodewords = function () {
- return this.numDataCodewords;
- };
- DataBlock.prototype.getCodewords = function () {
- return this.codewords;
- };
- return DataBlock;
- }();
- var _default = DataBlock;
- exports.default = _default;
- /***/ }),
- /* 409 */
- /*!*************************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/decoder/DecodedBitStreamParser.js ***!
- \*************************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _DecoderResult = _interopRequireDefault(__webpack_require__(/*! ../../common/DecoderResult */ 337));
- var _BitSource = _interopRequireDefault(__webpack_require__(/*! ../../common/BitSource */ 410));
- var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../util/StringBuilder */ 320));
- var _StringEncoding = _interopRequireDefault(__webpack_require__(/*! ../../util/StringEncoding */ 325));
- var _StringUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/StringUtils */ 321));
- var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../../FormatException */ 324));
- var _IllegalStateException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalStateException */ 344));
- /*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var Mode;
- (function (Mode) {
- Mode[Mode["PAD_ENCODE"] = 0] = "PAD_ENCODE";
- Mode[Mode["ASCII_ENCODE"] = 1] = "ASCII_ENCODE";
- Mode[Mode["C40_ENCODE"] = 2] = "C40_ENCODE";
- Mode[Mode["TEXT_ENCODE"] = 3] = "TEXT_ENCODE";
- Mode[Mode["ANSIX12_ENCODE"] = 4] = "ANSIX12_ENCODE";
- Mode[Mode["EDIFACT_ENCODE"] = 5] = "EDIFACT_ENCODE";
- Mode[Mode["BASE256_ENCODE"] = 6] = "BASE256_ENCODE";
- })(Mode || (Mode = {}));
- /**
- * <p>Data Matrix Codes can encode text as bits in one of several modes, and can use multiple modes
- * in one Data Matrix Code. This class decodes the bits back into text.</p>
- *
- * <p>See ISO 16022:2006, 5.2.1 - 5.2.9.2</p>
- *
- * @author bbrown@google.com (Brian Brown)
- * @author Sean Owen
- */
- var DecodedBitStreamParser = /** @class */function () {
- function DecodedBitStreamParser() {}
- DecodedBitStreamParser.decode = function (bytes) {
- var bits = new _BitSource.default(bytes);
- var result = new _StringBuilder.default();
- var resultTrailer = new _StringBuilder.default();
- var byteSegments = new Array();
- var mode = Mode.ASCII_ENCODE;
- do {
- if (mode === Mode.ASCII_ENCODE) {
- mode = this.decodeAsciiSegment(bits, result, resultTrailer);
- } else {
- switch (mode) {
- case Mode.C40_ENCODE:
- this.decodeC40Segment(bits, result);
- break;
- case Mode.TEXT_ENCODE:
- this.decodeTextSegment(bits, result);
- break;
- case Mode.ANSIX12_ENCODE:
- this.decodeAnsiX12Segment(bits, result);
- break;
- case Mode.EDIFACT_ENCODE:
- this.decodeEdifactSegment(bits, result);
- break;
- case Mode.BASE256_ENCODE:
- this.decodeBase256Segment(bits, result, byteSegments);
- break;
- default:
- throw new _FormatException.default();
- }
- mode = Mode.ASCII_ENCODE;
- }
- } while (mode !== Mode.PAD_ENCODE && bits.available() > 0);
- if (resultTrailer.length() > 0) {
- result.append(resultTrailer.toString());
- }
- return new _DecoderResult.default(bytes, result.toString(), byteSegments.length === 0 ? null : byteSegments, null);
- };
- /**
- * See ISO 16022:2006, 5.2.3 and Annex C, Table C.2
- */
- DecodedBitStreamParser.decodeAsciiSegment = function (bits, result, resultTrailer) {
- var upperShift = false;
- do {
- var oneByte = bits.readBits(8);
- if (oneByte === 0) {
- throw new _FormatException.default();
- } else if (oneByte <= 128) {
- // ASCII data (ASCII value + 1)
- if (upperShift) {
- oneByte += 128;
- // upperShift = false;
- }
- result.append(String.fromCharCode(oneByte - 1));
- return Mode.ASCII_ENCODE;
- } else if (oneByte === 129) {
- // Pad
- return Mode.PAD_ENCODE;
- } else if (oneByte <= 229) {
- // 2-digit data 00-99 (Numeric Value + 130)
- var value = oneByte - 130;
- if (value < 10) {
- // pad with '0' for single digit values
- result.append('0');
- }
- result.append('' + value);
- } else {
- switch (oneByte) {
- case 230:
- // Latch to C40 encodation
- return Mode.C40_ENCODE;
- case 231:
- // Latch to Base 256 encodation
- return Mode.BASE256_ENCODE;
- case 232:
- // FNC1
- result.append(String.fromCharCode(29)); // translate as ASCII 29
- break;
- case 233: // Structured Append
- case 234:
- // Reader Programming
- // Ignore these symbols for now
- // throw ReaderException.getInstance();
- break;
- case 235:
- // Upper Shift (shift to Extended ASCII)
- upperShift = true;
- break;
- case 236:
- // 05 Macro
- result.append("[)>\x1E05\x1D");
- resultTrailer.insert(0, "\x1E\x04");
- break;
- case 237:
- // 06 Macro
- result.append("[)>\x1E06\x1D");
- resultTrailer.insert(0, "\x1E\x04");
- break;
- case 238:
- // Latch to ANSI X12 encodation
- return Mode.ANSIX12_ENCODE;
- case 239:
- // Latch to Text encodation
- return Mode.TEXT_ENCODE;
- case 240:
- // Latch to EDIFACT encodation
- return Mode.EDIFACT_ENCODE;
- case 241:
- // ECI Character
- // TODO(bbrown): I think we need to support ECI
- // throw ReaderException.getInstance();
- // Ignore this symbol for now
- break;
- default:
- // Not to be used in ASCII encodation
- // but work around encoders that end with 254, latch back to ASCII
- if (oneByte !== 254 || bits.available() !== 0) {
- throw new _FormatException.default();
- }
- break;
- }
- }
- } while (bits.available() > 0);
- return Mode.ASCII_ENCODE;
- };
- /**
- * See ISO 16022:2006, 5.2.5 and Annex C, Table C.1
- */
- DecodedBitStreamParser.decodeC40Segment = function (bits, result) {
- // Three C40 values are encoded in a 16-bit value as
- // (1600 * C1) + (40 * C2) + C3 + 1
- // TODO(bbrown): The Upper Shift with C40 doesn't work in the 4 value scenario all the time
- var upperShift = false;
- var cValues = [];
- var shift = 0;
- do {
- // If there is only one byte left then it will be encoded as ASCII
- if (bits.available() === 8) {
- return;
- }
- var firstByte = bits.readBits(8);
- if (firstByte === 254) {
- // Unlatch codeword
- return;
- }
- this.parseTwoBytes(firstByte, bits.readBits(8), cValues);
- for (var i = 0; i < 3; i++) {
- var cValue = cValues[i];
- switch (shift) {
- case 0:
- if (cValue < 3) {
- shift = cValue + 1;
- } else if (cValue < this.C40_BASIC_SET_CHARS.length) {
- var c40char = this.C40_BASIC_SET_CHARS[cValue];
- if (upperShift) {
- result.append(String.fromCharCode(c40char.charCodeAt(0) + 128));
- upperShift = false;
- } else {
- result.append(c40char);
- }
- } else {
- throw new _FormatException.default();
- }
- break;
- case 1:
- if (upperShift) {
- result.append(String.fromCharCode(cValue + 128));
- upperShift = false;
- } else {
- result.append(String.fromCharCode(cValue));
- }
- shift = 0;
- break;
- case 2:
- if (cValue < this.C40_SHIFT2_SET_CHARS.length) {
- var c40char = this.C40_SHIFT2_SET_CHARS[cValue];
- if (upperShift) {
- result.append(String.fromCharCode(c40char.charCodeAt(0) + 128));
- upperShift = false;
- } else {
- result.append(c40char);
- }
- } else {
- switch (cValue) {
- case 27:
- // FNC1
- result.append(String.fromCharCode(29)); // translate as ASCII 29
- break;
- case 30:
- // Upper Shift
- upperShift = true;
- break;
- default:
- throw new _FormatException.default();
- }
- }
- shift = 0;
- break;
- case 3:
- if (upperShift) {
- result.append(String.fromCharCode(cValue + 224));
- upperShift = false;
- } else {
- result.append(String.fromCharCode(cValue + 96));
- }
- shift = 0;
- break;
- default:
- throw new _FormatException.default();
- }
- }
- } while (bits.available() > 0);
- };
- /**
- * See ISO 16022:2006, 5.2.6 and Annex C, Table C.2
- */
- DecodedBitStreamParser.decodeTextSegment = function (bits, result) {
- // Three Text values are encoded in a 16-bit value as
- // (1600 * C1) + (40 * C2) + C3 + 1
- // TODO(bbrown): The Upper Shift with Text doesn't work in the 4 value scenario all the time
- var upperShift = false;
- var cValues = [];
- var shift = 0;
- do {
- // If there is only one byte left then it will be encoded as ASCII
- if (bits.available() === 8) {
- return;
- }
- var firstByte = bits.readBits(8);
- if (firstByte === 254) {
- // Unlatch codeword
- return;
- }
- this.parseTwoBytes(firstByte, bits.readBits(8), cValues);
- for (var i = 0; i < 3; i++) {
- var cValue = cValues[i];
- switch (shift) {
- case 0:
- if (cValue < 3) {
- shift = cValue + 1;
- } else if (cValue < this.TEXT_BASIC_SET_CHARS.length) {
- var textChar = this.TEXT_BASIC_SET_CHARS[cValue];
- if (upperShift) {
- result.append(String.fromCharCode(textChar.charCodeAt(0) + 128));
- upperShift = false;
- } else {
- result.append(textChar);
- }
- } else {
- throw new _FormatException.default();
- }
- break;
- case 1:
- if (upperShift) {
- result.append(String.fromCharCode(cValue + 128));
- upperShift = false;
- } else {
- result.append(String.fromCharCode(cValue));
- }
- shift = 0;
- break;
- case 2:
- // Shift 2 for Text is the same encoding as C40
- if (cValue < this.TEXT_SHIFT2_SET_CHARS.length) {
- var textChar = this.TEXT_SHIFT2_SET_CHARS[cValue];
- if (upperShift) {
- result.append(String.fromCharCode(textChar.charCodeAt(0) + 128));
- upperShift = false;
- } else {
- result.append(textChar);
- }
- } else {
- switch (cValue) {
- case 27:
- // FNC1
- result.append(String.fromCharCode(29)); // translate as ASCII 29
- break;
- case 30:
- // Upper Shift
- upperShift = true;
- break;
- default:
- throw new _FormatException.default();
- }
- }
- shift = 0;
- break;
- case 3:
- if (cValue < this.TEXT_SHIFT3_SET_CHARS.length) {
- var textChar = this.TEXT_SHIFT3_SET_CHARS[cValue];
- if (upperShift) {
- result.append(String.fromCharCode(textChar.charCodeAt(0) + 128));
- upperShift = false;
- } else {
- result.append(textChar);
- }
- shift = 0;
- } else {
- throw new _FormatException.default();
- }
- break;
- default:
- throw new _FormatException.default();
- }
- }
- } while (bits.available() > 0);
- };
- /**
- * See ISO 16022:2006, 5.2.7
- */
- DecodedBitStreamParser.decodeAnsiX12Segment = function (bits, result) {
- // Three ANSI X12 values are encoded in a 16-bit value as
- // (1600 * C1) + (40 * C2) + C3 + 1
- var cValues = [];
- do {
- // If there is only one byte left then it will be encoded as ASCII
- if (bits.available() === 8) {
- return;
- }
- var firstByte = bits.readBits(8);
- if (firstByte === 254) {
- // Unlatch codeword
- return;
- }
- this.parseTwoBytes(firstByte, bits.readBits(8), cValues);
- for (var i = 0; i < 3; i++) {
- var cValue = cValues[i];
- switch (cValue) {
- case 0:
- // X12 segment terminator <CR>
- result.append('\r');
- break;
- case 1:
- // X12 segment separator *
- result.append('*');
- break;
- case 2:
- // X12 sub-element separator >
- result.append('>');
- break;
- case 3:
- // space
- result.append(' ');
- break;
- default:
- if (cValue < 14) {
- // 0 - 9
- result.append(String.fromCharCode(cValue + 44));
- } else if (cValue < 40) {
- // A - Z
- result.append(String.fromCharCode(cValue + 51));
- } else {
- throw new _FormatException.default();
- }
- break;
- }
- }
- } while (bits.available() > 0);
- };
- DecodedBitStreamParser.parseTwoBytes = function (firstByte, secondByte, result) {
- var fullBitValue = (firstByte << 8) + secondByte - 1;
- var temp = Math.floor(fullBitValue / 1600);
- result[0] = temp;
- fullBitValue -= temp * 1600;
- temp = Math.floor(fullBitValue / 40);
- result[1] = temp;
- result[2] = fullBitValue - temp * 40;
- };
- /**
- * See ISO 16022:2006, 5.2.8 and Annex C Table C.3
- */
- DecodedBitStreamParser.decodeEdifactSegment = function (bits, result) {
- do {
- // If there is only two or less bytes left then it will be encoded as ASCII
- if (bits.available() <= 16) {
- return;
- }
- for (var i = 0; i < 4; i++) {
- var edifactValue = bits.readBits(6);
- // Check for the unlatch character
- if (edifactValue === 0x1F) {
- // 011111
- // Read rest of byte, which should be 0, and stop
- var bitsLeft = 8 - bits.getBitOffset();
- if (bitsLeft !== 8) {
- bits.readBits(bitsLeft);
- }
- return;
- }
- if ((edifactValue & 0x20) === 0) {
- // no 1 in the leading (6th) bit
- edifactValue |= 0x40; // Add a leading 01 to the 6 bit binary value
- }
- result.append(String.fromCharCode(edifactValue));
- }
- } while (bits.available() > 0);
- };
- /**
- * See ISO 16022:2006, 5.2.9 and Annex B, B.2
- */
- DecodedBitStreamParser.decodeBase256Segment = function (bits, result, byteSegments) {
- // Figure out how long the Base 256 Segment is.
- var codewordPosition = 1 + bits.getByteOffset(); // position is 1-indexed
- var d1 = this.unrandomize255State(bits.readBits(8), codewordPosition++);
- var count;
- if (d1 === 0) {
- // Read the remainder of the symbol
- count = bits.available() / 8 | 0;
- } else if (d1 < 250) {
- count = d1;
- } else {
- count = 250 * (d1 - 249) + this.unrandomize255State(bits.readBits(8), codewordPosition++);
- }
- // We're seeing NegativeArraySizeException errors from users.
- if (count < 0) {
- throw new _FormatException.default();
- }
- var bytes = new Uint8Array(count);
- for (var i = 0; i < count; i++) {
- // Have seen this particular error in the wild, such as at
- // http://www.bcgen.com/demo/IDAutomationStreamingDataMatrix.aspx?MODE=3&D=Fred&PFMT=3&PT=F&X=0.3&O=0&LM=0.2
- if (bits.available() < 8) {
- throw new _FormatException.default();
- }
- bytes[i] = this.unrandomize255State(bits.readBits(8), codewordPosition++);
- }
- byteSegments.push(bytes);
- try {
- result.append(_StringEncoding.default.decode(bytes, _StringUtils.default.ISO88591));
- } catch (uee) {
- throw new _IllegalStateException.default('Platform does not support required encoding: ' + uee.message);
- }
- };
- /**
- * See ISO 16022:2006, Annex B, B.2
- */
- DecodedBitStreamParser.unrandomize255State = function (randomizedBase256Codeword, base256CodewordPosition) {
- var pseudoRandomNumber = 149 * base256CodewordPosition % 255 + 1;
- var tempVariable = randomizedBase256Codeword - pseudoRandomNumber;
- return tempVariable >= 0 ? tempVariable : tempVariable + 256;
- };
- /**
- * See ISO 16022:2006, Annex C Table C.1
- * The C40 Basic Character Set (*'s used for placeholders for the shift values)
- */
- DecodedBitStreamParser.C40_BASIC_SET_CHARS = ['*', '*', '*', ' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
- DecodedBitStreamParser.C40_SHIFT2_SET_CHARS = ['!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_'];
- /**
- * See ISO 16022:2006, Annex C Table C.2
- * The Text Basic Character Set (*'s used for placeholders for the shift values)
- */
- DecodedBitStreamParser.TEXT_BASIC_SET_CHARS = ['*', '*', '*', ' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
- // Shift 2 for Text is the same encoding as C40
- DecodedBitStreamParser.TEXT_SHIFT2_SET_CHARS = DecodedBitStreamParser.C40_SHIFT2_SET_CHARS;
- DecodedBitStreamParser.TEXT_SHIFT3_SET_CHARS = ['`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '{', '|', '}', '~', String.fromCharCode(127)];
- return DecodedBitStreamParser;
- }();
- var _default = DecodedBitStreamParser;
- exports.default = _default;
- /***/ }),
- /* 410 */
- /*!************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/BitSource.js ***!
- \************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../IllegalArgumentException */ 308));
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /*namespace com.google.zxing.common {*/
- /**
- * <p>This provides an easy abstraction to read bits at a time from a sequence of bytes, where the
- * number of bits read is not often a multiple of 8.</p>
- *
- * <p>This class is thread-safe but not reentrant -- unless the caller modifies the bytes array
- * it passed in, in which case all bets are off.</p>
- *
- * @author Sean Owen
- */
- var BitSource = /** @class */function () {
- /**
- * @param bytes bytes from which this will read bits. Bits will be read from the first byte first.
- * Bits are read within a byte from most-significant to least-significant bit.
- */
- function BitSource(bytes) {
- this.bytes = bytes;
- this.byteOffset = 0;
- this.bitOffset = 0;
- }
- /**
- * @return index of next bit in current byte which would be read by the next call to {@link #readBits(int)}.
- */
- BitSource.prototype.getBitOffset = function () {
- return this.bitOffset;
- };
- /**
- * @return index of next byte in input byte array which would be read by the next call to {@link #readBits(int)}.
- */
- BitSource.prototype.getByteOffset = function () {
- return this.byteOffset;
- };
- /**
- * @param numBits number of bits to read
- * @return int representing the bits read. The bits will appear as the least-significant
- * bits of the int
- * @throws IllegalArgumentException if numBits isn't in [1,32] or more than is available
- */
- BitSource.prototype.readBits = function (numBits /*int*/) {
- if (numBits < 1 || numBits > 32 || numBits > this.available()) {
- throw new _IllegalArgumentException.default('' + numBits);
- }
- var result = 0;
- var bitOffset = this.bitOffset;
- var byteOffset = this.byteOffset;
- var bytes = this.bytes;
- // First, read remainder from current byte
- if (bitOffset > 0) {
- var bitsLeft = 8 - bitOffset;
- var toRead = numBits < bitsLeft ? numBits : bitsLeft;
- var bitsToNotRead = bitsLeft - toRead;
- var mask = 0xFF >> 8 - toRead << bitsToNotRead;
- result = (bytes[byteOffset] & mask) >> bitsToNotRead;
- numBits -= toRead;
- bitOffset += toRead;
- if (bitOffset === 8) {
- bitOffset = 0;
- byteOffset++;
- }
- }
- // Next read whole bytes
- if (numBits > 0) {
- while (numBits >= 8) {
- result = result << 8 | bytes[byteOffset] & 0xFF;
- byteOffset++;
- numBits -= 8;
- }
- // Finally read a partial byte
- if (numBits > 0) {
- var bitsToNotRead = 8 - numBits;
- var mask = 0xFF >> bitsToNotRead << bitsToNotRead;
- result = result << numBits | (bytes[byteOffset] & mask) >> bitsToNotRead;
- bitOffset += numBits;
- }
- }
- this.bitOffset = bitOffset;
- this.byteOffset = byteOffset;
- return result;
- };
- /**
- * @return number of bits that can be read successfully
- */
- BitSource.prototype.available = function () {
- return 8 * (this.bytes.length - this.byteOffset) - this.bitOffset;
- };
- return BitSource;
- }();
- var _default = BitSource;
- exports.default = _default;
- /***/ }),
- /* 411 */
- /*!************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/detector/Detector.js ***!
- \************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _WhiteRectangleDetector = _interopRequireDefault(__webpack_require__(/*! ../../common/detector/WhiteRectangleDetector */ 351));
- var _DetectorResult = _interopRequireDefault(__webpack_require__(/*! ../../common/DetectorResult */ 350));
- var _GridSamplerInstance = _interopRequireDefault(__webpack_require__(/*! ../../common/GridSamplerInstance */ 352));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../NotFoundException */ 327));
- var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../../ResultPoint */ 346));
- /*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /**
- * <p>Encapsulates logic that can detect a Data Matrix Code in an image, even if the Data Matrix Code
- * is rotated or skewed, or partially obscured.</p>
- *
- * @author Sean Owen
- */
- var Detector = /** @class */function () {
- function Detector(image) {
- this.image = image;
- this.rectangleDetector = new _WhiteRectangleDetector.default(this.image);
- }
- /**
- * <p>Detects a Data Matrix Code in an image.</p>
- *
- * @return {@link DetectorResult} encapsulating results of detecting a Data Matrix Code
- * @throws NotFoundException if no Data Matrix Code can be found
- */
- Detector.prototype.detect = function () {
- var cornerPoints = this.rectangleDetector.detect();
- var points = this.detectSolid1(cornerPoints);
- points = this.detectSolid2(points);
- points[3] = this.correctTopRight(points);
- if (!points[3]) {
- throw new _NotFoundException.default();
- }
- points = this.shiftToModuleCenter(points);
- var topLeft = points[0];
- var bottomLeft = points[1];
- var bottomRight = points[2];
- var topRight = points[3];
- var dimensionTop = this.transitionsBetween(topLeft, topRight) + 1;
- var dimensionRight = this.transitionsBetween(bottomRight, topRight) + 1;
- if ((dimensionTop & 0x01) === 1) {
- dimensionTop += 1;
- }
- if ((dimensionRight & 0x01) === 1) {
- dimensionRight += 1;
- }
- if (4 * dimensionTop < 7 * dimensionRight && 4 * dimensionRight < 7 * dimensionTop) {
- // The matrix is square
- dimensionTop = dimensionRight = Math.max(dimensionTop, dimensionRight);
- }
- var bits = Detector.sampleGrid(this.image, topLeft, bottomLeft, bottomRight, topRight, dimensionTop, dimensionRight);
- return new _DetectorResult.default(bits, [topLeft, bottomLeft, bottomRight, topRight]);
- };
- Detector.shiftPoint = function (point, to, div) {
- var x = (to.getX() - point.getX()) / (div + 1);
- var y = (to.getY() - point.getY()) / (div + 1);
- return new _ResultPoint.default(point.getX() + x, point.getY() + y);
- };
- Detector.moveAway = function (point, fromX, fromY) {
- var x = point.getX();
- var y = point.getY();
- if (x < fromX) {
- x -= 1;
- } else {
- x += 1;
- }
- if (y < fromY) {
- y -= 1;
- } else {
- y += 1;
- }
- return new _ResultPoint.default(x, y);
- };
- /**
- * Detect a solid side which has minimum transition.
- */
- Detector.prototype.detectSolid1 = function (cornerPoints) {
- // 0 2
- // 1 3
- var pointA = cornerPoints[0];
- var pointB = cornerPoints[1];
- var pointC = cornerPoints[3];
- var pointD = cornerPoints[2];
- var trAB = this.transitionsBetween(pointA, pointB);
- var trBC = this.transitionsBetween(pointB, pointC);
- var trCD = this.transitionsBetween(pointC, pointD);
- var trDA = this.transitionsBetween(pointD, pointA);
- // 0..3
- // : :
- // 1--2
- var min = trAB;
- var points = [pointD, pointA, pointB, pointC];
- if (min > trBC) {
- min = trBC;
- points[0] = pointA;
- points[1] = pointB;
- points[2] = pointC;
- points[3] = pointD;
- }
- if (min > trCD) {
- min = trCD;
- points[0] = pointB;
- points[1] = pointC;
- points[2] = pointD;
- points[3] = pointA;
- }
- if (min > trDA) {
- points[0] = pointC;
- points[1] = pointD;
- points[2] = pointA;
- points[3] = pointB;
- }
- return points;
- };
- /**
- * Detect a second solid side next to first solid side.
- */
- Detector.prototype.detectSolid2 = function (points) {
- // A..D
- // : :
- // B--C
- var pointA = points[0];
- var pointB = points[1];
- var pointC = points[2];
- var pointD = points[3];
- // Transition detection on the edge is not stable.
- // To safely detect, shift the points to the module center.
- var tr = this.transitionsBetween(pointA, pointD);
- var pointBs = Detector.shiftPoint(pointB, pointC, (tr + 1) * 4);
- var pointCs = Detector.shiftPoint(pointC, pointB, (tr + 1) * 4);
- var trBA = this.transitionsBetween(pointBs, pointA);
- var trCD = this.transitionsBetween(pointCs, pointD);
- // 0..3
- // | :
- // 1--2
- if (trBA < trCD) {
- // solid sides: A-B-C
- points[0] = pointA;
- points[1] = pointB;
- points[2] = pointC;
- points[3] = pointD;
- } else {
- // solid sides: B-C-D
- points[0] = pointB;
- points[1] = pointC;
- points[2] = pointD;
- points[3] = pointA;
- }
- return points;
- };
- /**
- * Calculates the corner position of the white top right module.
- */
- Detector.prototype.correctTopRight = function (points) {
- // A..D
- // | :
- // B--C
- var pointA = points[0];
- var pointB = points[1];
- var pointC = points[2];
- var pointD = points[3];
- // shift points for safe transition detection.
- var trTop = this.transitionsBetween(pointA, pointD);
- var trRight = this.transitionsBetween(pointB, pointD);
- var pointAs = Detector.shiftPoint(pointA, pointB, (trRight + 1) * 4);
- var pointCs = Detector.shiftPoint(pointC, pointB, (trTop + 1) * 4);
- trTop = this.transitionsBetween(pointAs, pointD);
- trRight = this.transitionsBetween(pointCs, pointD);
- var candidate1 = new _ResultPoint.default(pointD.getX() + (pointC.getX() - pointB.getX()) / (trTop + 1), pointD.getY() + (pointC.getY() - pointB.getY()) / (trTop + 1));
- var candidate2 = new _ResultPoint.default(pointD.getX() + (pointA.getX() - pointB.getX()) / (trRight + 1), pointD.getY() + (pointA.getY() - pointB.getY()) / (trRight + 1));
- if (!this.isValid(candidate1)) {
- if (this.isValid(candidate2)) {
- return candidate2;
- }
- return null;
- }
- if (!this.isValid(candidate2)) {
- return candidate1;
- }
- var sumc1 = this.transitionsBetween(pointAs, candidate1) + this.transitionsBetween(pointCs, candidate1);
- var sumc2 = this.transitionsBetween(pointAs, candidate2) + this.transitionsBetween(pointCs, candidate2);
- if (sumc1 > sumc2) {
- return candidate1;
- } else {
- return candidate2;
- }
- };
- /**
- * Shift the edge points to the module center.
- */
- Detector.prototype.shiftToModuleCenter = function (points) {
- // A..D
- // | :
- // B--C
- var pointA = points[0];
- var pointB = points[1];
- var pointC = points[2];
- var pointD = points[3];
- // calculate pseudo dimensions
- var dimH = this.transitionsBetween(pointA, pointD) + 1;
- var dimV = this.transitionsBetween(pointC, pointD) + 1;
- // shift points for safe dimension detection
- var pointAs = Detector.shiftPoint(pointA, pointB, dimV * 4);
- var pointCs = Detector.shiftPoint(pointC, pointB, dimH * 4);
- // calculate more precise dimensions
- dimH = this.transitionsBetween(pointAs, pointD) + 1;
- dimV = this.transitionsBetween(pointCs, pointD) + 1;
- if ((dimH & 0x01) === 1) {
- dimH += 1;
- }
- if ((dimV & 0x01) === 1) {
- dimV += 1;
- }
- // WhiteRectangleDetector returns points inside of the rectangle.
- // I want points on the edges.
- var centerX = (pointA.getX() + pointB.getX() + pointC.getX() + pointD.getX()) / 4;
- var centerY = (pointA.getY() + pointB.getY() + pointC.getY() + pointD.getY()) / 4;
- pointA = Detector.moveAway(pointA, centerX, centerY);
- pointB = Detector.moveAway(pointB, centerX, centerY);
- pointC = Detector.moveAway(pointC, centerX, centerY);
- pointD = Detector.moveAway(pointD, centerX, centerY);
- var pointBs;
- var pointDs;
- // shift points to the center of each modules
- pointAs = Detector.shiftPoint(pointA, pointB, dimV * 4);
- pointAs = Detector.shiftPoint(pointAs, pointD, dimH * 4);
- pointBs = Detector.shiftPoint(pointB, pointA, dimV * 4);
- pointBs = Detector.shiftPoint(pointBs, pointC, dimH * 4);
- pointCs = Detector.shiftPoint(pointC, pointD, dimV * 4);
- pointCs = Detector.shiftPoint(pointCs, pointB, dimH * 4);
- pointDs = Detector.shiftPoint(pointD, pointC, dimV * 4);
- pointDs = Detector.shiftPoint(pointDs, pointA, dimH * 4);
- return [pointAs, pointBs, pointCs, pointDs];
- };
- Detector.prototype.isValid = function (p) {
- return p.getX() >= 0 && p.getX() < this.image.getWidth() && p.getY() > 0 && p.getY() < this.image.getHeight();
- };
- Detector.sampleGrid = function (image, topLeft, bottomLeft, bottomRight, topRight, dimensionX, dimensionY) {
- var sampler = _GridSamplerInstance.default.getInstance();
- return sampler.sampleGrid(image, dimensionX, dimensionY, 0.5, 0.5, dimensionX - 0.5, 0.5, dimensionX - 0.5, dimensionY - 0.5, 0.5, dimensionY - 0.5, topLeft.getX(), topLeft.getY(), topRight.getX(), topRight.getY(), bottomRight.getX(), bottomRight.getY(), bottomLeft.getX(), bottomLeft.getY());
- };
- /**
- * Counts the number of black/white transitions between two points, using something like Bresenham's algorithm.
- */
- Detector.prototype.transitionsBetween = function (from, to) {
- // See QR Code Detector, sizeOfBlackWhiteBlackRun()
- var fromX = Math.trunc(from.getX());
- var fromY = Math.trunc(from.getY());
- var toX = Math.trunc(to.getX());
- var toY = Math.trunc(to.getY());
- var steep = Math.abs(toY - fromY) > Math.abs(toX - fromX);
- if (steep) {
- var temp = fromX;
- fromX = fromY;
- fromY = temp;
- temp = toX;
- toX = toY;
- toY = temp;
- }
- var dx = Math.abs(toX - fromX);
- var dy = Math.abs(toY - fromY);
- var error = -dx / 2;
- var ystep = fromY < toY ? 1 : -1;
- var xstep = fromX < toX ? 1 : -1;
- var transitions = 0;
- var inBlack = this.image.get(steep ? fromY : fromX, steep ? fromX : fromY);
- for (var x = fromX, y = fromY; x !== toX; x += xstep) {
- var isBlack = this.image.get(steep ? y : x, steep ? x : y);
- if (isBlack !== inBlack) {
- transitions++;
- inBlack = isBlack;
- }
- error += dy;
- if (error > 0) {
- if (y === toY) {
- break;
- }
- y += ystep;
- error -= dx;
- }
- }
- return transitions;
- };
- return Detector;
- }();
- var _default = Detector;
- exports.default = _default;
- /***/ }),
- /* 412 */
- /*!***********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/browser/BrowserMultiFormatReader.js ***!
- \***********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.BrowserMultiFormatReader = void 0;
- var _BrowserCodeReader = __webpack_require__(/*! ./BrowserCodeReader */ 303);
- var _MultiFormatReader = _interopRequireDefault(__webpack_require__(/*! ../core/MultiFormatReader */ 413));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var BrowserMultiFormatReader = /** @class */function (_super) {
- __extends(BrowserMultiFormatReader, _super);
- function BrowserMultiFormatReader(hints, timeBetweenScansMillis) {
- if (hints === void 0) {
- hints = null;
- }
- if (timeBetweenScansMillis === void 0) {
- timeBetweenScansMillis = 500;
- }
- var _this = this;
- var reader = new _MultiFormatReader.default();
- reader.setHints(hints);
- _this = _super.call(this, reader, timeBetweenScansMillis) || this;
- return _this;
- }
- /**
- * Overwrite decodeBitmap to call decodeWithState, which will pay
- * attention to the hints set in the constructor function
- */
- BrowserMultiFormatReader.prototype.decodeBitmap = function (binaryBitmap) {
- return this.reader.decodeWithState(binaryBitmap);
- };
- return BrowserMultiFormatReader;
- }(_BrowserCodeReader.BrowserCodeReader);
- exports.BrowserMultiFormatReader = BrowserMultiFormatReader;
- /***/ }),
- /* 413 */
- /*!*************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/MultiFormatReader.js ***!
- \*************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _DecodeHintType = _interopRequireDefault(__webpack_require__(/*! ./DecodeHintType */ 322));
- var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ./BarcodeFormat */ 334));
- var _QRCodeReader = _interopRequireDefault(__webpack_require__(/*! ./qrcode/QRCodeReader */ 414));
- var _AztecReader = _interopRequireDefault(__webpack_require__(/*! ./aztec/AztecReader */ 332));
- var _MultiFormatOneDReader = _interopRequireDefault(__webpack_require__(/*! ./oned/MultiFormatOneDReader */ 357));
- var _DataMatrixReader = _interopRequireDefault(__webpack_require__(/*! ./datamatrix/DataMatrixReader */ 404));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ./NotFoundException */ 327));
- var _PDF417Reader = _interopRequireDefault(__webpack_require__(/*! ./pdf417/PDF417Reader */ 433));
- var _ReaderException = _interopRequireDefault(__webpack_require__(/*! ./ReaderException */ 458));
- /*
- * Copyright 2009 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- /*namespace com.google.zxing {*/
- /**
- * MultiFormatReader is a convenience class and the main entry point into the library for most uses.
- * By default it attempts to decode all barcode formats that the library supports. Optionally, you
- * can provide a hints object to request different behavior, for example only decoding QR codes.
- *
- * @author Sean Owen
- * @author dswitkin@google.com (Daniel Switkin)
- */
- var MultiFormatReader = /** @class */function () {
- function MultiFormatReader() {}
- /**
- * This version of decode honors the intent of Reader.decode(BinaryBitmap) in that it
- * passes null as a hint to the decoders. However, that makes it inefficient to call repeatedly.
- * Use setHints() followed by decodeWithState() for continuous scan applications.
- *
- * @param image The pixel data to decode
- * @return The contents of the image
- *
- * @throws NotFoundException Any errors which occurred
- */
- /*@Override*/
- // public decode(image: BinaryBitmap): Result {
- // setHints(null)
- // return decodeInternal(image)
- // }
- /**
- * Decode an image using the hints provided. Does not honor existing state.
- *
- * @param image The pixel data to decode
- * @param hints The hints to use, clearing the previous state.
- * @return The contents of the image
- *
- * @throws NotFoundException Any errors which occurred
- */
- /*@Override*/
- MultiFormatReader.prototype.decode = function (image, hints) {
- this.setHints(hints);
- return this.decodeInternal(image);
- };
- /**
- * Decode an image using the state set up by calling setHints() previously. Continuous scan
- * clients will get a <b>large</b> speed increase by using this instead of decode().
- *
- * @param image The pixel data to decode
- * @return The contents of the image
- *
- * @throws NotFoundException Any errors which occurred
- */
- MultiFormatReader.prototype.decodeWithState = function (image) {
- // Make sure to set up the default state so we don't crash
- if (this.readers === null || this.readers === undefined) {
- this.setHints(null);
- }
- return this.decodeInternal(image);
- };
- /**
- * This method adds state to the MultiFormatReader. By setting the hints once, subsequent calls
- * to decodeWithState(image) can reuse the same set of readers without reallocating memory. This
- * is important for performance in continuous scan clients.
- *
- * @param hints The set of hints to use for subsequent calls to decode(image)
- */
- MultiFormatReader.prototype.setHints = function (hints) {
- this.hints = hints;
- var tryHarder = hints !== null && hints !== undefined && undefined !== hints.get(_DecodeHintType.default.TRY_HARDER);
- /*@SuppressWarnings("unchecked")*/
- var formats = hints === null || hints === undefined ? null : hints.get(_DecodeHintType.default.POSSIBLE_FORMATS);
- var readers = new Array();
- if (formats !== null && formats !== undefined) {
- var addOneDReader = formats.some(function (f) {
- return f === _BarcodeFormat.default.UPC_A || f === _BarcodeFormat.default.UPC_E || f === _BarcodeFormat.default.EAN_13 || f === _BarcodeFormat.default.EAN_8 || f === _BarcodeFormat.default.CODABAR || f === _BarcodeFormat.default.CODE_39 || f === _BarcodeFormat.default.CODE_93 || f === _BarcodeFormat.default.CODE_128 || f === _BarcodeFormat.default.ITF || f === _BarcodeFormat.default.RSS_14 || f === _BarcodeFormat.default.RSS_EXPANDED;
- });
- // Put 1D readers upfront in "normal" mode
- // TYPESCRIPTPORT: TODO: uncomment below as they are ported
- if (addOneDReader && !tryHarder) {
- readers.push(new _MultiFormatOneDReader.default(hints));
- }
- if (formats.includes(_BarcodeFormat.default.QR_CODE)) {
- readers.push(new _QRCodeReader.default());
- }
- if (formats.includes(_BarcodeFormat.default.DATA_MATRIX)) {
- readers.push(new _DataMatrixReader.default());
- }
- if (formats.includes(_BarcodeFormat.default.AZTEC)) {
- readers.push(new _AztecReader.default());
- }
- if (formats.includes(_BarcodeFormat.default.PDF_417)) {
- readers.push(new _PDF417Reader.default());
- }
- // if (formats.includes(BarcodeFormat.MAXICODE)) {
- // readers.push(new MaxiCodeReader())
- // }
- // At end in "try harder" mode
- if (addOneDReader && tryHarder) {
- readers.push(new _MultiFormatOneDReader.default(hints));
- }
- }
- if (readers.length === 0) {
- if (!tryHarder) {
- readers.push(new _MultiFormatOneDReader.default(hints));
- }
- readers.push(new _QRCodeReader.default());
- readers.push(new _DataMatrixReader.default());
- readers.push(new _AztecReader.default());
- readers.push(new _PDF417Reader.default());
- // readers.push(new MaxiCodeReader())
- if (tryHarder) {
- readers.push(new _MultiFormatOneDReader.default(hints));
- }
- }
- this.readers = readers; // .toArray(new Reader[readers.size()])
- };
- /*@Override*/
- MultiFormatReader.prototype.reset = function () {
- var e_1, _a;
- if (this.readers !== null) {
- try {
- for (var _b = __values(this.readers), _c = _b.next(); !_c.done; _c = _b.next()) {
- var reader = _c.value;
- reader.reset();
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- }
- };
- /**
- * @throws NotFoundException
- */
- MultiFormatReader.prototype.decodeInternal = function (image) {
- var e_2, _a;
- if (this.readers === null) {
- throw new _ReaderException.default('No readers where selected, nothing can be read.');
- }
- try {
- for (var _b = __values(this.readers), _c = _b.next(); !_c.done; _c = _b.next()) {
- var reader = _c.value;
- // Trying to decode with ${reader} reader.
- try {
- return reader.decode(image, this.hints);
- } catch (ex) {
- if (ex instanceof _ReaderException.default) {
- continue;
- }
- // Bad Exception.
- }
- }
- } catch (e_2_1) {
- e_2 = {
- error: e_2_1
- };
- } finally {
- try {
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
- } finally {
- if (e_2) throw e_2.error;
- }
- }
- throw new _NotFoundException.default('No MultiFormat Readers were able to detect the code.');
- };
- return MultiFormatReader;
- }();
- var _default = MultiFormatReader;
- exports.default = _default;
- /***/ }),
- /* 414 */
- /*!***************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/QRCodeReader.js ***!
- \***************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
- var _BitMatrix = _interopRequireDefault(__webpack_require__(/*! ../common/BitMatrix */ 319));
- var _DecodeHintType = _interopRequireDefault(__webpack_require__(/*! ../DecodeHintType */ 322));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
- var _Result = _interopRequireDefault(__webpack_require__(/*! ../Result */ 333));
- var _ResultMetadataType = _interopRequireDefault(__webpack_require__(/*! ../ResultMetadataType */ 335));
- var _Decoder = _interopRequireDefault(__webpack_require__(/*! ./decoder/Decoder */ 415));
- var _QRCodeDecoderMetaData = _interopRequireDefault(__webpack_require__(/*! ./decoder/QRCodeDecoderMetaData */ 426));
- var _Detector = _interopRequireDefault(__webpack_require__(/*! ./detector/Detector */ 427));
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /*namespace com.google.zxing.qrcode {*/
- // import DetectorResult from '../common/DetectorResult';
- /*import java.util.List;*/
- /*import java.util.Map;*/
- /**
- * This implementation can detect and decode QR Codes in an image.
- *
- * @author Sean Owen
- */
- var QRCodeReader = /** @class */function () {
- function QRCodeReader() {
- this.decoder = new _Decoder.default();
- }
- QRCodeReader.prototype.getDecoder = function () {
- return this.decoder;
- };
- /**
- * Locates and decodes a QR code in an image.
- *
- * @return a representing: string the content encoded by the QR code
- * @throws NotFoundException if a QR code cannot be found
- * @throws FormatException if a QR code cannot be decoded
- * @throws ChecksumException if error correction fails
- */
- /*@Override*/
- // public decode(image: BinaryBitmap): Result /*throws NotFoundException, ChecksumException, FormatException */ {
- // return this.decode(image, null)
- // }
- /*@Override*/
- QRCodeReader.prototype.decode = function (image, hints) {
- var decoderResult;
- var points;
- if (hints !== undefined && hints !== null && undefined !== hints.get(_DecodeHintType.default.PURE_BARCODE)) {
- var bits = QRCodeReader.extractPureBits(image.getBlackMatrix());
- decoderResult = this.decoder.decodeBitMatrix(bits, hints);
- points = QRCodeReader.NO_POINTS;
- } else {
- var detectorResult = new _Detector.default(image.getBlackMatrix()).detect(hints);
- decoderResult = this.decoder.decodeBitMatrix(detectorResult.getBits(), hints);
- points = detectorResult.getPoints();
- }
- // If the code was mirrored: swap the bottom-left and the top-right points.
- if (decoderResult.getOther() instanceof _QRCodeDecoderMetaData.default) {
- decoderResult.getOther().applyMirroredCorrection(points);
- }
- var result = new _Result.default(decoderResult.getText(), decoderResult.getRawBytes(), undefined, points, _BarcodeFormat.default.QR_CODE, undefined);
- var byteSegments = decoderResult.getByteSegments();
- if (byteSegments !== null) {
- result.putMetadata(_ResultMetadataType.default.BYTE_SEGMENTS, byteSegments);
- }
- var ecLevel = decoderResult.getECLevel();
- if (ecLevel !== null) {
- result.putMetadata(_ResultMetadataType.default.ERROR_CORRECTION_LEVEL, ecLevel);
- }
- if (decoderResult.hasStructuredAppend()) {
- result.putMetadata(_ResultMetadataType.default.STRUCTURED_APPEND_SEQUENCE, decoderResult.getStructuredAppendSequenceNumber());
- result.putMetadata(_ResultMetadataType.default.STRUCTURED_APPEND_PARITY, decoderResult.getStructuredAppendParity());
- }
- return result;
- };
- /*@Override*/
- QRCodeReader.prototype.reset = function () {
- // do nothing
- };
- /**
- * This method detects a code in a "pure" image -- that is, pure monochrome image
- * which contains only an unrotated, unskewed, image of a code, with some white border
- * around it. This is a specialized method that works exceptionally fast in this special
- * case.
- *
- * @see com.google.zxing.datamatrix.DataMatrixReader#extractPureBits(BitMatrix)
- */
- QRCodeReader.extractPureBits = function (image) {
- var leftTopBlack = image.getTopLeftOnBit();
- var rightBottomBlack = image.getBottomRightOnBit();
- if (leftTopBlack === null || rightBottomBlack === null) {
- throw new _NotFoundException.default();
- }
- var moduleSize = this.moduleSize(leftTopBlack, image);
- var top = leftTopBlack[1];
- var bottom = rightBottomBlack[1];
- var left = leftTopBlack[0];
- var right = rightBottomBlack[0];
- // Sanity check!
- if (left >= right || top >= bottom) {
- throw new _NotFoundException.default();
- }
- if (bottom - top !== right - left) {
- // Special case, where bottom-right module wasn't black so we found something else in the last row
- // Assume it's a square, so use height as the width
- right = left + (bottom - top);
- if (right >= image.getWidth()) {
- // Abort if that would not make sense -- off image
- throw new _NotFoundException.default();
- }
- }
- var matrixWidth = Math.round((right - left + 1) / moduleSize);
- var matrixHeight = Math.round((bottom - top + 1) / moduleSize);
- if (matrixWidth <= 0 || matrixHeight <= 0) {
- throw new _NotFoundException.default();
- }
- if (matrixHeight !== matrixWidth) {
- // Only possibly decode square regions
- throw new _NotFoundException.default();
- }
- // Push in the "border" by half the module width so that we start
- // sampling in the middle of the module. Just in case the image is a
- // little off, this will help recover.
- var nudge = /*(int) */Math.floor(moduleSize / 2.0);
- top += nudge;
- left += nudge;
- // But careful that this does not sample off the edge
- // "right" is the farthest-right valid pixel location -- right+1 is not necessarily
- // This is positive by how much the inner x loop below would be too large
- var nudgedTooFarRight = left + /*(int) */Math.floor((matrixWidth - 1) * moduleSize) - right;
- if (nudgedTooFarRight > 0) {
- if (nudgedTooFarRight > nudge) {
- // Neither way fits; abort
- throw new _NotFoundException.default();
- }
- left -= nudgedTooFarRight;
- }
- // See logic above
- var nudgedTooFarDown = top + /*(int) */Math.floor((matrixHeight - 1) * moduleSize) - bottom;
- if (nudgedTooFarDown > 0) {
- if (nudgedTooFarDown > nudge) {
- // Neither way fits; abort
- throw new _NotFoundException.default();
- }
- top -= nudgedTooFarDown;
- }
- // Now just read off the bits
- var bits = new _BitMatrix.default(matrixWidth, matrixHeight);
- for (var y = 0; y < matrixHeight; y++) {
- var iOffset = top + /*(int) */Math.floor(y * moduleSize);
- for (var x = 0; x < matrixWidth; x++) {
- if (image.get(left + /*(int) */Math.floor(x * moduleSize), iOffset)) {
- bits.set(x, y);
- }
- }
- }
- return bits;
- };
- QRCodeReader.moduleSize = function (leftTopBlack, image) {
- var height = image.getHeight();
- var width = image.getWidth();
- var x = leftTopBlack[0];
- var y = leftTopBlack[1];
- var inBlack = true;
- var transitions = 0;
- while (x < width && y < height) {
- if (inBlack !== image.get(x, y)) {
- if (++transitions === 5) {
- break;
- }
- inBlack = !inBlack;
- }
- x++;
- y++;
- }
- if (x === width || y === height) {
- throw new _NotFoundException.default();
- }
- return (x - leftTopBlack[0]) / 7.0;
- };
- QRCodeReader.NO_POINTS = new Array();
- return QRCodeReader;
- }();
- var _default = QRCodeReader;
- exports.default = _default;
- /***/ }),
- /* 415 */
- /*!******************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/decoder/Decoder.js ***!
- \******************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _ChecksumException = _interopRequireDefault(__webpack_require__(/*! ../../ChecksumException */ 309));
- var _BitMatrix = _interopRequireDefault(__webpack_require__(/*! ../../common/BitMatrix */ 319));
- var _GenericGF = _interopRequireDefault(__webpack_require__(/*! ../../common/reedsolomon/GenericGF */ 338));
- var _ReedSolomonDecoder = _interopRequireDefault(__webpack_require__(/*! ../../common/reedsolomon/ReedSolomonDecoder */ 342));
- var _BitMatrixParser = _interopRequireDefault(__webpack_require__(/*! ./BitMatrixParser */ 416));
- var _DataBlock = _interopRequireDefault(__webpack_require__(/*! ./DataBlock */ 423));
- var _DecodedBitStreamParser = _interopRequireDefault(__webpack_require__(/*! ./DecodedBitStreamParser */ 424));
- var _QRCodeDecoderMetaData = _interopRequireDefault(__webpack_require__(/*! ./QRCodeDecoderMetaData */ 426));
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- /*namespace com.google.zxing.qrcode.decoder {*/
- /*import java.util.Map;*/
- /**
- * <p>The main class which implements QR Code decoding -- as opposed to locating and extracting
- * the QR Code from an image.</p>
- *
- * @author Sean Owen
- */
- var Decoder = /** @class */function () {
- function Decoder() {
- this.rsDecoder = new _ReedSolomonDecoder.default(_GenericGF.default.QR_CODE_FIELD_256);
- }
- // public decode(image: boolean[][]): DecoderResult /*throws ChecksumException, FormatException*/ {
- // return decode(image, null)
- // }
- /**
- * <p>Convenience method that can decode a QR Code represented as a 2D array of booleans.
- * "true" is taken to mean a black module.</p>
- *
- * @param image booleans representing white/black QR Code modules
- * @param hints decoding hints that should be used to influence decoding
- * @return text and bytes encoded within the QR Code
- * @throws FormatException if the QR Code cannot be decoded
- * @throws ChecksumException if error correction fails
- */
- Decoder.prototype.decodeBooleanArray = function (image, hints) {
- return this.decodeBitMatrix(_BitMatrix.default.parseFromBooleanArray(image), hints);
- };
- // public decodeBitMatrix(bits: BitMatrix): DecoderResult /*throws ChecksumException, FormatException*/ {
- // return decode(bits, null)
- // }
- /**
- * <p>Decodes a QR Code represented as a {@link BitMatrix}. A 1 or "true" is taken to mean a black module.</p>
- *
- * @param bits booleans representing white/black QR Code modules
- * @param hints decoding hints that should be used to influence decoding
- * @return text and bytes encoded within the QR Code
- * @throws FormatException if the QR Code cannot be decoded
- * @throws ChecksumException if error correction fails
- */
- Decoder.prototype.decodeBitMatrix = function (bits, hints) {
- // Construct a parser and read version, error-correction level
- var parser = new _BitMatrixParser.default(bits);
- var ex = null;
- try {
- return this.decodeBitMatrixParser(parser, hints);
- } catch (e /*: FormatException, ChecksumException*/) {
- ex = e;
- }
- try {
- // Revert the bit matrix
- parser.remask();
- // Will be attempting a mirrored reading of the version and format info.
- parser.setMirror(true);
- // Preemptively read the version.
- parser.readVersion();
- // Preemptively read the format information.
- parser.readFormatInformation();
- /*
- * Since we're here, this means we have successfully detected some kind
- * of version and format information when mirrored. This is a good sign,
- * that the QR code may be mirrored, and we should try once more with a
- * mirrored content.
- */
- // Prepare for a mirrored reading.
- parser.mirror();
- var result = this.decodeBitMatrixParser(parser, hints);
- // Success! Notify the caller that the code was mirrored.
- result.setOther(new _QRCodeDecoderMetaData.default(true));
- return result;
- } catch (e /*FormatException | ChecksumException*/) {
- // Throw the exception from the original reading
- if (ex !== null) {
- throw ex;
- }
- throw e;
- }
- };
- Decoder.prototype.decodeBitMatrixParser = function (parser, hints) {
- var e_1, _a, e_2, _b;
- var version = parser.readVersion();
- var ecLevel = parser.readFormatInformation().getErrorCorrectionLevel();
- // Read codewords
- var codewords = parser.readCodewords();
- // Separate into data blocks
- var dataBlocks = _DataBlock.default.getDataBlocks(codewords, version, ecLevel);
- // Count total number of data bytes
- var totalBytes = 0;
- try {
- for (var dataBlocks_1 = __values(dataBlocks), dataBlocks_1_1 = dataBlocks_1.next(); !dataBlocks_1_1.done; dataBlocks_1_1 = dataBlocks_1.next()) {
- var dataBlock = dataBlocks_1_1.value;
- totalBytes += dataBlock.getNumDataCodewords();
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (dataBlocks_1_1 && !dataBlocks_1_1.done && (_a = dataBlocks_1.return)) _a.call(dataBlocks_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- var resultBytes = new Uint8Array(totalBytes);
- var resultOffset = 0;
- try {
- // Error-correct and copy data blocks together into a stream of bytes
- for (var dataBlocks_2 = __values(dataBlocks), dataBlocks_2_1 = dataBlocks_2.next(); !dataBlocks_2_1.done; dataBlocks_2_1 = dataBlocks_2.next()) {
- var dataBlock = dataBlocks_2_1.value;
- var codewordBytes = dataBlock.getCodewords();
- var numDataCodewords = dataBlock.getNumDataCodewords();
- this.correctErrors(codewordBytes, numDataCodewords);
- for (var i = 0; i < numDataCodewords; i++) {
- resultBytes[resultOffset++] = codewordBytes[i];
- }
- }
- } catch (e_2_1) {
- e_2 = {
- error: e_2_1
- };
- } finally {
- try {
- if (dataBlocks_2_1 && !dataBlocks_2_1.done && (_b = dataBlocks_2.return)) _b.call(dataBlocks_2);
- } finally {
- if (e_2) throw e_2.error;
- }
- }
- // Decode the contents of that stream of bytes
- return _DecodedBitStreamParser.default.decode(resultBytes, version, ecLevel, hints);
- };
- /**
- * <p>Given data and error-correction codewords received, possibly corrupted by errors, attempts to
- * correct the errors in-place using Reed-Solomon error correction.</p>
- *
- * @param codewordBytes data and error correction codewords
- * @param numDataCodewords number of codewords that are data bytes
- * @throws ChecksumException if error correction fails
- */
- Decoder.prototype.correctErrors = function (codewordBytes, numDataCodewords /*int*/) {
- // const numCodewords = codewordBytes.length;
- // First read into an array of ints
- var codewordsInts = new Int32Array(codewordBytes);
- // TYPESCRIPTPORT: not realy necessary to transform to ints? could redesign everything to work with unsigned bytes?
- // const codewordsInts = new Int32Array(numCodewords)
- // for (let i = 0; i < numCodewords; i++) {
- // codewordsInts[i] = codewordBytes[i] & 0xFF
- // }
- try {
- this.rsDecoder.decode(codewordsInts, codewordBytes.length - numDataCodewords);
- } catch (ignored /*: ReedSolomonException*/) {
- throw new _ChecksumException.default();
- }
- // Copy back into array of bytes -- only need to worry about the bytes that were data
- // We don't care about errors in the error-correction codewords
- for (var i = 0; i < numDataCodewords; i++) {
- codewordBytes[i] = /*(byte) */codewordsInts[i];
- }
- };
- return Decoder;
- }();
- var _default = Decoder;
- exports.default = _default;
- /***/ }),
- /* 416 */
- /*!**************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/decoder/BitMatrixParser.js ***!
- \**************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _Version = _interopRequireDefault(__webpack_require__(/*! ./Version */ 417));
- var _FormatInformation = _interopRequireDefault(__webpack_require__(/*! ./FormatInformation */ 418));
- var _DataMask = _interopRequireDefault(__webpack_require__(/*! ./DataMask */ 422));
- var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../../FormatException */ 324));
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /**
- * @author Sean Owen
- */
- var BitMatrixParser = /** @class */function () {
- /**
- * @param bitMatrix {@link BitMatrix} to parse
- * @throws FormatException if dimension is not >= 21 and 1 mod 4
- */
- function BitMatrixParser(bitMatrix) {
- var dimension = bitMatrix.getHeight();
- if (dimension < 21 || (dimension & 0x03) !== 1) {
- throw new _FormatException.default();
- }
- this.bitMatrix = bitMatrix;
- }
- /**
- * <p>Reads format information from one of its two locations within the QR Code.</p>
- *
- * @return {@link FormatInformation} encapsulating the QR Code's format info
- * @throws FormatException if both format information locations cannot be parsed as
- * the valid encoding of format information
- */
- BitMatrixParser.prototype.readFormatInformation = function () {
- if (this.parsedFormatInfo !== null && this.parsedFormatInfo !== undefined) {
- return this.parsedFormatInfo;
- }
- // Read top-left format info bits
- var formatInfoBits1 = 0;
- for (var i = 0; i < 6; i++) {
- formatInfoBits1 = this.copyBit(i, 8, formatInfoBits1);
- }
- // .. and skip a bit in the timing pattern ...
- formatInfoBits1 = this.copyBit(7, 8, formatInfoBits1);
- formatInfoBits1 = this.copyBit(8, 8, formatInfoBits1);
- formatInfoBits1 = this.copyBit(8, 7, formatInfoBits1);
- // .. and skip a bit in the timing pattern ...
- for (var j = 5; j >= 0; j--) {
- formatInfoBits1 = this.copyBit(8, j, formatInfoBits1);
- }
- // Read the top-right/bottom-left pattern too
- var dimension = this.bitMatrix.getHeight();
- var formatInfoBits2 = 0;
- var jMin = dimension - 7;
- for (var j = dimension - 1; j >= jMin; j--) {
- formatInfoBits2 = this.copyBit(8, j, formatInfoBits2);
- }
- for (var i = dimension - 8; i < dimension; i++) {
- formatInfoBits2 = this.copyBit(i, 8, formatInfoBits2);
- }
- this.parsedFormatInfo = _FormatInformation.default.decodeFormatInformation(formatInfoBits1, formatInfoBits2);
- if (this.parsedFormatInfo !== null) {
- return this.parsedFormatInfo;
- }
- throw new _FormatException.default();
- };
- /**
- * <p>Reads version information from one of its two locations within the QR Code.</p>
- *
- * @return {@link Version} encapsulating the QR Code's version
- * @throws FormatException if both version information locations cannot be parsed as
- * the valid encoding of version information
- */
- BitMatrixParser.prototype.readVersion = function () {
- if (this.parsedVersion !== null && this.parsedVersion !== undefined) {
- return this.parsedVersion;
- }
- var dimension = this.bitMatrix.getHeight();
- var provisionalVersion = Math.floor((dimension - 17) / 4);
- if (provisionalVersion <= 6) {
- return _Version.default.getVersionForNumber(provisionalVersion);
- }
- // Read top-right version info: 3 wide by 6 tall
- var versionBits = 0;
- var ijMin = dimension - 11;
- for (var j = 5; j >= 0; j--) {
- for (var i = dimension - 9; i >= ijMin; i--) {
- versionBits = this.copyBit(i, j, versionBits);
- }
- }
- var theParsedVersion = _Version.default.decodeVersionInformation(versionBits);
- if (theParsedVersion !== null && theParsedVersion.getDimensionForVersion() === dimension) {
- this.parsedVersion = theParsedVersion;
- return theParsedVersion;
- }
- // Hmm, failed. Try bottom left: 6 wide by 3 tall
- versionBits = 0;
- for (var i = 5; i >= 0; i--) {
- for (var j = dimension - 9; j >= ijMin; j--) {
- versionBits = this.copyBit(i, j, versionBits);
- }
- }
- theParsedVersion = _Version.default.decodeVersionInformation(versionBits);
- if (theParsedVersion !== null && theParsedVersion.getDimensionForVersion() === dimension) {
- this.parsedVersion = theParsedVersion;
- return theParsedVersion;
- }
- throw new _FormatException.default();
- };
- BitMatrixParser.prototype.copyBit = function (i /*int*/, j /*int*/, versionBits /*int*/) {
- var bit = this.isMirror ? this.bitMatrix.get(j, i) : this.bitMatrix.get(i, j);
- return bit ? versionBits << 1 | 0x1 : versionBits << 1;
- };
- /**
- * <p>Reads the bits in the {@link BitMatrix} representing the finder pattern in the
- * correct order in order to reconstruct the codewords bytes contained within the
- * QR Code.</p>
- *
- * @return bytes encoded within the QR Code
- * @throws FormatException if the exact number of bytes expected is not read
- */
- BitMatrixParser.prototype.readCodewords = function () {
- var formatInfo = this.readFormatInformation();
- var version = this.readVersion();
- // Get the data mask for the format used in this QR Code. This will exclude
- // some bits from reading as we wind through the bit matrix.
- var dataMask = _DataMask.default.values.get(formatInfo.getDataMask());
- var dimension = this.bitMatrix.getHeight();
- dataMask.unmaskBitMatrix(this.bitMatrix, dimension);
- var functionPattern = version.buildFunctionPattern();
- var readingUp = true;
- var result = new Uint8Array(version.getTotalCodewords());
- var resultOffset = 0;
- var currentByte = 0;
- var bitsRead = 0;
- // Read columns in pairs, from right to left
- for (var j = dimension - 1; j > 0; j -= 2) {
- if (j === 6) {
- // Skip whole column with vertical alignment pattern
- // saves time and makes the other code proceed more cleanly
- j--;
- }
- // Read alternatingly from bottom to top then top to bottom
- for (var count = 0; count < dimension; count++) {
- var i = readingUp ? dimension - 1 - count : count;
- for (var col = 0; col < 2; col++) {
- // Ignore bits covered by the function pattern
- if (!functionPattern.get(j - col, i)) {
- // Read a bit
- bitsRead++;
- currentByte <<= 1;
- if (this.bitMatrix.get(j - col, i)) {
- currentByte |= 1;
- }
- // If we've made a whole byte, save it off
- if (bitsRead === 8) {
- result[resultOffset++] = /*(byte) */currentByte;
- bitsRead = 0;
- currentByte = 0;
- }
- }
- }
- }
- readingUp = !readingUp; // readingUp ^= true; // readingUp = !readingUp; // switch directions
- }
- if (resultOffset !== version.getTotalCodewords()) {
- throw new _FormatException.default();
- }
- return result;
- };
- /**
- * Revert the mask removal done while reading the code words. The bit matrix should revert to its original state.
- */
- BitMatrixParser.prototype.remask = function () {
- if (this.parsedFormatInfo === null) {
- return; // We have no format information, and have no data mask
- }
- var dataMask = _DataMask.default.values.get(this.parsedFormatInfo.getDataMask());
- var dimension = this.bitMatrix.getHeight();
- dataMask.unmaskBitMatrix(this.bitMatrix, dimension);
- };
- /**
- * Prepare the parser for a mirrored operation.
- * This flag has effect only on the {@link #readFormatInformation()} and the
- * {@link #readVersion()}. Before proceeding with {@link #readCodewords()} the
- * {@link #mirror()} method should be called.
- *
- * @param mirror Whether to read version and format information mirrored.
- */
- BitMatrixParser.prototype.setMirror = function (isMirror) {
- this.parsedVersion = null;
- this.parsedFormatInfo = null;
- this.isMirror = isMirror;
- };
- /** Mirror the bit matrix in order to attempt a second reading. */
- BitMatrixParser.prototype.mirror = function () {
- var bitMatrix = this.bitMatrix;
- for (var x = 0, width = bitMatrix.getWidth(); x < width; x++) {
- for (var y = x + 1, height = bitMatrix.getHeight(); y < height; y++) {
- if (bitMatrix.get(x, y) !== bitMatrix.get(y, x)) {
- bitMatrix.flip(y, x);
- bitMatrix.flip(x, y);
- }
- }
- }
- };
- return BitMatrixParser;
- }();
- var _default = BitMatrixParser;
- exports.default = _default;
- /***/ }),
- /* 417 */
- /*!******************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/decoder/Version.js ***!
- \******************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _BitMatrix = _interopRequireDefault(__webpack_require__(/*! ../../common/BitMatrix */ 319));
- var _FormatInformation = _interopRequireDefault(__webpack_require__(/*! ./FormatInformation */ 418));
- var _ECBlocks = _interopRequireDefault(__webpack_require__(/*! ./ECBlocks */ 420));
- var _ECB = _interopRequireDefault(__webpack_require__(/*! ./ECB */ 421));
- var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../../FormatException */ 324));
- var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalArgumentException */ 308));
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- /*namespace com.google.zxing.qrcode.decoder {*/
- /**
- * See ISO 18004:2006 Annex D
- *
- * @author Sean Owen
- */
- var Version = /** @class */function () {
- function Version(versionNumber /*int*/, alignmentPatternCenters) {
- var e_1, _a;
- var ecBlocks = [];
- for (var _i = 2; _i < arguments.length; _i++) {
- ecBlocks[_i - 2] = arguments[_i];
- }
- this.versionNumber = versionNumber;
- this.alignmentPatternCenters = alignmentPatternCenters;
- this.ecBlocks = ecBlocks;
- var total = 0;
- var ecCodewords = ecBlocks[0].getECCodewordsPerBlock();
- var ecbArray = ecBlocks[0].getECBlocks();
- try {
- for (var ecbArray_1 = __values(ecbArray), ecbArray_1_1 = ecbArray_1.next(); !ecbArray_1_1.done; ecbArray_1_1 = ecbArray_1.next()) {
- var ecBlock = ecbArray_1_1.value;
- total += ecBlock.getCount() * (ecBlock.getDataCodewords() + ecCodewords);
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (ecbArray_1_1 && !ecbArray_1_1.done && (_a = ecbArray_1.return)) _a.call(ecbArray_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- this.totalCodewords = total;
- }
- Version.prototype.getVersionNumber = function () {
- return this.versionNumber;
- };
- Version.prototype.getAlignmentPatternCenters = function () {
- return this.alignmentPatternCenters;
- };
- Version.prototype.getTotalCodewords = function () {
- return this.totalCodewords;
- };
- Version.prototype.getDimensionForVersion = function () {
- return 17 + 4 * this.versionNumber;
- };
- Version.prototype.getECBlocksForLevel = function (ecLevel) {
- return this.ecBlocks[ecLevel.getValue()];
- // TYPESCRIPTPORT: original was using ordinal, and using the order of levels as defined in ErrorCorrectionLevel enum (LMQH)
- // I will use the direct value from ErrorCorrectionLevelValues enum which in typescript goes to a number
- };
- /**
- * <p>Deduces version information purely from QR Code dimensions.</p>
- *
- * @param dimension dimension in modules
- * @return Version for a QR Code of that dimension
- * @throws FormatException if dimension is not 1 mod 4
- */
- Version.getProvisionalVersionForDimension = function (dimension /*int*/) {
- if (dimension % 4 !== 1) {
- throw new _FormatException.default();
- }
- try {
- return this.getVersionForNumber((dimension - 17) / 4);
- } catch (ignored /*: IllegalArgumentException*/) {
- throw new _FormatException.default();
- }
- };
- Version.getVersionForNumber = function (versionNumber /*int*/) {
- if (versionNumber < 1 || versionNumber > 40) {
- throw new _IllegalArgumentException.default();
- }
- return Version.VERSIONS[versionNumber - 1];
- };
- Version.decodeVersionInformation = function (versionBits /*int*/) {
- var bestDifference = Number.MAX_SAFE_INTEGER;
- var bestVersion = 0;
- for (var i = 0; i < Version.VERSION_DECODE_INFO.length; i++) {
- var targetVersion = Version.VERSION_DECODE_INFO[i];
- // Do the version info bits match exactly? done.
- if (targetVersion === versionBits) {
- return Version.getVersionForNumber(i + 7);
- }
- // Otherwise see if this is the closest to a real version info bit string
- // we have seen so far
- var bitsDifference = _FormatInformation.default.numBitsDiffering(versionBits, targetVersion);
- if (bitsDifference < bestDifference) {
- bestVersion = i + 7;
- bestDifference = bitsDifference;
- }
- }
- // We can tolerate up to 3 bits of error since no two version info codewords will
- // differ in less than 8 bits.
- if (bestDifference <= 3) {
- return Version.getVersionForNumber(bestVersion);
- }
- // If we didn't find a close enough match, fail
- return null;
- };
- /**
- * See ISO 18004:2006 Annex E
- */
- Version.prototype.buildFunctionPattern = function () {
- var dimension = this.getDimensionForVersion();
- var bitMatrix = new _BitMatrix.default(dimension);
- // Top left finder pattern + separator + format
- bitMatrix.setRegion(0, 0, 9, 9);
- // Top right finder pattern + separator + format
- bitMatrix.setRegion(dimension - 8, 0, 8, 9);
- // Bottom left finder pattern + separator + format
- bitMatrix.setRegion(0, dimension - 8, 9, 8);
- // Alignment patterns
- var max = this.alignmentPatternCenters.length;
- for (var x = 0; x < max; x++) {
- var i = this.alignmentPatternCenters[x] - 2;
- for (var y = 0; y < max; y++) {
- if (x === 0 && (y === 0 || y === max - 1) || x === max - 1 && y === 0) {
- // No alignment patterns near the three finder patterns
- continue;
- }
- bitMatrix.setRegion(this.alignmentPatternCenters[y] - 2, i, 5, 5);
- }
- }
- // Vertical timing pattern
- bitMatrix.setRegion(6, 9, 1, dimension - 17);
- // Horizontal timing pattern
- bitMatrix.setRegion(9, 6, dimension - 17, 1);
- if (this.versionNumber > 6) {
- // Version info, top right
- bitMatrix.setRegion(dimension - 11, 0, 3, 6);
- // Version info, bottom left
- bitMatrix.setRegion(0, dimension - 11, 6, 3);
- }
- return bitMatrix;
- };
- /*@Override*/
- Version.prototype.toString = function () {
- return '' + this.versionNumber;
- };
- /**
- * See ISO 18004:2006 Annex D.
- * Element i represents the raw version bits that specify version i + 7
- */
- Version.VERSION_DECODE_INFO = Int32Array.from([0x07C94, 0x085BC, 0x09A99, 0x0A4D3, 0x0BBF6, 0x0C762, 0x0D847, 0x0E60D, 0x0F928, 0x10B78, 0x1145D, 0x12A17, 0x13532, 0x149A6, 0x15683, 0x168C9, 0x177EC, 0x18EC4, 0x191E1, 0x1AFAB, 0x1B08E, 0x1CC1A, 0x1D33F, 0x1ED75, 0x1F250, 0x209D5, 0x216F0, 0x228BA, 0x2379F, 0x24B0B, 0x2542E, 0x26A64, 0x27541, 0x28C69]);
- /**
- * See ISO 18004:2006 6.5.1 Table 9
- */
- Version.VERSIONS = [new Version(1, new Int32Array(0), new _ECBlocks.default(7, new _ECB.default(1, 19)), new _ECBlocks.default(10, new _ECB.default(1, 16)), new _ECBlocks.default(13, new _ECB.default(1, 13)), new _ECBlocks.default(17, new _ECB.default(1, 9))), new Version(2, Int32Array.from([6, 18]), new _ECBlocks.default(10, new _ECB.default(1, 34)), new _ECBlocks.default(16, new _ECB.default(1, 28)), new _ECBlocks.default(22, new _ECB.default(1, 22)), new _ECBlocks.default(28, new _ECB.default(1, 16))), new Version(3, Int32Array.from([6, 22]), new _ECBlocks.default(15, new _ECB.default(1, 55)), new _ECBlocks.default(26, new _ECB.default(1, 44)), new _ECBlocks.default(18, new _ECB.default(2, 17)), new _ECBlocks.default(22, new _ECB.default(2, 13))), new Version(4, Int32Array.from([6, 26]), new _ECBlocks.default(20, new _ECB.default(1, 80)), new _ECBlocks.default(18, new _ECB.default(2, 32)), new _ECBlocks.default(26, new _ECB.default(2, 24)), new _ECBlocks.default(16, new _ECB.default(4, 9))), new Version(5, Int32Array.from([6, 30]), new _ECBlocks.default(26, new _ECB.default(1, 108)), new _ECBlocks.default(24, new _ECB.default(2, 43)), new _ECBlocks.default(18, new _ECB.default(2, 15), new _ECB.default(2, 16)), new _ECBlocks.default(22, new _ECB.default(2, 11), new _ECB.default(2, 12))), new Version(6, Int32Array.from([6, 34]), new _ECBlocks.default(18, new _ECB.default(2, 68)), new _ECBlocks.default(16, new _ECB.default(4, 27)), new _ECBlocks.default(24, new _ECB.default(4, 19)), new _ECBlocks.default(28, new _ECB.default(4, 15))), new Version(7, Int32Array.from([6, 22, 38]), new _ECBlocks.default(20, new _ECB.default(2, 78)), new _ECBlocks.default(18, new _ECB.default(4, 31)), new _ECBlocks.default(18, new _ECB.default(2, 14), new _ECB.default(4, 15)), new _ECBlocks.default(26, new _ECB.default(4, 13), new _ECB.default(1, 14))), new Version(8, Int32Array.from([6, 24, 42]), new _ECBlocks.default(24, new _ECB.default(2, 97)), new _ECBlocks.default(22, new _ECB.default(2, 38), new _ECB.default(2, 39)), new _ECBlocks.default(22, new _ECB.default(4, 18), new _ECB.default(2, 19)), new _ECBlocks.default(26, new _ECB.default(4, 14), new _ECB.default(2, 15))), new Version(9, Int32Array.from([6, 26, 46]), new _ECBlocks.default(30, new _ECB.default(2, 116)), new _ECBlocks.default(22, new _ECB.default(3, 36), new _ECB.default(2, 37)), new _ECBlocks.default(20, new _ECB.default(4, 16), new _ECB.default(4, 17)), new _ECBlocks.default(24, new _ECB.default(4, 12), new _ECB.default(4, 13))), new Version(10, Int32Array.from([6, 28, 50]), new _ECBlocks.default(18, new _ECB.default(2, 68), new _ECB.default(2, 69)), new _ECBlocks.default(26, new _ECB.default(4, 43), new _ECB.default(1, 44)), new _ECBlocks.default(24, new _ECB.default(6, 19), new _ECB.default(2, 20)), new _ECBlocks.default(28, new _ECB.default(6, 15), new _ECB.default(2, 16))), new Version(11, Int32Array.from([6, 30, 54]), new _ECBlocks.default(20, new _ECB.default(4, 81)), new _ECBlocks.default(30, new _ECB.default(1, 50), new _ECB.default(4, 51)), new _ECBlocks.default(28, new _ECB.default(4, 22), new _ECB.default(4, 23)), new _ECBlocks.default(24, new _ECB.default(3, 12), new _ECB.default(8, 13))), new Version(12, Int32Array.from([6, 32, 58]), new _ECBlocks.default(24, new _ECB.default(2, 92), new _ECB.default(2, 93)), new _ECBlocks.default(22, new _ECB.default(6, 36), new _ECB.default(2, 37)), new _ECBlocks.default(26, new _ECB.default(4, 20), new _ECB.default(6, 21)), new _ECBlocks.default(28, new _ECB.default(7, 14), new _ECB.default(4, 15))), new Version(13, Int32Array.from([6, 34, 62]), new _ECBlocks.default(26, new _ECB.default(4, 107)), new _ECBlocks.default(22, new _ECB.default(8, 37), new _ECB.default(1, 38)), new _ECBlocks.default(24, new _ECB.default(8, 20), new _ECB.default(4, 21)), new _ECBlocks.default(22, new _ECB.default(12, 11), new _ECB.default(4, 12))), new Version(14, Int32Array.from([6, 26, 46, 66]), new _ECBlocks.default(30, new _ECB.default(3, 115), new _ECB.default(1, 116)), new _ECBlocks.default(24, new _ECB.default(4, 40), new _ECB.default(5, 41)), new _ECBlocks.default(20, new _ECB.default(11, 16), new _ECB.default(5, 17)), new _ECBlocks.default(24, new _ECB.default(11, 12), new _ECB.default(5, 13))), new Version(15, Int32Array.from([6, 26, 48, 70]), new _ECBlocks.default(22, new _ECB.default(5, 87), new _ECB.default(1, 88)), new _ECBlocks.default(24, new _ECB.default(5, 41), new _ECB.default(5, 42)), new _ECBlocks.default(30, new _ECB.default(5, 24), new _ECB.default(7, 25)), new _ECBlocks.default(24, new _ECB.default(11, 12), new _ECB.default(7, 13))), new Version(16, Int32Array.from([6, 26, 50, 74]), new _ECBlocks.default(24, new _ECB.default(5, 98), new _ECB.default(1, 99)), new _ECBlocks.default(28, new _ECB.default(7, 45), new _ECB.default(3, 46)), new _ECBlocks.default(24, new _ECB.default(15, 19), new _ECB.default(2, 20)), new _ECBlocks.default(30, new _ECB.default(3, 15), new _ECB.default(13, 16))), new Version(17, Int32Array.from([6, 30, 54, 78]), new _ECBlocks.default(28, new _ECB.default(1, 107), new _ECB.default(5, 108)), new _ECBlocks.default(28, new _ECB.default(10, 46), new _ECB.default(1, 47)), new _ECBlocks.default(28, new _ECB.default(1, 22), new _ECB.default(15, 23)), new _ECBlocks.default(28, new _ECB.default(2, 14), new _ECB.default(17, 15))), new Version(18, Int32Array.from([6, 30, 56, 82]), new _ECBlocks.default(30, new _ECB.default(5, 120), new _ECB.default(1, 121)), new _ECBlocks.default(26, new _ECB.default(9, 43), new _ECB.default(4, 44)), new _ECBlocks.default(28, new _ECB.default(17, 22), new _ECB.default(1, 23)), new _ECBlocks.default(28, new _ECB.default(2, 14), new _ECB.default(19, 15))), new Version(19, Int32Array.from([6, 30, 58, 86]), new _ECBlocks.default(28, new _ECB.default(3, 113), new _ECB.default(4, 114)), new _ECBlocks.default(26, new _ECB.default(3, 44), new _ECB.default(11, 45)), new _ECBlocks.default(26, new _ECB.default(17, 21), new _ECB.default(4, 22)), new _ECBlocks.default(26, new _ECB.default(9, 13), new _ECB.default(16, 14))), new Version(20, Int32Array.from([6, 34, 62, 90]), new _ECBlocks.default(28, new _ECB.default(3, 107), new _ECB.default(5, 108)), new _ECBlocks.default(26, new _ECB.default(3, 41), new _ECB.default(13, 42)), new _ECBlocks.default(30, new _ECB.default(15, 24), new _ECB.default(5, 25)), new _ECBlocks.default(28, new _ECB.default(15, 15), new _ECB.default(10, 16))), new Version(21, Int32Array.from([6, 28, 50, 72, 94]), new _ECBlocks.default(28, new _ECB.default(4, 116), new _ECB.default(4, 117)), new _ECBlocks.default(26, new _ECB.default(17, 42)), new _ECBlocks.default(28, new _ECB.default(17, 22), new _ECB.default(6, 23)), new _ECBlocks.default(30, new _ECB.default(19, 16), new _ECB.default(6, 17))), new Version(22, Int32Array.from([6, 26, 50, 74, 98]), new _ECBlocks.default(28, new _ECB.default(2, 111), new _ECB.default(7, 112)), new _ECBlocks.default(28, new _ECB.default(17, 46)), new _ECBlocks.default(30, new _ECB.default(7, 24), new _ECB.default(16, 25)), new _ECBlocks.default(24, new _ECB.default(34, 13))), new Version(23, Int32Array.from([6, 30, 54, 78, 102]), new _ECBlocks.default(30, new _ECB.default(4, 121), new _ECB.default(5, 122)), new _ECBlocks.default(28, new _ECB.default(4, 47), new _ECB.default(14, 48)), new _ECBlocks.default(30, new _ECB.default(11, 24), new _ECB.default(14, 25)), new _ECBlocks.default(30, new _ECB.default(16, 15), new _ECB.default(14, 16))), new Version(24, Int32Array.from([6, 28, 54, 80, 106]), new _ECBlocks.default(30, new _ECB.default(6, 117), new _ECB.default(4, 118)), new _ECBlocks.default(28, new _ECB.default(6, 45), new _ECB.default(14, 46)), new _ECBlocks.default(30, new _ECB.default(11, 24), new _ECB.default(16, 25)), new _ECBlocks.default(30, new _ECB.default(30, 16), new _ECB.default(2, 17))), new Version(25, Int32Array.from([6, 32, 58, 84, 110]), new _ECBlocks.default(26, new _ECB.default(8, 106), new _ECB.default(4, 107)), new _ECBlocks.default(28, new _ECB.default(8, 47), new _ECB.default(13, 48)), new _ECBlocks.default(30, new _ECB.default(7, 24), new _ECB.default(22, 25)), new _ECBlocks.default(30, new _ECB.default(22, 15), new _ECB.default(13, 16))), new Version(26, Int32Array.from([6, 30, 58, 86, 114]), new _ECBlocks.default(28, new _ECB.default(10, 114), new _ECB.default(2, 115)), new _ECBlocks.default(28, new _ECB.default(19, 46), new _ECB.default(4, 47)), new _ECBlocks.default(28, new _ECB.default(28, 22), new _ECB.default(6, 23)), new _ECBlocks.default(30, new _ECB.default(33, 16), new _ECB.default(4, 17))), new Version(27, Int32Array.from([6, 34, 62, 90, 118]), new _ECBlocks.default(30, new _ECB.default(8, 122), new _ECB.default(4, 123)), new _ECBlocks.default(28, new _ECB.default(22, 45), new _ECB.default(3, 46)), new _ECBlocks.default(30, new _ECB.default(8, 23), new _ECB.default(26, 24)), new _ECBlocks.default(30, new _ECB.default(12, 15), new _ECB.default(28, 16))), new Version(28, Int32Array.from([6, 26, 50, 74, 98, 122]), new _ECBlocks.default(30, new _ECB.default(3, 117), new _ECB.default(10, 118)), new _ECBlocks.default(28, new _ECB.default(3, 45), new _ECB.default(23, 46)), new _ECBlocks.default(30, new _ECB.default(4, 24), new _ECB.default(31, 25)), new _ECBlocks.default(30, new _ECB.default(11, 15), new _ECB.default(31, 16))), new Version(29, Int32Array.from([6, 30, 54, 78, 102, 126]), new _ECBlocks.default(30, new _ECB.default(7, 116), new _ECB.default(7, 117)), new _ECBlocks.default(28, new _ECB.default(21, 45), new _ECB.default(7, 46)), new _ECBlocks.default(30, new _ECB.default(1, 23), new _ECB.default(37, 24)), new _ECBlocks.default(30, new _ECB.default(19, 15), new _ECB.default(26, 16))), new Version(30, Int32Array.from([6, 26, 52, 78, 104, 130]), new _ECBlocks.default(30, new _ECB.default(5, 115), new _ECB.default(10, 116)), new _ECBlocks.default(28, new _ECB.default(19, 47), new _ECB.default(10, 48)), new _ECBlocks.default(30, new _ECB.default(15, 24), new _ECB.default(25, 25)), new _ECBlocks.default(30, new _ECB.default(23, 15), new _ECB.default(25, 16))), new Version(31, Int32Array.from([6, 30, 56, 82, 108, 134]), new _ECBlocks.default(30, new _ECB.default(13, 115), new _ECB.default(3, 116)), new _ECBlocks.default(28, new _ECB.default(2, 46), new _ECB.default(29, 47)), new _ECBlocks.default(30, new _ECB.default(42, 24), new _ECB.default(1, 25)), new _ECBlocks.default(30, new _ECB.default(23, 15), new _ECB.default(28, 16))), new Version(32, Int32Array.from([6, 34, 60, 86, 112, 138]), new _ECBlocks.default(30, new _ECB.default(17, 115)), new _ECBlocks.default(28, new _ECB.default(10, 46), new _ECB.default(23, 47)), new _ECBlocks.default(30, new _ECB.default(10, 24), new _ECB.default(35, 25)), new _ECBlocks.default(30, new _ECB.default(19, 15), new _ECB.default(35, 16))), new Version(33, Int32Array.from([6, 30, 58, 86, 114, 142]), new _ECBlocks.default(30, new _ECB.default(17, 115), new _ECB.default(1, 116)), new _ECBlocks.default(28, new _ECB.default(14, 46), new _ECB.default(21, 47)), new _ECBlocks.default(30, new _ECB.default(29, 24), new _ECB.default(19, 25)), new _ECBlocks.default(30, new _ECB.default(11, 15), new _ECB.default(46, 16))), new Version(34, Int32Array.from([6, 34, 62, 90, 118, 146]), new _ECBlocks.default(30, new _ECB.default(13, 115), new _ECB.default(6, 116)), new _ECBlocks.default(28, new _ECB.default(14, 46), new _ECB.default(23, 47)), new _ECBlocks.default(30, new _ECB.default(44, 24), new _ECB.default(7, 25)), new _ECBlocks.default(30, new _ECB.default(59, 16), new _ECB.default(1, 17))), new Version(35, Int32Array.from([6, 30, 54, 78, 102, 126, 150]), new _ECBlocks.default(30, new _ECB.default(12, 121), new _ECB.default(7, 122)), new _ECBlocks.default(28, new _ECB.default(12, 47), new _ECB.default(26, 48)), new _ECBlocks.default(30, new _ECB.default(39, 24), new _ECB.default(14, 25)), new _ECBlocks.default(30, new _ECB.default(22, 15), new _ECB.default(41, 16))), new Version(36, Int32Array.from([6, 24, 50, 76, 102, 128, 154]), new _ECBlocks.default(30, new _ECB.default(6, 121), new _ECB.default(14, 122)), new _ECBlocks.default(28, new _ECB.default(6, 47), new _ECB.default(34, 48)), new _ECBlocks.default(30, new _ECB.default(46, 24), new _ECB.default(10, 25)), new _ECBlocks.default(30, new _ECB.default(2, 15), new _ECB.default(64, 16))), new Version(37, Int32Array.from([6, 28, 54, 80, 106, 132, 158]), new _ECBlocks.default(30, new _ECB.default(17, 122), new _ECB.default(4, 123)), new _ECBlocks.default(28, new _ECB.default(29, 46), new _ECB.default(14, 47)), new _ECBlocks.default(30, new _ECB.default(49, 24), new _ECB.default(10, 25)), new _ECBlocks.default(30, new _ECB.default(24, 15), new _ECB.default(46, 16))), new Version(38, Int32Array.from([6, 32, 58, 84, 110, 136, 162]), new _ECBlocks.default(30, new _ECB.default(4, 122), new _ECB.default(18, 123)), new _ECBlocks.default(28, new _ECB.default(13, 46), new _ECB.default(32, 47)), new _ECBlocks.default(30, new _ECB.default(48, 24), new _ECB.default(14, 25)), new _ECBlocks.default(30, new _ECB.default(42, 15), new _ECB.default(32, 16))), new Version(39, Int32Array.from([6, 26, 54, 82, 110, 138, 166]), new _ECBlocks.default(30, new _ECB.default(20, 117), new _ECB.default(4, 118)), new _ECBlocks.default(28, new _ECB.default(40, 47), new _ECB.default(7, 48)), new _ECBlocks.default(30, new _ECB.default(43, 24), new _ECB.default(22, 25)), new _ECBlocks.default(30, new _ECB.default(10, 15), new _ECB.default(67, 16))), new Version(40, Int32Array.from([6, 30, 58, 86, 114, 142, 170]), new _ECBlocks.default(30, new _ECB.default(19, 118), new _ECB.default(6, 119)), new _ECBlocks.default(28, new _ECB.default(18, 47), new _ECB.default(31, 48)), new _ECBlocks.default(30, new _ECB.default(34, 24), new _ECB.default(34, 25)), new _ECBlocks.default(30, new _ECB.default(20, 15), new _ECB.default(61, 16)))];
- return Version;
- }();
- var _default = Version;
- exports.default = _default;
- /***/ }),
- /* 418 */
- /*!****************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/decoder/FormatInformation.js ***!
- \****************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _ErrorCorrectionLevel = _interopRequireDefault(__webpack_require__(/*! ./ErrorCorrectionLevel */ 419));
- var _Integer = _interopRequireDefault(__webpack_require__(/*! ../../util/Integer */ 318));
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- /*namespace com.google.zxing.qrcode.decoder {*/
- /**
- * <p>Encapsulates a QR Code's format information, including the data mask used and
- * error correction level.</p>
- *
- * @author Sean Owen
- * @see DataMask
- * @see ErrorCorrectionLevel
- */
- var FormatInformation = /** @class */function () {
- function FormatInformation(formatInfo /*int*/) {
- // Bits 3,4
- this.errorCorrectionLevel = _ErrorCorrectionLevel.default.forBits(formatInfo >> 3 & 0x03);
- // Bottom 3 bits
- this.dataMask = /*(byte) */formatInfo & 0x07;
- }
- FormatInformation.numBitsDiffering = function (a /*int*/, b /*int*/) {
- return _Integer.default.bitCount(a ^ b);
- };
- /**
- * @param maskedFormatInfo1 format info indicator, with mask still applied
- * @param maskedFormatInfo2 second copy of same info; both are checked at the same time
- * to establish best match
- * @return information about the format it specifies, or {@code null}
- * if doesn't seem to match any known pattern
- */
- FormatInformation.decodeFormatInformation = function (maskedFormatInfo1 /*int*/, maskedFormatInfo2 /*int*/) {
- var formatInfo = FormatInformation.doDecodeFormatInformation(maskedFormatInfo1, maskedFormatInfo2);
- if (formatInfo !== null) {
- return formatInfo;
- }
- // Should return null, but, some QR codes apparently
- // do not mask this info. Try again by actually masking the pattern
- // first
- return FormatInformation.doDecodeFormatInformation(maskedFormatInfo1 ^ FormatInformation.FORMAT_INFO_MASK_QR, maskedFormatInfo2 ^ FormatInformation.FORMAT_INFO_MASK_QR);
- };
- FormatInformation.doDecodeFormatInformation = function (maskedFormatInfo1 /*int*/, maskedFormatInfo2 /*int*/) {
- var e_1, _a;
- // Find the int in FORMAT_INFO_DECODE_LOOKUP with fewest bits differing
- var bestDifference = Number.MAX_SAFE_INTEGER;
- var bestFormatInfo = 0;
- try {
- for (var _b = __values(FormatInformation.FORMAT_INFO_DECODE_LOOKUP), _c = _b.next(); !_c.done; _c = _b.next()) {
- var decodeInfo = _c.value;
- var targetInfo = decodeInfo[0];
- if (targetInfo === maskedFormatInfo1 || targetInfo === maskedFormatInfo2) {
- // Found an exact match
- return new FormatInformation(decodeInfo[1]);
- }
- var bitsDifference = FormatInformation.numBitsDiffering(maskedFormatInfo1, targetInfo);
- if (bitsDifference < bestDifference) {
- bestFormatInfo = decodeInfo[1];
- bestDifference = bitsDifference;
- }
- if (maskedFormatInfo1 !== maskedFormatInfo2) {
- // also try the other option
- bitsDifference = FormatInformation.numBitsDiffering(maskedFormatInfo2, targetInfo);
- if (bitsDifference < bestDifference) {
- bestFormatInfo = decodeInfo[1];
- bestDifference = bitsDifference;
- }
- }
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- // Hamming distance of the 32 masked codes is 7, by construction, so <= 3 bits
- // differing means we found a match
- if (bestDifference <= 3) {
- return new FormatInformation(bestFormatInfo);
- }
- return null;
- };
- FormatInformation.prototype.getErrorCorrectionLevel = function () {
- return this.errorCorrectionLevel;
- };
- FormatInformation.prototype.getDataMask = function () {
- return this.dataMask;
- };
- /*@Override*/
- FormatInformation.prototype.hashCode = function () {
- return this.errorCorrectionLevel.getBits() << 3 | this.dataMask;
- };
- /*@Override*/
- FormatInformation.prototype.equals = function (o) {
- if (!(o instanceof FormatInformation)) {
- return false;
- }
- var other = o;
- return this.errorCorrectionLevel === other.errorCorrectionLevel && this.dataMask === other.dataMask;
- };
- FormatInformation.FORMAT_INFO_MASK_QR = 0x5412;
- /**
- * See ISO 18004:2006, Annex C, Table C.1
- */
- FormatInformation.FORMAT_INFO_DECODE_LOOKUP = [Int32Array.from([0x5412, 0x00]), Int32Array.from([0x5125, 0x01]), Int32Array.from([0x5E7C, 0x02]), Int32Array.from([0x5B4B, 0x03]), Int32Array.from([0x45F9, 0x04]), Int32Array.from([0x40CE, 0x05]), Int32Array.from([0x4F97, 0x06]), Int32Array.from([0x4AA0, 0x07]), Int32Array.from([0x77C4, 0x08]), Int32Array.from([0x72F3, 0x09]), Int32Array.from([0x7DAA, 0x0A]), Int32Array.from([0x789D, 0x0B]), Int32Array.from([0x662F, 0x0C]), Int32Array.from([0x6318, 0x0D]), Int32Array.from([0x6C41, 0x0E]), Int32Array.from([0x6976, 0x0F]), Int32Array.from([0x1689, 0x10]), Int32Array.from([0x13BE, 0x11]), Int32Array.from([0x1CE7, 0x12]), Int32Array.from([0x19D0, 0x13]), Int32Array.from([0x0762, 0x14]), Int32Array.from([0x0255, 0x15]), Int32Array.from([0x0D0C, 0x16]), Int32Array.from([0x083B, 0x17]), Int32Array.from([0x355F, 0x18]), Int32Array.from([0x3068, 0x19]), Int32Array.from([0x3F31, 0x1A]), Int32Array.from([0x3A06, 0x1B]), Int32Array.from([0x24B4, 0x1C]), Int32Array.from([0x2183, 0x1D]), Int32Array.from([0x2EDA, 0x1E]), Int32Array.from([0x2BED, 0x1F])];
- return FormatInformation;
- }();
- var _default = FormatInformation;
- exports.default = _default;
- /***/ }),
- /* 419 */
- /*!*******************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/decoder/ErrorCorrectionLevel.js ***!
- \*******************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = exports.ErrorCorrectionLevelValues = void 0;
- var _ArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../ArgumentException */ 304));
- var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalArgumentException */ 308));
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /*namespace com.google.zxing.qrcode.decoder {*/
- var ErrorCorrectionLevelValues;
- exports.ErrorCorrectionLevelValues = ErrorCorrectionLevelValues;
- (function (ErrorCorrectionLevelValues) {
- ErrorCorrectionLevelValues[ErrorCorrectionLevelValues["L"] = 0] = "L";
- ErrorCorrectionLevelValues[ErrorCorrectionLevelValues["M"] = 1] = "M";
- ErrorCorrectionLevelValues[ErrorCorrectionLevelValues["Q"] = 2] = "Q";
- ErrorCorrectionLevelValues[ErrorCorrectionLevelValues["H"] = 3] = "H";
- })(ErrorCorrectionLevelValues || (exports.ErrorCorrectionLevelValues = ErrorCorrectionLevelValues = {}));
- /**
- * <p>See ISO 18004:2006, 6.5.1. This enum encapsulates the four error correction levels
- * defined by the QR code standard.</p>
- *
- * @author Sean Owen
- */
- var ErrorCorrectionLevel = /** @class */function () {
- function ErrorCorrectionLevel(value, stringValue, bits /*int*/) {
- this.value = value;
- this.stringValue = stringValue;
- this.bits = bits;
- ErrorCorrectionLevel.FOR_BITS.set(bits, this);
- ErrorCorrectionLevel.FOR_VALUE.set(value, this);
- }
- ErrorCorrectionLevel.prototype.getValue = function () {
- return this.value;
- };
- ErrorCorrectionLevel.prototype.getBits = function () {
- return this.bits;
- };
- ErrorCorrectionLevel.fromString = function (s) {
- switch (s) {
- case 'L':
- return ErrorCorrectionLevel.L;
- case 'M':
- return ErrorCorrectionLevel.M;
- case 'Q':
- return ErrorCorrectionLevel.Q;
- case 'H':
- return ErrorCorrectionLevel.H;
- default:
- throw new _ArgumentException.default(s + 'not available');
- }
- };
- ErrorCorrectionLevel.prototype.toString = function () {
- return this.stringValue;
- };
- ErrorCorrectionLevel.prototype.equals = function (o) {
- if (!(o instanceof ErrorCorrectionLevel)) {
- return false;
- }
- var other = o;
- return this.value === other.value;
- };
- /**
- * @param bits int containing the two bits encoding a QR Code's error correction level
- * @return ErrorCorrectionLevel representing the encoded error correction level
- */
- ErrorCorrectionLevel.forBits = function (bits /*int*/) {
- if (bits < 0 || bits >= ErrorCorrectionLevel.FOR_BITS.size) {
- throw new _IllegalArgumentException.default();
- }
- return ErrorCorrectionLevel.FOR_BITS.get(bits);
- };
- ErrorCorrectionLevel.FOR_BITS = new Map();
- ErrorCorrectionLevel.FOR_VALUE = new Map();
- /** L = ~7% correction */
- ErrorCorrectionLevel.L = new ErrorCorrectionLevel(ErrorCorrectionLevelValues.L, 'L', 0x01);
- /** M = ~15% correction */
- ErrorCorrectionLevel.M = new ErrorCorrectionLevel(ErrorCorrectionLevelValues.M, 'M', 0x00);
- /** Q = ~25% correction */
- ErrorCorrectionLevel.Q = new ErrorCorrectionLevel(ErrorCorrectionLevelValues.Q, 'Q', 0x03);
- /** H = ~30% correction */
- ErrorCorrectionLevel.H = new ErrorCorrectionLevel(ErrorCorrectionLevelValues.H, 'H', 0x02);
- return ErrorCorrectionLevel;
- }();
- var _default = ErrorCorrectionLevel;
- exports.default = _default;
- /***/ }),
- /* 420 */
- /*!*******************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/decoder/ECBlocks.js ***!
- \*******************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- /**
- * <p>Encapsulates a set of error-correction blocks in one symbol version. Most versions will
- * use blocks of differing sizes within one version, so, this encapsulates the parameters for
- * each set of blocks. It also holds the number of error-correction codewords per block since it
- * will be the same across all blocks within one version.</p>
- */
- var ECBlocks = /** @class */function () {
- function ECBlocks(ecCodewordsPerBlock /*int*/) {
- var ecBlocks = [];
- for (var _i = 1; _i < arguments.length; _i++) {
- ecBlocks[_i - 1] = arguments[_i];
- }
- this.ecCodewordsPerBlock = ecCodewordsPerBlock;
- this.ecBlocks = ecBlocks;
- }
- ECBlocks.prototype.getECCodewordsPerBlock = function () {
- return this.ecCodewordsPerBlock;
- };
- ECBlocks.prototype.getNumBlocks = function () {
- var e_1, _a;
- var total = 0;
- var ecBlocks = this.ecBlocks;
- try {
- for (var ecBlocks_1 = __values(ecBlocks), ecBlocks_1_1 = ecBlocks_1.next(); !ecBlocks_1_1.done; ecBlocks_1_1 = ecBlocks_1.next()) {
- var ecBlock = ecBlocks_1_1.value;
- total += ecBlock.getCount();
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (ecBlocks_1_1 && !ecBlocks_1_1.done && (_a = ecBlocks_1.return)) _a.call(ecBlocks_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- return total;
- };
- ECBlocks.prototype.getTotalECCodewords = function () {
- return this.ecCodewordsPerBlock * this.getNumBlocks();
- };
- ECBlocks.prototype.getECBlocks = function () {
- return this.ecBlocks;
- };
- return ECBlocks;
- }();
- var _default = ECBlocks;
- exports.default = _default;
- /***/ }),
- /* 421 */
- /*!**************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/decoder/ECB.js ***!
- \**************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- /**
- * <p>Encapsulates the parameters for one error-correction block in one symbol version.
- * This includes the number of data codewords, and the number of times a block with these
- * parameters is used consecutively in the QR code version's format.</p>
- */
- var ECB = /** @class */function () {
- function ECB(count /*int*/, dataCodewords /*int*/) {
- this.count = count;
- this.dataCodewords = dataCodewords;
- }
- ECB.prototype.getCount = function () {
- return this.count;
- };
- ECB.prototype.getDataCodewords = function () {
- return this.dataCodewords;
- };
- return ECB;
- }();
- var _default = ECB;
- exports.default = _default;
- /***/ }),
- /* 422 */
- /*!*******************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/decoder/DataMask.js ***!
- \*******************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = exports.DataMaskValues = void 0;
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var DataMaskValues;
- exports.DataMaskValues = DataMaskValues;
- (function (DataMaskValues) {
- DataMaskValues[DataMaskValues["DATA_MASK_000"] = 0] = "DATA_MASK_000";
- DataMaskValues[DataMaskValues["DATA_MASK_001"] = 1] = "DATA_MASK_001";
- DataMaskValues[DataMaskValues["DATA_MASK_010"] = 2] = "DATA_MASK_010";
- DataMaskValues[DataMaskValues["DATA_MASK_011"] = 3] = "DATA_MASK_011";
- DataMaskValues[DataMaskValues["DATA_MASK_100"] = 4] = "DATA_MASK_100";
- DataMaskValues[DataMaskValues["DATA_MASK_101"] = 5] = "DATA_MASK_101";
- DataMaskValues[DataMaskValues["DATA_MASK_110"] = 6] = "DATA_MASK_110";
- DataMaskValues[DataMaskValues["DATA_MASK_111"] = 7] = "DATA_MASK_111";
- })(DataMaskValues || (exports.DataMaskValues = DataMaskValues = {}));
- /**
- * <p>Encapsulates data masks for the data bits in a QR code, per ISO 18004:2006 6.8. Implementations
- * of this class can un-mask a raw BitMatrix. For simplicity, they will unmask the entire BitMatrix,
- * including areas used for finder patterns, timing patterns, etc. These areas should be unused
- * after the point they are unmasked anyway.</p>
- *
- * <p>Note that the diagram in section 6.8.1 is misleading since it indicates that i is column position
- * and j is row position. In fact, as the text says, i is row position and j is column position.</p>
- *
- * @author Sean Owen
- */
- var DataMask = /** @class */function () {
- // See ISO 18004:2006 6.8.1
- function DataMask(value, isMasked) {
- this.value = value;
- this.isMasked = isMasked;
- }
- // End of enum constants.
- /**
- * <p>Implementations of this method reverse the data masking process applied to a QR Code and
- * make its bits ready to read.</p>
- *
- * @param bits representation of QR Code bits
- * @param dimension dimension of QR Code, represented by bits, being unmasked
- */
- DataMask.prototype.unmaskBitMatrix = function (bits, dimension /*int*/) {
- for (var i = 0; i < dimension; i++) {
- for (var j = 0; j < dimension; j++) {
- if (this.isMasked(i, j)) {
- bits.flip(j, i);
- }
- }
- }
- };
- DataMask.values = new Map([
- /**
- * 000: mask bits for which (x + y) mod 2 == 0
- */
- [DataMaskValues.DATA_MASK_000, new DataMask(DataMaskValues.DATA_MASK_000, function (i /*int*/, j /*int*/) {
- return (i + j & 0x01) === 0;
- })],
- /**
- * 001: mask bits for which x mod 2 == 0
- */
- [DataMaskValues.DATA_MASK_001, new DataMask(DataMaskValues.DATA_MASK_001, function (i /*int*/, j /*int*/) {
- return (i & 0x01) === 0;
- })],
- /**
- * 010: mask bits for which y mod 3 == 0
- */
- [DataMaskValues.DATA_MASK_010, new DataMask(DataMaskValues.DATA_MASK_010, function (i /*int*/, j /*int*/) {
- return j % 3 === 0;
- })],
- /**
- * 011: mask bits for which (x + y) mod 3 == 0
- */
- [DataMaskValues.DATA_MASK_011, new DataMask(DataMaskValues.DATA_MASK_011, function (i /*int*/, j /*int*/) {
- return (i + j) % 3 === 0;
- })],
- /**
- * 100: mask bits for which (x/2 + y/3) mod 2 == 0
- */
- [DataMaskValues.DATA_MASK_100, new DataMask(DataMaskValues.DATA_MASK_100, function (i /*int*/, j /*int*/) {
- return (Math.floor(i / 2) + Math.floor(j / 3) & 0x01) === 0;
- })],
- /**
- * 101: mask bits for which xy mod 2 + xy mod 3 == 0
- * equivalently, such that xy mod 6 == 0
- */
- [DataMaskValues.DATA_MASK_101, new DataMask(DataMaskValues.DATA_MASK_101, function (i /*int*/, j /*int*/) {
- return i * j % 6 === 0;
- })],
- /**
- * 110: mask bits for which (xy mod 2 + xy mod 3) mod 2 == 0
- * equivalently, such that xy mod 6 < 3
- */
- [DataMaskValues.DATA_MASK_110, new DataMask(DataMaskValues.DATA_MASK_110, function (i /*int*/, j /*int*/) {
- return i * j % 6 < 3;
- })],
- /**
- * 111: mask bits for which ((x+y)mod 2 + xy mod 3) mod 2 == 0
- * equivalently, such that (x + y + xy mod 3) mod 2 == 0
- */
- [DataMaskValues.DATA_MASK_111, new DataMask(DataMaskValues.DATA_MASK_111, function (i /*int*/, j /*int*/) {
- return (i + j + i * j % 3 & 0x01) === 0;
- })]]);
- return DataMask;
- }();
- var _default = DataMask;
- exports.default = _default;
- /***/ }),
- /* 423 */
- /*!********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/decoder/DataBlock.js ***!
- \********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalArgumentException */ 308));
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- /**
- * <p>Encapsulates a block of data within a QR Code. QR Codes may split their data into
- * multiple blocks, each of which is a unit of data and error-correction codewords. Each
- * is represented by an instance of this class.</p>
- *
- * @author Sean Owen
- */
- var DataBlock = /** @class */function () {
- function DataBlock(numDataCodewords /*int*/, codewords) {
- this.numDataCodewords = numDataCodewords;
- this.codewords = codewords;
- }
- /**
- * <p>When QR Codes use multiple data blocks, they are actually interleaved.
- * That is, the first byte of data block 1 to n is written, then the second bytes, and so on. This
- * method will separate the data into original blocks.</p>
- *
- * @param rawCodewords bytes as read directly from the QR Code
- * @param version version of the QR Code
- * @param ecLevel error-correction level of the QR Code
- * @return DataBlocks containing original bytes, "de-interleaved" from representation in the
- * QR Code
- */
- DataBlock.getDataBlocks = function (rawCodewords, version, ecLevel) {
- var e_1, _a, e_2, _b;
- if (rawCodewords.length !== version.getTotalCodewords()) {
- throw new _IllegalArgumentException.default();
- }
- // Figure out the number and size of data blocks used by this version and
- // error correction level
- var ecBlocks = version.getECBlocksForLevel(ecLevel);
- // First count the total number of data blocks
- var totalBlocks = 0;
- var ecBlockArray = ecBlocks.getECBlocks();
- try {
- for (var ecBlockArray_1 = __values(ecBlockArray), ecBlockArray_1_1 = ecBlockArray_1.next(); !ecBlockArray_1_1.done; ecBlockArray_1_1 = ecBlockArray_1.next()) {
- var ecBlock = ecBlockArray_1_1.value;
- totalBlocks += ecBlock.getCount();
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (ecBlockArray_1_1 && !ecBlockArray_1_1.done && (_a = ecBlockArray_1.return)) _a.call(ecBlockArray_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- // Now establish DataBlocks of the appropriate size and number of data codewords
- var result = new Array(totalBlocks);
- var numResultBlocks = 0;
- try {
- for (var ecBlockArray_2 = __values(ecBlockArray), ecBlockArray_2_1 = ecBlockArray_2.next(); !ecBlockArray_2_1.done; ecBlockArray_2_1 = ecBlockArray_2.next()) {
- var ecBlock = ecBlockArray_2_1.value;
- for (var i = 0; i < ecBlock.getCount(); i++) {
- var numDataCodewords = ecBlock.getDataCodewords();
- var numBlockCodewords = ecBlocks.getECCodewordsPerBlock() + numDataCodewords;
- result[numResultBlocks++] = new DataBlock(numDataCodewords, new Uint8Array(numBlockCodewords));
- }
- }
- } catch (e_2_1) {
- e_2 = {
- error: e_2_1
- };
- } finally {
- try {
- if (ecBlockArray_2_1 && !ecBlockArray_2_1.done && (_b = ecBlockArray_2.return)) _b.call(ecBlockArray_2);
- } finally {
- if (e_2) throw e_2.error;
- }
- }
- // All blocks have the same amount of data, except that the last n
- // (where n may be 0) have 1 more byte. Figure out where these start.
- var shorterBlocksTotalCodewords = result[0].codewords.length;
- var longerBlocksStartAt = result.length - 1;
- // TYPESCRIPTPORT: check length is correct here
- while (longerBlocksStartAt >= 0) {
- var numCodewords = result[longerBlocksStartAt].codewords.length;
- if (numCodewords === shorterBlocksTotalCodewords) {
- break;
- }
- longerBlocksStartAt--;
- }
- longerBlocksStartAt++;
- var shorterBlocksNumDataCodewords = shorterBlocksTotalCodewords - ecBlocks.getECCodewordsPerBlock();
- // The last elements of result may be 1 element longer
- // first fill out as many elements as all of them have
- var rawCodewordsOffset = 0;
- for (var i = 0; i < shorterBlocksNumDataCodewords; i++) {
- for (var j = 0; j < numResultBlocks; j++) {
- result[j].codewords[i] = rawCodewords[rawCodewordsOffset++];
- }
- }
- // Fill out the last data block in the longer ones
- for (var j = longerBlocksStartAt; j < numResultBlocks; j++) {
- result[j].codewords[shorterBlocksNumDataCodewords] = rawCodewords[rawCodewordsOffset++];
- }
- // Now add in error correction blocks
- var max = result[0].codewords.length;
- for (var i = shorterBlocksNumDataCodewords; i < max; i++) {
- for (var j = 0; j < numResultBlocks; j++) {
- var iOffset = j < longerBlocksStartAt ? i : i + 1;
- result[j].codewords[iOffset] = rawCodewords[rawCodewordsOffset++];
- }
- }
- return result;
- };
- DataBlock.prototype.getNumDataCodewords = function () {
- return this.numDataCodewords;
- };
- DataBlock.prototype.getCodewords = function () {
- return this.codewords;
- };
- return DataBlock;
- }();
- var _default = DataBlock;
- exports.default = _default;
- /***/ }),
- /* 424 */
- /*!*********************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/decoder/DecodedBitStreamParser.js ***!
- \*********************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _BitSource = _interopRequireDefault(__webpack_require__(/*! ../../common/BitSource */ 410));
- var _CharacterSetECI = _interopRequireDefault(__webpack_require__(/*! ../../common/CharacterSetECI */ 323));
- var _DecoderResult = _interopRequireDefault(__webpack_require__(/*! ../../common/DecoderResult */ 337));
- var _StringUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/StringUtils */ 321));
- var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../../FormatException */ 324));
- var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../util/StringBuilder */ 320));
- var _StringEncoding = _interopRequireDefault(__webpack_require__(/*! ../../util/StringEncoding */ 325));
- var _Mode = _interopRequireDefault(__webpack_require__(/*! ./Mode */ 425));
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /*namespace com.google.zxing.qrcode.decoder {*/
- /*import java.io.UnsupportedEncodingException;*/
- /*import java.util.ArrayList;*/
- /*import java.util.Collection;*/
- /*import java.util.List;*/
- /*import java.util.Map;*/
- /**
- * <p>QR Codes can encode text as bits in one of several modes, and can use multiple modes
- * in one QR Code. This class decodes the bits back into text.</p>
- *
- * <p>See ISO 18004:2006, 6.4.3 - 6.4.7</p>
- *
- * @author Sean Owen
- */
- var DecodedBitStreamParser = /** @class */function () {
- function DecodedBitStreamParser() {}
- DecodedBitStreamParser.decode = function (bytes, version, ecLevel, hints) {
- var bits = new _BitSource.default(bytes);
- var result = new _StringBuilder.default();
- var byteSegments = new Array(); // 1
- // TYPESCRIPTPORT: I do not use constructor with size 1 as in original Java means capacity and the array length is checked below
- var symbolSequence = -1;
- var parityData = -1;
- try {
- var currentCharacterSetECI = null;
- var fc1InEffect = false;
- var mode = void 0;
- do {
- // While still another segment to read...
- if (bits.available() < 4) {
- // OK, assume we're done. Really, a TERMINATOR mode should have been recorded here
- mode = _Mode.default.TERMINATOR;
- } else {
- var modeBits = bits.readBits(4);
- mode = _Mode.default.forBits(modeBits); // mode is encoded by 4 bits
- }
- switch (mode) {
- case _Mode.default.TERMINATOR:
- break;
- case _Mode.default.FNC1_FIRST_POSITION:
- case _Mode.default.FNC1_SECOND_POSITION:
- // We do little with FNC1 except alter the parsed result a bit according to the spec
- fc1InEffect = true;
- break;
- case _Mode.default.STRUCTURED_APPEND:
- if (bits.available() < 16) {
- throw new _FormatException.default();
- }
- // sequence number and parity is added later to the result metadata
- // Read next 8 bits (symbol sequence #) and 8 bits (data: parity), then continue
- symbolSequence = bits.readBits(8);
- parityData = bits.readBits(8);
- break;
- case _Mode.default.ECI:
- // Count doesn't apply to ECI
- var value = DecodedBitStreamParser.parseECIValue(bits);
- currentCharacterSetECI = _CharacterSetECI.default.getCharacterSetECIByValue(value);
- if (currentCharacterSetECI === null) {
- throw new _FormatException.default();
- }
- break;
- case _Mode.default.HANZI:
- // First handle Hanzi mode which does not start with character count
- // Chinese mode contains a sub set indicator right after mode indicator
- var subset = bits.readBits(4);
- var countHanzi = bits.readBits(mode.getCharacterCountBits(version));
- if (subset === DecodedBitStreamParser.GB2312_SUBSET) {
- DecodedBitStreamParser.decodeHanziSegment(bits, result, countHanzi);
- }
- break;
- default:
- // "Normal" QR code modes:
- // How many characters will follow, encoded in this mode?
- var count = bits.readBits(mode.getCharacterCountBits(version));
- switch (mode) {
- case _Mode.default.NUMERIC:
- DecodedBitStreamParser.decodeNumericSegment(bits, result, count);
- break;
- case _Mode.default.ALPHANUMERIC:
- DecodedBitStreamParser.decodeAlphanumericSegment(bits, result, count, fc1InEffect);
- break;
- case _Mode.default.BYTE:
- DecodedBitStreamParser.decodeByteSegment(bits, result, count, currentCharacterSetECI, byteSegments, hints);
- break;
- case _Mode.default.KANJI:
- DecodedBitStreamParser.decodeKanjiSegment(bits, result, count);
- break;
- default:
- throw new _FormatException.default();
- }
- break;
- }
- } while (mode !== _Mode.default.TERMINATOR);
- } catch (iae /*: IllegalArgumentException*/) {
- // from readBits() calls
- throw new _FormatException.default();
- }
- return new _DecoderResult.default(bytes, result.toString(), byteSegments.length === 0 ? null : byteSegments, ecLevel === null ? null : ecLevel.toString(), symbolSequence, parityData);
- };
- /**
- * See specification GBT 18284-2000
- */
- DecodedBitStreamParser.decodeHanziSegment = function (bits, result, count /*int*/) {
- // Don't crash trying to read more bits than we have available.
- if (count * 13 > bits.available()) {
- throw new _FormatException.default();
- }
- // Each character will require 2 bytes. Read the characters as 2-byte pairs
- // and decode as GB2312 afterwards
- var buffer = new Uint8Array(2 * count);
- var offset = 0;
- while (count > 0) {
- // Each 13 bits encodes a 2-byte character
- var twoBytes = bits.readBits(13);
- var assembledTwoBytes = twoBytes / 0x060 << 8 & 0xFFFFFFFF | twoBytes % 0x060;
- if (assembledTwoBytes < 0x003BF) {
- // In the 0xA1A1 to 0xAAFE range
- assembledTwoBytes += 0x0A1A1;
- } else {
- // In the 0xB0A1 to 0xFAFE range
- assembledTwoBytes += 0x0A6A1;
- }
- buffer[offset] = /*(byte) */assembledTwoBytes >> 8 & 0xFF;
- buffer[offset + 1] = /*(byte) */assembledTwoBytes & 0xFF;
- offset += 2;
- count--;
- }
- try {
- result.append(_StringEncoding.default.decode(buffer, _StringUtils.default.GB2312));
- // TYPESCRIPTPORT: TODO: implement GB2312 decode. StringView from MDN could be a starting point
- } catch (ignored /*: UnsupportedEncodingException*/) {
- throw new _FormatException.default(ignored);
- }
- };
- DecodedBitStreamParser.decodeKanjiSegment = function (bits, result, count /*int*/) {
- // Don't crash trying to read more bits than we have available.
- if (count * 13 > bits.available()) {
- throw new _FormatException.default();
- }
- // Each character will require 2 bytes. Read the characters as 2-byte pairs
- // and decode as Shift_JIS afterwards
- var buffer = new Uint8Array(2 * count);
- var offset = 0;
- while (count > 0) {
- // Each 13 bits encodes a 2-byte character
- var twoBytes = bits.readBits(13);
- var assembledTwoBytes = twoBytes / 0x0C0 << 8 & 0xFFFFFFFF | twoBytes % 0x0C0;
- if (assembledTwoBytes < 0x01F00) {
- // In the 0x8140 to 0x9FFC range
- assembledTwoBytes += 0x08140;
- } else {
- // In the 0xE040 to 0xEBBF range
- assembledTwoBytes += 0x0C140;
- }
- buffer[offset] = /*(byte) */assembledTwoBytes >> 8;
- buffer[offset + 1] = /*(byte) */assembledTwoBytes;
- offset += 2;
- count--;
- }
- // Shift_JIS may not be supported in some environments:
- try {
- result.append(_StringEncoding.default.decode(buffer, _StringUtils.default.SHIFT_JIS));
- // TYPESCRIPTPORT: TODO: implement SHIFT_JIS decode. StringView from MDN could be a starting point
- } catch (ignored /*: UnsupportedEncodingException*/) {
- throw new _FormatException.default(ignored);
- }
- };
- DecodedBitStreamParser.decodeByteSegment = function (bits, result, count /*int*/, currentCharacterSetECI, byteSegments, hints) {
- // Don't crash trying to read more bits than we have available.
- if (8 * count > bits.available()) {
- throw new _FormatException.default();
- }
- var readBytes = new Uint8Array(count);
- for (var i = 0; i < count; i++) {
- readBytes[i] = /*(byte) */bits.readBits(8);
- }
- var encoding;
- if (currentCharacterSetECI === null) {
- // The spec isn't clear on this mode; see
- // section 6.4.5: t does not say which encoding to assuming
- // upon decoding. I have seen ISO-8859-1 used as well as
- // Shift_JIS -- without anything like an ECI designator to
- // give a hint.
- encoding = _StringUtils.default.guessEncoding(readBytes, hints);
- } else {
- encoding = currentCharacterSetECI.getName();
- }
- try {
- result.append(_StringEncoding.default.decode(readBytes, encoding));
- } catch (ignored /*: UnsupportedEncodingException*/) {
- throw new _FormatException.default(ignored);
- }
- byteSegments.push(readBytes);
- };
- DecodedBitStreamParser.toAlphaNumericChar = function (value /*int*/) {
- if (value >= DecodedBitStreamParser.ALPHANUMERIC_CHARS.length) {
- throw new _FormatException.default();
- }
- return DecodedBitStreamParser.ALPHANUMERIC_CHARS[value];
- };
- DecodedBitStreamParser.decodeAlphanumericSegment = function (bits, result, count /*int*/, fc1InEffect) {
- // Read two characters at a time
- var start = result.length();
- while (count > 1) {
- if (bits.available() < 11) {
- throw new _FormatException.default();
- }
- var nextTwoCharsBits = bits.readBits(11);
- result.append(DecodedBitStreamParser.toAlphaNumericChar(Math.floor(nextTwoCharsBits / 45)));
- result.append(DecodedBitStreamParser.toAlphaNumericChar(nextTwoCharsBits % 45));
- count -= 2;
- }
- if (count === 1) {
- // special case: one character left
- if (bits.available() < 6) {
- throw new _FormatException.default();
- }
- result.append(DecodedBitStreamParser.toAlphaNumericChar(bits.readBits(6)));
- }
- // See section 6.4.8.1, 6.4.8.2
- if (fc1InEffect) {
- // We need to massage the result a bit if in an FNC1 mode:
- for (var i = start; i < result.length(); i++) {
- if (result.charAt(i) === '%') {
- if (i < result.length() - 1 && result.charAt(i + 1) === '%') {
- // %% is rendered as %
- result.deleteCharAt(i + 1);
- } else {
- // In alpha mode, % should be converted to FNC1 separator 0x1D
- result.setCharAt(i, String.fromCharCode(0x1D));
- }
- }
- }
- }
- };
- DecodedBitStreamParser.decodeNumericSegment = function (bits, result, count /*int*/) {
- // Read three digits at a time
- while (count >= 3) {
- // Each 10 bits encodes three digits
- if (bits.available() < 10) {
- throw new _FormatException.default();
- }
- var threeDigitsBits = bits.readBits(10);
- if (threeDigitsBits >= 1000) {
- throw new _FormatException.default();
- }
- result.append(DecodedBitStreamParser.toAlphaNumericChar(Math.floor(threeDigitsBits / 100)));
- result.append(DecodedBitStreamParser.toAlphaNumericChar(Math.floor(threeDigitsBits / 10) % 10));
- result.append(DecodedBitStreamParser.toAlphaNumericChar(threeDigitsBits % 10));
- count -= 3;
- }
- if (count === 2) {
- // Two digits left over to read, encoded in 7 bits
- if (bits.available() < 7) {
- throw new _FormatException.default();
- }
- var twoDigitsBits = bits.readBits(7);
- if (twoDigitsBits >= 100) {
- throw new _FormatException.default();
- }
- result.append(DecodedBitStreamParser.toAlphaNumericChar(Math.floor(twoDigitsBits / 10)));
- result.append(DecodedBitStreamParser.toAlphaNumericChar(twoDigitsBits % 10));
- } else if (count === 1) {
- // One digit left over to read
- if (bits.available() < 4) {
- throw new _FormatException.default();
- }
- var digitBits = bits.readBits(4);
- if (digitBits >= 10) {
- throw new _FormatException.default();
- }
- result.append(DecodedBitStreamParser.toAlphaNumericChar(digitBits));
- }
- };
- DecodedBitStreamParser.parseECIValue = function (bits) {
- var firstByte = bits.readBits(8);
- if ((firstByte & 0x80) === 0) {
- // just one byte
- return firstByte & 0x7F;
- }
- if ((firstByte & 0xC0) === 0x80) {
- // two bytes
- var secondByte = bits.readBits(8);
- return (firstByte & 0x3F) << 8 & 0xFFFFFFFF | secondByte;
- }
- if ((firstByte & 0xE0) === 0xC0) {
- // three bytes
- var secondThirdBytes = bits.readBits(16);
- return (firstByte & 0x1F) << 16 & 0xFFFFFFFF | secondThirdBytes;
- }
- throw new _FormatException.default();
- };
- /**
- * See ISO 18004:2006, 6.4.4 Table 5
- */
- DecodedBitStreamParser.ALPHANUMERIC_CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:';
- DecodedBitStreamParser.GB2312_SUBSET = 1;
- return DecodedBitStreamParser;
- }();
- var _default = DecodedBitStreamParser; // function Uint8ArrayToString(a: Uint8Array): string {
- // const CHUNK_SZ = 0x8000;
- // const c = new StringBuilder();
- // for (let i = 0, length = a.length; i < length; i += CHUNK_SZ) {
- // c.append(String.fromCharCode.apply(null, a.subarray(i, i + CHUNK_SZ)));
- // }
- // return c.toString();
- // }
- exports.default = _default;
- /***/ }),
- /* 425 */
- /*!***************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/decoder/Mode.js ***!
- \***************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = exports.ModeValues = void 0;
- var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalArgumentException */ 308));
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var ModeValues;
- exports.ModeValues = ModeValues;
- (function (ModeValues) {
- ModeValues[ModeValues["TERMINATOR"] = 0] = "TERMINATOR";
- ModeValues[ModeValues["NUMERIC"] = 1] = "NUMERIC";
- ModeValues[ModeValues["ALPHANUMERIC"] = 2] = "ALPHANUMERIC";
- ModeValues[ModeValues["STRUCTURED_APPEND"] = 3] = "STRUCTURED_APPEND";
- ModeValues[ModeValues["BYTE"] = 4] = "BYTE";
- ModeValues[ModeValues["ECI"] = 5] = "ECI";
- ModeValues[ModeValues["KANJI"] = 6] = "KANJI";
- ModeValues[ModeValues["FNC1_FIRST_POSITION"] = 7] = "FNC1_FIRST_POSITION";
- ModeValues[ModeValues["FNC1_SECOND_POSITION"] = 8] = "FNC1_SECOND_POSITION";
- /** See GBT 18284-2000; "Hanzi" is a transliteration of this mode name. */
- ModeValues[ModeValues["HANZI"] = 9] = "HANZI";
- })(ModeValues || (exports.ModeValues = ModeValues = {}));
- /**
- * <p>See ISO 18004:2006, 6.4.1, Tables 2 and 3. This enum encapsulates the various modes in which
- * data can be encoded to bits in the QR code standard.</p>
- *
- * @author Sean Owen
- */
- var Mode = /** @class */function () {
- function Mode(value, stringValue, characterCountBitsForVersions, bits /*int*/) {
- this.value = value;
- this.stringValue = stringValue;
- this.characterCountBitsForVersions = characterCountBitsForVersions;
- this.bits = bits;
- Mode.FOR_BITS.set(bits, this);
- Mode.FOR_VALUE.set(value, this);
- }
- /**
- * @param bits four bits encoding a QR Code data mode
- * @return Mode encoded by these bits
- * @throws IllegalArgumentException if bits do not correspond to a known mode
- */
- Mode.forBits = function (bits /*int*/) {
- var mode = Mode.FOR_BITS.get(bits);
- if (undefined === mode) {
- throw new _IllegalArgumentException.default();
- }
- return mode;
- };
- /**
- * @param version version in question
- * @return number of bits used, in this QR Code symbol {@link Version}, to encode the
- * count of characters that will follow encoded in this Mode
- */
- Mode.prototype.getCharacterCountBits = function (version) {
- var versionNumber = version.getVersionNumber();
- var offset;
- if (versionNumber <= 9) {
- offset = 0;
- } else if (versionNumber <= 26) {
- offset = 1;
- } else {
- offset = 2;
- }
- return this.characterCountBitsForVersions[offset];
- };
- Mode.prototype.getValue = function () {
- return this.value;
- };
- Mode.prototype.getBits = function () {
- return this.bits;
- };
- Mode.prototype.equals = function (o) {
- if (!(o instanceof Mode)) {
- return false;
- }
- var other = o;
- return this.value === other.value;
- };
- Mode.prototype.toString = function () {
- return this.stringValue;
- };
- Mode.FOR_BITS = new Map();
- Mode.FOR_VALUE = new Map();
- Mode.TERMINATOR = new Mode(ModeValues.TERMINATOR, 'TERMINATOR', Int32Array.from([0, 0, 0]), 0x00); // Not really a mode...
- Mode.NUMERIC = new Mode(ModeValues.NUMERIC, 'NUMERIC', Int32Array.from([10, 12, 14]), 0x01);
- Mode.ALPHANUMERIC = new Mode(ModeValues.ALPHANUMERIC, 'ALPHANUMERIC', Int32Array.from([9, 11, 13]), 0x02);
- Mode.STRUCTURED_APPEND = new Mode(ModeValues.STRUCTURED_APPEND, 'STRUCTURED_APPEND', Int32Array.from([0, 0, 0]), 0x03); // Not supported
- Mode.BYTE = new Mode(ModeValues.BYTE, 'BYTE', Int32Array.from([8, 16, 16]), 0x04);
- Mode.ECI = new Mode(ModeValues.ECI, 'ECI', Int32Array.from([0, 0, 0]), 0x07); // character counts don't apply
- Mode.KANJI = new Mode(ModeValues.KANJI, 'KANJI', Int32Array.from([8, 10, 12]), 0x08);
- Mode.FNC1_FIRST_POSITION = new Mode(ModeValues.FNC1_FIRST_POSITION, 'FNC1_FIRST_POSITION', Int32Array.from([0, 0, 0]), 0x05);
- Mode.FNC1_SECOND_POSITION = new Mode(ModeValues.FNC1_SECOND_POSITION, 'FNC1_SECOND_POSITION', Int32Array.from([0, 0, 0]), 0x09);
- /** See GBT 18284-2000; "Hanzi" is a transliteration of this mode name. */
- Mode.HANZI = new Mode(ModeValues.HANZI, 'HANZI', Int32Array.from([8, 10, 12]), 0x0D);
- return Mode;
- }();
- var _default = Mode;
- exports.default = _default;
- /***/ }),
- /* 426 */
- /*!********************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/decoder/QRCodeDecoderMetaData.js ***!
- \********************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- /*
- * Copyright 2013 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /**
- * Meta-data container for QR Code decoding. Instances of this class may be used to convey information back to the
- * decoding caller. Callers are expected to process this.
- *
- * @see com.google.zxing.common.DecoderResult#getOther()
- */
- var QRCodeDecoderMetaData = /** @class */function () {
- function QRCodeDecoderMetaData(mirrored) {
- this.mirrored = mirrored;
- }
- /**
- * @return true if the QR Code was mirrored.
- */
- QRCodeDecoderMetaData.prototype.isMirrored = function () {
- return this.mirrored;
- };
- /**
- * Apply the result points' order correction due to mirroring.
- *
- * @param points Array of points to apply mirror correction to.
- */
- QRCodeDecoderMetaData.prototype.applyMirroredCorrection = function (points) {
- if (!this.mirrored || points === null || points.length < 3) {
- return;
- }
- var bottomLeft = points[0];
- points[0] = points[2];
- points[2] = bottomLeft;
- // No need to 'fix' top-left and alignment pattern.
- };
- return QRCodeDecoderMetaData;
- }();
- var _default = QRCodeDecoderMetaData;
- exports.default = _default;
- /***/ }),
- /* 427 */
- /*!********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/detector/Detector.js ***!
- \********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _MathUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/detector/MathUtils */ 347));
- var _DetectorResult = _interopRequireDefault(__webpack_require__(/*! ../../common/DetectorResult */ 350));
- var _GridSamplerInstance = _interopRequireDefault(__webpack_require__(/*! ../../common/GridSamplerInstance */ 352));
- var _PerspectiveTransform = _interopRequireDefault(__webpack_require__(/*! ../../common/PerspectiveTransform */ 355));
- var _DecodeHintType = _interopRequireDefault(__webpack_require__(/*! ../../DecodeHintType */ 322));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../NotFoundException */ 327));
- var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../../ResultPoint */ 346));
- var _Version = _interopRequireDefault(__webpack_require__(/*! ../decoder/Version */ 417));
- var _AlignmentPatternFinder = _interopRequireDefault(__webpack_require__(/*! ./AlignmentPatternFinder */ 428));
- var _FinderPatternFinder = _interopRequireDefault(__webpack_require__(/*! ./FinderPatternFinder */ 430));
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- // import GridSampler from '../../common/GridSampler';
- /*import java.util.Map;*/
- /**
- * <p>Encapsulates logic that can detect a QR Code in an image, even if the QR Code
- * is rotated or skewed, or partially obscured.</p>
- *
- * @author Sean Owen
- */
- var Detector = /** @class */function () {
- function Detector(image) {
- this.image = image;
- }
- Detector.prototype.getImage = function () {
- return this.image;
- };
- Detector.prototype.getResultPointCallback = function () {
- return this.resultPointCallback;
- };
- /**
- * <p>Detects a QR Code in an image.</p>
- *
- * @return {@link DetectorResult} encapsulating results of detecting a QR Code
- * @throws NotFoundException if QR Code cannot be found
- * @throws FormatException if a QR Code cannot be decoded
- */
- // public detect(): DetectorResult /*throws NotFoundException, FormatException*/ {
- // return detect(null)
- // }
- /**
- * <p>Detects a QR Code in an image.</p>
- *
- * @param hints optional hints to detector
- * @return {@link DetectorResult} encapsulating results of detecting a QR Code
- * @throws NotFoundException if QR Code cannot be found
- * @throws FormatException if a QR Code cannot be decoded
- */
- Detector.prototype.detect = function (hints) {
- this.resultPointCallback = hints === null || hints === undefined ? null : /*(ResultPointCallback) */hints.get(_DecodeHintType.default.NEED_RESULT_POINT_CALLBACK);
- var finder = new _FinderPatternFinder.default(this.image, this.resultPointCallback);
- var info = finder.find(hints);
- return this.processFinderPatternInfo(info);
- };
- Detector.prototype.processFinderPatternInfo = function (info) {
- var topLeft = info.getTopLeft();
- var topRight = info.getTopRight();
- var bottomLeft = info.getBottomLeft();
- var moduleSize = this.calculateModuleSize(topLeft, topRight, bottomLeft);
- if (moduleSize < 1.0) {
- throw new _NotFoundException.default('No pattern found in proccess finder.');
- }
- var dimension = Detector.computeDimension(topLeft, topRight, bottomLeft, moduleSize);
- var provisionalVersion = _Version.default.getProvisionalVersionForDimension(dimension);
- var modulesBetweenFPCenters = provisionalVersion.getDimensionForVersion() - 7;
- var alignmentPattern = null;
- // Anything above version 1 has an alignment pattern
- if (provisionalVersion.getAlignmentPatternCenters().length > 0) {
- // Guess where a "bottom right" finder pattern would have been
- var bottomRightX = topRight.getX() - topLeft.getX() + bottomLeft.getX();
- var bottomRightY = topRight.getY() - topLeft.getY() + bottomLeft.getY();
- // Estimate that alignment pattern is closer by 3 modules
- // from "bottom right" to known top left location
- var correctionToTopLeft = 1.0 - 3.0 / modulesBetweenFPCenters;
- var estAlignmentX = /*(int) */Math.floor(topLeft.getX() + correctionToTopLeft * (bottomRightX - topLeft.getX()));
- var estAlignmentY = /*(int) */Math.floor(topLeft.getY() + correctionToTopLeft * (bottomRightY - topLeft.getY()));
- // Kind of arbitrary -- expand search radius before giving up
- for (var i = 4; i <= 16; i <<= 1) {
- try {
- alignmentPattern = this.findAlignmentInRegion(moduleSize, estAlignmentX, estAlignmentY, i);
- break;
- } catch (re /*NotFoundException*/) {
- if (!(re instanceof _NotFoundException.default)) {
- throw re;
- }
- // try next round
- }
- }
- // If we didn't find alignment pattern... well try anyway without it
- }
- var transform = Detector.createTransform(topLeft, topRight, bottomLeft, alignmentPattern, dimension);
- var bits = Detector.sampleGrid(this.image, transform, dimension);
- var points;
- if (alignmentPattern === null) {
- points = [bottomLeft, topLeft, topRight];
- } else {
- points = [bottomLeft, topLeft, topRight, alignmentPattern];
- }
- return new _DetectorResult.default(bits, points);
- };
- Detector.createTransform = function (topLeft, topRight, bottomLeft, alignmentPattern, dimension /*int*/) {
- var dimMinusThree = dimension - 3.5;
- var bottomRightX; /*float*/
- var bottomRightY; /*float*/
- var sourceBottomRightX; /*float*/
- var sourceBottomRightY; /*float*/
- if (alignmentPattern !== null) {
- bottomRightX = alignmentPattern.getX();
- bottomRightY = alignmentPattern.getY();
- sourceBottomRightX = dimMinusThree - 3.0;
- sourceBottomRightY = sourceBottomRightX;
- } else {
- // Don't have an alignment pattern, just make up the bottom-right point
- bottomRightX = topRight.getX() - topLeft.getX() + bottomLeft.getX();
- bottomRightY = topRight.getY() - topLeft.getY() + bottomLeft.getY();
- sourceBottomRightX = dimMinusThree;
- sourceBottomRightY = dimMinusThree;
- }
- return _PerspectiveTransform.default.quadrilateralToQuadrilateral(3.5, 3.5, dimMinusThree, 3.5, sourceBottomRightX, sourceBottomRightY, 3.5, dimMinusThree, topLeft.getX(), topLeft.getY(), topRight.getX(), topRight.getY(), bottomRightX, bottomRightY, bottomLeft.getX(), bottomLeft.getY());
- };
- Detector.sampleGrid = function (image, transform, dimension /*int*/) {
- var sampler = _GridSamplerInstance.default.getInstance();
- return sampler.sampleGridWithTransform(image, dimension, dimension, transform);
- };
- /**
- * <p>Computes the dimension (number of modules on a size) of the QR Code based on the position
- * of the finder patterns and estimated module size.</p>
- */
- Detector.computeDimension = function (topLeft, topRight, bottomLeft, moduleSize /*float*/) {
- var tltrCentersDimension = _MathUtils.default.round(_ResultPoint.default.distance(topLeft, topRight) / moduleSize);
- var tlblCentersDimension = _MathUtils.default.round(_ResultPoint.default.distance(topLeft, bottomLeft) / moduleSize);
- var dimension = Math.floor((tltrCentersDimension + tlblCentersDimension) / 2) + 7;
- switch (dimension & 0x03) {
- // mod 4
- case 0:
- dimension++;
- break;
- // 1? do nothing
- case 2:
- dimension--;
- break;
- case 3:
- throw new _NotFoundException.default('Dimensions could be not found.');
- }
- return dimension;
- };
- /**
- * <p>Computes an average estimated module size based on estimated derived from the positions
- * of the three finder patterns.</p>
- *
- * @param topLeft detected top-left finder pattern center
- * @param topRight detected top-right finder pattern center
- * @param bottomLeft detected bottom-left finder pattern center
- * @return estimated module size
- */
- Detector.prototype.calculateModuleSize = function (topLeft, topRight, bottomLeft) {
- // Take the average
- return (this.calculateModuleSizeOneWay(topLeft, topRight) + this.calculateModuleSizeOneWay(topLeft, bottomLeft)) / 2.0;
- };
- /**
- * <p>Estimates module size based on two finder patterns -- it uses
- * {@link #sizeOfBlackWhiteBlackRunBothWays(int, int, int, int)} to figure the
- * width of each, measuring along the axis between their centers.</p>
- */
- Detector.prototype.calculateModuleSizeOneWay = function (pattern, otherPattern) {
- var moduleSizeEst1 = this.sizeOfBlackWhiteBlackRunBothWays( /*(int) */Math.floor(pattern.getX()), /*(int) */Math.floor(pattern.getY()), /*(int) */Math.floor(otherPattern.getX()), /*(int) */Math.floor(otherPattern.getY()));
- var moduleSizeEst2 = this.sizeOfBlackWhiteBlackRunBothWays( /*(int) */Math.floor(otherPattern.getX()), /*(int) */Math.floor(otherPattern.getY()), /*(int) */Math.floor(pattern.getX()), /*(int) */Math.floor(pattern.getY()));
- if (isNaN(moduleSizeEst1)) {
- return moduleSizeEst2 / 7.0;
- }
- if (isNaN(moduleSizeEst2)) {
- return moduleSizeEst1 / 7.0;
- }
- // Average them, and divide by 7 since we've counted the width of 3 black modules,
- // and 1 white and 1 black module on either side. Ergo, divide sum by 14.
- return (moduleSizeEst1 + moduleSizeEst2) / 14.0;
- };
- /**
- * See {@link #sizeOfBlackWhiteBlackRun(int, int, int, int)}; computes the total width of
- * a finder pattern by looking for a black-white-black run from the center in the direction
- * of another point (another finder pattern center), and in the opposite direction too.
- */
- Detector.prototype.sizeOfBlackWhiteBlackRunBothWays = function (fromX /*int*/, fromY /*int*/, toX /*int*/, toY /*int*/) {
- var result = this.sizeOfBlackWhiteBlackRun(fromX, fromY, toX, toY);
- // Now count other way -- don't run off image though of course
- var scale = 1.0;
- var otherToX = fromX - (toX - fromX);
- if (otherToX < 0) {
- scale = fromX / ( /*(float) */fromX - otherToX);
- otherToX = 0;
- } else if (otherToX >= this.image.getWidth()) {
- scale = (this.image.getWidth() - 1 - fromX) / ( /*(float) */otherToX - fromX);
- otherToX = this.image.getWidth() - 1;
- }
- var otherToY = /*(int) */Math.floor(fromY - (toY - fromY) * scale);
- scale = 1.0;
- if (otherToY < 0) {
- scale = fromY / ( /*(float) */fromY - otherToY);
- otherToY = 0;
- } else if (otherToY >= this.image.getHeight()) {
- scale = (this.image.getHeight() - 1 - fromY) / ( /*(float) */otherToY - fromY);
- otherToY = this.image.getHeight() - 1;
- }
- otherToX = /*(int) */Math.floor(fromX + (otherToX - fromX) * scale);
- result += this.sizeOfBlackWhiteBlackRun(fromX, fromY, otherToX, otherToY);
- // Middle pixel is double-counted this way; subtract 1
- return result - 1.0;
- };
- /**
- * <p>This method traces a line from a point in the image, in the direction towards another point.
- * It begins in a black region, and keeps going until it finds white, then black, then white again.
- * It reports the distance from the start to this point.</p>
- *
- * <p>This is used when figuring out how wide a finder pattern is, when the finder pattern
- * may be skewed or rotated.</p>
- */
- Detector.prototype.sizeOfBlackWhiteBlackRun = function (fromX /*int*/, fromY /*int*/, toX /*int*/, toY /*int*/) {
- // Mild variant of Bresenham's algorithm
- // see http://en.wikipedia.org/wiki/Bresenham's_line_algorithm
- var steep = Math.abs(toY - fromY) > Math.abs(toX - fromX);
- if (steep) {
- var temp = fromX;
- fromX = fromY;
- fromY = temp;
- temp = toX;
- toX = toY;
- toY = temp;
- }
- var dx = Math.abs(toX - fromX);
- var dy = Math.abs(toY - fromY);
- var error = -dx / 2;
- var xstep = fromX < toX ? 1 : -1;
- var ystep = fromY < toY ? 1 : -1;
- // In black pixels, looking for white, first or second time.
- var state = 0;
- // Loop up until x == toX, but not beyond
- var xLimit = toX + xstep;
- for (var x = fromX, y = fromY; x !== xLimit; x += xstep) {
- var realX = steep ? y : x;
- var realY = steep ? x : y;
- // Does current pixel mean we have moved white to black or vice versa?
- // Scanning black in state 0,2 and white in state 1, so if we find the wrong
- // color, advance to next state or end if we are in state 2 already
- if (state === 1 === this.image.get(realX, realY)) {
- if (state === 2) {
- return _MathUtils.default.distance(x, y, fromX, fromY);
- }
- state++;
- }
- error += dy;
- if (error > 0) {
- if (y === toY) {
- break;
- }
- y += ystep;
- error -= dx;
- }
- }
- // Found black-white-black; give the benefit of the doubt that the next pixel outside the image
- // is "white" so this last point at (toX+xStep,toY) is the right ending. This is really a
- // small approximation; (toX+xStep,toY+yStep) might be really correct. Ignore this.
- if (state === 2) {
- return _MathUtils.default.distance(toX + xstep, toY, fromX, fromY);
- }
- // else we didn't find even black-white-black; no estimate is really possible
- return NaN;
- };
- /**
- * <p>Attempts to locate an alignment pattern in a limited region of the image, which is
- * guessed to contain it. This method uses {@link AlignmentPattern}.</p>
- *
- * @param overallEstModuleSize estimated module size so far
- * @param estAlignmentX x coordinate of center of area probably containing alignment pattern
- * @param estAlignmentY y coordinate of above
- * @param allowanceFactor number of pixels in all directions to search from the center
- * @return {@link AlignmentPattern} if found, or null otherwise
- * @throws NotFoundException if an unexpected error occurs during detection
- */
- Detector.prototype.findAlignmentInRegion = function (overallEstModuleSize /*float*/, estAlignmentX /*int*/, estAlignmentY /*int*/, allowanceFactor /*float*/) {
- // Look for an alignment pattern (3 modules in size) around where it
- // should be
- var allowance = /*(int) */Math.floor(allowanceFactor * overallEstModuleSize);
- var alignmentAreaLeftX = Math.max(0, estAlignmentX - allowance);
- var alignmentAreaRightX = Math.min(this.image.getWidth() - 1, estAlignmentX + allowance);
- if (alignmentAreaRightX - alignmentAreaLeftX < overallEstModuleSize * 3) {
- throw new _NotFoundException.default('Alignment top exceeds estimated module size.');
- }
- var alignmentAreaTopY = Math.max(0, estAlignmentY - allowance);
- var alignmentAreaBottomY = Math.min(this.image.getHeight() - 1, estAlignmentY + allowance);
- if (alignmentAreaBottomY - alignmentAreaTopY < overallEstModuleSize * 3) {
- throw new _NotFoundException.default('Alignment bottom exceeds estimated module size.');
- }
- var alignmentFinder = new _AlignmentPatternFinder.default(this.image, alignmentAreaLeftX, alignmentAreaTopY, alignmentAreaRightX - alignmentAreaLeftX, alignmentAreaBottomY - alignmentAreaTopY, overallEstModuleSize, this.resultPointCallback);
- return alignmentFinder.find();
- };
- return Detector;
- }();
- var _default = Detector;
- exports.default = _default;
- /***/ }),
- /* 428 */
- /*!**********************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/detector/AlignmentPatternFinder.js ***!
- \**********************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _AlignmentPattern = _interopRequireDefault(__webpack_require__(/*! ./AlignmentPattern */ 429));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../NotFoundException */ 327));
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- /*import java.util.ArrayList;*/
- /*import java.util.List;*/
- /**
- * <p>This class attempts to find alignment patterns in a QR Code. Alignment patterns look like finder
- * patterns but are smaller and appear at regular intervals throughout the image.</p>
- *
- * <p>At the moment this only looks for the bottom-right alignment pattern.</p>
- *
- * <p>This is mostly a simplified copy of {@link FinderPatternFinder}. It is copied,
- * pasted and stripped down here for maximum performance but does unfortunately duplicate
- * some code.</p>
- *
- * <p>This class is thread-safe but not reentrant. Each thread must allocate its own object.</p>
- *
- * @author Sean Owen
- */
- var AlignmentPatternFinder = /** @class */function () {
- /**
- * <p>Creates a finder that will look in a portion of the whole image.</p>
- *
- * @param image image to search
- * @param startX left column from which to start searching
- * @param startY top row from which to start searching
- * @param width width of region to search
- * @param height height of region to search
- * @param moduleSize estimated module size so far
- */
- function AlignmentPatternFinder(image, startX /*int*/, startY /*int*/, width /*int*/, height /*int*/, moduleSize /*float*/, resultPointCallback) {
- this.image = image;
- this.startX = startX;
- this.startY = startY;
- this.width = width;
- this.height = height;
- this.moduleSize = moduleSize;
- this.resultPointCallback = resultPointCallback;
- this.possibleCenters = []; // new Array<any>(5))
- // TYPESCRIPTPORT: array initialization without size as the length is checked below
- this.crossCheckStateCount = new Int32Array(3);
- }
- /**
- * <p>This method attempts to find the bottom-right alignment pattern in the image. It is a bit messy since
- * it's pretty performance-critical and so is written to be fast foremost.</p>
- *
- * @return {@link AlignmentPattern} if found
- * @throws NotFoundException if not found
- */
- AlignmentPatternFinder.prototype.find = function () {
- var startX = this.startX;
- var height = this.height;
- var width = this.width;
- var maxJ = startX + width;
- var middleI = this.startY + height / 2;
- // We are looking for black/white/black modules in 1:1:1 ratio
- // this tracks the number of black/white/black modules seen so far
- var stateCount = new Int32Array(3);
- var image = this.image;
- for (var iGen = 0; iGen < height; iGen++) {
- // Search from middle outwards
- var i = middleI + ((iGen & 0x01) === 0 ? Math.floor((iGen + 1) / 2) : -Math.floor((iGen + 1) / 2));
- stateCount[0] = 0;
- stateCount[1] = 0;
- stateCount[2] = 0;
- var j = startX;
- // Burn off leading white pixels before anything else; if we start in the middle of
- // a white run, it doesn't make sense to count its length, since we don't know if the
- // white run continued to the left of the start point
- while (j < maxJ && !image.get(j, i)) {
- j++;
- }
- var currentState = 0;
- while (j < maxJ) {
- if (image.get(j, i)) {
- // Black pixel
- if (currentState === 1) {
- // Counting black pixels
- stateCount[1]++;
- } else {
- // Counting white pixels
- if (currentState === 2) {
- // A winner?
- if (this.foundPatternCross(stateCount)) {
- // Yes
- var confirmed = this.handlePossibleCenter(stateCount, i, j);
- if (confirmed !== null) {
- return confirmed;
- }
- }
- stateCount[0] = stateCount[2];
- stateCount[1] = 1;
- stateCount[2] = 0;
- currentState = 1;
- } else {
- stateCount[++currentState]++;
- }
- }
- } else {
- // White pixel
- if (currentState === 1) {
- // Counting black pixels
- currentState++;
- }
- stateCount[currentState]++;
- }
- j++;
- }
- if (this.foundPatternCross(stateCount)) {
- var confirmed = this.handlePossibleCenter(stateCount, i, maxJ);
- if (confirmed !== null) {
- return confirmed;
- }
- }
- }
- // Hmm, nothing we saw was observed and confirmed twice. If we had
- // any guess at all, return it.
- if (this.possibleCenters.length !== 0) {
- return this.possibleCenters[0];
- }
- throw new _NotFoundException.default();
- };
- /**
- * Given a count of black/white/black pixels just seen and an end position,
- * figures the location of the center of this black/white/black run.
- */
- AlignmentPatternFinder.centerFromEnd = function (stateCount, end /*int*/) {
- return end - stateCount[2] - stateCount[1] / 2.0;
- };
- /**
- * @param stateCount count of black/white/black pixels just read
- * @return true iff the proportions of the counts is close enough to the 1/1/1 ratios
- * used by alignment patterns to be considered a match
- */
- AlignmentPatternFinder.prototype.foundPatternCross = function (stateCount) {
- var moduleSize = this.moduleSize;
- var maxVariance = moduleSize / 2.0;
- for (var i = 0; i < 3; i++) {
- if (Math.abs(moduleSize - stateCount[i]) >= maxVariance) {
- return false;
- }
- }
- return true;
- };
- /**
- * <p>After a horizontal scan finds a potential alignment pattern, this method
- * "cross-checks" by scanning down vertically through the center of the possible
- * alignment pattern to see if the same proportion is detected.</p>
- *
- * @param startI row where an alignment pattern was detected
- * @param centerJ center of the section that appears to cross an alignment pattern
- * @param maxCount maximum reasonable number of modules that should be
- * observed in any reading state, based on the results of the horizontal scan
- * @return vertical center of alignment pattern, or {@link Float#NaN} if not found
- */
- AlignmentPatternFinder.prototype.crossCheckVertical = function (startI /*int*/, centerJ /*int*/, maxCount /*int*/, originalStateCountTotal /*int*/) {
- var image = this.image;
- var maxI = image.getHeight();
- var stateCount = this.crossCheckStateCount;
- stateCount[0] = 0;
- stateCount[1] = 0;
- stateCount[2] = 0;
- // Start counting up from center
- var i = startI;
- while (i >= 0 && image.get(centerJ, i) && stateCount[1] <= maxCount) {
- stateCount[1]++;
- i--;
- }
- // If already too many modules in this state or ran off the edge:
- if (i < 0 || stateCount[1] > maxCount) {
- return NaN;
- }
- while (i >= 0 && !image.get(centerJ, i) && stateCount[0] <= maxCount) {
- stateCount[0]++;
- i--;
- }
- if (stateCount[0] > maxCount) {
- return NaN;
- }
- // Now also count down from center
- i = startI + 1;
- while (i < maxI && image.get(centerJ, i) && stateCount[1] <= maxCount) {
- stateCount[1]++;
- i++;
- }
- if (i === maxI || stateCount[1] > maxCount) {
- return NaN;
- }
- while (i < maxI && !image.get(centerJ, i) && stateCount[2] <= maxCount) {
- stateCount[2]++;
- i++;
- }
- if (stateCount[2] > maxCount) {
- return NaN;
- }
- var stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2];
- if (5 * Math.abs(stateCountTotal - originalStateCountTotal) >= 2 * originalStateCountTotal) {
- return NaN;
- }
- return this.foundPatternCross(stateCount) ? AlignmentPatternFinder.centerFromEnd(stateCount, i) : NaN;
- };
- /**
- * <p>This is called when a horizontal scan finds a possible alignment pattern. It will
- * cross check with a vertical scan, and if successful, will see if this pattern had been
- * found on a previous horizontal scan. If so, we consider it confirmed and conclude we have
- * found the alignment pattern.</p>
- *
- * @param stateCount reading state module counts from horizontal scan
- * @param i row where alignment pattern may be found
- * @param j end of possible alignment pattern in row
- * @return {@link AlignmentPattern} if we have found the same pattern twice, or null if not
- */
- AlignmentPatternFinder.prototype.handlePossibleCenter = function (stateCount, i /*int*/, j /*int*/) {
- var e_1, _a;
- var stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2];
- var centerJ = AlignmentPatternFinder.centerFromEnd(stateCount, j);
- var centerI = this.crossCheckVertical(i, /*(int) */centerJ, 2 * stateCount[1], stateCountTotal);
- if (!isNaN(centerI)) {
- var estimatedModuleSize = (stateCount[0] + stateCount[1] + stateCount[2]) / 3.0;
- try {
- for (var _b = __values(this.possibleCenters), _c = _b.next(); !_c.done; _c = _b.next()) {
- var center = _c.value;
- // Look for about the same center and module size:
- if (center.aboutEquals(estimatedModuleSize, centerI, centerJ)) {
- return center.combineEstimate(centerI, centerJ, estimatedModuleSize);
- }
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- // Hadn't found this before; save it
- var point = new _AlignmentPattern.default(centerJ, centerI, estimatedModuleSize);
- this.possibleCenters.push(point);
- if (this.resultPointCallback !== null && this.resultPointCallback !== undefined) {
- this.resultPointCallback.foundPossibleResultPoint(point);
- }
- }
- return null;
- };
- return AlignmentPatternFinder;
- }();
- var _default = AlignmentPatternFinder;
- exports.default = _default;
- /***/ }),
- /* 429 */
- /*!****************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/detector/AlignmentPattern.js ***!
- \****************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../../ResultPoint */ 346));
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /*namespace com.google.zxing.qrcode.detector {*/
- /**
- * <p>Encapsulates an alignment pattern, which are the smaller square patterns found in
- * all but the simplest QR Codes.</p>
- *
- * @author Sean Owen
- */
- var AlignmentPattern = /** @class */function (_super) {
- __extends(AlignmentPattern, _super);
- function AlignmentPattern(posX /*float*/, posY /*float*/, estimatedModuleSize /*float*/) {
- var _this = _super.call(this, posX, posY) || this;
- _this.estimatedModuleSize = estimatedModuleSize;
- return _this;
- }
- /**
- * <p>Determines if this alignment pattern "about equals" an alignment pattern at the stated
- * position and size -- meaning, it is at nearly the same center with nearly the same size.</p>
- */
- AlignmentPattern.prototype.aboutEquals = function (moduleSize /*float*/, i /*float*/, j /*float*/) {
- if (Math.abs(i - this.getY()) <= moduleSize && Math.abs(j - this.getX()) <= moduleSize) {
- var moduleSizeDiff = Math.abs(moduleSize - this.estimatedModuleSize);
- return moduleSizeDiff <= 1.0 || moduleSizeDiff <= this.estimatedModuleSize;
- }
- return false;
- };
- /**
- * Combines this object's current estimate of a finder pattern position and module size
- * with a new estimate. It returns a new {@code FinderPattern} containing an average of the two.
- */
- AlignmentPattern.prototype.combineEstimate = function (i /*float*/, j /*float*/, newModuleSize /*float*/) {
- var combinedX = (this.getX() + j) / 2.0;
- var combinedY = (this.getY() + i) / 2.0;
- var combinedModuleSize = (this.estimatedModuleSize + newModuleSize) / 2.0;
- return new AlignmentPattern(combinedX, combinedY, combinedModuleSize);
- };
- return AlignmentPattern;
- }(_ResultPoint.default);
- var _default = AlignmentPattern;
- exports.default = _default;
- /***/ }),
- /* 430 */
- /*!*******************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/detector/FinderPatternFinder.js ***!
- \*******************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _DecodeHintType = _interopRequireDefault(__webpack_require__(/*! ../../DecodeHintType */ 322));
- var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../../ResultPoint */ 346));
- var _FinderPattern = _interopRequireDefault(__webpack_require__(/*! ./FinderPattern */ 431));
- var _FinderPatternInfo = _interopRequireDefault(__webpack_require__(/*! ./FinderPatternInfo */ 432));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../NotFoundException */ 327));
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- /*namespace com.google.zxing.qrcode.detector {*/
- /*import java.io.Serializable;*/
- /*import java.util.ArrayList;*/
- /*import java.util.Collections;*/
- /*import java.util.Comparator;*/
- /*import java.util.List;*/
- /*import java.util.Map;*/
- /**
- * <p>This class attempts to find finder patterns in a QR Code. Finder patterns are the square
- * markers at three corners of a QR Code.</p>
- *
- * <p>This class is thread-safe but not reentrant. Each thread must allocate its own object.
- *
- * @author Sean Owen
- */
- var FinderPatternFinder = /** @class */function () {
- /**
- * <p>Creates a finder that will search the image for three finder patterns.</p>
- *
- * @param image image to search
- */
- // public constructor(image: BitMatrix) {
- // this(image, null)
- // }
- function FinderPatternFinder(image, resultPointCallback) {
- this.image = image;
- this.resultPointCallback = resultPointCallback;
- this.possibleCenters = [];
- this.crossCheckStateCount = new Int32Array(5);
- this.resultPointCallback = resultPointCallback;
- }
- FinderPatternFinder.prototype.getImage = function () {
- return this.image;
- };
- FinderPatternFinder.prototype.getPossibleCenters = function () {
- return this.possibleCenters;
- };
- FinderPatternFinder.prototype.find = function (hints) {
- var tryHarder = hints !== null && hints !== undefined && undefined !== hints.get(_DecodeHintType.default.TRY_HARDER);
- var pureBarcode = hints !== null && hints !== undefined && undefined !== hints.get(_DecodeHintType.default.PURE_BARCODE);
- var image = this.image;
- var maxI = image.getHeight();
- var maxJ = image.getWidth();
- // We are looking for black/white/black/white/black modules in
- // 1:1:3:1:1 ratio; this tracks the number of such modules seen so far
- // Let's assume that the maximum version QR Code we support takes up 1/4 the height of the
- // image, and then account for the center being 3 modules in size. This gives the smallest
- // number of pixels the center could be, so skip this often. When trying harder, look for all
- // QR versions regardless of how dense they are.
- var iSkip = Math.floor(3 * maxI / (4 * FinderPatternFinder.MAX_MODULES));
- if (iSkip < FinderPatternFinder.MIN_SKIP || tryHarder) {
- iSkip = FinderPatternFinder.MIN_SKIP;
- }
- var done = false;
- var stateCount = new Int32Array(5);
- for (var i = iSkip - 1; i < maxI && !done; i += iSkip) {
- // Get a row of black/white values
- stateCount[0] = 0;
- stateCount[1] = 0;
- stateCount[2] = 0;
- stateCount[3] = 0;
- stateCount[4] = 0;
- var currentState = 0;
- for (var j = 0; j < maxJ; j++) {
- if (image.get(j, i)) {
- // Black pixel
- if ((currentState & 1) === 1) {
- // Counting white pixels
- currentState++;
- }
- stateCount[currentState]++;
- } else {
- // White pixel
- if ((currentState & 1) === 0) {
- // Counting black pixels
- if (currentState === 4) {
- // A winner?
- if (FinderPatternFinder.foundPatternCross(stateCount)) {
- // Yes
- var confirmed = this.handlePossibleCenter(stateCount, i, j, pureBarcode);
- if (confirmed === true) {
- // Start examining every other line. Checking each line turned out to be too
- // expensive and didn't improve performance.
- iSkip = 2;
- if (this.hasSkipped === true) {
- done = this.haveMultiplyConfirmedCenters();
- } else {
- var rowSkip = this.findRowSkip();
- if (rowSkip > stateCount[2]) {
- // Skip rows between row of lower confirmed center
- // and top of presumed third confirmed center
- // but back up a bit to get a full chance of detecting
- // it, entire width of center of finder pattern
- // Skip by rowSkip, but back off by stateCount[2] (size of last center
- // of pattern we saw) to be conservative, and also back off by iSkip which
- // is about to be re-added
- i += rowSkip - stateCount[2] - iSkip;
- j = maxJ - 1;
- }
- }
- } else {
- stateCount[0] = stateCount[2];
- stateCount[1] = stateCount[3];
- stateCount[2] = stateCount[4];
- stateCount[3] = 1;
- stateCount[4] = 0;
- currentState = 3;
- continue;
- }
- // Clear state to start looking again
- currentState = 0;
- stateCount[0] = 0;
- stateCount[1] = 0;
- stateCount[2] = 0;
- stateCount[3] = 0;
- stateCount[4] = 0;
- } else {
- // No, shift counts back by two
- stateCount[0] = stateCount[2];
- stateCount[1] = stateCount[3];
- stateCount[2] = stateCount[4];
- stateCount[3] = 1;
- stateCount[4] = 0;
- currentState = 3;
- }
- } else {
- stateCount[++currentState]++;
- }
- } else {
- // Counting white pixels
- stateCount[currentState]++;
- }
- }
- }
- if (FinderPatternFinder.foundPatternCross(stateCount)) {
- var confirmed = this.handlePossibleCenter(stateCount, i, maxJ, pureBarcode);
- if (confirmed === true) {
- iSkip = stateCount[0];
- if (this.hasSkipped) {
- // Found a third one
- done = this.haveMultiplyConfirmedCenters();
- }
- }
- }
- }
- var patternInfo = this.selectBestPatterns();
- _ResultPoint.default.orderBestPatterns(patternInfo);
- return new _FinderPatternInfo.default(patternInfo);
- };
- /**
- * Given a count of black/white/black/white/black pixels just seen and an end position,
- * figures the location of the center of this run.
- */
- FinderPatternFinder.centerFromEnd = function (stateCount, end /*int*/) {
- return end - stateCount[4] - stateCount[3] - stateCount[2] / 2.0;
- };
- /**
- * @param stateCount count of black/white/black/white/black pixels just read
- * @return true iff the proportions of the counts is close enough to the 1/1/3/1/1 ratios
- * used by finder patterns to be considered a match
- */
- FinderPatternFinder.foundPatternCross = function (stateCount) {
- var totalModuleSize = 0;
- for (var i = 0; i < 5; i++) {
- var count = stateCount[i];
- if (count === 0) {
- return false;
- }
- totalModuleSize += count;
- }
- if (totalModuleSize < 7) {
- return false;
- }
- var moduleSize = totalModuleSize / 7.0;
- var maxVariance = moduleSize / 2.0;
- // Allow less than 50% variance from 1-1-3-1-1 proportions
- return Math.abs(moduleSize - stateCount[0]) < maxVariance && Math.abs(moduleSize - stateCount[1]) < maxVariance && Math.abs(3.0 * moduleSize - stateCount[2]) < 3 * maxVariance && Math.abs(moduleSize - stateCount[3]) < maxVariance && Math.abs(moduleSize - stateCount[4]) < maxVariance;
- };
- FinderPatternFinder.prototype.getCrossCheckStateCount = function () {
- var crossCheckStateCount = this.crossCheckStateCount;
- crossCheckStateCount[0] = 0;
- crossCheckStateCount[1] = 0;
- crossCheckStateCount[2] = 0;
- crossCheckStateCount[3] = 0;
- crossCheckStateCount[4] = 0;
- return crossCheckStateCount;
- };
- /**
- * After a vertical and horizontal scan finds a potential finder pattern, this method
- * "cross-cross-cross-checks" by scanning down diagonally through the center of the possible
- * finder pattern to see if the same proportion is detected.
- *
- * @param startI row where a finder pattern was detected
- * @param centerJ center of the section that appears to cross a finder pattern
- * @param maxCount maximum reasonable number of modules that should be
- * observed in any reading state, based on the results of the horizontal scan
- * @param originalStateCountTotal The original state count total.
- * @return true if proportions are withing expected limits
- */
- FinderPatternFinder.prototype.crossCheckDiagonal = function (startI /*int*/, centerJ /*int*/, maxCount /*int*/, originalStateCountTotal /*int*/) {
- var stateCount = this.getCrossCheckStateCount();
- // Start counting up, left from center finding black center mass
- var i = 0;
- var image = this.image;
- while (startI >= i && centerJ >= i && image.get(centerJ - i, startI - i)) {
- stateCount[2]++;
- i++;
- }
- if (startI < i || centerJ < i) {
- return false;
- }
- // Continue up, left finding white space
- while (startI >= i && centerJ >= i && !image.get(centerJ - i, startI - i) && stateCount[1] <= maxCount) {
- stateCount[1]++;
- i++;
- }
- // If already too many modules in this state or ran off the edge:
- if (startI < i || centerJ < i || stateCount[1] > maxCount) {
- return false;
- }
- // Continue up, left finding black border
- while (startI >= i && centerJ >= i && image.get(centerJ - i, startI - i) && stateCount[0] <= maxCount) {
- stateCount[0]++;
- i++;
- }
- if (stateCount[0] > maxCount) {
- return false;
- }
- var maxI = image.getHeight();
- var maxJ = image.getWidth();
- // Now also count down, right from center
- i = 1;
- while (startI + i < maxI && centerJ + i < maxJ && image.get(centerJ + i, startI + i)) {
- stateCount[2]++;
- i++;
- }
- // Ran off the edge?
- if (startI + i >= maxI || centerJ + i >= maxJ) {
- return false;
- }
- while (startI + i < maxI && centerJ + i < maxJ && !image.get(centerJ + i, startI + i) && stateCount[3] < maxCount) {
- stateCount[3]++;
- i++;
- }
- if (startI + i >= maxI || centerJ + i >= maxJ || stateCount[3] >= maxCount) {
- return false;
- }
- while (startI + i < maxI && centerJ + i < maxJ && image.get(centerJ + i, startI + i) && stateCount[4] < maxCount) {
- stateCount[4]++;
- i++;
- }
- if (stateCount[4] >= maxCount) {
- return false;
- }
- // If we found a finder-pattern-like section, but its size is more than 100% different than
- // the original, assume it's a false positive
- var stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4];
- return Math.abs(stateCountTotal - originalStateCountTotal) < 2 * originalStateCountTotal && FinderPatternFinder.foundPatternCross(stateCount);
- };
- /**
- * <p>After a horizontal scan finds a potential finder pattern, this method
- * "cross-checks" by scanning down vertically through the center of the possible
- * finder pattern to see if the same proportion is detected.</p>
- *
- * @param startI row where a finder pattern was detected
- * @param centerJ center of the section that appears to cross a finder pattern
- * @param maxCount maximum reasonable number of modules that should be
- * observed in any reading state, based on the results of the horizontal scan
- * @return vertical center of finder pattern, or {@link Float#NaN} if not found
- */
- FinderPatternFinder.prototype.crossCheckVertical = function (startI /*int*/, centerJ /*int*/, maxCount /*int*/, originalStateCountTotal /*int*/) {
- var image = this.image;
- var maxI = image.getHeight();
- var stateCount = this.getCrossCheckStateCount();
- // Start counting up from center
- var i = startI;
- while (i >= 0 && image.get(centerJ, i)) {
- stateCount[2]++;
- i--;
- }
- if (i < 0) {
- return NaN;
- }
- while (i >= 0 && !image.get(centerJ, i) && stateCount[1] <= maxCount) {
- stateCount[1]++;
- i--;
- }
- // If already too many modules in this state or ran off the edge:
- if (i < 0 || stateCount[1] > maxCount) {
- return NaN;
- }
- while (i >= 0 && image.get(centerJ, i) && stateCount[0] <= maxCount) {
- stateCount[0]++;
- i--;
- }
- if (stateCount[0] > maxCount) {
- return NaN;
- }
- // Now also count down from center
- i = startI + 1;
- while (i < maxI && image.get(centerJ, i)) {
- stateCount[2]++;
- i++;
- }
- if (i === maxI) {
- return NaN;
- }
- while (i < maxI && !image.get(centerJ, i) && stateCount[3] < maxCount) {
- stateCount[3]++;
- i++;
- }
- if (i === maxI || stateCount[3] >= maxCount) {
- return NaN;
- }
- while (i < maxI && image.get(centerJ, i) && stateCount[4] < maxCount) {
- stateCount[4]++;
- i++;
- }
- if (stateCount[4] >= maxCount) {
- return NaN;
- }
- // If we found a finder-pattern-like section, but its size is more than 40% different than
- // the original, assume it's a false positive
- var stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4];
- if (5 * Math.abs(stateCountTotal - originalStateCountTotal) >= 2 * originalStateCountTotal) {
- return NaN;
- }
- return FinderPatternFinder.foundPatternCross(stateCount) ? FinderPatternFinder.centerFromEnd(stateCount, i) : NaN;
- };
- /**
- * <p>Like {@link #crossCheckVertical(int, int, int, int)}, and in fact is basically identical,
- * except it reads horizontally instead of vertically. This is used to cross-cross
- * check a vertical cross check and locate the real center of the alignment pattern.</p>
- */
- FinderPatternFinder.prototype.crossCheckHorizontal = function (startJ /*int*/, centerI /*int*/, maxCount /*int*/, originalStateCountTotal /*int*/) {
- var image = this.image;
- var maxJ = image.getWidth();
- var stateCount = this.getCrossCheckStateCount();
- var j = startJ;
- while (j >= 0 && image.get(j, centerI)) {
- stateCount[2]++;
- j--;
- }
- if (j < 0) {
- return NaN;
- }
- while (j >= 0 && !image.get(j, centerI) && stateCount[1] <= maxCount) {
- stateCount[1]++;
- j--;
- }
- if (j < 0 || stateCount[1] > maxCount) {
- return NaN;
- }
- while (j >= 0 && image.get(j, centerI) && stateCount[0] <= maxCount) {
- stateCount[0]++;
- j--;
- }
- if (stateCount[0] > maxCount) {
- return NaN;
- }
- j = startJ + 1;
- while (j < maxJ && image.get(j, centerI)) {
- stateCount[2]++;
- j++;
- }
- if (j === maxJ) {
- return NaN;
- }
- while (j < maxJ && !image.get(j, centerI) && stateCount[3] < maxCount) {
- stateCount[3]++;
- j++;
- }
- if (j === maxJ || stateCount[3] >= maxCount) {
- return NaN;
- }
- while (j < maxJ && image.get(j, centerI) && stateCount[4] < maxCount) {
- stateCount[4]++;
- j++;
- }
- if (stateCount[4] >= maxCount) {
- return NaN;
- }
- // If we found a finder-pattern-like section, but its size is significantly different than
- // the original, assume it's a false positive
- var stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4];
- if (5 * Math.abs(stateCountTotal - originalStateCountTotal) >= originalStateCountTotal) {
- return NaN;
- }
- return FinderPatternFinder.foundPatternCross(stateCount) ? FinderPatternFinder.centerFromEnd(stateCount, j) : NaN;
- };
- /**
- * <p>This is called when a horizontal scan finds a possible alignment pattern. It will
- * cross check with a vertical scan, and if successful, will, ah, cross-cross-check
- * with another horizontal scan. This is needed primarily to locate the real horizontal
- * center of the pattern in cases of extreme skew.
- * And then we cross-cross-cross check with another diagonal scan.</p>
- *
- * <p>If that succeeds the finder pattern location is added to a list that tracks
- * the number of times each location has been nearly-matched as a finder pattern.
- * Each additional find is more evidence that the location is in fact a finder
- * pattern center
- *
- * @param stateCount reading state module counts from horizontal scan
- * @param i row where finder pattern may be found
- * @param j end of possible finder pattern in row
- * @param pureBarcode true if in "pure barcode" mode
- * @return true if a finder pattern candidate was found this time
- */
- FinderPatternFinder.prototype.handlePossibleCenter = function (stateCount, i /*int*/, j /*int*/, pureBarcode) {
- var stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4];
- var centerJ = FinderPatternFinder.centerFromEnd(stateCount, j);
- var centerI = this.crossCheckVertical(i, /*(int) */Math.floor(centerJ), stateCount[2], stateCountTotal);
- if (!isNaN(centerI)) {
- // Re-cross check
- centerJ = this.crossCheckHorizontal( /*(int) */Math.floor(centerJ), /*(int) */Math.floor(centerI), stateCount[2], stateCountTotal);
- if (!isNaN(centerJ) && (!pureBarcode || this.crossCheckDiagonal( /*(int) */Math.floor(centerI), /*(int) */Math.floor(centerJ), stateCount[2], stateCountTotal))) {
- var estimatedModuleSize = stateCountTotal / 7.0;
- var found = false;
- var possibleCenters = this.possibleCenters;
- for (var index = 0, length_1 = possibleCenters.length; index < length_1; index++) {
- var center = possibleCenters[index];
- // Look for about the same center and module size:
- if (center.aboutEquals(estimatedModuleSize, centerI, centerJ)) {
- possibleCenters[index] = center.combineEstimate(centerI, centerJ, estimatedModuleSize);
- found = true;
- break;
- }
- }
- if (!found) {
- var point = new _FinderPattern.default(centerJ, centerI, estimatedModuleSize);
- possibleCenters.push(point);
- if (this.resultPointCallback !== null && this.resultPointCallback !== undefined) {
- this.resultPointCallback.foundPossibleResultPoint(point);
- }
- }
- return true;
- }
- }
- return false;
- };
- /**
- * @return number of rows we could safely skip during scanning, based on the first
- * two finder patterns that have been located. In some cases their position will
- * allow us to infer that the third pattern must lie below a certain point farther
- * down in the image.
- */
- FinderPatternFinder.prototype.findRowSkip = function () {
- var e_1, _a;
- var max = this.possibleCenters.length;
- if (max <= 1) {
- return 0;
- }
- var firstConfirmedCenter = null;
- try {
- for (var _b = __values(this.possibleCenters), _c = _b.next(); !_c.done; _c = _b.next()) {
- var center = _c.value;
- if (center.getCount() >= FinderPatternFinder.CENTER_QUORUM) {
- if (firstConfirmedCenter == null) {
- firstConfirmedCenter = center;
- } else {
- // We have two confirmed centers
- // How far down can we skip before resuming looking for the next
- // pattern? In the worst case, only the difference between the
- // difference in the x / y coordinates of the two centers.
- // This is the case where you find top left last.
- this.hasSkipped = true;
- return (/*(int) */Math.floor((Math.abs(firstConfirmedCenter.getX() - center.getX()) - Math.abs(firstConfirmedCenter.getY() - center.getY())) / 2)
- );
- }
- }
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- return 0;
- };
- /**
- * @return true iff we have found at least 3 finder patterns that have been detected
- * at least {@link #CENTER_QUORUM} times each, and, the estimated module size of the
- * candidates is "pretty similar"
- */
- FinderPatternFinder.prototype.haveMultiplyConfirmedCenters = function () {
- var e_2, _a, e_3, _b;
- var confirmedCount = 0;
- var totalModuleSize = 0.0;
- var max = this.possibleCenters.length;
- try {
- for (var _c = __values(this.possibleCenters), _d = _c.next(); !_d.done; _d = _c.next()) {
- var pattern = _d.value;
- if (pattern.getCount() >= FinderPatternFinder.CENTER_QUORUM) {
- confirmedCount++;
- totalModuleSize += pattern.getEstimatedModuleSize();
- }
- }
- } catch (e_2_1) {
- e_2 = {
- error: e_2_1
- };
- } finally {
- try {
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
- } finally {
- if (e_2) throw e_2.error;
- }
- }
- if (confirmedCount < 3) {
- return false;
- }
- // OK, we have at least 3 confirmed centers, but, it's possible that one is a "false positive"
- // and that we need to keep looking. We detect this by asking if the estimated module sizes
- // vary too much. We arbitrarily say that when the total deviation from average exceeds
- // 5% of the total module size estimates, it's too much.
- var average = totalModuleSize / max;
- var totalDeviation = 0.0;
- try {
- for (var _e = __values(this.possibleCenters), _f = _e.next(); !_f.done; _f = _e.next()) {
- var pattern = _f.value;
- totalDeviation += Math.abs(pattern.getEstimatedModuleSize() - average);
- }
- } catch (e_3_1) {
- e_3 = {
- error: e_3_1
- };
- } finally {
- try {
- if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
- } finally {
- if (e_3) throw e_3.error;
- }
- }
- return totalDeviation <= 0.05 * totalModuleSize;
- };
- /**
- * @return the 3 best {@link FinderPattern}s from our list of candidates. The "best" are
- * those that have been detected at least {@link #CENTER_QUORUM} times, and whose module
- * size differs from the average among those patterns the least
- * @throws NotFoundException if 3 such finder patterns do not exist
- */
- FinderPatternFinder.prototype.selectBestPatterns = function () {
- var e_4, _a, e_5, _b;
- var startSize = this.possibleCenters.length;
- if (startSize < 3) {
- // Couldn't find enough finder patterns
- throw new _NotFoundException.default();
- }
- var possibleCenters = this.possibleCenters;
- var average;
- // Filter outlier possibilities whose module size is too different
- if (startSize > 3) {
- // But we can only afford to do so if we have at least 4 possibilities to choose from
- var totalModuleSize = 0.0;
- var square = 0.0;
- try {
- for (var _c = __values(this.possibleCenters), _d = _c.next(); !_d.done; _d = _c.next()) {
- var center = _d.value;
- var size = center.getEstimatedModuleSize();
- totalModuleSize += size;
- square += size * size;
- }
- } catch (e_4_1) {
- e_4 = {
- error: e_4_1
- };
- } finally {
- try {
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
- } finally {
- if (e_4) throw e_4.error;
- }
- }
- average = totalModuleSize / startSize;
- var stdDev = Math.sqrt(square / startSize - average * average);
- possibleCenters.sort(
- /**
- * <p>Orders by furthest from average</p>
- */
- // FurthestFromAverageComparator implements Comparator<FinderPattern>
- function (center1, center2) {
- var dA = Math.abs(center2.getEstimatedModuleSize() - average);
- var dB = Math.abs(center1.getEstimatedModuleSize() - average);
- return dA < dB ? -1 : dA > dB ? 1 : 0;
- });
- var limit = Math.max(0.2 * average, stdDev);
- for (var i = 0; i < possibleCenters.length && possibleCenters.length > 3; i++) {
- var pattern = possibleCenters[i];
- if (Math.abs(pattern.getEstimatedModuleSize() - average) > limit) {
- possibleCenters.splice(i, 1);
- i--;
- }
- }
- }
- if (possibleCenters.length > 3) {
- // Throw away all but those first size candidate points we found.
- var totalModuleSize = 0.0;
- try {
- for (var possibleCenters_1 = __values(possibleCenters), possibleCenters_1_1 = possibleCenters_1.next(); !possibleCenters_1_1.done; possibleCenters_1_1 = possibleCenters_1.next()) {
- var possibleCenter = possibleCenters_1_1.value;
- totalModuleSize += possibleCenter.getEstimatedModuleSize();
- }
- } catch (e_5_1) {
- e_5 = {
- error: e_5_1
- };
- } finally {
- try {
- if (possibleCenters_1_1 && !possibleCenters_1_1.done && (_b = possibleCenters_1.return)) _b.call(possibleCenters_1);
- } finally {
- if (e_5) throw e_5.error;
- }
- }
- average = totalModuleSize / possibleCenters.length;
- possibleCenters.sort(
- /**
- * <p>Orders by {@link FinderPattern#getCount()}, descending.</p>
- */
- // CenterComparator implements Comparator<FinderPattern>
- function (center1, center2) {
- if (center2.getCount() === center1.getCount()) {
- var dA = Math.abs(center2.getEstimatedModuleSize() - average);
- var dB = Math.abs(center1.getEstimatedModuleSize() - average);
- return dA < dB ? 1 : dA > dB ? -1 : 0;
- } else {
- return center2.getCount() - center1.getCount();
- }
- });
- possibleCenters.splice(3); // this is not realy necessary as we only return first 3 anyway
- }
- return [possibleCenters[0], possibleCenters[1], possibleCenters[2]];
- };
- FinderPatternFinder.CENTER_QUORUM = 2;
- FinderPatternFinder.MIN_SKIP = 3; // 1 pixel/module times 3 modules/center
- FinderPatternFinder.MAX_MODULES = 57; // support up to version 10 for mobile clients
- return FinderPatternFinder;
- }();
- var _default = FinderPatternFinder;
- exports.default = _default;
- /***/ }),
- /* 431 */
- /*!*************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/detector/FinderPattern.js ***!
- \*************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../../ResultPoint */ 346));
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /*namespace com.google.zxing.qrcode.detector {*/
- /**
- * <p>Encapsulates a finder pattern, which are the three square patterns found in
- * the corners of QR Codes. It also encapsulates a count of similar finder patterns,
- * as a convenience to the finder's bookkeeping.</p>
- *
- * @author Sean Owen
- */
- var FinderPattern = /** @class */function (_super) {
- __extends(FinderPattern, _super);
- // FinderPattern(posX: number/*float*/, posY: number/*float*/, estimatedModuleSize: number/*float*/) {
- // this(posX, posY, estimatedModuleSize, 1)
- // }
- function FinderPattern(posX /*float*/, posY /*float*/, estimatedModuleSize /*float*/, count /*int*/) {
- var _this = _super.call(this, posX, posY) || this;
- _this.estimatedModuleSize = estimatedModuleSize;
- _this.count = count;
- if (undefined === count) {
- _this.count = 1;
- }
- return _this;
- }
- FinderPattern.prototype.getEstimatedModuleSize = function () {
- return this.estimatedModuleSize;
- };
- FinderPattern.prototype.getCount = function () {
- return this.count;
- };
- /*
- void incrementCount() {
- this.count++
- }
- */
- /**
- * <p>Determines if this finder pattern "about equals" a finder pattern at the stated
- * position and size -- meaning, it is at nearly the same center with nearly the same size.</p>
- */
- FinderPattern.prototype.aboutEquals = function (moduleSize /*float*/, i /*float*/, j /*float*/) {
- if (Math.abs(i - this.getY()) <= moduleSize && Math.abs(j - this.getX()) <= moduleSize) {
- var moduleSizeDiff = Math.abs(moduleSize - this.estimatedModuleSize);
- return moduleSizeDiff <= 1.0 || moduleSizeDiff <= this.estimatedModuleSize;
- }
- return false;
- };
- /**
- * Combines this object's current estimate of a finder pattern position and module size
- * with a new estimate. It returns a new {@code FinderPattern} containing a weighted average
- * based on count.
- */
- FinderPattern.prototype.combineEstimate = function (i /*float*/, j /*float*/, newModuleSize /*float*/) {
- var combinedCount = this.count + 1;
- var combinedX = (this.count * this.getX() + j) / combinedCount;
- var combinedY = (this.count * this.getY() + i) / combinedCount;
- var combinedModuleSize = (this.count * this.estimatedModuleSize + newModuleSize) / combinedCount;
- return new FinderPattern(combinedX, combinedY, combinedModuleSize, combinedCount);
- };
- return FinderPattern;
- }(_ResultPoint.default);
- var _default = FinderPattern;
- exports.default = _default;
- /***/ }),
- /* 432 */
- /*!*****************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/detector/FinderPatternInfo.js ***!
- \*****************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /**
- * <p>Encapsulates information about finder patterns in an image, including the location of
- * the three finder patterns, and their estimated module size.</p>
- *
- * @author Sean Owen
- */
- var FinderPatternInfo = /** @class */function () {
- function FinderPatternInfo(patternCenters) {
- this.bottomLeft = patternCenters[0];
- this.topLeft = patternCenters[1];
- this.topRight = patternCenters[2];
- }
- FinderPatternInfo.prototype.getBottomLeft = function () {
- return this.bottomLeft;
- };
- FinderPatternInfo.prototype.getTopLeft = function () {
- return this.topLeft;
- };
- FinderPatternInfo.prototype.getTopRight = function () {
- return this.topRight;
- };
- return FinderPatternInfo;
- }();
- var _default = FinderPatternInfo;
- exports.default = _default;
- /***/ }),
- /* 433 */
- /*!***************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/PDF417Reader.js ***!
- \***************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
- var _ChecksumException = _interopRequireDefault(__webpack_require__(/*! ../ChecksumException */ 309));
- var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../FormatException */ 324));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
- var _Result = _interopRequireDefault(__webpack_require__(/*! ../Result */ 333));
- var _PDF417Common = _interopRequireDefault(__webpack_require__(/*! ./PDF417Common */ 434));
- var _Integer = _interopRequireDefault(__webpack_require__(/*! ../util/Integer */ 318));
- var _ResultMetadataType = _interopRequireDefault(__webpack_require__(/*! ../ResultMetadataType */ 335));
- var _Detector = _interopRequireDefault(__webpack_require__(/*! ./detector/Detector */ 435));
- var _PDF417ScanningDecoder = _interopRequireDefault(__webpack_require__(/*! ./decoder/PDF417ScanningDecoder */ 437));
- /*
- * Copyright 2009 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- // package com.google.zxing.pdf417;
- // import com.google.zxing.BarcodeFormat;
- // import java.util.ArrayList;
- // import java.util.List;
- // import java.util.Map;
- /**
- * This implementation can detect and decode PDF417 codes in an image.
- *
- * @author Guenther Grau
- */
- var PDF417Reader = /** @class */function () {
- function PDF417Reader() {}
- // private static /*final Result[]*/ EMPTY_RESULT_ARRAY: Result[] = new Result([0]);
- /**
- * Locates and decodes a PDF417 code in an image.
- *
- * @return a String representing the content encoded by the PDF417 code
- * @throws NotFoundException if a PDF417 code cannot be found,
- * @throws FormatException if a PDF417 cannot be decoded
- * @throws ChecksumException
- */
- // @Override
- PDF417Reader.prototype.decode = function (image, hints) {
- if (hints === void 0) {
- hints = null;
- }
- var result = PDF417Reader.decode(image, hints, false);
- if (result == null || result.length === 0 || result[0] == null) {
- throw _NotFoundException.default.getNotFoundInstance();
- }
- return result[0];
- };
- /**
- *
- * @param BinaryBitmap
- * @param image
- * @throws NotFoundException
- */
- // @Override
- PDF417Reader.prototype.decodeMultiple = function (image, hints) {
- if (hints === void 0) {
- hints = null;
- }
- try {
- return PDF417Reader.decode(image, hints, true);
- } catch (ignored) {
- if (ignored instanceof _FormatException.default || ignored instanceof _ChecksumException.default) {
- throw _NotFoundException.default.getNotFoundInstance();
- }
- throw ignored;
- }
- };
- /**
- *
- * @param image
- * @param hints
- * @param multiple
- *
- * @throws NotFoundException
- * @throws FormatExceptionß
- * @throws ChecksumException
- */
- PDF417Reader.decode = function (image, hints, multiple) {
- var e_1, _a;
- var results = new Array();
- var detectorResult = _Detector.default.detectMultiple(image, hints, multiple);
- try {
- for (var _b = __values(detectorResult.getPoints()), _c = _b.next(); !_c.done; _c = _b.next()) {
- var points = _c.value;
- var decoderResult = _PDF417ScanningDecoder.default.decode(detectorResult.getBits(), points[4], points[5], points[6], points[7], PDF417Reader.getMinCodewordWidth(points), PDF417Reader.getMaxCodewordWidth(points));
- var result = new _Result.default(decoderResult.getText(), decoderResult.getRawBytes(), undefined, points, _BarcodeFormat.default.PDF_417);
- result.putMetadata(_ResultMetadataType.default.ERROR_CORRECTION_LEVEL, decoderResult.getECLevel());
- var pdf417ResultMetadata = decoderResult.getOther();
- if (pdf417ResultMetadata != null) {
- result.putMetadata(_ResultMetadataType.default.PDF417_EXTRA_METADATA, pdf417ResultMetadata);
- }
- results.push(result);
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- return results.map(function (x) {
- return x;
- });
- };
- PDF417Reader.getMaxWidth = function (p1, p2) {
- if (p1 == null || p2 == null) {
- return 0;
- }
- return Math.trunc(Math.abs(p1.getX() - p2.getX()));
- };
- PDF417Reader.getMinWidth = function (p1, p2) {
- if (p1 == null || p2 == null) {
- return _Integer.default.MAX_VALUE;
- }
- return Math.trunc(Math.abs(p1.getX() - p2.getX()));
- };
- PDF417Reader.getMaxCodewordWidth = function (p) {
- return Math.floor(Math.max(Math.max(PDF417Reader.getMaxWidth(p[0], p[4]), PDF417Reader.getMaxWidth(p[6], p[2]) * _PDF417Common.default.MODULES_IN_CODEWORD / _PDF417Common.default.MODULES_IN_STOP_PATTERN), Math.max(PDF417Reader.getMaxWidth(p[1], p[5]), PDF417Reader.getMaxWidth(p[7], p[3]) * _PDF417Common.default.MODULES_IN_CODEWORD / _PDF417Common.default.MODULES_IN_STOP_PATTERN)));
- };
- PDF417Reader.getMinCodewordWidth = function (p) {
- return Math.floor(Math.min(Math.min(PDF417Reader.getMinWidth(p[0], p[4]), PDF417Reader.getMinWidth(p[6], p[2]) * _PDF417Common.default.MODULES_IN_CODEWORD / _PDF417Common.default.MODULES_IN_STOP_PATTERN), Math.min(PDF417Reader.getMinWidth(p[1], p[5]), PDF417Reader.getMinWidth(p[7], p[3]) * _PDF417Common.default.MODULES_IN_CODEWORD / _PDF417Common.default.MODULES_IN_STOP_PATTERN)));
- };
- // @Override
- PDF417Reader.prototype.reset = function () {
- // nothing needs to be reset
- };
- return PDF417Reader;
- }();
- var _default = PDF417Reader;
- exports.default = _default;
- /***/ }),
- /* 434 */
- /*!***************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/PDF417Common.js ***!
- \***************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _Arrays = _interopRequireDefault(__webpack_require__(/*! ../util/Arrays */ 314));
- var _MathUtils = _interopRequireDefault(__webpack_require__(/*! ../common/detector/MathUtils */ 347));
- /*
- * Copyright 2009 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- // package com.google.zxing.pdf417;
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- // import java.util.Arrays;
- /**
- * @author SITA Lab (kevin.osullivan@sita.aero)
- * @author Guenther Grau
- */
- var PDF417Common = /** @class */function () {
- function PDF417Common() {}
- PDF417Common.prototype.PDF417Common = function () {};
- /**
- * @param moduleBitCount values to sum
- * @return sum of values
- * @deprecated call {@link MathUtils#sum(int[])}
- */
- // @Deprecated
- PDF417Common.getBitCountSum = function (moduleBitCount) {
- return _MathUtils.default.sum(moduleBitCount);
- };
- PDF417Common.toIntArray = function (list) {
- var e_1, _a;
- if (list == null || !list.length) {
- return PDF417Common.EMPTY_INT_ARRAY;
- }
- var result = new Int32Array(list.length);
- var i = 0;
- try {
- for (var list_1 = __values(list), list_1_1 = list_1.next(); !list_1_1.done; list_1_1 = list_1.next()) {
- var integer = list_1_1.value;
- result[i++] = integer;
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (list_1_1 && !list_1_1.done && (_a = list_1.return)) _a.call(list_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- return result;
- };
- /**
- * @param symbol encoded symbol to translate to a codeword
- * @return the codeword corresponding to the symbol.
- */
- PDF417Common.getCodeword = function (symbol /*int*/) {
- var i = _Arrays.default.binarySearch(PDF417Common.SYMBOL_TABLE, symbol & 0x3FFFF);
- if (i < 0) {
- return -1;
- }
- return (PDF417Common.CODEWORD_TABLE[i] - 1) % PDF417Common.NUMBER_OF_CODEWORDS;
- };
- PDF417Common.NUMBER_OF_CODEWORDS = 929;
- // Maximum Codewords (Data + Error).
- PDF417Common.MAX_CODEWORDS_IN_BARCODE = PDF417Common.NUMBER_OF_CODEWORDS - 1;
- PDF417Common.MIN_ROWS_IN_BARCODE = 3;
- PDF417Common.MAX_ROWS_IN_BARCODE = 90;
- // One left row indication column + max 30 data columns + one right row indicator column
- // public static /*final*/ MAX_CODEWORDS_IN_ROW: /*int*/ number = 32;
- PDF417Common.MODULES_IN_CODEWORD = 17;
- PDF417Common.MODULES_IN_STOP_PATTERN = 18;
- PDF417Common.BARS_IN_MODULE = 8;
- PDF417Common.EMPTY_INT_ARRAY = new Int32Array([]);
- /**
- * The sorted table of all possible symbols. Extracted from the PDF417
- * specification. The index of a symbol in this table corresponds to the
- * index into the codeword table.
- */
- PDF417Common.SYMBOL_TABLE = Int32Array.from([0x1025e, 0x1027a, 0x1029e, 0x102bc, 0x102f2, 0x102f4, 0x1032e, 0x1034e, 0x1035c, 0x10396, 0x103a6, 0x103ac, 0x10422, 0x10428, 0x10436, 0x10442, 0x10444, 0x10448, 0x10450, 0x1045e, 0x10466, 0x1046c, 0x1047a, 0x10482, 0x1049e, 0x104a0, 0x104bc, 0x104c6, 0x104d8, 0x104ee, 0x104f2, 0x104f4, 0x10504, 0x10508, 0x10510, 0x1051e, 0x10520, 0x1053c, 0x10540, 0x10578, 0x10586, 0x1058c, 0x10598, 0x105b0, 0x105be, 0x105ce, 0x105dc, 0x105e2, 0x105e4, 0x105e8, 0x105f6, 0x1062e, 0x1064e, 0x1065c, 0x1068e, 0x1069c, 0x106b8, 0x106de, 0x106fa, 0x10716, 0x10726, 0x1072c, 0x10746, 0x1074c, 0x10758, 0x1076e, 0x10792, 0x10794, 0x107a2, 0x107a4, 0x107a8, 0x107b6, 0x10822, 0x10828, 0x10842, 0x10848, 0x10850, 0x1085e, 0x10866, 0x1086c, 0x1087a, 0x10882, 0x10884, 0x10890, 0x1089e, 0x108a0, 0x108bc, 0x108c6, 0x108cc, 0x108d8, 0x108ee, 0x108f2, 0x108f4, 0x10902, 0x10908, 0x1091e, 0x10920, 0x1093c, 0x10940, 0x10978, 0x10986, 0x10998, 0x109b0, 0x109be, 0x109ce, 0x109dc, 0x109e2, 0x109e4, 0x109e8, 0x109f6, 0x10a08, 0x10a10, 0x10a1e, 0x10a20, 0x10a3c, 0x10a40, 0x10a78, 0x10af0, 0x10b06, 0x10b0c, 0x10b18, 0x10b30, 0x10b3e, 0x10b60, 0x10b7c, 0x10b8e, 0x10b9c, 0x10bb8, 0x10bc2, 0x10bc4, 0x10bc8, 0x10bd0, 0x10bde, 0x10be6, 0x10bec, 0x10c2e, 0x10c4e, 0x10c5c, 0x10c62, 0x10c64, 0x10c68, 0x10c76, 0x10c8e, 0x10c9c, 0x10cb8, 0x10cc2, 0x10cc4, 0x10cc8, 0x10cd0, 0x10cde, 0x10ce6, 0x10cec, 0x10cfa, 0x10d0e, 0x10d1c, 0x10d38, 0x10d70, 0x10d7e, 0x10d82, 0x10d84, 0x10d88, 0x10d90, 0x10d9e, 0x10da0, 0x10dbc, 0x10dc6, 0x10dcc, 0x10dd8, 0x10dee, 0x10df2, 0x10df4, 0x10e16, 0x10e26, 0x10e2c, 0x10e46, 0x10e58, 0x10e6e, 0x10e86, 0x10e8c, 0x10e98, 0x10eb0, 0x10ebe, 0x10ece, 0x10edc, 0x10f0a, 0x10f12, 0x10f14, 0x10f22, 0x10f28, 0x10f36, 0x10f42, 0x10f44, 0x10f48, 0x10f50, 0x10f5e, 0x10f66, 0x10f6c, 0x10fb2, 0x10fb4, 0x11022, 0x11028, 0x11042, 0x11048, 0x11050, 0x1105e, 0x1107a, 0x11082, 0x11084, 0x11090, 0x1109e, 0x110a0, 0x110bc, 0x110c6, 0x110cc, 0x110d8, 0x110ee, 0x110f2, 0x110f4, 0x11102, 0x1111e, 0x11120, 0x1113c, 0x11140, 0x11178, 0x11186, 0x11198, 0x111b0, 0x111be, 0x111ce, 0x111dc, 0x111e2, 0x111e4, 0x111e8, 0x111f6, 0x11208, 0x1121e, 0x11220, 0x11278, 0x112f0, 0x1130c, 0x11330, 0x1133e, 0x11360, 0x1137c, 0x1138e, 0x1139c, 0x113b8, 0x113c2, 0x113c8, 0x113d0, 0x113de, 0x113e6, 0x113ec, 0x11408, 0x11410, 0x1141e, 0x11420, 0x1143c, 0x11440, 0x11478, 0x114f0, 0x115e0, 0x1160c, 0x11618, 0x11630, 0x1163e, 0x11660, 0x1167c, 0x116c0, 0x116f8, 0x1171c, 0x11738, 0x11770, 0x1177e, 0x11782, 0x11784, 0x11788, 0x11790, 0x1179e, 0x117a0, 0x117bc, 0x117c6, 0x117cc, 0x117d8, 0x117ee, 0x1182e, 0x11834, 0x1184e, 0x1185c, 0x11862, 0x11864, 0x11868, 0x11876, 0x1188e, 0x1189c, 0x118b8, 0x118c2, 0x118c8, 0x118d0, 0x118de, 0x118e6, 0x118ec, 0x118fa, 0x1190e, 0x1191c, 0x11938, 0x11970, 0x1197e, 0x11982, 0x11984, 0x11990, 0x1199e, 0x119a0, 0x119bc, 0x119c6, 0x119cc, 0x119d8, 0x119ee, 0x119f2, 0x119f4, 0x11a0e, 0x11a1c, 0x11a38, 0x11a70, 0x11a7e, 0x11ae0, 0x11afc, 0x11b08, 0x11b10, 0x11b1e, 0x11b20, 0x11b3c, 0x11b40, 0x11b78, 0x11b8c, 0x11b98, 0x11bb0, 0x11bbe, 0x11bce, 0x11bdc, 0x11be2, 0x11be4, 0x11be8, 0x11bf6, 0x11c16, 0x11c26, 0x11c2c, 0x11c46, 0x11c4c, 0x11c58, 0x11c6e, 0x11c86, 0x11c98, 0x11cb0, 0x11cbe, 0x11cce, 0x11cdc, 0x11ce2, 0x11ce4, 0x11ce8, 0x11cf6, 0x11d06, 0x11d0c, 0x11d18, 0x11d30, 0x11d3e, 0x11d60, 0x11d7c, 0x11d8e, 0x11d9c, 0x11db8, 0x11dc4, 0x11dc8, 0x11dd0, 0x11dde, 0x11de6, 0x11dec, 0x11dfa, 0x11e0a, 0x11e12, 0x11e14, 0x11e22, 0x11e24, 0x11e28, 0x11e36, 0x11e42, 0x11e44, 0x11e50, 0x11e5e, 0x11e66, 0x11e6c, 0x11e82, 0x11e84, 0x11e88, 0x11e90, 0x11e9e, 0x11ea0, 0x11ebc, 0x11ec6, 0x11ecc, 0x11ed8, 0x11eee, 0x11f1a, 0x11f2e, 0x11f32, 0x11f34, 0x11f4e, 0x11f5c, 0x11f62, 0x11f64, 0x11f68, 0x11f76, 0x12048, 0x1205e, 0x12082, 0x12084, 0x12090, 0x1209e, 0x120a0, 0x120bc, 0x120d8, 0x120f2, 0x120f4, 0x12108, 0x1211e, 0x12120, 0x1213c, 0x12140, 0x12178, 0x12186, 0x12198, 0x121b0, 0x121be, 0x121e2, 0x121e4, 0x121e8, 0x121f6, 0x12204, 0x12210, 0x1221e, 0x12220, 0x12278, 0x122f0, 0x12306, 0x1230c, 0x12330, 0x1233e, 0x12360, 0x1237c, 0x1238e, 0x1239c, 0x123b8, 0x123c2, 0x123c8, 0x123d0, 0x123e6, 0x123ec, 0x1241e, 0x12420, 0x1243c, 0x124f0, 0x125e0, 0x12618, 0x1263e, 0x12660, 0x1267c, 0x126c0, 0x126f8, 0x12738, 0x12770, 0x1277e, 0x12782, 0x12784, 0x12790, 0x1279e, 0x127a0, 0x127bc, 0x127c6, 0x127cc, 0x127d8, 0x127ee, 0x12820, 0x1283c, 0x12840, 0x12878, 0x128f0, 0x129e0, 0x12bc0, 0x12c18, 0x12c30, 0x12c3e, 0x12c60, 0x12c7c, 0x12cc0, 0x12cf8, 0x12df0, 0x12e1c, 0x12e38, 0x12e70, 0x12e7e, 0x12ee0, 0x12efc, 0x12f04, 0x12f08, 0x12f10, 0x12f20, 0x12f3c, 0x12f40, 0x12f78, 0x12f86, 0x12f8c, 0x12f98, 0x12fb0, 0x12fbe, 0x12fce, 0x12fdc, 0x1302e, 0x1304e, 0x1305c, 0x13062, 0x13068, 0x1308e, 0x1309c, 0x130b8, 0x130c2, 0x130c8, 0x130d0, 0x130de, 0x130ec, 0x130fa, 0x1310e, 0x13138, 0x13170, 0x1317e, 0x13182, 0x13184, 0x13190, 0x1319e, 0x131a0, 0x131bc, 0x131c6, 0x131cc, 0x131d8, 0x131f2, 0x131f4, 0x1320e, 0x1321c, 0x13270, 0x1327e, 0x132e0, 0x132fc, 0x13308, 0x1331e, 0x13320, 0x1333c, 0x13340, 0x13378, 0x13386, 0x13398, 0x133b0, 0x133be, 0x133ce, 0x133dc, 0x133e2, 0x133e4, 0x133e8, 0x133f6, 0x1340e, 0x1341c, 0x13438, 0x13470, 0x1347e, 0x134e0, 0x134fc, 0x135c0, 0x135f8, 0x13608, 0x13610, 0x1361e, 0x13620, 0x1363c, 0x13640, 0x13678, 0x136f0, 0x1370c, 0x13718, 0x13730, 0x1373e, 0x13760, 0x1377c, 0x1379c, 0x137b8, 0x137c2, 0x137c4, 0x137c8, 0x137d0, 0x137de, 0x137e6, 0x137ec, 0x13816, 0x13826, 0x1382c, 0x13846, 0x1384c, 0x13858, 0x1386e, 0x13874, 0x13886, 0x13898, 0x138b0, 0x138be, 0x138ce, 0x138dc, 0x138e2, 0x138e4, 0x138e8, 0x13906, 0x1390c, 0x13930, 0x1393e, 0x13960, 0x1397c, 0x1398e, 0x1399c, 0x139b8, 0x139c8, 0x139d0, 0x139de, 0x139e6, 0x139ec, 0x139fa, 0x13a06, 0x13a0c, 0x13a18, 0x13a30, 0x13a3e, 0x13a60, 0x13a7c, 0x13ac0, 0x13af8, 0x13b0e, 0x13b1c, 0x13b38, 0x13b70, 0x13b7e, 0x13b88, 0x13b90, 0x13b9e, 0x13ba0, 0x13bbc, 0x13bcc, 0x13bd8, 0x13bee, 0x13bf2, 0x13bf4, 0x13c12, 0x13c14, 0x13c22, 0x13c24, 0x13c28, 0x13c36, 0x13c42, 0x13c48, 0x13c50, 0x13c5e, 0x13c66, 0x13c6c, 0x13c82, 0x13c84, 0x13c90, 0x13c9e, 0x13ca0, 0x13cbc, 0x13cc6, 0x13ccc, 0x13cd8, 0x13cee, 0x13d02, 0x13d04, 0x13d08, 0x13d10, 0x13d1e, 0x13d20, 0x13d3c, 0x13d40, 0x13d78, 0x13d86, 0x13d8c, 0x13d98, 0x13db0, 0x13dbe, 0x13dce, 0x13ddc, 0x13de4, 0x13de8, 0x13df6, 0x13e1a, 0x13e2e, 0x13e32, 0x13e34, 0x13e4e, 0x13e5c, 0x13e62, 0x13e64, 0x13e68, 0x13e76, 0x13e8e, 0x13e9c, 0x13eb8, 0x13ec2, 0x13ec4, 0x13ec8, 0x13ed0, 0x13ede, 0x13ee6, 0x13eec, 0x13f26, 0x13f2c, 0x13f3a, 0x13f46, 0x13f4c, 0x13f58, 0x13f6e, 0x13f72, 0x13f74, 0x14082, 0x1409e, 0x140a0, 0x140bc, 0x14104, 0x14108, 0x14110, 0x1411e, 0x14120, 0x1413c, 0x14140, 0x14178, 0x1418c, 0x14198, 0x141b0, 0x141be, 0x141e2, 0x141e4, 0x141e8, 0x14208, 0x14210, 0x1421e, 0x14220, 0x1423c, 0x14240, 0x14278, 0x142f0, 0x14306, 0x1430c, 0x14318, 0x14330, 0x1433e, 0x14360, 0x1437c, 0x1438e, 0x143c2, 0x143c4, 0x143c8, 0x143d0, 0x143e6, 0x143ec, 0x14408, 0x14410, 0x1441e, 0x14420, 0x1443c, 0x14440, 0x14478, 0x144f0, 0x145e0, 0x1460c, 0x14618, 0x14630, 0x1463e, 0x14660, 0x1467c, 0x146c0, 0x146f8, 0x1471c, 0x14738, 0x14770, 0x1477e, 0x14782, 0x14784, 0x14788, 0x14790, 0x147a0, 0x147bc, 0x147c6, 0x147cc, 0x147d8, 0x147ee, 0x14810, 0x14820, 0x1483c, 0x14840, 0x14878, 0x148f0, 0x149e0, 0x14bc0, 0x14c30, 0x14c3e, 0x14c60, 0x14c7c, 0x14cc0, 0x14cf8, 0x14df0, 0x14e38, 0x14e70, 0x14e7e, 0x14ee0, 0x14efc, 0x14f04, 0x14f08, 0x14f10, 0x14f1e, 0x14f20, 0x14f3c, 0x14f40, 0x14f78, 0x14f86, 0x14f8c, 0x14f98, 0x14fb0, 0x14fce, 0x14fdc, 0x15020, 0x15040, 0x15078, 0x150f0, 0x151e0, 0x153c0, 0x15860, 0x1587c, 0x158c0, 0x158f8, 0x159f0, 0x15be0, 0x15c70, 0x15c7e, 0x15ce0, 0x15cfc, 0x15dc0, 0x15df8, 0x15e08, 0x15e10, 0x15e20, 0x15e40, 0x15e78, 0x15ef0, 0x15f0c, 0x15f18, 0x15f30, 0x15f60, 0x15f7c, 0x15f8e, 0x15f9c, 0x15fb8, 0x1604e, 0x1605c, 0x1608e, 0x1609c, 0x160b8, 0x160c2, 0x160c4, 0x160c8, 0x160de, 0x1610e, 0x1611c, 0x16138, 0x16170, 0x1617e, 0x16184, 0x16188, 0x16190, 0x1619e, 0x161a0, 0x161bc, 0x161c6, 0x161cc, 0x161d8, 0x161f2, 0x161f4, 0x1620e, 0x1621c, 0x16238, 0x16270, 0x1627e, 0x162e0, 0x162fc, 0x16304, 0x16308, 0x16310, 0x1631e, 0x16320, 0x1633c, 0x16340, 0x16378, 0x16386, 0x1638c, 0x16398, 0x163b0, 0x163be, 0x163ce, 0x163dc, 0x163e2, 0x163e4, 0x163e8, 0x163f6, 0x1640e, 0x1641c, 0x16438, 0x16470, 0x1647e, 0x164e0, 0x164fc, 0x165c0, 0x165f8, 0x16610, 0x1661e, 0x16620, 0x1663c, 0x16640, 0x16678, 0x166f0, 0x16718, 0x16730, 0x1673e, 0x16760, 0x1677c, 0x1678e, 0x1679c, 0x167b8, 0x167c2, 0x167c4, 0x167c8, 0x167d0, 0x167de, 0x167e6, 0x167ec, 0x1681c, 0x16838, 0x16870, 0x168e0, 0x168fc, 0x169c0, 0x169f8, 0x16bf0, 0x16c10, 0x16c1e, 0x16c20, 0x16c3c, 0x16c40, 0x16c78, 0x16cf0, 0x16de0, 0x16e18, 0x16e30, 0x16e3e, 0x16e60, 0x16e7c, 0x16ec0, 0x16ef8, 0x16f1c, 0x16f38, 0x16f70, 0x16f7e, 0x16f84, 0x16f88, 0x16f90, 0x16f9e, 0x16fa0, 0x16fbc, 0x16fc6, 0x16fcc, 0x16fd8, 0x17026, 0x1702c, 0x17046, 0x1704c, 0x17058, 0x1706e, 0x17086, 0x1708c, 0x17098, 0x170b0, 0x170be, 0x170ce, 0x170dc, 0x170e8, 0x17106, 0x1710c, 0x17118, 0x17130, 0x1713e, 0x17160, 0x1717c, 0x1718e, 0x1719c, 0x171b8, 0x171c2, 0x171c4, 0x171c8, 0x171d0, 0x171de, 0x171e6, 0x171ec, 0x171fa, 0x17206, 0x1720c, 0x17218, 0x17230, 0x1723e, 0x17260, 0x1727c, 0x172c0, 0x172f8, 0x1730e, 0x1731c, 0x17338, 0x17370, 0x1737e, 0x17388, 0x17390, 0x1739e, 0x173a0, 0x173bc, 0x173cc, 0x173d8, 0x173ee, 0x173f2, 0x173f4, 0x1740c, 0x17418, 0x17430, 0x1743e, 0x17460, 0x1747c, 0x174c0, 0x174f8, 0x175f0, 0x1760e, 0x1761c, 0x17638, 0x17670, 0x1767e, 0x176e0, 0x176fc, 0x17708, 0x17710, 0x1771e, 0x17720, 0x1773c, 0x17740, 0x17778, 0x17798, 0x177b0, 0x177be, 0x177dc, 0x177e2, 0x177e4, 0x177e8, 0x17822, 0x17824, 0x17828, 0x17836, 0x17842, 0x17844, 0x17848, 0x17850, 0x1785e, 0x17866, 0x1786c, 0x17882, 0x17884, 0x17888, 0x17890, 0x1789e, 0x178a0, 0x178bc, 0x178c6, 0x178cc, 0x178d8, 0x178ee, 0x178f2, 0x178f4, 0x17902, 0x17904, 0x17908, 0x17910, 0x1791e, 0x17920, 0x1793c, 0x17940, 0x17978, 0x17986, 0x1798c, 0x17998, 0x179b0, 0x179be, 0x179ce, 0x179dc, 0x179e2, 0x179e4, 0x179e8, 0x179f6, 0x17a04, 0x17a08, 0x17a10, 0x17a1e, 0x17a20, 0x17a3c, 0x17a40, 0x17a78, 0x17af0, 0x17b06, 0x17b0c, 0x17b18, 0x17b30, 0x17b3e, 0x17b60, 0x17b7c, 0x17b8e, 0x17b9c, 0x17bb8, 0x17bc4, 0x17bc8, 0x17bd0, 0x17bde, 0x17be6, 0x17bec, 0x17c2e, 0x17c32, 0x17c34, 0x17c4e, 0x17c5c, 0x17c62, 0x17c64, 0x17c68, 0x17c76, 0x17c8e, 0x17c9c, 0x17cb8, 0x17cc2, 0x17cc4, 0x17cc8, 0x17cd0, 0x17cde, 0x17ce6, 0x17cec, 0x17d0e, 0x17d1c, 0x17d38, 0x17d70, 0x17d82, 0x17d84, 0x17d88, 0x17d90, 0x17d9e, 0x17da0, 0x17dbc, 0x17dc6, 0x17dcc, 0x17dd8, 0x17dee, 0x17e26, 0x17e2c, 0x17e3a, 0x17e46, 0x17e4c, 0x17e58, 0x17e6e, 0x17e72, 0x17e74, 0x17e86, 0x17e8c, 0x17e98, 0x17eb0, 0x17ece, 0x17edc, 0x17ee2, 0x17ee4, 0x17ee8, 0x17ef6, 0x1813a, 0x18172, 0x18174, 0x18216, 0x18226, 0x1823a, 0x1824c, 0x18258, 0x1826e, 0x18272, 0x18274, 0x18298, 0x182be, 0x182e2, 0x182e4, 0x182e8, 0x182f6, 0x1835e, 0x1837a, 0x183ae, 0x183d6, 0x18416, 0x18426, 0x1842c, 0x1843a, 0x18446, 0x18458, 0x1846e, 0x18472, 0x18474, 0x18486, 0x184b0, 0x184be, 0x184ce, 0x184dc, 0x184e2, 0x184e4, 0x184e8, 0x184f6, 0x18506, 0x1850c, 0x18518, 0x18530, 0x1853e, 0x18560, 0x1857c, 0x1858e, 0x1859c, 0x185b8, 0x185c2, 0x185c4, 0x185c8, 0x185d0, 0x185de, 0x185e6, 0x185ec, 0x185fa, 0x18612, 0x18614, 0x18622, 0x18628, 0x18636, 0x18642, 0x18650, 0x1865e, 0x1867a, 0x18682, 0x18684, 0x18688, 0x18690, 0x1869e, 0x186a0, 0x186bc, 0x186c6, 0x186cc, 0x186d8, 0x186ee, 0x186f2, 0x186f4, 0x1872e, 0x1874e, 0x1875c, 0x18796, 0x187a6, 0x187ac, 0x187d2, 0x187d4, 0x18826, 0x1882c, 0x1883a, 0x18846, 0x1884c, 0x18858, 0x1886e, 0x18872, 0x18874, 0x18886, 0x18898, 0x188b0, 0x188be, 0x188ce, 0x188dc, 0x188e2, 0x188e4, 0x188e8, 0x188f6, 0x1890c, 0x18930, 0x1893e, 0x18960, 0x1897c, 0x1898e, 0x189b8, 0x189c2, 0x189c8, 0x189d0, 0x189de, 0x189e6, 0x189ec, 0x189fa, 0x18a18, 0x18a30, 0x18a3e, 0x18a60, 0x18a7c, 0x18ac0, 0x18af8, 0x18b1c, 0x18b38, 0x18b70, 0x18b7e, 0x18b82, 0x18b84, 0x18b88, 0x18b90, 0x18b9e, 0x18ba0, 0x18bbc, 0x18bc6, 0x18bcc, 0x18bd8, 0x18bee, 0x18bf2, 0x18bf4, 0x18c22, 0x18c24, 0x18c28, 0x18c36, 0x18c42, 0x18c48, 0x18c50, 0x18c5e, 0x18c66, 0x18c7a, 0x18c82, 0x18c84, 0x18c90, 0x18c9e, 0x18ca0, 0x18cbc, 0x18ccc, 0x18cf2, 0x18cf4, 0x18d04, 0x18d08, 0x18d10, 0x18d1e, 0x18d20, 0x18d3c, 0x18d40, 0x18d78, 0x18d86, 0x18d98, 0x18dce, 0x18de2, 0x18de4, 0x18de8, 0x18e2e, 0x18e32, 0x18e34, 0x18e4e, 0x18e5c, 0x18e62, 0x18e64, 0x18e68, 0x18e8e, 0x18e9c, 0x18eb8, 0x18ec2, 0x18ec4, 0x18ec8, 0x18ed0, 0x18efa, 0x18f16, 0x18f26, 0x18f2c, 0x18f46, 0x18f4c, 0x18f58, 0x18f6e, 0x18f8a, 0x18f92, 0x18f94, 0x18fa2, 0x18fa4, 0x18fa8, 0x18fb6, 0x1902c, 0x1903a, 0x19046, 0x1904c, 0x19058, 0x19072, 0x19074, 0x19086, 0x19098, 0x190b0, 0x190be, 0x190ce, 0x190dc, 0x190e2, 0x190e8, 0x190f6, 0x19106, 0x1910c, 0x19130, 0x1913e, 0x19160, 0x1917c, 0x1918e, 0x1919c, 0x191b8, 0x191c2, 0x191c8, 0x191d0, 0x191de, 0x191e6, 0x191ec, 0x191fa, 0x19218, 0x1923e, 0x19260, 0x1927c, 0x192c0, 0x192f8, 0x19338, 0x19370, 0x1937e, 0x19382, 0x19384, 0x19390, 0x1939e, 0x193a0, 0x193bc, 0x193c6, 0x193cc, 0x193d8, 0x193ee, 0x193f2, 0x193f4, 0x19430, 0x1943e, 0x19460, 0x1947c, 0x194c0, 0x194f8, 0x195f0, 0x19638, 0x19670, 0x1967e, 0x196e0, 0x196fc, 0x19702, 0x19704, 0x19708, 0x19710, 0x19720, 0x1973c, 0x19740, 0x19778, 0x19786, 0x1978c, 0x19798, 0x197b0, 0x197be, 0x197ce, 0x197dc, 0x197e2, 0x197e4, 0x197e8, 0x19822, 0x19824, 0x19842, 0x19848, 0x19850, 0x1985e, 0x19866, 0x1987a, 0x19882, 0x19884, 0x19890, 0x1989e, 0x198a0, 0x198bc, 0x198cc, 0x198f2, 0x198f4, 0x19902, 0x19908, 0x1991e, 0x19920, 0x1993c, 0x19940, 0x19978, 0x19986, 0x19998, 0x199ce, 0x199e2, 0x199e4, 0x199e8, 0x19a08, 0x19a10, 0x19a1e, 0x19a20, 0x19a3c, 0x19a40, 0x19a78, 0x19af0, 0x19b18, 0x19b3e, 0x19b60, 0x19b9c, 0x19bc2, 0x19bc4, 0x19bc8, 0x19bd0, 0x19be6, 0x19c2e, 0x19c34, 0x19c4e, 0x19c5c, 0x19c62, 0x19c64, 0x19c68, 0x19c8e, 0x19c9c, 0x19cb8, 0x19cc2, 0x19cc8, 0x19cd0, 0x19ce6, 0x19cfa, 0x19d0e, 0x19d1c, 0x19d38, 0x19d70, 0x19d7e, 0x19d82, 0x19d84, 0x19d88, 0x19d90, 0x19da0, 0x19dcc, 0x19df2, 0x19df4, 0x19e16, 0x19e26, 0x19e2c, 0x19e46, 0x19e4c, 0x19e58, 0x19e74, 0x19e86, 0x19e8c, 0x19e98, 0x19eb0, 0x19ebe, 0x19ece, 0x19ee2, 0x19ee4, 0x19ee8, 0x19f0a, 0x19f12, 0x19f14, 0x19f22, 0x19f24, 0x19f28, 0x19f42, 0x19f44, 0x19f48, 0x19f50, 0x19f5e, 0x19f6c, 0x19f9a, 0x19fae, 0x19fb2, 0x19fb4, 0x1a046, 0x1a04c, 0x1a072, 0x1a074, 0x1a086, 0x1a08c, 0x1a098, 0x1a0b0, 0x1a0be, 0x1a0e2, 0x1a0e4, 0x1a0e8, 0x1a0f6, 0x1a106, 0x1a10c, 0x1a118, 0x1a130, 0x1a13e, 0x1a160, 0x1a17c, 0x1a18e, 0x1a19c, 0x1a1b8, 0x1a1c2, 0x1a1c4, 0x1a1c8, 0x1a1d0, 0x1a1de, 0x1a1e6, 0x1a1ec, 0x1a218, 0x1a230, 0x1a23e, 0x1a260, 0x1a27c, 0x1a2c0, 0x1a2f8, 0x1a31c, 0x1a338, 0x1a370, 0x1a37e, 0x1a382, 0x1a384, 0x1a388, 0x1a390, 0x1a39e, 0x1a3a0, 0x1a3bc, 0x1a3c6, 0x1a3cc, 0x1a3d8, 0x1a3ee, 0x1a3f2, 0x1a3f4, 0x1a418, 0x1a430, 0x1a43e, 0x1a460, 0x1a47c, 0x1a4c0, 0x1a4f8, 0x1a5f0, 0x1a61c, 0x1a638, 0x1a670, 0x1a67e, 0x1a6e0, 0x1a6fc, 0x1a702, 0x1a704, 0x1a708, 0x1a710, 0x1a71e, 0x1a720, 0x1a73c, 0x1a740, 0x1a778, 0x1a786, 0x1a78c, 0x1a798, 0x1a7b0, 0x1a7be, 0x1a7ce, 0x1a7dc, 0x1a7e2, 0x1a7e4, 0x1a7e8, 0x1a830, 0x1a860, 0x1a87c, 0x1a8c0, 0x1a8f8, 0x1a9f0, 0x1abe0, 0x1ac70, 0x1ac7e, 0x1ace0, 0x1acfc, 0x1adc0, 0x1adf8, 0x1ae04, 0x1ae08, 0x1ae10, 0x1ae20, 0x1ae3c, 0x1ae40, 0x1ae78, 0x1aef0, 0x1af06, 0x1af0c, 0x1af18, 0x1af30, 0x1af3e, 0x1af60, 0x1af7c, 0x1af8e, 0x1af9c, 0x1afb8, 0x1afc4, 0x1afc8, 0x1afd0, 0x1afde, 0x1b042, 0x1b05e, 0x1b07a, 0x1b082, 0x1b084, 0x1b088, 0x1b090, 0x1b09e, 0x1b0a0, 0x1b0bc, 0x1b0cc, 0x1b0f2, 0x1b0f4, 0x1b102, 0x1b104, 0x1b108, 0x1b110, 0x1b11e, 0x1b120, 0x1b13c, 0x1b140, 0x1b178, 0x1b186, 0x1b198, 0x1b1ce, 0x1b1e2, 0x1b1e4, 0x1b1e8, 0x1b204, 0x1b208, 0x1b210, 0x1b21e, 0x1b220, 0x1b23c, 0x1b240, 0x1b278, 0x1b2f0, 0x1b30c, 0x1b33e, 0x1b360, 0x1b39c, 0x1b3c2, 0x1b3c4, 0x1b3c8, 0x1b3d0, 0x1b3e6, 0x1b410, 0x1b41e, 0x1b420, 0x1b43c, 0x1b440, 0x1b478, 0x1b4f0, 0x1b5e0, 0x1b618, 0x1b660, 0x1b67c, 0x1b6c0, 0x1b738, 0x1b782, 0x1b784, 0x1b788, 0x1b790, 0x1b79e, 0x1b7a0, 0x1b7cc, 0x1b82e, 0x1b84e, 0x1b85c, 0x1b88e, 0x1b89c, 0x1b8b8, 0x1b8c2, 0x1b8c4, 0x1b8c8, 0x1b8d0, 0x1b8e6, 0x1b8fa, 0x1b90e, 0x1b91c, 0x1b938, 0x1b970, 0x1b97e, 0x1b982, 0x1b984, 0x1b988, 0x1b990, 0x1b99e, 0x1b9a0, 0x1b9cc, 0x1b9f2, 0x1b9f4, 0x1ba0e, 0x1ba1c, 0x1ba38, 0x1ba70, 0x1ba7e, 0x1bae0, 0x1bafc, 0x1bb08, 0x1bb10, 0x1bb20, 0x1bb3c, 0x1bb40, 0x1bb98, 0x1bbce, 0x1bbe2, 0x1bbe4, 0x1bbe8, 0x1bc16, 0x1bc26, 0x1bc2c, 0x1bc46, 0x1bc4c, 0x1bc58, 0x1bc72, 0x1bc74, 0x1bc86, 0x1bc8c, 0x1bc98, 0x1bcb0, 0x1bcbe, 0x1bcce, 0x1bce2, 0x1bce4, 0x1bce8, 0x1bd06, 0x1bd0c, 0x1bd18, 0x1bd30, 0x1bd3e, 0x1bd60, 0x1bd7c, 0x1bd9c, 0x1bdc2, 0x1bdc4, 0x1bdc8, 0x1bdd0, 0x1bde6, 0x1bdfa, 0x1be12, 0x1be14, 0x1be22, 0x1be24, 0x1be28, 0x1be42, 0x1be44, 0x1be48, 0x1be50, 0x1be5e, 0x1be66, 0x1be82, 0x1be84, 0x1be88, 0x1be90, 0x1be9e, 0x1bea0, 0x1bebc, 0x1becc, 0x1bef4, 0x1bf1a, 0x1bf2e, 0x1bf32, 0x1bf34, 0x1bf4e, 0x1bf5c, 0x1bf62, 0x1bf64, 0x1bf68, 0x1c09a, 0x1c0b2, 0x1c0b4, 0x1c11a, 0x1c132, 0x1c134, 0x1c162, 0x1c164, 0x1c168, 0x1c176, 0x1c1ba, 0x1c21a, 0x1c232, 0x1c234, 0x1c24e, 0x1c25c, 0x1c262, 0x1c264, 0x1c268, 0x1c276, 0x1c28e, 0x1c2c2, 0x1c2c4, 0x1c2c8, 0x1c2d0, 0x1c2de, 0x1c2e6, 0x1c2ec, 0x1c2fa, 0x1c316, 0x1c326, 0x1c33a, 0x1c346, 0x1c34c, 0x1c372, 0x1c374, 0x1c41a, 0x1c42e, 0x1c432, 0x1c434, 0x1c44e, 0x1c45c, 0x1c462, 0x1c464, 0x1c468, 0x1c476, 0x1c48e, 0x1c49c, 0x1c4b8, 0x1c4c2, 0x1c4c8, 0x1c4d0, 0x1c4de, 0x1c4e6, 0x1c4ec, 0x1c4fa, 0x1c51c, 0x1c538, 0x1c570, 0x1c57e, 0x1c582, 0x1c584, 0x1c588, 0x1c590, 0x1c59e, 0x1c5a0, 0x1c5bc, 0x1c5c6, 0x1c5cc, 0x1c5d8, 0x1c5ee, 0x1c5f2, 0x1c5f4, 0x1c616, 0x1c626, 0x1c62c, 0x1c63a, 0x1c646, 0x1c64c, 0x1c658, 0x1c66e, 0x1c672, 0x1c674, 0x1c686, 0x1c68c, 0x1c698, 0x1c6b0, 0x1c6be, 0x1c6ce, 0x1c6dc, 0x1c6e2, 0x1c6e4, 0x1c6e8, 0x1c712, 0x1c714, 0x1c722, 0x1c728, 0x1c736, 0x1c742, 0x1c744, 0x1c748, 0x1c750, 0x1c75e, 0x1c766, 0x1c76c, 0x1c77a, 0x1c7ae, 0x1c7d6, 0x1c7ea, 0x1c81a, 0x1c82e, 0x1c832, 0x1c834, 0x1c84e, 0x1c85c, 0x1c862, 0x1c864, 0x1c868, 0x1c876, 0x1c88e, 0x1c89c, 0x1c8b8, 0x1c8c2, 0x1c8c8, 0x1c8d0, 0x1c8de, 0x1c8e6, 0x1c8ec, 0x1c8fa, 0x1c90e, 0x1c938, 0x1c970, 0x1c97e, 0x1c982, 0x1c984, 0x1c990, 0x1c99e, 0x1c9a0, 0x1c9bc, 0x1c9c6, 0x1c9cc, 0x1c9d8, 0x1c9ee, 0x1c9f2, 0x1c9f4, 0x1ca38, 0x1ca70, 0x1ca7e, 0x1cae0, 0x1cafc, 0x1cb02, 0x1cb04, 0x1cb08, 0x1cb10, 0x1cb20, 0x1cb3c, 0x1cb40, 0x1cb78, 0x1cb86, 0x1cb8c, 0x1cb98, 0x1cbb0, 0x1cbbe, 0x1cbce, 0x1cbdc, 0x1cbe2, 0x1cbe4, 0x1cbe8, 0x1cbf6, 0x1cc16, 0x1cc26, 0x1cc2c, 0x1cc3a, 0x1cc46, 0x1cc58, 0x1cc72, 0x1cc74, 0x1cc86, 0x1ccb0, 0x1ccbe, 0x1ccce, 0x1cce2, 0x1cce4, 0x1cce8, 0x1cd06, 0x1cd0c, 0x1cd18, 0x1cd30, 0x1cd3e, 0x1cd60, 0x1cd7c, 0x1cd9c, 0x1cdc2, 0x1cdc4, 0x1cdc8, 0x1cdd0, 0x1cdde, 0x1cde6, 0x1cdfa, 0x1ce22, 0x1ce28, 0x1ce42, 0x1ce50, 0x1ce5e, 0x1ce66, 0x1ce7a, 0x1ce82, 0x1ce84, 0x1ce88, 0x1ce90, 0x1ce9e, 0x1cea0, 0x1cebc, 0x1cecc, 0x1cef2, 0x1cef4, 0x1cf2e, 0x1cf32, 0x1cf34, 0x1cf4e, 0x1cf5c, 0x1cf62, 0x1cf64, 0x1cf68, 0x1cf96, 0x1cfa6, 0x1cfac, 0x1cfca, 0x1cfd2, 0x1cfd4, 0x1d02e, 0x1d032, 0x1d034, 0x1d04e, 0x1d05c, 0x1d062, 0x1d064, 0x1d068, 0x1d076, 0x1d08e, 0x1d09c, 0x1d0b8, 0x1d0c2, 0x1d0c4, 0x1d0c8, 0x1d0d0, 0x1d0de, 0x1d0e6, 0x1d0ec, 0x1d0fa, 0x1d11c, 0x1d138, 0x1d170, 0x1d17e, 0x1d182, 0x1d184, 0x1d188, 0x1d190, 0x1d19e, 0x1d1a0, 0x1d1bc, 0x1d1c6, 0x1d1cc, 0x1d1d8, 0x1d1ee, 0x1d1f2, 0x1d1f4, 0x1d21c, 0x1d238, 0x1d270, 0x1d27e, 0x1d2e0, 0x1d2fc, 0x1d302, 0x1d304, 0x1d308, 0x1d310, 0x1d31e, 0x1d320, 0x1d33c, 0x1d340, 0x1d378, 0x1d386, 0x1d38c, 0x1d398, 0x1d3b0, 0x1d3be, 0x1d3ce, 0x1d3dc, 0x1d3e2, 0x1d3e4, 0x1d3e8, 0x1d3f6, 0x1d470, 0x1d47e, 0x1d4e0, 0x1d4fc, 0x1d5c0, 0x1d5f8, 0x1d604, 0x1d608, 0x1d610, 0x1d620, 0x1d640, 0x1d678, 0x1d6f0, 0x1d706, 0x1d70c, 0x1d718, 0x1d730, 0x1d73e, 0x1d760, 0x1d77c, 0x1d78e, 0x1d79c, 0x1d7b8, 0x1d7c2, 0x1d7c4, 0x1d7c8, 0x1d7d0, 0x1d7de, 0x1d7e6, 0x1d7ec, 0x1d826, 0x1d82c, 0x1d83a, 0x1d846, 0x1d84c, 0x1d858, 0x1d872, 0x1d874, 0x1d886, 0x1d88c, 0x1d898, 0x1d8b0, 0x1d8be, 0x1d8ce, 0x1d8e2, 0x1d8e4, 0x1d8e8, 0x1d8f6, 0x1d90c, 0x1d918, 0x1d930, 0x1d93e, 0x1d960, 0x1d97c, 0x1d99c, 0x1d9c2, 0x1d9c4, 0x1d9c8, 0x1d9d0, 0x1d9e6, 0x1d9fa, 0x1da0c, 0x1da18, 0x1da30, 0x1da3e, 0x1da60, 0x1da7c, 0x1dac0, 0x1daf8, 0x1db38, 0x1db82, 0x1db84, 0x1db88, 0x1db90, 0x1db9e, 0x1dba0, 0x1dbcc, 0x1dbf2, 0x1dbf4, 0x1dc22, 0x1dc42, 0x1dc44, 0x1dc48, 0x1dc50, 0x1dc5e, 0x1dc66, 0x1dc7a, 0x1dc82, 0x1dc84, 0x1dc88, 0x1dc90, 0x1dc9e, 0x1dca0, 0x1dcbc, 0x1dccc, 0x1dcf2, 0x1dcf4, 0x1dd04, 0x1dd08, 0x1dd10, 0x1dd1e, 0x1dd20, 0x1dd3c, 0x1dd40, 0x1dd78, 0x1dd86, 0x1dd98, 0x1ddce, 0x1dde2, 0x1dde4, 0x1dde8, 0x1de2e, 0x1de32, 0x1de34, 0x1de4e, 0x1de5c, 0x1de62, 0x1de64, 0x1de68, 0x1de8e, 0x1de9c, 0x1deb8, 0x1dec2, 0x1dec4, 0x1dec8, 0x1ded0, 0x1dee6, 0x1defa, 0x1df16, 0x1df26, 0x1df2c, 0x1df46, 0x1df4c, 0x1df58, 0x1df72, 0x1df74, 0x1df8a, 0x1df92, 0x1df94, 0x1dfa2, 0x1dfa4, 0x1dfa8, 0x1e08a, 0x1e092, 0x1e094, 0x1e0a2, 0x1e0a4, 0x1e0a8, 0x1e0b6, 0x1e0da, 0x1e10a, 0x1e112, 0x1e114, 0x1e122, 0x1e124, 0x1e128, 0x1e136, 0x1e142, 0x1e144, 0x1e148, 0x1e150, 0x1e166, 0x1e16c, 0x1e17a, 0x1e19a, 0x1e1b2, 0x1e1b4, 0x1e20a, 0x1e212, 0x1e214, 0x1e222, 0x1e224, 0x1e228, 0x1e236, 0x1e242, 0x1e248, 0x1e250, 0x1e25e, 0x1e266, 0x1e26c, 0x1e27a, 0x1e282, 0x1e284, 0x1e288, 0x1e290, 0x1e2a0, 0x1e2bc, 0x1e2c6, 0x1e2cc, 0x1e2d8, 0x1e2ee, 0x1e2f2, 0x1e2f4, 0x1e31a, 0x1e332, 0x1e334, 0x1e35c, 0x1e362, 0x1e364, 0x1e368, 0x1e3ba, 0x1e40a, 0x1e412, 0x1e414, 0x1e422, 0x1e428, 0x1e436, 0x1e442, 0x1e448, 0x1e450, 0x1e45e, 0x1e466, 0x1e46c, 0x1e47a, 0x1e482, 0x1e484, 0x1e490, 0x1e49e, 0x1e4a0, 0x1e4bc, 0x1e4c6, 0x1e4cc, 0x1e4d8, 0x1e4ee, 0x1e4f2, 0x1e4f4, 0x1e502, 0x1e504, 0x1e508, 0x1e510, 0x1e51e, 0x1e520, 0x1e53c, 0x1e540, 0x1e578, 0x1e586, 0x1e58c, 0x1e598, 0x1e5b0, 0x1e5be, 0x1e5ce, 0x1e5dc, 0x1e5e2, 0x1e5e4, 0x1e5e8, 0x1e5f6, 0x1e61a, 0x1e62e, 0x1e632, 0x1e634, 0x1e64e, 0x1e65c, 0x1e662, 0x1e668, 0x1e68e, 0x1e69c, 0x1e6b8, 0x1e6c2, 0x1e6c4, 0x1e6c8, 0x1e6d0, 0x1e6e6, 0x1e6fa, 0x1e716, 0x1e726, 0x1e72c, 0x1e73a, 0x1e746, 0x1e74c, 0x1e758, 0x1e772, 0x1e774, 0x1e792, 0x1e794, 0x1e7a2, 0x1e7a4, 0x1e7a8, 0x1e7b6, 0x1e812, 0x1e814, 0x1e822, 0x1e824, 0x1e828, 0x1e836, 0x1e842, 0x1e844, 0x1e848, 0x1e850, 0x1e85e, 0x1e866, 0x1e86c, 0x1e87a, 0x1e882, 0x1e884, 0x1e888, 0x1e890, 0x1e89e, 0x1e8a0, 0x1e8bc, 0x1e8c6, 0x1e8cc, 0x1e8d8, 0x1e8ee, 0x1e8f2, 0x1e8f4, 0x1e902, 0x1e904, 0x1e908, 0x1e910, 0x1e920, 0x1e93c, 0x1e940, 0x1e978, 0x1e986, 0x1e98c, 0x1e998, 0x1e9b0, 0x1e9be, 0x1e9ce, 0x1e9dc, 0x1e9e2, 0x1e9e4, 0x1e9e8, 0x1e9f6, 0x1ea04, 0x1ea08, 0x1ea10, 0x1ea20, 0x1ea40, 0x1ea78, 0x1eaf0, 0x1eb06, 0x1eb0c, 0x1eb18, 0x1eb30, 0x1eb3e, 0x1eb60, 0x1eb7c, 0x1eb8e, 0x1eb9c, 0x1ebb8, 0x1ebc2, 0x1ebc4, 0x1ebc8, 0x1ebd0, 0x1ebde, 0x1ebe6, 0x1ebec, 0x1ec1a, 0x1ec2e, 0x1ec32, 0x1ec34, 0x1ec4e, 0x1ec5c, 0x1ec62, 0x1ec64, 0x1ec68, 0x1ec8e, 0x1ec9c, 0x1ecb8, 0x1ecc2, 0x1ecc4, 0x1ecc8, 0x1ecd0, 0x1ece6, 0x1ecfa, 0x1ed0e, 0x1ed1c, 0x1ed38, 0x1ed70, 0x1ed7e, 0x1ed82, 0x1ed84, 0x1ed88, 0x1ed90, 0x1ed9e, 0x1eda0, 0x1edcc, 0x1edf2, 0x1edf4, 0x1ee16, 0x1ee26, 0x1ee2c, 0x1ee3a, 0x1ee46, 0x1ee4c, 0x1ee58, 0x1ee6e, 0x1ee72, 0x1ee74, 0x1ee86, 0x1ee8c, 0x1ee98, 0x1eeb0, 0x1eebe, 0x1eece, 0x1eedc, 0x1eee2, 0x1eee4, 0x1eee8, 0x1ef12, 0x1ef22, 0x1ef24, 0x1ef28, 0x1ef36, 0x1ef42, 0x1ef44, 0x1ef48, 0x1ef50, 0x1ef5e, 0x1ef66, 0x1ef6c, 0x1ef7a, 0x1efae, 0x1efb2, 0x1efb4, 0x1efd6, 0x1f096, 0x1f0a6, 0x1f0ac, 0x1f0ba, 0x1f0ca, 0x1f0d2, 0x1f0d4, 0x1f116, 0x1f126, 0x1f12c, 0x1f13a, 0x1f146, 0x1f14c, 0x1f158, 0x1f16e, 0x1f172, 0x1f174, 0x1f18a, 0x1f192, 0x1f194, 0x1f1a2, 0x1f1a4, 0x1f1a8, 0x1f1da, 0x1f216, 0x1f226, 0x1f22c, 0x1f23a, 0x1f246, 0x1f258, 0x1f26e, 0x1f272, 0x1f274, 0x1f286, 0x1f28c, 0x1f298, 0x1f2b0, 0x1f2be, 0x1f2ce, 0x1f2dc, 0x1f2e2, 0x1f2e4, 0x1f2e8, 0x1f2f6, 0x1f30a, 0x1f312, 0x1f314, 0x1f322, 0x1f328, 0x1f342, 0x1f344, 0x1f348, 0x1f350, 0x1f35e, 0x1f366, 0x1f37a, 0x1f39a, 0x1f3ae, 0x1f3b2, 0x1f3b4, 0x1f416, 0x1f426, 0x1f42c, 0x1f43a, 0x1f446, 0x1f44c, 0x1f458, 0x1f46e, 0x1f472, 0x1f474, 0x1f486, 0x1f48c, 0x1f498, 0x1f4b0, 0x1f4be, 0x1f4ce, 0x1f4dc, 0x1f4e2, 0x1f4e4, 0x1f4e8, 0x1f4f6, 0x1f506, 0x1f50c, 0x1f518, 0x1f530, 0x1f53e, 0x1f560, 0x1f57c, 0x1f58e, 0x1f59c, 0x1f5b8, 0x1f5c2, 0x1f5c4, 0x1f5c8, 0x1f5d0, 0x1f5de, 0x1f5e6, 0x1f5ec, 0x1f5fa, 0x1f60a, 0x1f612, 0x1f614, 0x1f622, 0x1f624, 0x1f628, 0x1f636, 0x1f642, 0x1f644, 0x1f648, 0x1f650, 0x1f65e, 0x1f666, 0x1f67a, 0x1f682, 0x1f684, 0x1f688, 0x1f690, 0x1f69e, 0x1f6a0, 0x1f6bc, 0x1f6cc, 0x1f6f2, 0x1f6f4, 0x1f71a, 0x1f72e, 0x1f732, 0x1f734, 0x1f74e, 0x1f75c, 0x1f762, 0x1f764, 0x1f768, 0x1f776, 0x1f796, 0x1f7a6, 0x1f7ac, 0x1f7ba, 0x1f7d2, 0x1f7d4, 0x1f89a, 0x1f8ae, 0x1f8b2, 0x1f8b4, 0x1f8d6, 0x1f8ea, 0x1f91a, 0x1f92e, 0x1f932, 0x1f934, 0x1f94e, 0x1f95c, 0x1f962, 0x1f964, 0x1f968, 0x1f976, 0x1f996, 0x1f9a6, 0x1f9ac, 0x1f9ba, 0x1f9ca, 0x1f9d2, 0x1f9d4, 0x1fa1a, 0x1fa2e, 0x1fa32, 0x1fa34, 0x1fa4e, 0x1fa5c, 0x1fa62, 0x1fa64, 0x1fa68, 0x1fa76, 0x1fa8e, 0x1fa9c, 0x1fab8, 0x1fac2, 0x1fac4, 0x1fac8, 0x1fad0, 0x1fade, 0x1fae6, 0x1faec, 0x1fb16, 0x1fb26, 0x1fb2c, 0x1fb3a, 0x1fb46, 0x1fb4c, 0x1fb58, 0x1fb6e, 0x1fb72, 0x1fb74, 0x1fb8a, 0x1fb92, 0x1fb94, 0x1fba2, 0x1fba4, 0x1fba8, 0x1fbb6, 0x1fbda]);
- /**
- * This table contains to codewords for all symbols.
- */
- PDF417Common.CODEWORD_TABLE = Int32Array.from([2627, 1819, 2622, 2621, 1813, 1812, 2729, 2724, 2723, 2779, 2774, 2773, 902, 896, 908, 868, 865, 861, 859, 2511, 873, 871, 1780, 835, 2493, 825, 2491, 842, 837, 844, 1764, 1762, 811, 810, 809, 2483, 807, 2482, 806, 2480, 815, 814, 813, 812, 2484, 817, 816, 1745, 1744, 1742, 1746, 2655, 2637, 2635, 2626, 2625, 2623, 2628, 1820, 2752, 2739, 2737, 2728, 2727, 2725, 2730, 2785, 2783, 2778, 2777, 2775, 2780, 787, 781, 747, 739, 736, 2413, 754, 752, 1719, 692, 689, 681, 2371, 678, 2369, 700, 697, 694, 703, 1688, 1686, 642, 638, 2343, 631, 2341, 627, 2338, 651, 646, 643, 2345, 654, 652, 1652, 1650, 1647, 1654, 601, 599, 2322, 596, 2321, 594, 2319, 2317, 611, 610, 608, 606, 2324, 603, 2323, 615, 614, 612, 1617, 1616, 1614, 1612, 616, 1619, 1618, 2575, 2538, 2536, 905, 901, 898, 909, 2509, 2507, 2504, 870, 867, 864, 860, 2512, 875, 872, 1781, 2490, 2489, 2487, 2485, 1748, 836, 834, 832, 830, 2494, 827, 2492, 843, 841, 839, 845, 1765, 1763, 2701, 2676, 2674, 2653, 2648, 2656, 2634, 2633, 2631, 2629, 1821, 2638, 2636, 2770, 2763, 2761, 2750, 2745, 2753, 2736, 2735, 2733, 2731, 1848, 2740, 2738, 2786, 2784, 591, 588, 576, 569, 566, 2296, 1590, 537, 534, 526, 2276, 522, 2274, 545, 542, 539, 548, 1572, 1570, 481, 2245, 466, 2242, 462, 2239, 492, 485, 482, 2249, 496, 494, 1534, 1531, 1528, 1538, 413, 2196, 406, 2191, 2188, 425, 419, 2202, 415, 2199, 432, 430, 427, 1472, 1467, 1464, 433, 1476, 1474, 368, 367, 2160, 365, 2159, 362, 2157, 2155, 2152, 378, 377, 375, 2166, 372, 2165, 369, 2162, 383, 381, 379, 2168, 1419, 1418, 1416, 1414, 385, 1411, 384, 1423, 1422, 1420, 1424, 2461, 802, 2441, 2439, 790, 786, 783, 794, 2409, 2406, 2403, 750, 742, 738, 2414, 756, 753, 1720, 2367, 2365, 2362, 2359, 1663, 693, 691, 684, 2373, 680, 2370, 702, 699, 696, 704, 1690, 1687, 2337, 2336, 2334, 2332, 1624, 2329, 1622, 640, 637, 2344, 634, 2342, 630, 2340, 650, 648, 645, 2346, 655, 653, 1653, 1651, 1649, 1655, 2612, 2597, 2595, 2571, 2568, 2565, 2576, 2534, 2529, 2526, 1787, 2540, 2537, 907, 904, 900, 910, 2503, 2502, 2500, 2498, 1768, 2495, 1767, 2510, 2508, 2506, 869, 866, 863, 2513, 876, 874, 1782, 2720, 2713, 2711, 2697, 2694, 2691, 2702, 2672, 2670, 2664, 1828, 2678, 2675, 2647, 2646, 2644, 2642, 1823, 2639, 1822, 2654, 2652, 2650, 2657, 2771, 1855, 2765, 2762, 1850, 1849, 2751, 2749, 2747, 2754, 353, 2148, 344, 342, 336, 2142, 332, 2140, 345, 1375, 1373, 306, 2130, 299, 2128, 295, 2125, 319, 314, 311, 2132, 1354, 1352, 1349, 1356, 262, 257, 2101, 253, 2096, 2093, 274, 273, 267, 2107, 263, 2104, 280, 278, 275, 1316, 1311, 1308, 1320, 1318, 2052, 202, 2050, 2044, 2040, 219, 2063, 212, 2060, 208, 2055, 224, 221, 2066, 1260, 1258, 1252, 231, 1248, 229, 1266, 1264, 1261, 1268, 155, 1998, 153, 1996, 1994, 1991, 1988, 165, 164, 2007, 162, 2006, 159, 2003, 2000, 172, 171, 169, 2012, 166, 2010, 1186, 1184, 1182, 1179, 175, 1176, 173, 1192, 1191, 1189, 1187, 176, 1194, 1193, 2313, 2307, 2305, 592, 589, 2294, 2292, 2289, 578, 572, 568, 2297, 580, 1591, 2272, 2267, 2264, 1547, 538, 536, 529, 2278, 525, 2275, 547, 544, 541, 1574, 1571, 2237, 2235, 2229, 1493, 2225, 1489, 478, 2247, 470, 2244, 465, 2241, 493, 488, 484, 2250, 498, 495, 1536, 1533, 1530, 1539, 2187, 2186, 2184, 2182, 1432, 2179, 1430, 2176, 1427, 414, 412, 2197, 409, 2195, 405, 2193, 2190, 426, 424, 421, 2203, 418, 2201, 431, 429, 1473, 1471, 1469, 1466, 434, 1477, 1475, 2478, 2472, 2470, 2459, 2457, 2454, 2462, 803, 2437, 2432, 2429, 1726, 2443, 2440, 792, 789, 785, 2401, 2399, 2393, 1702, 2389, 1699, 2411, 2408, 2405, 745, 741, 2415, 758, 755, 1721, 2358, 2357, 2355, 2353, 1661, 2350, 1660, 2347, 1657, 2368, 2366, 2364, 2361, 1666, 690, 687, 2374, 683, 2372, 701, 698, 705, 1691, 1689, 2619, 2617, 2610, 2608, 2605, 2613, 2593, 2588, 2585, 1803, 2599, 2596, 2563, 2561, 2555, 1797, 2551, 1795, 2573, 2570, 2567, 2577, 2525, 2524, 2522, 2520, 1786, 2517, 1785, 2514, 1783, 2535, 2533, 2531, 2528, 1788, 2541, 2539, 906, 903, 911, 2721, 1844, 2715, 2712, 1838, 1836, 2699, 2696, 2693, 2703, 1827, 1826, 1824, 2673, 2671, 2669, 2666, 1829, 2679, 2677, 1858, 1857, 2772, 1854, 1853, 1851, 1856, 2766, 2764, 143, 1987, 139, 1986, 135, 133, 131, 1984, 128, 1983, 125, 1981, 138, 137, 136, 1985, 1133, 1132, 1130, 112, 110, 1974, 107, 1973, 104, 1971, 1969, 122, 121, 119, 117, 1977, 114, 1976, 124, 1115, 1114, 1112, 1110, 1117, 1116, 84, 83, 1953, 81, 1952, 78, 1950, 1948, 1945, 94, 93, 91, 1959, 88, 1958, 85, 1955, 99, 97, 95, 1961, 1086, 1085, 1083, 1081, 1078, 100, 1090, 1089, 1087, 1091, 49, 47, 1917, 44, 1915, 1913, 1910, 1907, 59, 1926, 56, 1925, 53, 1922, 1919, 66, 64, 1931, 61, 1929, 1042, 1040, 1038, 71, 1035, 70, 1032, 68, 1048, 1047, 1045, 1043, 1050, 1049, 12, 10, 1869, 1867, 1864, 1861, 21, 1880, 19, 1877, 1874, 1871, 28, 1888, 25, 1886, 22, 1883, 982, 980, 977, 974, 32, 30, 991, 989, 987, 984, 34, 995, 994, 992, 2151, 2150, 2147, 2146, 2144, 356, 355, 354, 2149, 2139, 2138, 2136, 2134, 1359, 343, 341, 338, 2143, 335, 2141, 348, 347, 346, 1376, 1374, 2124, 2123, 2121, 2119, 1326, 2116, 1324, 310, 308, 305, 2131, 302, 2129, 298, 2127, 320, 318, 316, 313, 2133, 322, 321, 1355, 1353, 1351, 1357, 2092, 2091, 2089, 2087, 1276, 2084, 1274, 2081, 1271, 259, 2102, 256, 2100, 252, 2098, 2095, 272, 269, 2108, 266, 2106, 281, 279, 277, 1317, 1315, 1313, 1310, 282, 1321, 1319, 2039, 2037, 2035, 2032, 1203, 2029, 1200, 1197, 207, 2053, 205, 2051, 201, 2049, 2046, 2043, 220, 218, 2064, 215, 2062, 211, 2059, 228, 226, 223, 2069, 1259, 1257, 1254, 232, 1251, 230, 1267, 1265, 1263, 2316, 2315, 2312, 2311, 2309, 2314, 2304, 2303, 2301, 2299, 1593, 2308, 2306, 590, 2288, 2287, 2285, 2283, 1578, 2280, 1577, 2295, 2293, 2291, 579, 577, 574, 571, 2298, 582, 581, 1592, 2263, 2262, 2260, 2258, 1545, 2255, 1544, 2252, 1541, 2273, 2271, 2269, 2266, 1550, 535, 532, 2279, 528, 2277, 546, 543, 549, 1575, 1573, 2224, 2222, 2220, 1486, 2217, 1485, 2214, 1482, 1479, 2238, 2236, 2234, 2231, 1496, 2228, 1492, 480, 477, 2248, 473, 2246, 469, 2243, 490, 487, 2251, 497, 1537, 1535, 1532, 2477, 2476, 2474, 2479, 2469, 2468, 2466, 2464, 1730, 2473, 2471, 2453, 2452, 2450, 2448, 1729, 2445, 1728, 2460, 2458, 2456, 2463, 805, 804, 2428, 2427, 2425, 2423, 1725, 2420, 1724, 2417, 1722, 2438, 2436, 2434, 2431, 1727, 2444, 2442, 793, 791, 788, 795, 2388, 2386, 2384, 1697, 2381, 1696, 2378, 1694, 1692, 2402, 2400, 2398, 2395, 1703, 2392, 1701, 2412, 2410, 2407, 751, 748, 744, 2416, 759, 757, 1807, 2620, 2618, 1806, 1805, 2611, 2609, 2607, 2614, 1802, 1801, 1799, 2594, 2592, 2590, 2587, 1804, 2600, 2598, 1794, 1793, 1791, 1789, 2564, 2562, 2560, 2557, 1798, 2554, 1796, 2574, 2572, 2569, 2578, 1847, 1846, 2722, 1843, 1842, 1840, 1845, 2716, 2714, 1835, 1834, 1832, 1830, 1839, 1837, 2700, 2698, 2695, 2704, 1817, 1811, 1810, 897, 862, 1777, 829, 826, 838, 1760, 1758, 808, 2481, 1741, 1740, 1738, 1743, 2624, 1818, 2726, 2776, 782, 740, 737, 1715, 686, 679, 695, 1682, 1680, 639, 628, 2339, 647, 644, 1645, 1643, 1640, 1648, 602, 600, 597, 595, 2320, 593, 2318, 609, 607, 604, 1611, 1610, 1608, 1606, 613, 1615, 1613, 2328, 926, 924, 892, 886, 899, 857, 850, 2505, 1778, 824, 823, 821, 819, 2488, 818, 2486, 833, 831, 828, 840, 1761, 1759, 2649, 2632, 2630, 2746, 2734, 2732, 2782, 2781, 570, 567, 1587, 531, 527, 523, 540, 1566, 1564, 476, 467, 463, 2240, 486, 483, 1524, 1521, 1518, 1529, 411, 403, 2192, 399, 2189, 423, 416, 1462, 1457, 1454, 428, 1468, 1465, 2210, 366, 363, 2158, 360, 2156, 357, 2153, 376, 373, 370, 2163, 1410, 1409, 1407, 1405, 382, 1402, 380, 1417, 1415, 1412, 1421, 2175, 2174, 777, 774, 771, 784, 732, 725, 722, 2404, 743, 1716, 676, 674, 668, 2363, 665, 2360, 685, 1684, 1681, 626, 624, 622, 2335, 620, 2333, 617, 2330, 641, 635, 649, 1646, 1644, 1642, 2566, 928, 925, 2530, 2527, 894, 891, 888, 2501, 2499, 2496, 858, 856, 854, 851, 1779, 2692, 2668, 2665, 2645, 2643, 2640, 2651, 2768, 2759, 2757, 2744, 2743, 2741, 2748, 352, 1382, 340, 337, 333, 1371, 1369, 307, 300, 296, 2126, 315, 312, 1347, 1342, 1350, 261, 258, 250, 2097, 246, 2094, 271, 268, 264, 1306, 1301, 1298, 276, 1312, 1309, 2115, 203, 2048, 195, 2045, 191, 2041, 213, 209, 2056, 1246, 1244, 1238, 225, 1234, 222, 1256, 1253, 1249, 1262, 2080, 2079, 154, 1997, 150, 1995, 147, 1992, 1989, 163, 160, 2004, 156, 2001, 1175, 1174, 1172, 1170, 1167, 170, 1164, 167, 1185, 1183, 1180, 1177, 174, 1190, 1188, 2025, 2024, 2022, 587, 586, 564, 559, 556, 2290, 573, 1588, 520, 518, 512, 2268, 508, 2265, 530, 1568, 1565, 461, 457, 2233, 450, 2230, 446, 2226, 479, 471, 489, 1526, 1523, 1520, 397, 395, 2185, 392, 2183, 389, 2180, 2177, 410, 2194, 402, 422, 1463, 1461, 1459, 1456, 1470, 2455, 799, 2433, 2430, 779, 776, 773, 2397, 2394, 2390, 734, 728, 724, 746, 1717, 2356, 2354, 2351, 2348, 1658, 677, 675, 673, 670, 667, 688, 1685, 1683, 2606, 2589, 2586, 2559, 2556, 2552, 927, 2523, 2521, 2518, 2515, 1784, 2532, 895, 893, 890, 2718, 2709, 2707, 2689, 2687, 2684, 2663, 2662, 2660, 2658, 1825, 2667, 2769, 1852, 2760, 2758, 142, 141, 1139, 1138, 134, 132, 129, 126, 1982, 1129, 1128, 1126, 1131, 113, 111, 108, 105, 1972, 101, 1970, 120, 118, 115, 1109, 1108, 1106, 1104, 123, 1113, 1111, 82, 79, 1951, 75, 1949, 72, 1946, 92, 89, 86, 1956, 1077, 1076, 1074, 1072, 98, 1069, 96, 1084, 1082, 1079, 1088, 1968, 1967, 48, 45, 1916, 42, 1914, 39, 1911, 1908, 60, 57, 54, 1923, 50, 1920, 1031, 1030, 1028, 1026, 67, 1023, 65, 1020, 62, 1041, 1039, 1036, 1033, 69, 1046, 1044, 1944, 1943, 1941, 11, 9, 1868, 7, 1865, 1862, 1859, 20, 1878, 16, 1875, 13, 1872, 970, 968, 966, 963, 29, 960, 26, 23, 983, 981, 978, 975, 33, 971, 31, 990, 988, 985, 1906, 1904, 1902, 993, 351, 2145, 1383, 331, 330, 328, 326, 2137, 323, 2135, 339, 1372, 1370, 294, 293, 291, 289, 2122, 286, 2120, 283, 2117, 309, 303, 317, 1348, 1346, 1344, 245, 244, 242, 2090, 239, 2088, 236, 2085, 2082, 260, 2099, 249, 270, 1307, 1305, 1303, 1300, 1314, 189, 2038, 186, 2036, 183, 2033, 2030, 2026, 206, 198, 2047, 194, 216, 1247, 1245, 1243, 1240, 227, 1237, 1255, 2310, 2302, 2300, 2286, 2284, 2281, 565, 563, 561, 558, 575, 1589, 2261, 2259, 2256, 2253, 1542, 521, 519, 517, 514, 2270, 511, 533, 1569, 1567, 2223, 2221, 2218, 2215, 1483, 2211, 1480, 459, 456, 453, 2232, 449, 474, 491, 1527, 1525, 1522, 2475, 2467, 2465, 2451, 2449, 2446, 801, 800, 2426, 2424, 2421, 2418, 1723, 2435, 780, 778, 775, 2387, 2385, 2382, 2379, 1695, 2375, 1693, 2396, 735, 733, 730, 727, 749, 1718, 2616, 2615, 2604, 2603, 2601, 2584, 2583, 2581, 2579, 1800, 2591, 2550, 2549, 2547, 2545, 1792, 2542, 1790, 2558, 929, 2719, 1841, 2710, 2708, 1833, 1831, 2690, 2688, 2686, 1815, 1809, 1808, 1774, 1756, 1754, 1737, 1736, 1734, 1739, 1816, 1711, 1676, 1674, 633, 629, 1638, 1636, 1633, 1641, 598, 1605, 1604, 1602, 1600, 605, 1609, 1607, 2327, 887, 853, 1775, 822, 820, 1757, 1755, 1584, 524, 1560, 1558, 468, 464, 1514, 1511, 1508, 1519, 408, 404, 400, 1452, 1447, 1444, 417, 1458, 1455, 2208, 364, 361, 358, 2154, 1401, 1400, 1398, 1396, 374, 1393, 371, 1408, 1406, 1403, 1413, 2173, 2172, 772, 726, 723, 1712, 672, 669, 666, 682, 1678, 1675, 625, 623, 621, 618, 2331, 636, 632, 1639, 1637, 1635, 920, 918, 884, 880, 889, 849, 848, 847, 846, 2497, 855, 852, 1776, 2641, 2742, 2787, 1380, 334, 1367, 1365, 301, 297, 1340, 1338, 1335, 1343, 255, 251, 247, 1296, 1291, 1288, 265, 1302, 1299, 2113, 204, 196, 192, 2042, 1232, 1230, 1224, 214, 1220, 210, 1242, 1239, 1235, 1250, 2077, 2075, 151, 148, 1993, 144, 1990, 1163, 1162, 1160, 1158, 1155, 161, 1152, 157, 1173, 1171, 1168, 1165, 168, 1181, 1178, 2021, 2020, 2018, 2023, 585, 560, 557, 1585, 516, 509, 1562, 1559, 458, 447, 2227, 472, 1516, 1513, 1510, 398, 396, 393, 390, 2181, 386, 2178, 407, 1453, 1451, 1449, 1446, 420, 1460, 2209, 769, 764, 720, 712, 2391, 729, 1713, 664, 663, 661, 659, 2352, 656, 2349, 671, 1679, 1677, 2553, 922, 919, 2519, 2516, 885, 883, 881, 2685, 2661, 2659, 2767, 2756, 2755, 140, 1137, 1136, 130, 127, 1125, 1124, 1122, 1127, 109, 106, 102, 1103, 1102, 1100, 1098, 116, 1107, 1105, 1980, 80, 76, 73, 1947, 1068, 1067, 1065, 1063, 90, 1060, 87, 1075, 1073, 1070, 1080, 1966, 1965, 46, 43, 40, 1912, 36, 1909, 1019, 1018, 1016, 1014, 58, 1011, 55, 1008, 51, 1029, 1027, 1024, 1021, 63, 1037, 1034, 1940, 1939, 1937, 1942, 8, 1866, 4, 1863, 1, 1860, 956, 954, 952, 949, 946, 17, 14, 969, 967, 964, 961, 27, 957, 24, 979, 976, 972, 1901, 1900, 1898, 1896, 986, 1905, 1903, 350, 349, 1381, 329, 327, 324, 1368, 1366, 292, 290, 287, 284, 2118, 304, 1341, 1339, 1337, 1345, 243, 240, 237, 2086, 233, 2083, 254, 1297, 1295, 1293, 1290, 1304, 2114, 190, 187, 184, 2034, 180, 2031, 177, 2027, 199, 1233, 1231, 1229, 1226, 217, 1223, 1241, 2078, 2076, 584, 555, 554, 552, 550, 2282, 562, 1586, 507, 506, 504, 502, 2257, 499, 2254, 515, 1563, 1561, 445, 443, 441, 2219, 438, 2216, 435, 2212, 460, 454, 475, 1517, 1515, 1512, 2447, 798, 797, 2422, 2419, 770, 768, 766, 2383, 2380, 2376, 721, 719, 717, 714, 731, 1714, 2602, 2582, 2580, 2548, 2546, 2543, 923, 921, 2717, 2706, 2705, 2683, 2682, 2680, 1771, 1752, 1750, 1733, 1732, 1731, 1735, 1814, 1707, 1670, 1668, 1631, 1629, 1626, 1634, 1599, 1598, 1596, 1594, 1603, 1601, 2326, 1772, 1753, 1751, 1581, 1554, 1552, 1504, 1501, 1498, 1509, 1442, 1437, 1434, 401, 1448, 1445, 2206, 1392, 1391, 1389, 1387, 1384, 359, 1399, 1397, 1394, 1404, 2171, 2170, 1708, 1672, 1669, 619, 1632, 1630, 1628, 1773, 1378, 1363, 1361, 1333, 1328, 1336, 1286, 1281, 1278, 248, 1292, 1289, 2111, 1218, 1216, 1210, 197, 1206, 193, 1228, 1225, 1221, 1236, 2073, 2071, 1151, 1150, 1148, 1146, 152, 1143, 149, 1140, 145, 1161, 1159, 1156, 1153, 158, 1169, 1166, 2017, 2016, 2014, 2019, 1582, 510, 1556, 1553, 452, 448, 1506, 1500, 394, 391, 387, 1443, 1441, 1439, 1436, 1450, 2207, 765, 716, 713, 1709, 662, 660, 657, 1673, 1671, 916, 914, 879, 878, 877, 882, 1135, 1134, 1121, 1120, 1118, 1123, 1097, 1096, 1094, 1092, 103, 1101, 1099, 1979, 1059, 1058, 1056, 1054, 77, 1051, 74, 1066, 1064, 1061, 1071, 1964, 1963, 1007, 1006, 1004, 1002, 999, 41, 996, 37, 1017, 1015, 1012, 1009, 52, 1025, 1022, 1936, 1935, 1933, 1938, 942, 940, 938, 935, 932, 5, 2, 955, 953, 950, 947, 18, 943, 15, 965, 962, 958, 1895, 1894, 1892, 1890, 973, 1899, 1897, 1379, 325, 1364, 1362, 288, 285, 1334, 1332, 1330, 241, 238, 234, 1287, 1285, 1283, 1280, 1294, 2112, 188, 185, 181, 178, 2028, 1219, 1217, 1215, 1212, 200, 1209, 1227, 2074, 2072, 583, 553, 551, 1583, 505, 503, 500, 513, 1557, 1555, 444, 442, 439, 436, 2213, 455, 451, 1507, 1505, 1502, 796, 763, 762, 760, 767, 711, 710, 708, 706, 2377, 718, 715, 1710, 2544, 917, 915, 2681, 1627, 1597, 1595, 2325, 1769, 1749, 1747, 1499, 1438, 1435, 2204, 1390, 1388, 1385, 1395, 2169, 2167, 1704, 1665, 1662, 1625, 1623, 1620, 1770, 1329, 1282, 1279, 2109, 1214, 1207, 1222, 2068, 2065, 1149, 1147, 1144, 1141, 146, 1157, 1154, 2013, 2011, 2008, 2015, 1579, 1549, 1546, 1495, 1487, 1433, 1431, 1428, 1425, 388, 1440, 2205, 1705, 658, 1667, 1664, 1119, 1095, 1093, 1978, 1057, 1055, 1052, 1062, 1962, 1960, 1005, 1003, 1000, 997, 38, 1013, 1010, 1932, 1930, 1927, 1934, 941, 939, 936, 933, 6, 930, 3, 951, 948, 944, 1889, 1887, 1884, 1881, 959, 1893, 1891, 35, 1377, 1360, 1358, 1327, 1325, 1322, 1331, 1277, 1275, 1272, 1269, 235, 1284, 2110, 1205, 1204, 1201, 1198, 182, 1195, 179, 1213, 2070, 2067, 1580, 501, 1551, 1548, 440, 437, 1497, 1494, 1490, 1503, 761, 709, 707, 1706, 913, 912, 2198, 1386, 2164, 2161, 1621, 1766, 2103, 1208, 2058, 2054, 1145, 1142, 2005, 2002, 1999, 2009, 1488, 1429, 1426, 2200, 1698, 1659, 1656, 1975, 1053, 1957, 1954, 1001, 998, 1924, 1921, 1918, 1928, 937, 934, 931, 1879, 1876, 1873, 1870, 945, 1885, 1882, 1323, 1273, 1270, 2105, 1202, 1199, 1196, 1211, 2061, 2057, 1576, 1543, 1540, 1484, 1481, 1478, 1491, 1700]);
- return PDF417Common;
- }();
- var _default = PDF417Common;
- exports.default = _default;
- /***/ }),
- /* 435 */
- /*!********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/detector/Detector.js ***!
- \********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../../ResultPoint */ 346));
- var _System = _interopRequireDefault(__webpack_require__(/*! ../../util/System */ 315));
- var _Arrays = _interopRequireDefault(__webpack_require__(/*! ../../util/Arrays */ 314));
- var _PDF417DetectorResult = _interopRequireDefault(__webpack_require__(/*! ./PDF417DetectorResult */ 436));
- /*
- * Copyright 2009 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- // import com.google.zxing.NotFoundException;
- // import com.google.zxing.ResultPoint;
- // import java.util.ArrayList;
- // import java.util.Arrays;
- // import java.util.List;
- // import java.util.Map;
- /**
- * <p>Encapsulates logic that can detect a PDF417 Code in an image, even if the
- * PDF417 Code is rotated or skewed, or partially obscured.</p>
- *
- * @author SITA Lab (kevin.osullivan@sita.aero)
- * @author dswitkin@google.com (Daniel Switkin)
- * @author Guenther Grau
- */
- var Detector = /** @class */function () {
- function Detector() {}
- /**
- * <p>Detects a PDF417 Code in an image. Only checks 0 and 180 degree rotations.</p>
- *
- * @param image barcode image to decode
- * @param hints optional hints to detector
- * @param multiple if true, then the image is searched for multiple codes. If false, then at most one code will
- * be found and returned
- * @return {@link PDF417DetectorResult} encapsulating results of detecting a PDF417 code
- * @throws NotFoundException if no PDF417 Code can be found
- */
- Detector.detectMultiple = function (image, hints, multiple) {
- // TODO detection improvement, tryHarder could try several different luminance thresholds/blackpoints or even
- // different binarizers
- // boolean tryHarder = hints != null && hints.containsKey(DecodeHintType.TRY_HARDER);
- var bitMatrix = image.getBlackMatrix();
- var barcodeCoordinates = Detector.detect(multiple, bitMatrix);
- if (!barcodeCoordinates.length) {
- bitMatrix = bitMatrix.clone();
- bitMatrix.rotate180();
- barcodeCoordinates = Detector.detect(multiple, bitMatrix);
- }
- return new _PDF417DetectorResult.default(bitMatrix, barcodeCoordinates);
- };
- /**
- * Detects PDF417 codes in an image. Only checks 0 degree rotation
- * @param multiple if true, then the image is searched for multiple codes. If false, then at most one code will
- * be found and returned
- * @param bitMatrix bit matrix to detect barcodes in
- * @return List of ResultPoint arrays containing the coordinates of found barcodes
- */
- Detector.detect = function (multiple, bitMatrix) {
- var e_1, _a;
- var barcodeCoordinates = new Array();
- var row = 0;
- var column = 0;
- var foundBarcodeInRow = false;
- while (row < bitMatrix.getHeight()) {
- var vertices = Detector.findVertices(bitMatrix, row, column);
- if (vertices[0] == null && vertices[3] == null) {
- if (!foundBarcodeInRow) {
- // we didn't find any barcode so that's the end of searching
- break;
- }
- // we didn't find a barcode starting at the given column and row. Try again from the first column and slightly
- // below the lowest barcode we found so far.
- foundBarcodeInRow = false;
- column = 0;
- try {
- for (var barcodeCoordinates_1 = (e_1 = void 0, __values(barcodeCoordinates)), barcodeCoordinates_1_1 = barcodeCoordinates_1.next(); !barcodeCoordinates_1_1.done; barcodeCoordinates_1_1 = barcodeCoordinates_1.next()) {
- var barcodeCoordinate = barcodeCoordinates_1_1.value;
- if (barcodeCoordinate[1] != null) {
- row = Math.trunc(Math.max(row, barcodeCoordinate[1].getY()));
- }
- if (barcodeCoordinate[3] != null) {
- row = Math.max(row, Math.trunc(barcodeCoordinate[3].getY()));
- }
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (barcodeCoordinates_1_1 && !barcodeCoordinates_1_1.done && (_a = barcodeCoordinates_1.return)) _a.call(barcodeCoordinates_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- row += Detector.ROW_STEP;
- continue;
- }
- foundBarcodeInRow = true;
- barcodeCoordinates.push(vertices);
- if (!multiple) {
- break;
- }
- // if we didn't find a right row indicator column, then continue the search for the next barcode after the
- // start pattern of the barcode just found.
- if (vertices[2] != null) {
- column = Math.trunc(vertices[2].getX());
- row = Math.trunc(vertices[2].getY());
- } else {
- column = Math.trunc(vertices[4].getX());
- row = Math.trunc(vertices[4].getY());
- }
- }
- return barcodeCoordinates;
- };
- /**
- * Locate the vertices and the codewords area of a black blob using the Start
- * and Stop patterns as locators.
- *
- * @param matrix the scanned barcode image.
- * @return an array containing the vertices:
- * vertices[0] x, y top left barcode
- * vertices[1] x, y bottom left barcode
- * vertices[2] x, y top right barcode
- * vertices[3] x, y bottom right barcode
- * vertices[4] x, y top left codeword area
- * vertices[5] x, y bottom left codeword area
- * vertices[6] x, y top right codeword area
- * vertices[7] x, y bottom right codeword area
- */
- Detector.findVertices = function (matrix, startRow, startColumn) {
- var height = matrix.getHeight();
- var width = matrix.getWidth();
- // const result = new ResultPoint[8];
- var result = new Array(8);
- Detector.copyToResult(result, Detector.findRowsWithPattern(matrix, height, width, startRow, startColumn, Detector.START_PATTERN), Detector.INDEXES_START_PATTERN);
- if (result[4] != null) {
- startColumn = Math.trunc(result[4].getX());
- startRow = Math.trunc(result[4].getY());
- }
- Detector.copyToResult(result, Detector.findRowsWithPattern(matrix, height, width, startRow, startColumn, Detector.STOP_PATTERN), Detector.INDEXES_STOP_PATTERN);
- return result;
- };
- Detector.copyToResult = function (result, tmpResult, destinationIndexes) {
- for (var i = 0; i < destinationIndexes.length; i++) {
- result[destinationIndexes[i]] = tmpResult[i];
- }
- };
- Detector.findRowsWithPattern = function (matrix, height, width, startRow, startColumn, pattern) {
- // const result = new ResultPoint[4];
- var result = new Array(4);
- var found = false;
- var counters = new Int32Array(pattern.length);
- for (; startRow < height; startRow += Detector.ROW_STEP) {
- var loc = Detector.findGuardPattern(matrix, startColumn, startRow, width, false, pattern, counters);
- if (loc != null) {
- while (startRow > 0) {
- var previousRowLoc = Detector.findGuardPattern(matrix, startColumn, --startRow, width, false, pattern, counters);
- if (previousRowLoc != null) {
- loc = previousRowLoc;
- } else {
- startRow++;
- break;
- }
- }
- result[0] = new _ResultPoint.default(loc[0], startRow);
- result[1] = new _ResultPoint.default(loc[1], startRow);
- found = true;
- break;
- }
- }
- var stopRow = startRow + 1;
- // Last row of the current symbol that contains pattern
- if (found) {
- var skippedRowCount = 0;
- var previousRowLoc = Int32Array.from([Math.trunc(result[0].getX()), Math.trunc(result[1].getX())]);
- for (; stopRow < height; stopRow++) {
- var loc = Detector.findGuardPattern(matrix, previousRowLoc[0], stopRow, width, false, pattern, counters);
- // a found pattern is only considered to belong to the same barcode if the start and end positions
- // don't differ too much. Pattern drift should be not bigger than two for consecutive rows. With
- // a higher number of skipped rows drift could be larger. To keep it simple for now, we allow a slightly
- // larger drift and don't check for skipped rows.
- if (loc != null && Math.abs(previousRowLoc[0] - loc[0]) < Detector.MAX_PATTERN_DRIFT && Math.abs(previousRowLoc[1] - loc[1]) < Detector.MAX_PATTERN_DRIFT) {
- previousRowLoc = loc;
- skippedRowCount = 0;
- } else {
- if (skippedRowCount > Detector.SKIPPED_ROW_COUNT_MAX) {
- break;
- } else {
- skippedRowCount++;
- }
- }
- }
- stopRow -= skippedRowCount + 1;
- result[2] = new _ResultPoint.default(previousRowLoc[0], stopRow);
- result[3] = new _ResultPoint.default(previousRowLoc[1], stopRow);
- }
- if (stopRow - startRow < Detector.BARCODE_MIN_HEIGHT) {
- _Arrays.default.fill(result, null);
- }
- return result;
- };
- /**
- * @param matrix row of black/white values to search
- * @param column x position to start search
- * @param row y position to start search
- * @param width the number of pixels to search on this row
- * @param pattern pattern of counts of number of black and white pixels that are
- * being searched for as a pattern
- * @param counters array of counters, as long as pattern, to re-use
- * @return start/end horizontal offset of guard pattern, as an array of two ints.
- */
- Detector.findGuardPattern = function (matrix, column, row, width, whiteFirst, pattern, counters) {
- _Arrays.default.fillWithin(counters, 0, counters.length, 0);
- var patternStart = column;
- var pixelDrift = 0;
- // if there are black pixels left of the current pixel shift to the left, but only for MAX_PIXEL_DRIFT pixels
- while (matrix.get(patternStart, row) && patternStart > 0 && pixelDrift++ < Detector.MAX_PIXEL_DRIFT) {
- patternStart--;
- }
- var x = patternStart;
- var counterPosition = 0;
- var patternLength = pattern.length;
- for (var isWhite = whiteFirst; x < width; x++) {
- var pixel = matrix.get(x, row);
- if (pixel !== isWhite) {
- counters[counterPosition]++;
- } else {
- if (counterPosition === patternLength - 1) {
- if (Detector.patternMatchVariance(counters, pattern, Detector.MAX_INDIVIDUAL_VARIANCE) < Detector.MAX_AVG_VARIANCE) {
- return new Int32Array([patternStart, x]);
- }
- patternStart += counters[0] + counters[1];
- _System.default.arraycopy(counters, 2, counters, 0, counterPosition - 1);
- counters[counterPosition - 1] = 0;
- counters[counterPosition] = 0;
- counterPosition--;
- } else {
- counterPosition++;
- }
- counters[counterPosition] = 1;
- isWhite = !isWhite;
- }
- }
- if (counterPosition === patternLength - 1 && Detector.patternMatchVariance(counters, pattern, Detector.MAX_INDIVIDUAL_VARIANCE) < Detector.MAX_AVG_VARIANCE) {
- return new Int32Array([patternStart, x - 1]);
- }
- return null;
- };
- /**
- * Determines how closely a set of observed counts of runs of black/white
- * values matches a given target pattern. This is reported as the ratio of
- * the total variance from the expected pattern proportions across all
- * pattern elements, to the length of the pattern.
- *
- * @param counters observed counters
- * @param pattern expected pattern
- * @param maxIndividualVariance The most any counter can differ before we give up
- * @return ratio of total variance between counters and pattern compared to total pattern size
- */
- Detector.patternMatchVariance = function (counters, pattern, maxIndividualVariance) {
- var numCounters = counters.length;
- var total = 0;
- var patternLength = 0;
- for (var i = 0; i < numCounters; i++) {
- total += counters[i];
- patternLength += pattern[i];
- }
- if (total < patternLength) {
- // If we don't even have one pixel per unit of bar width, assume this
- // is too small to reliably match, so fail:
- return (/*Float.POSITIVE_INFINITY*/Infinity
- );
- }
- // We're going to fake floating-point math in integers. We just need to use more bits.
- // Scale up patternLength so that intermediate values below like scaledCounter will have
- // more "significant digits".
- var unitBarWidth = total / patternLength;
- maxIndividualVariance *= unitBarWidth;
- var totalVariance = 0.0;
- for (var x = 0; x < numCounters; x++) {
- var counter = counters[x];
- var scaledPattern = pattern[x] * unitBarWidth;
- var variance = counter > scaledPattern ? counter - scaledPattern : scaledPattern - counter;
- if (variance > maxIndividualVariance) {
- return (/*Float.POSITIVE_INFINITY*/Infinity
- );
- }
- totalVariance += variance;
- }
- return totalVariance / total;
- };
- Detector.INDEXES_START_PATTERN = Int32Array.from([0, 4, 1, 5]);
- Detector.INDEXES_STOP_PATTERN = Int32Array.from([6, 2, 7, 3]);
- Detector.MAX_AVG_VARIANCE = 0.42;
- Detector.MAX_INDIVIDUAL_VARIANCE = 0.8;
- // B S B S B S B S Bar/Space pattern
- // 11111111 0 1 0 1 0 1 000
- Detector.START_PATTERN = Int32Array.from([8, 1, 1, 1, 1, 1, 1, 3]);
- // 1111111 0 1 000 1 0 1 00 1
- Detector.STOP_PATTERN = Int32Array.from([7, 1, 1, 3, 1, 1, 1, 2, 1]);
- Detector.MAX_PIXEL_DRIFT = 3;
- Detector.MAX_PATTERN_DRIFT = 5;
- // if we set the value too low, then we don't detect the correct height of the bar if the start patterns are damaged.
- // if we set the value too high, then we might detect the start pattern from a neighbor barcode.
- Detector.SKIPPED_ROW_COUNT_MAX = 25;
- // A PDF471 barcode should have at least 3 rows, with each row being >= 3 times the module width. Therefore it should be at least
- // 9 pixels tall. To be conservative, we use about half the size to ensure we don't miss it.
- Detector.ROW_STEP = 5;
- Detector.BARCODE_MIN_HEIGHT = 10;
- return Detector;
- }();
- var _default = Detector;
- exports.default = _default;
- /***/ }),
- /* 436 */
- /*!********************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/detector/PDF417DetectorResult.js ***!
- \********************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- /*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- // import java.util.List;
- /**
- * @author Guenther Grau
- */
- var PDF417DetectorResult = /** @class */function () {
- function PDF417DetectorResult(bits, points) {
- this.bits = bits;
- this.points = points;
- }
- PDF417DetectorResult.prototype.getBits = function () {
- return this.bits;
- };
- PDF417DetectorResult.prototype.getPoints = function () {
- return this.points;
- };
- return PDF417DetectorResult;
- }();
- var _default = PDF417DetectorResult;
- exports.default = _default;
- /***/ }),
- /* 437 */
- /*!********************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/decoder/PDF417ScanningDecoder.js ***!
- \********************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _ChecksumException = _interopRequireDefault(__webpack_require__(/*! ../../ChecksumException */ 309));
- var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../../FormatException */ 324));
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../NotFoundException */ 327));
- var _MathUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/detector/MathUtils */ 347));
- var _PDF417Common = _interopRequireDefault(__webpack_require__(/*! ../PDF417Common */ 434));
- var _ErrorCorrection = _interopRequireDefault(__webpack_require__(/*! ./ec/ErrorCorrection */ 438));
- var _BoundingBox = _interopRequireDefault(__webpack_require__(/*! ./BoundingBox */ 442));
- var _DetectionResultRowIndicatorColumn = _interopRequireDefault(__webpack_require__(/*! ./DetectionResultRowIndicatorColumn */ 443));
- var _DetectionResult = _interopRequireDefault(__webpack_require__(/*! ./DetectionResult */ 448));
- var _DetectionResultColumn = _interopRequireDefault(__webpack_require__(/*! ./DetectionResultColumn */ 445));
- var _Codeword = _interopRequireDefault(__webpack_require__(/*! ./Codeword */ 449));
- var _BarcodeValue = _interopRequireDefault(__webpack_require__(/*! ./BarcodeValue */ 447));
- var _PDF417CodewordDecoder = _interopRequireDefault(__webpack_require__(/*! ./PDF417CodewordDecoder */ 450));
- var _DecodedBitStreamParser = _interopRequireDefault(__webpack_require__(/*! ./DecodedBitStreamParser */ 451));
- var _Formatter = _interopRequireDefault(__webpack_require__(/*! ../../util/Formatter */ 446));
- /*
- * Copyright 2013 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- // package com.google.zxing.pdf417.decoder;
- // import com.google.zxing.ChecksumException;
- // import java.util.ArrayList;
- // import java.util.Collection;
- // import java.util.Formatter;
- // import java.util.List;
- /**
- * @author Guenther Grau
- */
- var PDF417ScanningDecoder = /** @class */function () {
- function PDF417ScanningDecoder() {}
- /**
- * @TODO don't pass in minCodewordWidth and maxCodewordWidth, pass in barcode columns for start and stop pattern
- *
- * columns. That way width can be deducted from the pattern column.
- * This approach also allows to detect more details about the barcode, e.g. if a bar type (white or black) is wider
- * than it should be. This can happen if the scanner used a bad blackpoint.
- *
- * @param BitMatrix
- * @param image
- * @param ResultPoint
- * @param imageTopLeft
- * @param ResultPoint
- * @param imageBottomLeft
- * @param ResultPoint
- * @param imageTopRight
- * @param ResultPoint
- * @param imageBottomRight
- * @param int
- * @param minCodewordWidth
- * @param int
- * @param maxCodewordWidth
- *
- * @throws NotFoundException
- * @throws FormatException
- * @throws ChecksumException
- */
- PDF417ScanningDecoder.decode = function (image, imageTopLeft, imageBottomLeft, imageTopRight, imageBottomRight, minCodewordWidth, maxCodewordWidth) {
- var boundingBox = new _BoundingBox.default(image, imageTopLeft, imageBottomLeft, imageTopRight, imageBottomRight);
- var leftRowIndicatorColumn = null;
- var rightRowIndicatorColumn = null;
- var detectionResult;
- for (var firstPass /*boolean*/ = true;; firstPass = false) {
- if (imageTopLeft != null) {
- leftRowIndicatorColumn = PDF417ScanningDecoder.getRowIndicatorColumn(image, boundingBox, imageTopLeft, true, minCodewordWidth, maxCodewordWidth);
- }
- if (imageTopRight != null) {
- rightRowIndicatorColumn = PDF417ScanningDecoder.getRowIndicatorColumn(image, boundingBox, imageTopRight, false, minCodewordWidth, maxCodewordWidth);
- }
- detectionResult = PDF417ScanningDecoder.merge(leftRowIndicatorColumn, rightRowIndicatorColumn);
- if (detectionResult == null) {
- throw _NotFoundException.default.getNotFoundInstance();
- }
- var resultBox = detectionResult.getBoundingBox();
- if (firstPass && resultBox != null && (resultBox.getMinY() < boundingBox.getMinY() || resultBox.getMaxY() > boundingBox.getMaxY())) {
- boundingBox = resultBox;
- } else {
- break;
- }
- }
- detectionResult.setBoundingBox(boundingBox);
- var maxBarcodeColumn = detectionResult.getBarcodeColumnCount() + 1;
- detectionResult.setDetectionResultColumn(0, leftRowIndicatorColumn);
- detectionResult.setDetectionResultColumn(maxBarcodeColumn, rightRowIndicatorColumn);
- var leftToRight = leftRowIndicatorColumn != null;
- for (var barcodeColumnCount /*int*/ = 1; barcodeColumnCount <= maxBarcodeColumn; barcodeColumnCount++) {
- var barcodeColumn = leftToRight ? barcodeColumnCount : maxBarcodeColumn - barcodeColumnCount;
- if (detectionResult.getDetectionResultColumn(barcodeColumn) !== /* null */undefined) {
- // This will be the case for the opposite row indicator column, which doesn't need to be decoded again.
- continue;
- }
- var detectionResultColumn = void 0;
- if (barcodeColumn === 0 || barcodeColumn === maxBarcodeColumn) {
- detectionResultColumn = new _DetectionResultRowIndicatorColumn.default(boundingBox, barcodeColumn === 0);
- } else {
- detectionResultColumn = new _DetectionResultColumn.default(boundingBox);
- }
- detectionResult.setDetectionResultColumn(barcodeColumn, detectionResultColumn);
- var startColumn = -1;
- var previousStartColumn = startColumn;
- // TODO start at a row for which we know the start position, then detect upwards and downwards from there.
- for (var imageRow /*int*/ = boundingBox.getMinY(); imageRow <= boundingBox.getMaxY(); imageRow++) {
- startColumn = PDF417ScanningDecoder.getStartColumn(detectionResult, barcodeColumn, imageRow, leftToRight);
- if (startColumn < 0 || startColumn > boundingBox.getMaxX()) {
- if (previousStartColumn === -1) {
- continue;
- }
- startColumn = previousStartColumn;
- }
- var codeword = PDF417ScanningDecoder.detectCodeword(image, boundingBox.getMinX(), boundingBox.getMaxX(), leftToRight, startColumn, imageRow, minCodewordWidth, maxCodewordWidth);
- if (codeword != null) {
- detectionResultColumn.setCodeword(imageRow, codeword);
- previousStartColumn = startColumn;
- minCodewordWidth = Math.min(minCodewordWidth, codeword.getWidth());
- maxCodewordWidth = Math.max(maxCodewordWidth, codeword.getWidth());
- }
- }
- }
- return PDF417ScanningDecoder.createDecoderResult(detectionResult);
- };
- /**
- *
- * @param leftRowIndicatorColumn
- * @param rightRowIndicatorColumn
- *
- * @throws NotFoundException
- */
- PDF417ScanningDecoder.merge = function (leftRowIndicatorColumn, rightRowIndicatorColumn) {
- if (leftRowIndicatorColumn == null && rightRowIndicatorColumn == null) {
- return null;
- }
- var barcodeMetadata = PDF417ScanningDecoder.getBarcodeMetadata(leftRowIndicatorColumn, rightRowIndicatorColumn);
- if (barcodeMetadata == null) {
- return null;
- }
- var boundingBox = _BoundingBox.default.merge(PDF417ScanningDecoder.adjustBoundingBox(leftRowIndicatorColumn), PDF417ScanningDecoder.adjustBoundingBox(rightRowIndicatorColumn));
- return new _DetectionResult.default(barcodeMetadata, boundingBox);
- };
- /**
- *
- * @param rowIndicatorColumn
- *
- * @throws NotFoundException
- */
- PDF417ScanningDecoder.adjustBoundingBox = function (rowIndicatorColumn) {
- var e_1, _a;
- if (rowIndicatorColumn == null) {
- return null;
- }
- var rowHeights = rowIndicatorColumn.getRowHeights();
- if (rowHeights == null) {
- return null;
- }
- var maxRowHeight = PDF417ScanningDecoder.getMax(rowHeights);
- var missingStartRows = 0;
- try {
- for (var rowHeights_1 = __values(rowHeights), rowHeights_1_1 = rowHeights_1.next(); !rowHeights_1_1.done; rowHeights_1_1 = rowHeights_1.next()) {
- var rowHeight = rowHeights_1_1.value /*int*/;
- missingStartRows += maxRowHeight - rowHeight;
- if (rowHeight > 0) {
- break;
- }
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (rowHeights_1_1 && !rowHeights_1_1.done && (_a = rowHeights_1.return)) _a.call(rowHeights_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- var codewords = rowIndicatorColumn.getCodewords();
- for (var row /*int*/ = 0; missingStartRows > 0 && codewords[row] == null; row++) {
- missingStartRows--;
- }
- var missingEndRows = 0;
- for (var row /*int*/ = rowHeights.length - 1; row >= 0; row--) {
- missingEndRows += maxRowHeight - rowHeights[row];
- if (rowHeights[row] > 0) {
- break;
- }
- }
- for (var row /*int*/ = codewords.length - 1; missingEndRows > 0 && codewords[row] == null; row--) {
- missingEndRows--;
- }
- return rowIndicatorColumn.getBoundingBox().addMissingRows(missingStartRows, missingEndRows, rowIndicatorColumn.isLeft());
- };
- PDF417ScanningDecoder.getMax = function (values) {
- var e_2, _a;
- var maxValue = -1;
- try {
- for (var values_1 = __values(values), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) {
- var value = values_1_1.value /*int*/;
- maxValue = Math.max(maxValue, value);
- }
- } catch (e_2_1) {
- e_2 = {
- error: e_2_1
- };
- } finally {
- try {
- if (values_1_1 && !values_1_1.done && (_a = values_1.return)) _a.call(values_1);
- } finally {
- if (e_2) throw e_2.error;
- }
- }
- return maxValue;
- };
- PDF417ScanningDecoder.getBarcodeMetadata = function (leftRowIndicatorColumn, rightRowIndicatorColumn) {
- var leftBarcodeMetadata;
- if (leftRowIndicatorColumn == null || (leftBarcodeMetadata = leftRowIndicatorColumn.getBarcodeMetadata()) == null) {
- return rightRowIndicatorColumn == null ? null : rightRowIndicatorColumn.getBarcodeMetadata();
- }
- var rightBarcodeMetadata;
- if (rightRowIndicatorColumn == null || (rightBarcodeMetadata = rightRowIndicatorColumn.getBarcodeMetadata()) == null) {
- return leftBarcodeMetadata;
- }
- if (leftBarcodeMetadata.getColumnCount() !== rightBarcodeMetadata.getColumnCount() && leftBarcodeMetadata.getErrorCorrectionLevel() !== rightBarcodeMetadata.getErrorCorrectionLevel() && leftBarcodeMetadata.getRowCount() !== rightBarcodeMetadata.getRowCount()) {
- return null;
- }
- return leftBarcodeMetadata;
- };
- PDF417ScanningDecoder.getRowIndicatorColumn = function (image, boundingBox, startPoint, leftToRight, minCodewordWidth, maxCodewordWidth) {
- var rowIndicatorColumn = new _DetectionResultRowIndicatorColumn.default(boundingBox, leftToRight);
- for (var i /*int*/ = 0; i < 2; i++) {
- var increment = i === 0 ? 1 : -1;
- var startColumn = Math.trunc(Math.trunc(startPoint.getX()));
- for (var imageRow /*int*/ = Math.trunc(Math.trunc(startPoint.getY())); imageRow <= boundingBox.getMaxY() && imageRow >= boundingBox.getMinY(); imageRow += increment) {
- var codeword = PDF417ScanningDecoder.detectCodeword(image, 0, image.getWidth(), leftToRight, startColumn, imageRow, minCodewordWidth, maxCodewordWidth);
- if (codeword != null) {
- rowIndicatorColumn.setCodeword(imageRow, codeword);
- if (leftToRight) {
- startColumn = codeword.getStartX();
- } else {
- startColumn = codeword.getEndX();
- }
- }
- }
- }
- return rowIndicatorColumn;
- };
- /**
- *
- * @param detectionResult
- * @param BarcodeValue
- * @param param2
- * @param param3
- * @param barcodeMatrix
- *
- * @throws NotFoundException
- */
- PDF417ScanningDecoder.adjustCodewordCount = function (detectionResult, barcodeMatrix) {
- var barcodeMatrix01 = barcodeMatrix[0][1];
- var numberOfCodewords = barcodeMatrix01.getValue();
- var calculatedNumberOfCodewords = detectionResult.getBarcodeColumnCount() * detectionResult.getBarcodeRowCount() - PDF417ScanningDecoder.getNumberOfECCodeWords(detectionResult.getBarcodeECLevel());
- if (numberOfCodewords.length === 0) {
- if (calculatedNumberOfCodewords < 1 || calculatedNumberOfCodewords > _PDF417Common.default.MAX_CODEWORDS_IN_BARCODE) {
- throw _NotFoundException.default.getNotFoundInstance();
- }
- barcodeMatrix01.setValue(calculatedNumberOfCodewords);
- } else if (numberOfCodewords[0] !== calculatedNumberOfCodewords) {
- // The calculated one is more reliable as it is derived from the row indicator columns
- barcodeMatrix01.setValue(calculatedNumberOfCodewords);
- }
- };
- /**
- *
- * @param detectionResult
- *
- * @throws FormatException
- * @throws ChecksumException
- * @throws NotFoundException
- */
- PDF417ScanningDecoder.createDecoderResult = function (detectionResult) {
- var barcodeMatrix = PDF417ScanningDecoder.createBarcodeMatrix(detectionResult);
- PDF417ScanningDecoder.adjustCodewordCount(detectionResult, barcodeMatrix);
- var erasures /*Collection<Integer>*/ = new Array();
- var codewords = new Int32Array(detectionResult.getBarcodeRowCount() * detectionResult.getBarcodeColumnCount());
- var ambiguousIndexValuesList = /*List<int[]>*/[];
- var ambiguousIndexesList = /*Collection<Integer>*/new Array();
- for (var row /*int*/ = 0; row < detectionResult.getBarcodeRowCount(); row++) {
- for (var column /*int*/ = 0; column < detectionResult.getBarcodeColumnCount(); column++) {
- var values = barcodeMatrix[row][column + 1].getValue();
- var codewordIndex = row * detectionResult.getBarcodeColumnCount() + column;
- if (values.length === 0) {
- erasures.push(codewordIndex);
- } else if (values.length === 1) {
- codewords[codewordIndex] = values[0];
- } else {
- ambiguousIndexesList.push(codewordIndex);
- ambiguousIndexValuesList.push(values);
- }
- }
- }
- var ambiguousIndexValues = new Array(ambiguousIndexValuesList.length);
- for (var i /*int*/ = 0; i < ambiguousIndexValues.length; i++) {
- ambiguousIndexValues[i] = ambiguousIndexValuesList[i];
- }
- return PDF417ScanningDecoder.createDecoderResultFromAmbiguousValues(detectionResult.getBarcodeECLevel(), codewords, _PDF417Common.default.toIntArray(erasures), _PDF417Common.default.toIntArray(ambiguousIndexesList), ambiguousIndexValues);
- };
- /**
- * This method deals with the fact, that the decoding process doesn't always yield a single most likely value. The
- * current error correction implementation doesn't deal with erasures very well, so it's better to provide a value
- * for these ambiguous codewords instead of treating it as an erasure. The problem is that we don't know which of
- * the ambiguous values to choose. We try decode using the first value, and if that fails, we use another of the
- * ambiguous values and try to decode again. This usually only happens on very hard to read and decode barcodes,
- * so decoding the normal barcodes is not affected by this.
- *
- * @param erasureArray contains the indexes of erasures
- * @param ambiguousIndexes array with the indexes that have more than one most likely value
- * @param ambiguousIndexValues two dimensional array that contains the ambiguous values. The first dimension must
- * be the same length as the ambiguousIndexes array
- *
- * @throws FormatException
- * @throws ChecksumException
- */
- PDF417ScanningDecoder.createDecoderResultFromAmbiguousValues = function (ecLevel, codewords, erasureArray, ambiguousIndexes, ambiguousIndexValues) {
- var ambiguousIndexCount = new Int32Array(ambiguousIndexes.length);
- var tries = 100;
- while (tries-- > 0) {
- for (var i /*int*/ = 0; i < ambiguousIndexCount.length; i++) {
- codewords[ambiguousIndexes[i]] = ambiguousIndexValues[i][ambiguousIndexCount[i]];
- }
- try {
- return PDF417ScanningDecoder.decodeCodewords(codewords, ecLevel, erasureArray);
- } catch (err) {
- var ignored = err instanceof _ChecksumException.default;
- if (!ignored) {
- throw err;
- }
- }
- if (ambiguousIndexCount.length === 0) {
- throw _ChecksumException.default.getChecksumInstance();
- }
- for (var i /*int*/ = 0; i < ambiguousIndexCount.length; i++) {
- if (ambiguousIndexCount[i] < ambiguousIndexValues[i].length - 1) {
- ambiguousIndexCount[i]++;
- break;
- } else {
- ambiguousIndexCount[i] = 0;
- if (i === ambiguousIndexCount.length - 1) {
- throw _ChecksumException.default.getChecksumInstance();
- }
- }
- }
- }
- throw _ChecksumException.default.getChecksumInstance();
- };
- PDF417ScanningDecoder.createBarcodeMatrix = function (detectionResult) {
- var e_3, _a, e_4, _b;
- // let barcodeMatrix: BarcodeValue[][] =
- // new BarcodeValue[detectionResult.getBarcodeRowCount()][detectionResult.getBarcodeColumnCount() + 2];
- var barcodeMatrix = Array.from({
- length: detectionResult.getBarcodeRowCount()
- }, function () {
- return new Array(detectionResult.getBarcodeColumnCount() + 2);
- });
- for (var row /*int*/ = 0; row < barcodeMatrix.length; row++) {
- for (var column_1 /*int*/ = 0; column_1 < barcodeMatrix[row].length; column_1++) {
- barcodeMatrix[row][column_1] = new _BarcodeValue.default();
- }
- }
- var column = 0;
- try {
- for (var _c = __values(detectionResult.getDetectionResultColumns()), _d = _c.next(); !_d.done; _d = _c.next()) {
- var detectionResultColumn = _d.value /*DetectionResultColumn*/;
- if (detectionResultColumn != null) {
- try {
- for (var _e = (e_4 = void 0, __values(detectionResultColumn.getCodewords())), _f = _e.next(); !_f.done; _f = _e.next()) {
- var codeword = _f.value /*Codeword*/;
- if (codeword != null) {
- var rowNumber = codeword.getRowNumber();
- if (rowNumber >= 0) {
- if (rowNumber >= barcodeMatrix.length) {
- // We have more rows than the barcode metadata allows for, ignore them.
- continue;
- }
- barcodeMatrix[rowNumber][column].setValue(codeword.getValue());
- }
- }
- }
- } catch (e_4_1) {
- e_4 = {
- error: e_4_1
- };
- } finally {
- try {
- if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
- } finally {
- if (e_4) throw e_4.error;
- }
- }
- }
- column++;
- }
- } catch (e_3_1) {
- e_3 = {
- error: e_3_1
- };
- } finally {
- try {
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
- } finally {
- if (e_3) throw e_3.error;
- }
- }
- return barcodeMatrix;
- };
- PDF417ScanningDecoder.isValidBarcodeColumn = function (detectionResult, barcodeColumn) {
- return barcodeColumn >= 0 && barcodeColumn <= detectionResult.getBarcodeColumnCount() + 1;
- };
- PDF417ScanningDecoder.getStartColumn = function (detectionResult, barcodeColumn, imageRow, leftToRight) {
- var e_5, _a;
- var offset = leftToRight ? 1 : -1;
- var codeword = null;
- if (PDF417ScanningDecoder.isValidBarcodeColumn(detectionResult, barcodeColumn - offset)) {
- codeword = detectionResult.getDetectionResultColumn(barcodeColumn - offset).getCodeword(imageRow);
- }
- if (codeword != null) {
- return leftToRight ? codeword.getEndX() : codeword.getStartX();
- }
- codeword = detectionResult.getDetectionResultColumn(barcodeColumn).getCodewordNearby(imageRow);
- if (codeword != null) {
- return leftToRight ? codeword.getStartX() : codeword.getEndX();
- }
- if (PDF417ScanningDecoder.isValidBarcodeColumn(detectionResult, barcodeColumn - offset)) {
- codeword = detectionResult.getDetectionResultColumn(barcodeColumn - offset).getCodewordNearby(imageRow);
- }
- if (codeword != null) {
- return leftToRight ? codeword.getEndX() : codeword.getStartX();
- }
- var skippedColumns = 0;
- while (PDF417ScanningDecoder.isValidBarcodeColumn(detectionResult, barcodeColumn - offset)) {
- barcodeColumn -= offset;
- try {
- for (var _b = (e_5 = void 0, __values(detectionResult.getDetectionResultColumn(barcodeColumn).getCodewords())), _c = _b.next(); !_c.done; _c = _b.next()) {
- var previousRowCodeword = _c.value /*Codeword*/;
- if (previousRowCodeword != null) {
- return (leftToRight ? previousRowCodeword.getEndX() : previousRowCodeword.getStartX()) + offset * skippedColumns * (previousRowCodeword.getEndX() - previousRowCodeword.getStartX());
- }
- }
- } catch (e_5_1) {
- e_5 = {
- error: e_5_1
- };
- } finally {
- try {
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
- } finally {
- if (e_5) throw e_5.error;
- }
- }
- skippedColumns++;
- }
- return leftToRight ? detectionResult.getBoundingBox().getMinX() : detectionResult.getBoundingBox().getMaxX();
- };
- PDF417ScanningDecoder.detectCodeword = function (image, minColumn, maxColumn, leftToRight, startColumn, imageRow, minCodewordWidth, maxCodewordWidth) {
- startColumn = PDF417ScanningDecoder.adjustCodewordStartColumn(image, minColumn, maxColumn, leftToRight, startColumn, imageRow);
- // we usually know fairly exact now how long a codeword is. We should provide minimum and maximum expected length
- // and try to adjust the read pixels, e.g. remove single pixel errors or try to cut off exceeding pixels.
- // min and maxCodewordWidth should not be used as they are calculated for the whole barcode an can be inaccurate
- // for the current position
- var moduleBitCount = PDF417ScanningDecoder.getModuleBitCount(image, minColumn, maxColumn, leftToRight, startColumn, imageRow);
- if (moduleBitCount == null) {
- return null;
- }
- var endColumn;
- var codewordBitCount = _MathUtils.default.sum(moduleBitCount);
- if (leftToRight) {
- endColumn = startColumn + codewordBitCount;
- } else {
- for (var i /*int*/ = 0; i < moduleBitCount.length / 2; i++) {
- var tmpCount = moduleBitCount[i];
- moduleBitCount[i] = moduleBitCount[moduleBitCount.length - 1 - i];
- moduleBitCount[moduleBitCount.length - 1 - i] = tmpCount;
- }
- endColumn = startColumn;
- startColumn = endColumn - codewordBitCount;
- }
- // TODO implement check for width and correction of black and white bars
- // use start (and maybe stop pattern) to determine if black bars are wider than white bars. If so, adjust.
- // should probably done only for codewords with a lot more than 17 bits.
- // The following fixes 10-1.png, which has wide black bars and small white bars
- // for (let i /*int*/ = 0; i < moduleBitCount.length; i++) {
- // if (i % 2 === 0) {
- // moduleBitCount[i]--;
- // } else {
- // moduleBitCount[i]++;
- // }
- // }
- // We could also use the width of surrounding codewords for more accurate results, but this seems
- // sufficient for now
- if (!PDF417ScanningDecoder.checkCodewordSkew(codewordBitCount, minCodewordWidth, maxCodewordWidth)) {
- // We could try to use the startX and endX position of the codeword in the same column in the previous row,
- // create the bit count from it and normalize it to 8. This would help with single pixel errors.
- return null;
- }
- var decodedValue = _PDF417CodewordDecoder.default.getDecodedValue(moduleBitCount);
- var codeword = _PDF417Common.default.getCodeword(decodedValue);
- if (codeword === -1) {
- return null;
- }
- return new _Codeword.default(startColumn, endColumn, PDF417ScanningDecoder.getCodewordBucketNumber(decodedValue), codeword);
- };
- PDF417ScanningDecoder.getModuleBitCount = function (image, minColumn, maxColumn, leftToRight, startColumn, imageRow) {
- var imageColumn = startColumn;
- var moduleBitCount = new Int32Array(8);
- var moduleNumber = 0;
- var increment = leftToRight ? 1 : -1;
- var previousPixelValue = leftToRight;
- while ((leftToRight ? imageColumn < maxColumn : imageColumn >= minColumn) && moduleNumber < moduleBitCount.length) {
- if (image.get(imageColumn, imageRow) === previousPixelValue) {
- moduleBitCount[moduleNumber]++;
- imageColumn += increment;
- } else {
- moduleNumber++;
- previousPixelValue = !previousPixelValue;
- }
- }
- if (moduleNumber === moduleBitCount.length || imageColumn === (leftToRight ? maxColumn : minColumn) && moduleNumber === moduleBitCount.length - 1) {
- return moduleBitCount;
- }
- return null;
- };
- PDF417ScanningDecoder.getNumberOfECCodeWords = function (barcodeECLevel) {
- return 2 << barcodeECLevel;
- };
- PDF417ScanningDecoder.adjustCodewordStartColumn = function (image, minColumn, maxColumn, leftToRight, codewordStartColumn, imageRow) {
- var correctedStartColumn = codewordStartColumn;
- var increment = leftToRight ? -1 : 1;
- // there should be no black pixels before the start column. If there are, then we need to start earlier.
- for (var i /*int*/ = 0; i < 2; i++) {
- while ((leftToRight ? correctedStartColumn >= minColumn : correctedStartColumn < maxColumn) && leftToRight === image.get(correctedStartColumn, imageRow)) {
- if (Math.abs(codewordStartColumn - correctedStartColumn) > PDF417ScanningDecoder.CODEWORD_SKEW_SIZE) {
- return codewordStartColumn;
- }
- correctedStartColumn += increment;
- }
- increment = -increment;
- leftToRight = !leftToRight;
- }
- return correctedStartColumn;
- };
- PDF417ScanningDecoder.checkCodewordSkew = function (codewordSize, minCodewordWidth, maxCodewordWidth) {
- return minCodewordWidth - PDF417ScanningDecoder.CODEWORD_SKEW_SIZE <= codewordSize && codewordSize <= maxCodewordWidth + PDF417ScanningDecoder.CODEWORD_SKEW_SIZE;
- };
- /**
- * @throws FormatException,
- * @throws ChecksumException
- */
- PDF417ScanningDecoder.decodeCodewords = function (codewords, ecLevel, erasures) {
- if (codewords.length === 0) {
- throw _FormatException.default.getFormatInstance();
- }
- var numECCodewords = 1 << ecLevel + 1;
- var correctedErrorsCount = PDF417ScanningDecoder.correctErrors(codewords, erasures, numECCodewords);
- PDF417ScanningDecoder.verifyCodewordCount(codewords, numECCodewords);
- // Decode the codewords
- var decoderResult = _DecodedBitStreamParser.default.decode(codewords, '' + ecLevel);
- decoderResult.setErrorsCorrected(correctedErrorsCount);
- decoderResult.setErasures(erasures.length);
- return decoderResult;
- };
- /**
- * <p>Given data and error-correction codewords received, possibly corrupted by errors, attempts to
- * correct the errors in-place.</p>
- *
- * @param codewords data and error correction codewords
- * @param erasures positions of any known erasures
- * @param numECCodewords number of error correction codewords that are available in codewords
- * @throws ChecksumException if error correction fails
- */
- PDF417ScanningDecoder.correctErrors = function (codewords, erasures, numECCodewords) {
- if (erasures != null && erasures.length > numECCodewords / 2 + PDF417ScanningDecoder.MAX_ERRORS || numECCodewords < 0 || numECCodewords > PDF417ScanningDecoder.MAX_EC_CODEWORDS) {
- // Too many errors or EC Codewords is corrupted
- throw _ChecksumException.default.getChecksumInstance();
- }
- return PDF417ScanningDecoder.errorCorrection.decode(codewords, numECCodewords, erasures);
- };
- /**
- * Verify that all is OK with the codeword array.
- * @throws FormatException
- */
- PDF417ScanningDecoder.verifyCodewordCount = function (codewords, numECCodewords) {
- if (codewords.length < 4) {
- // Codeword array size should be at least 4 allowing for
- // Count CW, At least one Data CW, Error Correction CW, Error Correction CW
- throw _FormatException.default.getFormatInstance();
- }
- // The first codeword, the Symbol Length Descriptor, shall always encode the total number of data
- // codewords in the symbol, including the Symbol Length Descriptor itself, data codewords and pad
- // codewords, but excluding the number of error correction codewords.
- var numberOfCodewords = codewords[0];
- if (numberOfCodewords > codewords.length) {
- throw _FormatException.default.getFormatInstance();
- }
- if (numberOfCodewords === 0) {
- // Reset to the length of the array - 8 (Allow for at least level 3 Error Correction (8 Error Codewords)
- if (numECCodewords < codewords.length) {
- codewords[0] = codewords.length - numECCodewords;
- } else {
- throw _FormatException.default.getFormatInstance();
- }
- }
- };
- PDF417ScanningDecoder.getBitCountForCodeword = function (codeword) {
- var result = new Int32Array(8);
- var previousValue = 0;
- var i = result.length - 1;
- while (true) {
- if ((codeword & 0x1) !== previousValue) {
- previousValue = codeword & 0x1;
- i--;
- if (i < 0) {
- break;
- }
- }
- result[i]++;
- codeword >>= 1;
- }
- return result;
- };
- PDF417ScanningDecoder.getCodewordBucketNumber = function (codeword) {
- if (codeword instanceof Int32Array) {
- return this.getCodewordBucketNumber_Int32Array(codeword);
- }
- return this.getCodewordBucketNumber_number(codeword);
- };
- PDF417ScanningDecoder.getCodewordBucketNumber_number = function (codeword) {
- return PDF417ScanningDecoder.getCodewordBucketNumber(PDF417ScanningDecoder.getBitCountForCodeword(codeword));
- };
- PDF417ScanningDecoder.getCodewordBucketNumber_Int32Array = function (moduleBitCount) {
- return (moduleBitCount[0] - moduleBitCount[2] + moduleBitCount[4] - moduleBitCount[6] + 9) % 9;
- };
- PDF417ScanningDecoder.toString = function (barcodeMatrix) {
- var formatter = new _Formatter.default();
- // try (let formatter = new Formatter()) {
- for (var row /*int*/ = 0; row < barcodeMatrix.length; row++) {
- formatter.format('Row %2d: ', row);
- for (var column /*int*/ = 0; column < barcodeMatrix[row].length; column++) {
- var barcodeValue = barcodeMatrix[row][column];
- if (barcodeValue.getValue().length === 0) {
- formatter.format(' ', null);
- } else {
- formatter.format('%4d(%2d)', barcodeValue.getValue()[0], barcodeValue.getConfidence(barcodeValue.getValue()[0]));
- }
- }
- formatter.format('%n');
- }
- return formatter.toString();
- // }
- };
- /*final*/
- PDF417ScanningDecoder.CODEWORD_SKEW_SIZE = 2;
- /*final*/
- PDF417ScanningDecoder.MAX_ERRORS = 3;
- /*final*/
- PDF417ScanningDecoder.MAX_EC_CODEWORDS = 512;
- /*final*/
- PDF417ScanningDecoder.errorCorrection = new _ErrorCorrection.default();
- return PDF417ScanningDecoder;
- }();
- var _default = PDF417ScanningDecoder;
- exports.default = _default;
- /***/ }),
- /* 438 */
- /*!*****************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/decoder/ec/ErrorCorrection.js ***!
- \*****************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _ChecksumException = _interopRequireDefault(__webpack_require__(/*! ../../../ChecksumException */ 309));
- var _ModulusPoly = _interopRequireDefault(__webpack_require__(/*! ./ModulusPoly */ 439));
- var _ModulusGF = _interopRequireDefault(__webpack_require__(/*! ./ModulusGF */ 440));
- /*
- * Copyright 2012 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- // package com.google.zxing.pdf417.decoder.ec;
- // import com.google.zxing.ChecksumException;
- /**
- * <p>PDF417 error correction implementation.</p>
- *
- * <p>This <a href="http://en.wikipedia.org/wiki/Reed%E2%80%93Solomon_error_correction#Example">example</a>
- * is quite useful in understanding the algorithm.</p>
- *
- * @author Sean Owen
- * @see com.google.zxing.common.reedsolomon.ReedSolomonDecoder
- */
- var ErrorCorrection = /** @class */function () {
- function ErrorCorrection() {
- this.field = _ModulusGF.default.PDF417_GF;
- }
- /**
- * @param received received codewords
- * @param numECCodewords number of those codewords used for EC
- * @param erasures location of erasures
- * @return number of errors
- * @throws ChecksumException if errors cannot be corrected, maybe because of too many errors
- */
- ErrorCorrection.prototype.decode = function (received, numECCodewords, erasures) {
- var e_1, _a;
- var poly = new _ModulusPoly.default(this.field, received);
- var S = new Int32Array(numECCodewords);
- var error = false;
- for (var i /*int*/ = numECCodewords; i > 0; i--) {
- var evaluation = poly.evaluateAt(this.field.exp(i));
- S[numECCodewords - i] = evaluation;
- if (evaluation !== 0) {
- error = true;
- }
- }
- if (!error) {
- return 0;
- }
- var knownErrors = this.field.getOne();
- if (erasures != null) {
- try {
- for (var erasures_1 = __values(erasures), erasures_1_1 = erasures_1.next(); !erasures_1_1.done; erasures_1_1 = erasures_1.next()) {
- var erasure = erasures_1_1.value;
- var b = this.field.exp(received.length - 1 - erasure);
- // Add (1 - bx) term:
- var term = new _ModulusPoly.default(this.field, new Int32Array([this.field.subtract(0, b), 1]));
- knownErrors = knownErrors.multiply(term);
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (erasures_1_1 && !erasures_1_1.done && (_a = erasures_1.return)) _a.call(erasures_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- }
- var syndrome = new _ModulusPoly.default(this.field, S);
- // syndrome = syndrome.multiply(knownErrors);
- var sigmaOmega = this.runEuclideanAlgorithm(this.field.buildMonomial(numECCodewords, 1), syndrome, numECCodewords);
- var sigma = sigmaOmega[0];
- var omega = sigmaOmega[1];
- // sigma = sigma.multiply(knownErrors);
- var errorLocations = this.findErrorLocations(sigma);
- var errorMagnitudes = this.findErrorMagnitudes(omega, sigma, errorLocations);
- for (var i /*int*/ = 0; i < errorLocations.length; i++) {
- var position = received.length - 1 - this.field.log(errorLocations[i]);
- if (position < 0) {
- throw _ChecksumException.default.getChecksumInstance();
- }
- received[position] = this.field.subtract(received[position], errorMagnitudes[i]);
- }
- return errorLocations.length;
- };
- /**
- *
- * @param ModulusPoly
- * @param a
- * @param ModulusPoly
- * @param b
- * @param int
- * @param R
- * @throws ChecksumException
- */
- ErrorCorrection.prototype.runEuclideanAlgorithm = function (a, b, R) {
- // Assume a's degree is >= b's
- if (a.getDegree() < b.getDegree()) {
- var temp = a;
- a = b;
- b = temp;
- }
- var rLast = a;
- var r = b;
- var tLast = this.field.getZero();
- var t = this.field.getOne();
- // Run Euclidean algorithm until r's degree is less than R/2
- while (r.getDegree() >= Math.round(R / 2)) {
- var rLastLast = rLast;
- var tLastLast = tLast;
- rLast = r;
- tLast = t;
- // Divide rLastLast by rLast, with quotient in q and remainder in r
- if (rLast.isZero()) {
- // Oops, Euclidean algorithm already terminated?
- throw _ChecksumException.default.getChecksumInstance();
- }
- r = rLastLast;
- var q = this.field.getZero();
- var denominatorLeadingTerm = rLast.getCoefficient(rLast.getDegree());
- var dltInverse = this.field.inverse(denominatorLeadingTerm);
- while (r.getDegree() >= rLast.getDegree() && !r.isZero()) {
- var degreeDiff = r.getDegree() - rLast.getDegree();
- var scale = this.field.multiply(r.getCoefficient(r.getDegree()), dltInverse);
- q = q.add(this.field.buildMonomial(degreeDiff, scale));
- r = r.subtract(rLast.multiplyByMonomial(degreeDiff, scale));
- }
- t = q.multiply(tLast).subtract(tLastLast).negative();
- }
- var sigmaTildeAtZero = t.getCoefficient(0);
- if (sigmaTildeAtZero === 0) {
- throw _ChecksumException.default.getChecksumInstance();
- }
- var inverse = this.field.inverse(sigmaTildeAtZero);
- var sigma = t.multiply(inverse);
- var omega = r.multiply(inverse);
- return [sigma, omega];
- };
- /**
- *
- * @param errorLocator
- * @throws ChecksumException
- */
- ErrorCorrection.prototype.findErrorLocations = function (errorLocator) {
- // This is a direct application of Chien's search
- var numErrors = errorLocator.getDegree();
- var result = new Int32Array(numErrors);
- var e = 0;
- for (var i /*int*/ = 1; i < this.field.getSize() && e < numErrors; i++) {
- if (errorLocator.evaluateAt(i) === 0) {
- result[e] = this.field.inverse(i);
- e++;
- }
- }
- if (e !== numErrors) {
- throw _ChecksumException.default.getChecksumInstance();
- }
- return result;
- };
- ErrorCorrection.prototype.findErrorMagnitudes = function (errorEvaluator, errorLocator, errorLocations) {
- var errorLocatorDegree = errorLocator.getDegree();
- var formalDerivativeCoefficients = new Int32Array(errorLocatorDegree);
- for (var i /*int*/ = 1; i <= errorLocatorDegree; i++) {
- formalDerivativeCoefficients[errorLocatorDegree - i] = this.field.multiply(i, errorLocator.getCoefficient(i));
- }
- var formalDerivative = new _ModulusPoly.default(this.field, formalDerivativeCoefficients);
- // This is directly applying Forney's Formula
- var s = errorLocations.length;
- var result = new Int32Array(s);
- for (var i /*int*/ = 0; i < s; i++) {
- var xiInverse = this.field.inverse(errorLocations[i]);
- var numerator = this.field.subtract(0, errorEvaluator.evaluateAt(xiInverse));
- var denominator = this.field.inverse(formalDerivative.evaluateAt(xiInverse));
- result[i] = this.field.multiply(numerator, denominator);
- }
- return result;
- };
- return ErrorCorrection;
- }();
- var _default = ErrorCorrection;
- exports.default = _default;
- /***/ }),
- /* 439 */
- /*!*************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/decoder/ec/ModulusPoly.js ***!
- \*************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../../IllegalArgumentException */ 308));
- var _System = _interopRequireDefault(__webpack_require__(/*! ../../../util/System */ 315));
- var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../../util/StringBuilder */ 320));
- /*
- * Copyright 2012 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- // package com.google.zxing.pdf417.decoder.ec;
- /**
- * @author Sean Owen
- * @see com.google.zxing.common.reedsolomon.GenericGFPoly
- */
- var ModulusPoly = /** @class */function () {
- function ModulusPoly(field, coefficients) {
- if (coefficients.length === 0) {
- throw new _IllegalArgumentException.default();
- }
- this.field = field;
- var coefficientsLength = /*int*/coefficients.length;
- if (coefficientsLength > 1 && coefficients[0] === 0) {
- // Leading term must be non-zero for anything except the constant polynomial "0"
- var firstNonZero = /*int*/1;
- while (firstNonZero < coefficientsLength && coefficients[firstNonZero] === 0) {
- firstNonZero++;
- }
- if (firstNonZero === coefficientsLength) {
- this.coefficients = new Int32Array([0]);
- } else {
- this.coefficients = new Int32Array(coefficientsLength - firstNonZero);
- _System.default.arraycopy(coefficients, firstNonZero, this.coefficients, 0, this.coefficients.length);
- }
- } else {
- this.coefficients = coefficients;
- }
- }
- ModulusPoly.prototype.getCoefficients = function () {
- return this.coefficients;
- };
- /**
- * @return degree of this polynomial
- */
- ModulusPoly.prototype.getDegree = function () {
- return this.coefficients.length - 1;
- };
- /**
- * @return true iff this polynomial is the monomial "0"
- */
- ModulusPoly.prototype.isZero = function () {
- return this.coefficients[0] === 0;
- };
- /**
- * @return coefficient of x^degree term in this polynomial
- */
- ModulusPoly.prototype.getCoefficient = function (degree) {
- return this.coefficients[this.coefficients.length - 1 - degree];
- };
- /**
- * @return evaluation of this polynomial at a given point
- */
- ModulusPoly.prototype.evaluateAt = function (a) {
- var e_1, _a;
- if (a === 0) {
- // Just return the x^0 coefficient
- return this.getCoefficient(0);
- }
- if (a === 1) {
- // Just the sum of the coefficients
- var sum = /*int*/0;
- try {
- for (var _b = __values(this.coefficients), _c = _b.next(); !_c.done; _c = _b.next()) {
- var coefficient = _c.value /*int*/;
- sum = this.field.add(sum, coefficient);
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- return sum;
- }
- var result = /*int*/this.coefficients[0];
- var size = /*int*/this.coefficients.length;
- for (var i /*int*/ = 1; i < size; i++) {
- result = this.field.add(this.field.multiply(a, result), this.coefficients[i]);
- }
- return result;
- };
- ModulusPoly.prototype.add = function (other) {
- if (!this.field.equals(other.field)) {
- throw new _IllegalArgumentException.default('ModulusPolys do not have same ModulusGF field');
- }
- if (this.isZero()) {
- return other;
- }
- if (other.isZero()) {
- return this;
- }
- var smallerCoefficients = this.coefficients;
- var largerCoefficients = other.coefficients;
- if (smallerCoefficients.length > largerCoefficients.length) {
- var temp = smallerCoefficients;
- smallerCoefficients = largerCoefficients;
- largerCoefficients = temp;
- }
- var sumDiff = new Int32Array(largerCoefficients.length);
- var lengthDiff = /*int*/largerCoefficients.length - smallerCoefficients.length;
- // Copy high-order terms only found in higher-degree polynomial's coefficients
- _System.default.arraycopy(largerCoefficients, 0, sumDiff, 0, lengthDiff);
- for (var i /*int*/ = lengthDiff; i < largerCoefficients.length; i++) {
- sumDiff[i] = this.field.add(smallerCoefficients[i - lengthDiff], largerCoefficients[i]);
- }
- return new ModulusPoly(this.field, sumDiff);
- };
- ModulusPoly.prototype.subtract = function (other) {
- if (!this.field.equals(other.field)) {
- throw new _IllegalArgumentException.default('ModulusPolys do not have same ModulusGF field');
- }
- if (other.isZero()) {
- return this;
- }
- return this.add(other.negative());
- };
- ModulusPoly.prototype.multiply = function (other) {
- if (other instanceof ModulusPoly) {
- return this.multiplyOther(other);
- }
- return this.multiplyScalar(other);
- };
- ModulusPoly.prototype.multiplyOther = function (other) {
- if (!this.field.equals(other.field)) {
- throw new _IllegalArgumentException.default('ModulusPolys do not have same ModulusGF field');
- }
- if (this.isZero() || other.isZero()) {
- // return this.field.getZero();
- return new ModulusPoly(this.field, new Int32Array([0]));
- }
- var aCoefficients = this.coefficients;
- var aLength = /*int*/aCoefficients.length;
- var bCoefficients = other.coefficients;
- var bLength = /*int*/bCoefficients.length;
- var product = new Int32Array(aLength + bLength - 1);
- for (var i /*int*/ = 0; i < aLength; i++) {
- var aCoeff = /*int*/aCoefficients[i];
- for (var j /*int*/ = 0; j < bLength; j++) {
- product[i + j] = this.field.add(product[i + j], this.field.multiply(aCoeff, bCoefficients[j]));
- }
- }
- return new ModulusPoly(this.field, product);
- };
- ModulusPoly.prototype.negative = function () {
- var size = /*int*/this.coefficients.length;
- var negativeCoefficients = new Int32Array(size);
- for (var i /*int*/ = 0; i < size; i++) {
- negativeCoefficients[i] = this.field.subtract(0, this.coefficients[i]);
- }
- return new ModulusPoly(this.field, negativeCoefficients);
- };
- ModulusPoly.prototype.multiplyScalar = function (scalar) {
- if (scalar === 0) {
- return new ModulusPoly(this.field, new Int32Array([0]));
- }
- if (scalar === 1) {
- return this;
- }
- var size = /*int*/this.coefficients.length;
- var product = new Int32Array(size);
- for (var i /*int*/ = 0; i < size; i++) {
- product[i] = this.field.multiply(this.coefficients[i], scalar);
- }
- return new ModulusPoly(this.field, product);
- };
- ModulusPoly.prototype.multiplyByMonomial = function (degree, coefficient) {
- if (degree < 0) {
- throw new _IllegalArgumentException.default();
- }
- if (coefficient === 0) {
- return new ModulusPoly(this.field, new Int32Array([0]));
- }
- var size = /*int*/this.coefficients.length;
- var product = new Int32Array(size + degree);
- for (var i /*int*/ = 0; i < size; i++) {
- product[i] = this.field.multiply(this.coefficients[i], coefficient);
- }
- return new ModulusPoly(this.field, product);
- };
- /*
- ModulusPoly[] divide(other: ModulusPoly) {
- if (!field.equals(other.field)) {
- throw new IllegalArgumentException("ModulusPolys do not have same ModulusGF field");
- }
- if (other.isZero()) {
- throw new IllegalArgumentException("Divide by 0");
- }
- let quotient: ModulusPoly = field.getZero();
- let remainder: ModulusPoly = this;
- let denominatorLeadingTerm: /*int/ number = other.getCoefficient(other.getDegree());
- let inverseDenominatorLeadingTerm: /*int/ number = field.inverse(denominatorLeadingTerm);
- while (remainder.getDegree() >= other.getDegree() && !remainder.isZero()) {
- let degreeDifference: /*int/ number = remainder.getDegree() - other.getDegree();
- let scale: /*int/ number = field.multiply(remainder.getCoefficient(remainder.getDegree()), inverseDenominatorLeadingTerm);
- let term: ModulusPoly = other.multiplyByMonomial(degreeDifference, scale);
- let iterationQuotient: ModulusPoly = field.buildMonomial(degreeDifference, scale);
- quotient = quotient.add(iterationQuotient);
- remainder = remainder.subtract(term);
- }
- return new ModulusPoly[] { quotient, remainder };
- }
- */
- // @Override
- ModulusPoly.prototype.toString = function () {
- var result = new _StringBuilder.default( /*8 * this.getDegree()*/); // dynamic string size in JS
- for (var degree /*int*/ = this.getDegree(); degree >= 0; degree--) {
- var coefficient = /*int*/this.getCoefficient(degree);
- if (coefficient !== 0) {
- if (coefficient < 0) {
- result.append(' - ');
- coefficient = -coefficient;
- } else {
- if (result.length() > 0) {
- result.append(' + ');
- }
- }
- if (degree === 0 || coefficient !== 1) {
- result.append(coefficient);
- }
- if (degree !== 0) {
- if (degree === 1) {
- result.append('x');
- } else {
- result.append('x^');
- result.append(degree);
- }
- }
- }
- }
- return result.toString();
- };
- return ModulusPoly;
- }();
- var _default = ModulusPoly;
- exports.default = _default;
- /***/ }),
- /* 440 */
- /*!***********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/decoder/ec/ModulusGF.js ***!
- \***********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _PDF417Common = _interopRequireDefault(__webpack_require__(/*! ../../PDF417Common */ 434));
- var _ModulusPoly = _interopRequireDefault(__webpack_require__(/*! ./ModulusPoly */ 439));
- var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../../IllegalArgumentException */ 308));
- var _ModulusBase = _interopRequireDefault(__webpack_require__(/*! ./ModulusBase */ 441));
- /*
- * Copyright 2012 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- // package com.google.zxing.pdf417.decoder.ec;
- // import com.google.zxing.pdf417.PDF417Common;
- /**
- * <p>A field based on powers of a generator integer, modulo some modulus.</p>
- *
- * @author Sean Owen
- * @see com.google.zxing.common.reedsolomon.GenericGF
- */
- var ModulusGF = /** @class */function (_super) {
- __extends(ModulusGF, _super);
- // private /*final*/ modulus: /*int*/ number;
- function ModulusGF(modulus, generator) {
- var _this = _super.call(this) || this;
- _this.modulus = modulus;
- _this.expTable = new Int32Array(modulus);
- _this.logTable = new Int32Array(modulus);
- var x = /*int*/1;
- for (var i /*int*/ = 0; i < modulus; i++) {
- _this.expTable[i] = x;
- x = x * generator % modulus;
- }
- for (var i /*int*/ = 0; i < modulus - 1; i++) {
- _this.logTable[_this.expTable[i]] = i;
- }
- // logTable[0] == 0 but this should never be used
- _this.zero = new _ModulusPoly.default(_this, new Int32Array([0]));
- _this.one = new _ModulusPoly.default(_this, new Int32Array([1]));
- return _this;
- }
- ModulusGF.prototype.getZero = function () {
- return this.zero;
- };
- ModulusGF.prototype.getOne = function () {
- return this.one;
- };
- ModulusGF.prototype.buildMonomial = function (degree, coefficient) {
- if (degree < 0) {
- throw new _IllegalArgumentException.default();
- }
- if (coefficient === 0) {
- return this.zero;
- }
- var coefficients = new Int32Array(degree + 1);
- coefficients[0] = coefficient;
- return new _ModulusPoly.default(this, coefficients);
- };
- ModulusGF.PDF417_GF = new ModulusGF(_PDF417Common.default.NUMBER_OF_CODEWORDS, 3);
- return ModulusGF;
- }(_ModulusBase.default);
- var _default = ModulusGF;
- exports.default = _default;
- /***/ }),
- /* 441 */
- /*!*************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/decoder/ec/ModulusBase.js ***!
- \*************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../../IllegalArgumentException */ 308));
- var _ArithmeticException = _interopRequireDefault(__webpack_require__(/*! ../../../ArithmeticException */ 341));
- var ModulusBase = /** @class */function () {
- function ModulusBase() {}
- ModulusBase.prototype.add = function (a, b) {
- return (a + b) % this.modulus;
- };
- ModulusBase.prototype.subtract = function (a, b) {
- return (this.modulus + a - b) % this.modulus;
- };
- ModulusBase.prototype.exp = function (a) {
- return this.expTable[a];
- };
- ModulusBase.prototype.log = function (a) {
- if (a === 0) {
- throw new _IllegalArgumentException.default();
- }
- return this.logTable[a];
- };
- ModulusBase.prototype.inverse = function (a) {
- if (a === 0) {
- throw new _ArithmeticException.default();
- }
- return this.expTable[this.modulus - this.logTable[a] - 1];
- };
- ModulusBase.prototype.multiply = function (a, b) {
- if (a === 0 || b === 0) {
- return 0;
- }
- return this.expTable[(this.logTable[a] + this.logTable[b]) % (this.modulus - 1)];
- };
- ModulusBase.prototype.getSize = function () {
- return this.modulus;
- };
- ModulusBase.prototype.equals = function (o) {
- return o === this;
- };
- return ModulusBase;
- }();
- var _default = ModulusBase;
- exports.default = _default;
- /***/ }),
- /* 442 */
- /*!**********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/decoder/BoundingBox.js ***!
- \**********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../NotFoundException */ 327));
- var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../../ResultPoint */ 346));
- /*
- * Copyright 2013 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- // package com.google.zxing.pdf417.decoder;
- // import com.google.zxing.NotFoundException;
- // import com.google.zxing.ResultPoint;
- /**
- * @author Guenther Grau
- */
- var BoundingBox = /** @class */function () {
- function BoundingBox(image, topLeft, bottomLeft, topRight, bottomRight) {
- if (image instanceof BoundingBox) {
- this.constructor_2(image);
- } else {
- this.constructor_1(image, topLeft, bottomLeft, topRight, bottomRight);
- }
- }
- /**
- *
- * @param image
- * @param topLeft
- * @param bottomLeft
- * @param topRight
- * @param bottomRight
- *
- * @throws NotFoundException
- */
- BoundingBox.prototype.constructor_1 = function (image, topLeft, bottomLeft, topRight, bottomRight) {
- var leftUnspecified = topLeft == null || bottomLeft == null;
- var rightUnspecified = topRight == null || bottomRight == null;
- if (leftUnspecified && rightUnspecified) {
- throw new _NotFoundException.default();
- }
- if (leftUnspecified) {
- topLeft = new _ResultPoint.default(0, topRight.getY());
- bottomLeft = new _ResultPoint.default(0, bottomRight.getY());
- } else if (rightUnspecified) {
- topRight = new _ResultPoint.default(image.getWidth() - 1, topLeft.getY());
- bottomRight = new _ResultPoint.default(image.getWidth() - 1, bottomLeft.getY());
- }
- this.image = image;
- this.topLeft = topLeft;
- this.bottomLeft = bottomLeft;
- this.topRight = topRight;
- this.bottomRight = bottomRight;
- this.minX = Math.trunc(Math.min(topLeft.getX(), bottomLeft.getX()));
- this.maxX = Math.trunc(Math.max(topRight.getX(), bottomRight.getX()));
- this.minY = Math.trunc(Math.min(topLeft.getY(), topRight.getY()));
- this.maxY = Math.trunc(Math.max(bottomLeft.getY(), bottomRight.getY()));
- };
- BoundingBox.prototype.constructor_2 = function (boundingBox) {
- this.image = boundingBox.image;
- this.topLeft = boundingBox.getTopLeft();
- this.bottomLeft = boundingBox.getBottomLeft();
- this.topRight = boundingBox.getTopRight();
- this.bottomRight = boundingBox.getBottomRight();
- this.minX = boundingBox.getMinX();
- this.maxX = boundingBox.getMaxX();
- this.minY = boundingBox.getMinY();
- this.maxY = boundingBox.getMaxY();
- };
- /**
- * @throws NotFoundException
- */
- BoundingBox.merge = function (leftBox, rightBox) {
- if (leftBox == null) {
- return rightBox;
- }
- if (rightBox == null) {
- return leftBox;
- }
- return new BoundingBox(leftBox.image, leftBox.topLeft, leftBox.bottomLeft, rightBox.topRight, rightBox.bottomRight);
- };
- /**
- * @throws NotFoundException
- */
- BoundingBox.prototype.addMissingRows = function (missingStartRows, missingEndRows, isLeft) {
- var newTopLeft = this.topLeft;
- var newBottomLeft = this.bottomLeft;
- var newTopRight = this.topRight;
- var newBottomRight = this.bottomRight;
- if (missingStartRows > 0) {
- var top_1 = isLeft ? this.topLeft : this.topRight;
- var newMinY = Math.trunc(top_1.getY() - missingStartRows);
- if (newMinY < 0) {
- newMinY = 0;
- }
- var newTop = new _ResultPoint.default(top_1.getX(), newMinY);
- if (isLeft) {
- newTopLeft = newTop;
- } else {
- newTopRight = newTop;
- }
- }
- if (missingEndRows > 0) {
- var bottom = isLeft ? this.bottomLeft : this.bottomRight;
- var newMaxY = Math.trunc(bottom.getY() + missingEndRows);
- if (newMaxY >= this.image.getHeight()) {
- newMaxY = this.image.getHeight() - 1;
- }
- var newBottom = new _ResultPoint.default(bottom.getX(), newMaxY);
- if (isLeft) {
- newBottomLeft = newBottom;
- } else {
- newBottomRight = newBottom;
- }
- }
- return new BoundingBox(this.image, newTopLeft, newBottomLeft, newTopRight, newBottomRight);
- };
- BoundingBox.prototype.getMinX = function () {
- return this.minX;
- };
- BoundingBox.prototype.getMaxX = function () {
- return this.maxX;
- };
- BoundingBox.prototype.getMinY = function () {
- return this.minY;
- };
- BoundingBox.prototype.getMaxY = function () {
- return this.maxY;
- };
- BoundingBox.prototype.getTopLeft = function () {
- return this.topLeft;
- };
- BoundingBox.prototype.getTopRight = function () {
- return this.topRight;
- };
- BoundingBox.prototype.getBottomLeft = function () {
- return this.bottomLeft;
- };
- BoundingBox.prototype.getBottomRight = function () {
- return this.bottomRight;
- };
- return BoundingBox;
- }();
- var _default = BoundingBox;
- exports.default = _default;
- /***/ }),
- /* 443 */
- /*!********************************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/decoder/DetectionResultRowIndicatorColumn.js ***!
- \********************************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _PDF417Common = _interopRequireDefault(__webpack_require__(/*! ../PDF417Common */ 434));
- var _BarcodeMetadata = _interopRequireDefault(__webpack_require__(/*! ./BarcodeMetadata */ 444));
- var _DetectionResultColumn = _interopRequireDefault(__webpack_require__(/*! ./DetectionResultColumn */ 445));
- var _BarcodeValue = _interopRequireDefault(__webpack_require__(/*! ./BarcodeValue */ 447));
- /*
- * Copyright 2013 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- // import com.google.zxing.pdf417.PDF417Common;
- /**
- * @author Guenther Grau
- */
- var DetectionResultRowIndicatorColumn = /** @class */function (_super) {
- __extends(DetectionResultRowIndicatorColumn, _super);
- function DetectionResultRowIndicatorColumn(boundingBox, isLeft) {
- var _this = _super.call(this, boundingBox) || this;
- _this._isLeft = isLeft;
- return _this;
- }
- DetectionResultRowIndicatorColumn.prototype.setRowNumbers = function () {
- var e_1, _a;
- try {
- for (var _b = __values(this.getCodewords()), _c = _b.next(); !_c.done; _c = _b.next()) {
- var codeword = _c.value /*Codeword*/;
- if (codeword != null) {
- codeword.setRowNumberAsRowIndicatorColumn();
- }
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- };
- // TODO implement properly
- // TODO maybe we should add missing codewords to store the correct row number to make
- // finding row numbers for other columns easier
- // use row height count to make detection of invalid row numbers more reliable
- DetectionResultRowIndicatorColumn.prototype.adjustCompleteIndicatorColumnRowNumbers = function (barcodeMetadata) {
- var codewords = this.getCodewords();
- this.setRowNumbers();
- this.removeIncorrectCodewords(codewords, barcodeMetadata);
- var boundingBox = this.getBoundingBox();
- var top = this._isLeft ? boundingBox.getTopLeft() : boundingBox.getTopRight();
- var bottom = this._isLeft ? boundingBox.getBottomLeft() : boundingBox.getBottomRight();
- var firstRow = this.imageRowToCodewordIndex(Math.trunc(top.getY()));
- var lastRow = this.imageRowToCodewordIndex(Math.trunc(bottom.getY()));
- // We need to be careful using the average row height. Barcode could be skewed so that we have smaller and
- // taller rows
- // float averageRowHeight = (lastRow - firstRow) / /*(float)*/ barcodeMetadata.getRowCount();
- var barcodeRow = -1;
- var maxRowHeight = 1;
- var currentRowHeight = 0;
- for (var codewordsRow /*int*/ = firstRow; codewordsRow < lastRow; codewordsRow++) {
- if (codewords[codewordsRow] == null) {
- continue;
- }
- var codeword = codewords[codewordsRow];
- // float expectedRowNumber = (codewordsRow - firstRow) / averageRowHeight;
- // if (Math.abs(codeword.getRowNumber() - expectedRowNumber) > 2) {
- // SimpleLog.log(LEVEL.WARNING,
- // "Removing codeword, rowNumberSkew too high, codeword[" + codewordsRow + "]: Expected Row: " +
- // expectedRowNumber + ", RealRow: " + codeword.getRowNumber() + ", value: " + codeword.getValue());
- // codewords[codewordsRow] = null;
- // }
- var rowDifference = codeword.getRowNumber() - barcodeRow;
- // TODO improve handling with case where first row indicator doesn't start with 0
- if (rowDifference === 0) {
- currentRowHeight++;
- } else if (rowDifference === 1) {
- maxRowHeight = Math.max(maxRowHeight, currentRowHeight);
- currentRowHeight = 1;
- barcodeRow = codeword.getRowNumber();
- } else if (rowDifference < 0 || codeword.getRowNumber() >= barcodeMetadata.getRowCount() || rowDifference > codewordsRow) {
- codewords[codewordsRow] = null;
- } else {
- var checkedRows = void 0;
- if (maxRowHeight > 2) {
- checkedRows = (maxRowHeight - 2) * rowDifference;
- } else {
- checkedRows = rowDifference;
- }
- var closePreviousCodewordFound = checkedRows >= codewordsRow;
- for (var i /*int*/ = 1; i <= checkedRows && !closePreviousCodewordFound; i++) {
- // there must be (height * rowDifference) number of codewords missing. For now we assume height = 1.
- // This should hopefully get rid of most problems already.
- closePreviousCodewordFound = codewords[codewordsRow - i] != null;
- }
- if (closePreviousCodewordFound) {
- codewords[codewordsRow] = null;
- } else {
- barcodeRow = codeword.getRowNumber();
- currentRowHeight = 1;
- }
- }
- }
- // return (int) (averageRowHeight + 0.5);
- };
- DetectionResultRowIndicatorColumn.prototype.getRowHeights = function () {
- var e_2, _a;
- var barcodeMetadata = this.getBarcodeMetadata();
- if (barcodeMetadata == null) {
- return null;
- }
- this.adjustIncompleteIndicatorColumnRowNumbers(barcodeMetadata);
- var result = new Int32Array(barcodeMetadata.getRowCount());
- try {
- for (var _b = __values(this.getCodewords()), _c = _b.next(); !_c.done; _c = _b.next()) {
- var codeword = _c.value /*Codeword*/;
- if (codeword != null) {
- var rowNumber = codeword.getRowNumber();
- if (rowNumber >= result.length) {
- // We have more rows than the barcode metadata allows for, ignore them.
- continue;
- }
- result[rowNumber]++;
- } // else throw exception?
- }
- } catch (e_2_1) {
- e_2 = {
- error: e_2_1
- };
- } finally {
- try {
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
- } finally {
- if (e_2) throw e_2.error;
- }
- }
- return result;
- };
- // TODO maybe we should add missing codewords to store the correct row number to make
- // finding row numbers for other columns easier
- // use row height count to make detection of invalid row numbers more reliable
- DetectionResultRowIndicatorColumn.prototype.adjustIncompleteIndicatorColumnRowNumbers = function (barcodeMetadata) {
- var boundingBox = this.getBoundingBox();
- var top = this._isLeft ? boundingBox.getTopLeft() : boundingBox.getTopRight();
- var bottom = this._isLeft ? boundingBox.getBottomLeft() : boundingBox.getBottomRight();
- var firstRow = this.imageRowToCodewordIndex(Math.trunc(top.getY()));
- var lastRow = this.imageRowToCodewordIndex(Math.trunc(bottom.getY()));
- // float averageRowHeight = (lastRow - firstRow) / /*(float)*/ barcodeMetadata.getRowCount();
- var codewords = this.getCodewords();
- var barcodeRow = -1;
- var maxRowHeight = 1;
- var currentRowHeight = 0;
- for (var codewordsRow /*int*/ = firstRow; codewordsRow < lastRow; codewordsRow++) {
- if (codewords[codewordsRow] == null) {
- continue;
- }
- var codeword = codewords[codewordsRow];
- codeword.setRowNumberAsRowIndicatorColumn();
- var rowDifference = codeword.getRowNumber() - barcodeRow;
- // TODO improve handling with case where first row indicator doesn't start with 0
- if (rowDifference === 0) {
- currentRowHeight++;
- } else if (rowDifference === 1) {
- maxRowHeight = Math.max(maxRowHeight, currentRowHeight);
- currentRowHeight = 1;
- barcodeRow = codeword.getRowNumber();
- } else if (codeword.getRowNumber() >= barcodeMetadata.getRowCount()) {
- codewords[codewordsRow] = null;
- } else {
- barcodeRow = codeword.getRowNumber();
- currentRowHeight = 1;
- }
- }
- // return (int) (averageRowHeight + 0.5);
- };
- DetectionResultRowIndicatorColumn.prototype.getBarcodeMetadata = function () {
- var e_3, _a;
- var codewords = this.getCodewords();
- var barcodeColumnCount = new _BarcodeValue.default();
- var barcodeRowCountUpperPart = new _BarcodeValue.default();
- var barcodeRowCountLowerPart = new _BarcodeValue.default();
- var barcodeECLevel = new _BarcodeValue.default();
- try {
- for (var codewords_1 = __values(codewords), codewords_1_1 = codewords_1.next(); !codewords_1_1.done; codewords_1_1 = codewords_1.next()) {
- var codeword = codewords_1_1.value /*Codeword*/;
- if (codeword == null) {
- continue;
- }
- codeword.setRowNumberAsRowIndicatorColumn();
- var rowIndicatorValue = codeword.getValue() % 30;
- var codewordRowNumber = codeword.getRowNumber();
- if (!this._isLeft) {
- codewordRowNumber += 2;
- }
- switch (codewordRowNumber % 3) {
- case 0:
- barcodeRowCountUpperPart.setValue(rowIndicatorValue * 3 + 1);
- break;
- case 1:
- barcodeECLevel.setValue(rowIndicatorValue / 3);
- barcodeRowCountLowerPart.setValue(rowIndicatorValue % 3);
- break;
- case 2:
- barcodeColumnCount.setValue(rowIndicatorValue + 1);
- break;
- }
- }
- } catch (e_3_1) {
- e_3 = {
- error: e_3_1
- };
- } finally {
- try {
- if (codewords_1_1 && !codewords_1_1.done && (_a = codewords_1.return)) _a.call(codewords_1);
- } finally {
- if (e_3) throw e_3.error;
- }
- }
- // Maybe we should check if we have ambiguous values?
- if (barcodeColumnCount.getValue().length === 0 || barcodeRowCountUpperPart.getValue().length === 0 || barcodeRowCountLowerPart.getValue().length === 0 || barcodeECLevel.getValue().length === 0 || barcodeColumnCount.getValue()[0] < 1 || barcodeRowCountUpperPart.getValue()[0] + barcodeRowCountLowerPart.getValue()[0] < _PDF417Common.default.MIN_ROWS_IN_BARCODE || barcodeRowCountUpperPart.getValue()[0] + barcodeRowCountLowerPart.getValue()[0] > _PDF417Common.default.MAX_ROWS_IN_BARCODE) {
- return null;
- }
- var barcodeMetadata = new _BarcodeMetadata.default(barcodeColumnCount.getValue()[0], barcodeRowCountUpperPart.getValue()[0], barcodeRowCountLowerPart.getValue()[0], barcodeECLevel.getValue()[0]);
- this.removeIncorrectCodewords(codewords, barcodeMetadata);
- return barcodeMetadata;
- };
- DetectionResultRowIndicatorColumn.prototype.removeIncorrectCodewords = function (codewords, barcodeMetadata) {
- // Remove codewords which do not match the metadata
- // TODO Maybe we should keep the incorrect codewords for the start and end positions?
- for (var codewordRow /*int*/ = 0; codewordRow < codewords.length; codewordRow++) {
- var codeword = codewords[codewordRow];
- if (codewords[codewordRow] == null) {
- continue;
- }
- var rowIndicatorValue = codeword.getValue() % 30;
- var codewordRowNumber = codeword.getRowNumber();
- if (codewordRowNumber > barcodeMetadata.getRowCount()) {
- codewords[codewordRow] = null;
- continue;
- }
- if (!this._isLeft) {
- codewordRowNumber += 2;
- }
- switch (codewordRowNumber % 3) {
- case 0:
- if (rowIndicatorValue * 3 + 1 !== barcodeMetadata.getRowCountUpperPart()) {
- codewords[codewordRow] = null;
- }
- break;
- case 1:
- if (Math.trunc(rowIndicatorValue / 3) !== barcodeMetadata.getErrorCorrectionLevel() || rowIndicatorValue % 3 !== barcodeMetadata.getRowCountLowerPart()) {
- codewords[codewordRow] = null;
- }
- break;
- case 2:
- if (rowIndicatorValue + 1 !== barcodeMetadata.getColumnCount()) {
- codewords[codewordRow] = null;
- }
- break;
- }
- }
- };
- DetectionResultRowIndicatorColumn.prototype.isLeft = function () {
- return this._isLeft;
- };
- // @Override
- DetectionResultRowIndicatorColumn.prototype.toString = function () {
- return 'IsLeft: ' + this._isLeft + '\n' + _super.prototype.toString.call(this);
- };
- return DetectionResultRowIndicatorColumn;
- }(_DetectionResultColumn.default);
- var _default = DetectionResultRowIndicatorColumn;
- exports.default = _default;
- /***/ }),
- /* 444 */
- /*!**************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/decoder/BarcodeMetadata.js ***!
- \**************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- /*
- * Copyright 2013 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- // package com.google.zxing.pdf417.decoder;
- /**
- * @author Guenther Grau
- */
- var BarcodeMetadata = /** @class */function () {
- function BarcodeMetadata(columnCount, rowCountUpperPart, rowCountLowerPart, errorCorrectionLevel) {
- this.columnCount = columnCount;
- this.errorCorrectionLevel = errorCorrectionLevel;
- this.rowCountUpperPart = rowCountUpperPart;
- this.rowCountLowerPart = rowCountLowerPart;
- this.rowCount = rowCountUpperPart + rowCountLowerPart;
- }
- BarcodeMetadata.prototype.getColumnCount = function () {
- return this.columnCount;
- };
- BarcodeMetadata.prototype.getErrorCorrectionLevel = function () {
- return this.errorCorrectionLevel;
- };
- BarcodeMetadata.prototype.getRowCount = function () {
- return this.rowCount;
- };
- BarcodeMetadata.prototype.getRowCountUpperPart = function () {
- return this.rowCountUpperPart;
- };
- BarcodeMetadata.prototype.getRowCountLowerPart = function () {
- return this.rowCountLowerPart;
- };
- return BarcodeMetadata;
- }();
- var _default = BarcodeMetadata;
- exports.default = _default;
- /***/ }),
- /* 445 */
- /*!********************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/decoder/DetectionResultColumn.js ***!
- \********************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _Formatter = _interopRequireDefault(__webpack_require__(/*! ../../util/Formatter */ 446));
- var _BoundingBox = _interopRequireDefault(__webpack_require__(/*! ./BoundingBox */ 442));
- /*
- * Copyright 2013 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- // package com.google.zxing.pdf417.decoder;
- // import java.util.Formatter;
- /**
- * @author Guenther Grau
- */
- var DetectionResultColumn = /** @class */function () {
- function DetectionResultColumn(boundingBox) {
- this.boundingBox = new _BoundingBox.default(boundingBox);
- // this.codewords = new Codeword[boundingBox.getMaxY() - boundingBox.getMinY() + 1];
- this.codewords = new Array(boundingBox.getMaxY() - boundingBox.getMinY() + 1);
- }
- /*final*/
- DetectionResultColumn.prototype.getCodewordNearby = function (imageRow) {
- var codeword = this.getCodeword(imageRow);
- if (codeword != null) {
- return codeword;
- }
- for (var i = 1; i < DetectionResultColumn.MAX_NEARBY_DISTANCE; i++) {
- var nearImageRow = this.imageRowToCodewordIndex(imageRow) - i;
- if (nearImageRow >= 0) {
- codeword = this.codewords[nearImageRow];
- if (codeword != null) {
- return codeword;
- }
- }
- nearImageRow = this.imageRowToCodewordIndex(imageRow) + i;
- if (nearImageRow < this.codewords.length) {
- codeword = this.codewords[nearImageRow];
- if (codeword != null) {
- return codeword;
- }
- }
- }
- return null;
- };
- /*final int*/
- DetectionResultColumn.prototype.imageRowToCodewordIndex = function (imageRow) {
- return imageRow - this.boundingBox.getMinY();
- };
- /*final void*/
- DetectionResultColumn.prototype.setCodeword = function (imageRow, codeword) {
- this.codewords[this.imageRowToCodewordIndex(imageRow)] = codeword;
- };
- /*final*/
- DetectionResultColumn.prototype.getCodeword = function (imageRow) {
- return this.codewords[this.imageRowToCodewordIndex(imageRow)];
- };
- /*final*/
- DetectionResultColumn.prototype.getBoundingBox = function () {
- return this.boundingBox;
- };
- /*final*/
- DetectionResultColumn.prototype.getCodewords = function () {
- return this.codewords;
- };
- // @Override
- DetectionResultColumn.prototype.toString = function () {
- var e_1, _a;
- var formatter = new _Formatter.default();
- var row = 0;
- try {
- for (var _b = __values(this.codewords), _c = _b.next(); !_c.done; _c = _b.next()) {
- var codeword = _c.value;
- if (codeword == null) {
- formatter.format('%3d: | %n', row++);
- continue;
- }
- formatter.format('%3d: %3d|%3d%n', row++, codeword.getRowNumber(), codeword.getValue());
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- return formatter.toString();
- };
- DetectionResultColumn.MAX_NEARBY_DISTANCE = 5;
- return DetectionResultColumn;
- }();
- var _default = DetectionResultColumn;
- exports.default = _default;
- /***/ }),
- /* 446 */
- /*!**********************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/util/Formatter.js ***!
- \**********************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
- /**
- * Java Formatter class polyfill that works in the JS way.
- */
- var Formatter = /** @class */function () {
- function Formatter() {
- this.buffer = '';
- }
- /**
- *
- * @see https://stackoverflow.com/a/13439711/4367683
- *
- * @param str
- * @param arr
- */
- Formatter.form = function (str, arr) {
- var i = -1;
- function callback(exp, p0, p1, p2, p3, p4) {
- if (exp === '%%') return '%';
- if (arr[++i] === undefined) return undefined;
- exp = p2 ? parseInt(p2.substr(1)) : undefined;
- var base = p3 ? parseInt(p3.substr(1)) : undefined;
- var val;
- switch (p4) {
- case 's':
- val = arr[i];
- break;
- case 'c':
- val = arr[i][0];
- break;
- case 'f':
- val = parseFloat(arr[i]).toFixed(exp);
- break;
- case 'p':
- val = parseFloat(arr[i]).toPrecision(exp);
- break;
- case 'e':
- val = parseFloat(arr[i]).toExponential(exp);
- break;
- case 'x':
- val = parseInt(arr[i]).toString(base ? base : 16);
- break;
- case 'd':
- val = parseFloat(parseInt(arr[i], base ? base : 10).toPrecision(exp)).toFixed(0);
- break;
- }
- val = (0, _typeof2.default)(val) === 'object' ? JSON.stringify(val) : (+val).toString(base);
- var size = parseInt(p1); /* padding size */
- var ch = p1 && p1[0] + '' === '0' ? '0' : ' '; /* isnull? */
- while (val.length < size) {
- val = p0 !== undefined ? val + ch : ch + val;
- } /* isminus? */
- return val;
- }
- var regex = /%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;
- return str.replace(regex, callback);
- };
- /**
- *
- * @param append The new string to append.
- * @param args Argumets values to be formated.
- */
- Formatter.prototype.format = function (append) {
- var args = [];
- for (var _i = 1; _i < arguments.length; _i++) {
- args[_i - 1] = arguments[_i];
- }
- this.buffer += Formatter.form(append, args);
- };
- /**
- * Returns the Formatter string value.
- */
- Formatter.prototype.toString = function () {
- return this.buffer;
- };
- return Formatter;
- }();
- var _default = Formatter;
- exports.default = _default;
- /***/ }),
- /* 447 */
- /*!***********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/decoder/BarcodeValue.js ***!
- \***********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _PDF417Common = _interopRequireDefault(__webpack_require__(/*! ../PDF417Common */ 434));
- /*
- * Copyright 2013 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- var __read = void 0 && (void 0).__read || function (o, n) {
- var m = typeof Symbol === "function" && o[Symbol.iterator];
- if (!m) return o;
- var i = m.call(o),
- r,
- ar = [],
- e;
- try {
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
- ar.push(r.value);
- }
- } catch (error) {
- e = {
- error: error
- };
- } finally {
- try {
- if (r && !r.done && (m = i["return"])) m.call(i);
- } finally {
- if (e) throw e.error;
- }
- }
- return ar;
- };
- // package com.google.zxing.pdf417.decoder;
- // import com.google.zxing.pdf417.PDF417Common;
- // import java.util.ArrayList;
- // import java.util.Collection;
- // import java.util.HashMap;
- // import java.util.Map;
- // import java.util.Map.Entry;
- /**
- * @author Guenther Grau
- */
- var BarcodeValue = /** @class */function () {
- function BarcodeValue() {
- this.values = new Map();
- }
- /**
- * Add an occurrence of a value
- */
- BarcodeValue.prototype.setValue = function (value) {
- value = Math.trunc(value);
- var confidence = this.values.get(value);
- if (confidence == null) {
- confidence = 0;
- }
- confidence++;
- this.values.set(value, confidence);
- };
- /**
- * Determines the maximum occurrence of a set value and returns all values which were set with this occurrence.
- * @return an array of int, containing the values with the highest occurrence, or null, if no value was set
- */
- BarcodeValue.prototype.getValue = function () {
- var e_1, _a;
- var maxConfidence = -1;
- var result = new Array();
- var _loop_1 = function _loop_1(key, value) {
- var entry = {
- getKey: function getKey() {
- return key;
- },
- getValue: function getValue() {
- return value;
- }
- };
- if (entry.getValue() > maxConfidence) {
- maxConfidence = entry.getValue();
- result = [];
- result.push(entry.getKey());
- } else if (entry.getValue() === maxConfidence) {
- result.push(entry.getKey());
- }
- };
- try {
- for (var _b = __values(this.values.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {
- var _d = __read(_c.value, 2),
- key = _d[0],
- value = _d[1];
- _loop_1(key, value);
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- return _PDF417Common.default.toIntArray(result);
- };
- BarcodeValue.prototype.getConfidence = function (value) {
- return this.values.get(value);
- };
- return BarcodeValue;
- }();
- var _default = BarcodeValue;
- exports.default = _default;
- /***/ }),
- /* 448 */
- /*!**************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/decoder/DetectionResult.js ***!
- \**************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _PDF417Common = _interopRequireDefault(__webpack_require__(/*! ../PDF417Common */ 434));
- var _Formatter = _interopRequireDefault(__webpack_require__(/*! ../../util/Formatter */ 446));
- /*
- * Copyright 2013 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- // package com.google.zxing.pdf417.decoder;
- // import com.google.zxing.pdf417.PDF417Common;
- /**
- * @author Guenther Grau
- */
- var DetectionResult = /** @class */function () {
- function DetectionResult(barcodeMetadata, boundingBox) {
- /*final*/this.ADJUST_ROW_NUMBER_SKIP = 2;
- this.barcodeMetadata = barcodeMetadata;
- this.barcodeColumnCount = barcodeMetadata.getColumnCount();
- this.boundingBox = boundingBox;
- // this.detectionResultColumns = new DetectionResultColumn[this.barcodeColumnCount + 2];
- this.detectionResultColumns = new Array(this.barcodeColumnCount + 2);
- }
- DetectionResult.prototype.getDetectionResultColumns = function () {
- this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]);
- this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount + 1]);
- var unadjustedCodewordCount = _PDF417Common.default.MAX_CODEWORDS_IN_BARCODE;
- var previousUnadjustedCount;
- do {
- previousUnadjustedCount = unadjustedCodewordCount;
- unadjustedCodewordCount = this.adjustRowNumbersAndGetCount();
- } while (unadjustedCodewordCount > 0 && unadjustedCodewordCount < previousUnadjustedCount);
- return this.detectionResultColumns;
- };
- DetectionResult.prototype.adjustIndicatorColumnRowNumbers = function (detectionResultColumn) {
- if (detectionResultColumn != null) {
- detectionResultColumn.adjustCompleteIndicatorColumnRowNumbers(this.barcodeMetadata);
- }
- };
- // TODO ensure that no detected codewords with unknown row number are left
- // we should be able to estimate the row height and use it as a hint for the row number
- // we should also fill the rows top to bottom and bottom to top
- /**
- * @return number of codewords which don't have a valid row number. Note that the count is not accurate as codewords
- * will be counted several times. It just serves as an indicator to see when we can stop adjusting row numbers
- */
- DetectionResult.prototype.adjustRowNumbersAndGetCount = function () {
- var unadjustedCount = this.adjustRowNumbersByRow();
- if (unadjustedCount === 0) {
- return 0;
- }
- for (var barcodeColumn /*int*/ = 1; barcodeColumn < this.barcodeColumnCount + 1; barcodeColumn++) {
- var codewords = this.detectionResultColumns[barcodeColumn].getCodewords();
- for (var codewordsRow /*int*/ = 0; codewordsRow < codewords.length; codewordsRow++) {
- if (codewords[codewordsRow] == null) {
- continue;
- }
- if (!codewords[codewordsRow].hasValidRowNumber()) {
- this.adjustRowNumbers(barcodeColumn, codewordsRow, codewords);
- }
- }
- }
- return unadjustedCount;
- };
- DetectionResult.prototype.adjustRowNumbersByRow = function () {
- this.adjustRowNumbersFromBothRI();
- // TODO we should only do full row adjustments if row numbers of left and right row indicator column match.
- // Maybe it's even better to calculated the height (rows: d) and divide it by the number of barcode
- // rows. This, together with the LRI and RRI row numbers should allow us to get a good estimate where a row
- // number starts and ends.
- var unadjustedCount = this.adjustRowNumbersFromLRI();
- return unadjustedCount + this.adjustRowNumbersFromRRI();
- };
- DetectionResult.prototype.adjustRowNumbersFromBothRI = function () {
- if (this.detectionResultColumns[0] == null || this.detectionResultColumns[this.barcodeColumnCount + 1] == null) {
- return;
- }
- var LRIcodewords = this.detectionResultColumns[0].getCodewords();
- var RRIcodewords = this.detectionResultColumns[this.barcodeColumnCount + 1].getCodewords();
- for (var codewordsRow /*int*/ = 0; codewordsRow < LRIcodewords.length; codewordsRow++) {
- if (LRIcodewords[codewordsRow] != null && RRIcodewords[codewordsRow] != null && LRIcodewords[codewordsRow].getRowNumber() === RRIcodewords[codewordsRow].getRowNumber()) {
- for (var barcodeColumn /*int*/ = 1; barcodeColumn <= this.barcodeColumnCount; barcodeColumn++) {
- var codeword = this.detectionResultColumns[barcodeColumn].getCodewords()[codewordsRow];
- if (codeword == null) {
- continue;
- }
- codeword.setRowNumber(LRIcodewords[codewordsRow].getRowNumber());
- if (!codeword.hasValidRowNumber()) {
- this.detectionResultColumns[barcodeColumn].getCodewords()[codewordsRow] = null;
- }
- }
- }
- }
- };
- DetectionResult.prototype.adjustRowNumbersFromRRI = function () {
- if (this.detectionResultColumns[this.barcodeColumnCount + 1] == null) {
- return 0;
- }
- var unadjustedCount = 0;
- var codewords = this.detectionResultColumns[this.barcodeColumnCount + 1].getCodewords();
- for (var codewordsRow /*int*/ = 0; codewordsRow < codewords.length; codewordsRow++) {
- if (codewords[codewordsRow] == null) {
- continue;
- }
- var rowIndicatorRowNumber = codewords[codewordsRow].getRowNumber();
- var invalidRowCounts = 0;
- for (var barcodeColumn /*int*/ = this.barcodeColumnCount + 1; barcodeColumn > 0 && invalidRowCounts < this.ADJUST_ROW_NUMBER_SKIP; barcodeColumn--) {
- var codeword = this.detectionResultColumns[barcodeColumn].getCodewords()[codewordsRow];
- if (codeword != null) {
- invalidRowCounts = DetectionResult.adjustRowNumberIfValid(rowIndicatorRowNumber, invalidRowCounts, codeword);
- if (!codeword.hasValidRowNumber()) {
- unadjustedCount++;
- }
- }
- }
- }
- return unadjustedCount;
- };
- DetectionResult.prototype.adjustRowNumbersFromLRI = function () {
- if (this.detectionResultColumns[0] == null) {
- return 0;
- }
- var unadjustedCount = 0;
- var codewords = this.detectionResultColumns[0].getCodewords();
- for (var codewordsRow /*int*/ = 0; codewordsRow < codewords.length; codewordsRow++) {
- if (codewords[codewordsRow] == null) {
- continue;
- }
- var rowIndicatorRowNumber = codewords[codewordsRow].getRowNumber();
- var invalidRowCounts = 0;
- for (var barcodeColumn /*int*/ = 1; barcodeColumn < this.barcodeColumnCount + 1 && invalidRowCounts < this.ADJUST_ROW_NUMBER_SKIP; barcodeColumn++) {
- var codeword = this.detectionResultColumns[barcodeColumn].getCodewords()[codewordsRow];
- if (codeword != null) {
- invalidRowCounts = DetectionResult.adjustRowNumberIfValid(rowIndicatorRowNumber, invalidRowCounts, codeword);
- if (!codeword.hasValidRowNumber()) {
- unadjustedCount++;
- }
- }
- }
- }
- return unadjustedCount;
- };
- DetectionResult.adjustRowNumberIfValid = function (rowIndicatorRowNumber, invalidRowCounts, codeword) {
- if (codeword == null) {
- return invalidRowCounts;
- }
- if (!codeword.hasValidRowNumber()) {
- if (codeword.isValidRowNumber(rowIndicatorRowNumber)) {
- codeword.setRowNumber(rowIndicatorRowNumber);
- invalidRowCounts = 0;
- } else {
- ++invalidRowCounts;
- }
- }
- return invalidRowCounts;
- };
- DetectionResult.prototype.adjustRowNumbers = function (barcodeColumn, codewordsRow, codewords) {
- var e_1, _a;
- if (this.detectionResultColumns[barcodeColumn - 1] == null) {
- return;
- }
- var codeword = codewords[codewordsRow];
- var previousColumnCodewords = this.detectionResultColumns[barcodeColumn - 1].getCodewords();
- var nextColumnCodewords = previousColumnCodewords;
- if (this.detectionResultColumns[barcodeColumn + 1] != null) {
- nextColumnCodewords = this.detectionResultColumns[barcodeColumn + 1].getCodewords();
- }
- // let otherCodewords: Codeword[] = new Codeword[14];
- var otherCodewords = new Array(14);
- otherCodewords[2] = previousColumnCodewords[codewordsRow];
- otherCodewords[3] = nextColumnCodewords[codewordsRow];
- if (codewordsRow > 0) {
- otherCodewords[0] = codewords[codewordsRow - 1];
- otherCodewords[4] = previousColumnCodewords[codewordsRow - 1];
- otherCodewords[5] = nextColumnCodewords[codewordsRow - 1];
- }
- if (codewordsRow > 1) {
- otherCodewords[8] = codewords[codewordsRow - 2];
- otherCodewords[10] = previousColumnCodewords[codewordsRow - 2];
- otherCodewords[11] = nextColumnCodewords[codewordsRow - 2];
- }
- if (codewordsRow < codewords.length - 1) {
- otherCodewords[1] = codewords[codewordsRow + 1];
- otherCodewords[6] = previousColumnCodewords[codewordsRow + 1];
- otherCodewords[7] = nextColumnCodewords[codewordsRow + 1];
- }
- if (codewordsRow < codewords.length - 2) {
- otherCodewords[9] = codewords[codewordsRow + 2];
- otherCodewords[12] = previousColumnCodewords[codewordsRow + 2];
- otherCodewords[13] = nextColumnCodewords[codewordsRow + 2];
- }
- try {
- for (var otherCodewords_1 = __values(otherCodewords), otherCodewords_1_1 = otherCodewords_1.next(); !otherCodewords_1_1.done; otherCodewords_1_1 = otherCodewords_1.next()) {
- var otherCodeword = otherCodewords_1_1.value;
- if (DetectionResult.adjustRowNumber(codeword, otherCodeword)) {
- return;
- }
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (otherCodewords_1_1 && !otherCodewords_1_1.done && (_a = otherCodewords_1.return)) _a.call(otherCodewords_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- };
- /**
- * @return true, if row number was adjusted, false otherwise
- */
- DetectionResult.adjustRowNumber = function (codeword, otherCodeword) {
- if (otherCodeword == null) {
- return false;
- }
- if (otherCodeword.hasValidRowNumber() && otherCodeword.getBucket() === codeword.getBucket()) {
- codeword.setRowNumber(otherCodeword.getRowNumber());
- return true;
- }
- return false;
- };
- DetectionResult.prototype.getBarcodeColumnCount = function () {
- return this.barcodeColumnCount;
- };
- DetectionResult.prototype.getBarcodeRowCount = function () {
- return this.barcodeMetadata.getRowCount();
- };
- DetectionResult.prototype.getBarcodeECLevel = function () {
- return this.barcodeMetadata.getErrorCorrectionLevel();
- };
- DetectionResult.prototype.setBoundingBox = function (boundingBox) {
- this.boundingBox = boundingBox;
- };
- DetectionResult.prototype.getBoundingBox = function () {
- return this.boundingBox;
- };
- DetectionResult.prototype.setDetectionResultColumn = function (barcodeColumn, detectionResultColumn) {
- this.detectionResultColumns[barcodeColumn] = detectionResultColumn;
- };
- DetectionResult.prototype.getDetectionResultColumn = function (barcodeColumn) {
- return this.detectionResultColumns[barcodeColumn];
- };
- // @Override
- DetectionResult.prototype.toString = function () {
- var rowIndicatorColumn = this.detectionResultColumns[0];
- if (rowIndicatorColumn == null) {
- rowIndicatorColumn = this.detectionResultColumns[this.barcodeColumnCount + 1];
- }
- // try (
- var formatter = new _Formatter.default();
- // ) {
- for (var codewordsRow /*int*/ = 0; codewordsRow < rowIndicatorColumn.getCodewords().length; codewordsRow++) {
- formatter.format('CW %3d:', codewordsRow);
- for (var barcodeColumn /*int*/ = 0; barcodeColumn < this.barcodeColumnCount + 2; barcodeColumn++) {
- if (this.detectionResultColumns[barcodeColumn] == null) {
- formatter.format(' | ');
- continue;
- }
- var codeword = this.detectionResultColumns[barcodeColumn].getCodewords()[codewordsRow];
- if (codeword == null) {
- formatter.format(' | ');
- continue;
- }
- formatter.format(' %3d|%3d', codeword.getRowNumber(), codeword.getValue());
- }
- formatter.format('%n');
- }
- return formatter.toString();
- // }
- };
- return DetectionResult;
- }();
- var _default = DetectionResult;
- exports.default = _default;
- /***/ }),
- /* 449 */
- /*!*******************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/decoder/Codeword.js ***!
- \*******************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- /*
- * Copyright 2013 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- // package com.google.zxing.pdf417.decoder;
- /**
- * @author Guenther Grau
- */
- var Codeword = /** @class */function () {
- function Codeword(startX, endX, bucket, value) {
- this.rowNumber = Codeword.BARCODE_ROW_UNKNOWN;
- this.startX = Math.trunc(startX);
- this.endX = Math.trunc(endX);
- this.bucket = Math.trunc(bucket);
- this.value = Math.trunc(value);
- }
- Codeword.prototype.hasValidRowNumber = function () {
- return this.isValidRowNumber(this.rowNumber);
- };
- Codeword.prototype.isValidRowNumber = function (rowNumber) {
- return rowNumber !== Codeword.BARCODE_ROW_UNKNOWN && this.bucket === rowNumber % 3 * 3;
- };
- Codeword.prototype.setRowNumberAsRowIndicatorColumn = function () {
- this.rowNumber = Math.trunc(Math.trunc(this.value / 30) * 3 + Math.trunc(this.bucket / 3));
- };
- Codeword.prototype.getWidth = function () {
- return this.endX - this.startX;
- };
- Codeword.prototype.getStartX = function () {
- return this.startX;
- };
- Codeword.prototype.getEndX = function () {
- return this.endX;
- };
- Codeword.prototype.getBucket = function () {
- return this.bucket;
- };
- Codeword.prototype.getValue = function () {
- return this.value;
- };
- Codeword.prototype.getRowNumber = function () {
- return this.rowNumber;
- };
- Codeword.prototype.setRowNumber = function (rowNumber) {
- this.rowNumber = rowNumber;
- };
- // @Override
- Codeword.prototype.toString = function () {
- return this.rowNumber + '|' + this.value;
- };
- Codeword.BARCODE_ROW_UNKNOWN = -1;
- return Codeword;
- }();
- var _default = Codeword;
- exports.default = _default;
- /***/ }),
- /* 450 */
- /*!********************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/decoder/PDF417CodewordDecoder.js ***!
- \********************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _MathUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/detector/MathUtils */ 347));
- var _PDF417Common = _interopRequireDefault(__webpack_require__(/*! ../PDF417Common */ 434));
- var _Float = _interopRequireDefault(__webpack_require__(/*! ../../util/Float */ 348));
- /*
- * Copyright 2013 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- // package com.google.zxing.pdf417.decoder;
- // import com.google.zxing.common.detector.MathUtils;
- // import com.google.zxing.pdf417.PDF417Common;
- /**
- * @author Guenther Grau
- * @author creatale GmbH (christoph.schulz@creatale.de)
- */
- var PDF417CodewordDecoder = /** @class */function () {
- function PDF417CodewordDecoder() {}
- /* @note
- * this action have to be performed before first use of class
- * - static constructor
- * working with 32bit float (based from Java logic)
- */
- PDF417CodewordDecoder.initialize = function () {
- // Pre-computes the symbol ratio table.
- for ( /*int*/var i = 0; i < _PDF417Common.default.SYMBOL_TABLE.length; i++) {
- var currentSymbol = _PDF417Common.default.SYMBOL_TABLE[i];
- var currentBit = currentSymbol & 0x1;
- for ( /*int*/var j = 0; j < _PDF417Common.default.BARS_IN_MODULE; j++) {
- var size = 0.0;
- while ((currentSymbol & 0x1) === currentBit) {
- size += 1.0;
- currentSymbol >>= 1;
- }
- currentBit = currentSymbol & 0x1;
- if (!PDF417CodewordDecoder.RATIOS_TABLE[i]) {
- PDF417CodewordDecoder.RATIOS_TABLE[i] = new Array(_PDF417Common.default.BARS_IN_MODULE);
- }
- PDF417CodewordDecoder.RATIOS_TABLE[i][_PDF417Common.default.BARS_IN_MODULE - j - 1] = Math.fround(size / _PDF417Common.default.MODULES_IN_CODEWORD);
- }
- }
- this.bSymbolTableReady = true;
- };
- PDF417CodewordDecoder.getDecodedValue = function (moduleBitCount) {
- var decodedValue = PDF417CodewordDecoder.getDecodedCodewordValue(PDF417CodewordDecoder.sampleBitCounts(moduleBitCount));
- if (decodedValue !== -1) {
- return decodedValue;
- }
- return PDF417CodewordDecoder.getClosestDecodedValue(moduleBitCount);
- };
- PDF417CodewordDecoder.sampleBitCounts = function (moduleBitCount) {
- var bitCountSum = _MathUtils.default.sum(moduleBitCount);
- var result = new Int32Array(_PDF417Common.default.BARS_IN_MODULE);
- var bitCountIndex = 0;
- var sumPreviousBits = 0;
- for ( /*int*/var i = 0; i < _PDF417Common.default.MODULES_IN_CODEWORD; i++) {
- var sampleIndex = bitCountSum / (2 * _PDF417Common.default.MODULES_IN_CODEWORD) + i * bitCountSum / _PDF417Common.default.MODULES_IN_CODEWORD;
- if (sumPreviousBits + moduleBitCount[bitCountIndex] <= sampleIndex) {
- sumPreviousBits += moduleBitCount[bitCountIndex];
- bitCountIndex++;
- }
- result[bitCountIndex]++;
- }
- return result;
- };
- PDF417CodewordDecoder.getDecodedCodewordValue = function (moduleBitCount) {
- var decodedValue = PDF417CodewordDecoder.getBitValue(moduleBitCount);
- return _PDF417Common.default.getCodeword(decodedValue) === -1 ? -1 : decodedValue;
- };
- PDF417CodewordDecoder.getBitValue = function (moduleBitCount) {
- var result = /*long*/0;
- for (var /*int*/i = 0; i < moduleBitCount.length; i++) {
- for ( /*int*/var bit = 0; bit < moduleBitCount[i]; bit++) {
- result = result << 1 | (i % 2 === 0 ? 1 : 0);
- }
- }
- return Math.trunc(result);
- };
- // working with 32bit float (as in Java)
- PDF417CodewordDecoder.getClosestDecodedValue = function (moduleBitCount) {
- var bitCountSum = _MathUtils.default.sum(moduleBitCount);
- var bitCountRatios = new Array(_PDF417Common.default.BARS_IN_MODULE);
- if (bitCountSum > 1) {
- for (var /*int*/i = 0; i < bitCountRatios.length; i++) {
- bitCountRatios[i] = Math.fround(moduleBitCount[i] / bitCountSum);
- }
- }
- var bestMatchError = _Float.default.MAX_VALUE;
- var bestMatch = -1;
- if (!this.bSymbolTableReady) {
- PDF417CodewordDecoder.initialize();
- }
- for ( /*int*/var j = 0; j < PDF417CodewordDecoder.RATIOS_TABLE.length; j++) {
- var error = 0.0;
- var ratioTableRow = PDF417CodewordDecoder.RATIOS_TABLE[j];
- for ( /*int*/var k = 0; k < _PDF417Common.default.BARS_IN_MODULE; k++) {
- var diff = Math.fround(ratioTableRow[k] - bitCountRatios[k]);
- error += Math.fround(diff * diff);
- if (error >= bestMatchError) {
- break;
- }
- }
- if (error < bestMatchError) {
- bestMatchError = error;
- bestMatch = _PDF417Common.default.SYMBOL_TABLE[j];
- }
- }
- return bestMatch;
- };
- // flag that the table is ready for use
- PDF417CodewordDecoder.bSymbolTableReady = false;
- PDF417CodewordDecoder.RATIOS_TABLE = new Array(_PDF417Common.default.SYMBOL_TABLE.length).map(function (x) {
- return x = new Array(_PDF417Common.default.BARS_IN_MODULE);
- });
- return PDF417CodewordDecoder;
- }();
- var _default = PDF417CodewordDecoder;
- exports.default = _default;
- /***/ }),
- /* 451 */
- /*!*********************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/decoder/DecodedBitStreamParser.js ***!
- \*********************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(global) {
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../../FormatException */ 324));
- var _CharacterSetECI = _interopRequireDefault(__webpack_require__(/*! ../../common/CharacterSetECI */ 323));
- var _DecoderResult = _interopRequireDefault(__webpack_require__(/*! ../../common/DecoderResult */ 337));
- var _PDF417ResultMetadata = _interopRequireDefault(__webpack_require__(/*! ../PDF417ResultMetadata */ 452));
- var _Arrays = _interopRequireDefault(__webpack_require__(/*! ../../util/Arrays */ 314));
- var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../util/StringBuilder */ 320));
- var _Integer = _interopRequireDefault(__webpack_require__(/*! ../../util/Integer */ 318));
- var _Long = _interopRequireDefault(__webpack_require__(/*! ../../util/Long */ 453));
- var _ByteArrayOutputStream = _interopRequireDefault(__webpack_require__(/*! ../../util/ByteArrayOutputStream */ 454));
- var _StringEncoding = _interopRequireDefault(__webpack_require__(/*! ../../util/StringEncoding */ 325));
- /*
- * Copyright 2009 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- // package com.google.zxing.pdf417.decoder;
- // import com.google.zxing.FormatException;
- // import com.google.zxing.common.CharacterSetECI;
- // import com.google.zxing.common.DecoderResult;
- // import com.google.zxing.pdf417.PDF417ResultMetadata;
- // import java.io.ByteArrayOutputStream;
- // import java.math.BigInteger;
- // import java.nio.charset.Charset;
- // import java.nio.charset.StandardCharsets;
- // import java.util.Arrays;
- /*private*/
- var Mode;
- (function (Mode) {
- Mode[Mode["ALPHA"] = 0] = "ALPHA";
- Mode[Mode["LOWER"] = 1] = "LOWER";
- Mode[Mode["MIXED"] = 2] = "MIXED";
- Mode[Mode["PUNCT"] = 3] = "PUNCT";
- Mode[Mode["ALPHA_SHIFT"] = 4] = "ALPHA_SHIFT";
- Mode[Mode["PUNCT_SHIFT"] = 5] = "PUNCT_SHIFT";
- })(Mode || (Mode = {}));
- /**
- * Indirectly access the global BigInt constructor, it
- * allows browsers that doesn't support BigInt to run
- * the library without breaking due to "undefined BigInt"
- * errors.
- */
- function getBigIntConstructor() {
- if (typeof window !== 'undefined') {
- return window['BigInt'] || null;
- }
- if (typeof global !== 'undefined') {
- return global['BigInt'] || null;
- }
- if (typeof self !== 'undefined') {
- return self['BigInt'] || null;
- }
- throw new Error('Can\'t search globals for BigInt!');
- }
- /**
- * Used to store the BigInt constructor.
- */
- var BigInteger;
- /**
- * This function creates a bigint value. It allows browsers
- * that doesn't support BigInt to run the rest of the library
- * by not directly accessing the BigInt constructor.
- */
- function createBigInt(num) {
- if (typeof BigInteger === 'undefined') {
- BigInteger = getBigIntConstructor();
- }
- if (BigInteger === null) {
- throw new Error('BigInt is not supported!');
- }
- return BigInteger(num);
- }
- function getEXP900() {
- // in Java - array with length = 16
- var EXP900 = [];
- EXP900[0] = createBigInt(1);
- var nineHundred = createBigInt(900);
- EXP900[1] = nineHundred;
- // in Java - array with length = 16
- for (var i /*int*/ = 2; i < 16; i++) {
- EXP900[i] = EXP900[i - 1] * nineHundred;
- }
- return EXP900;
- }
- /**
- * <p>This class contains the methods for decoding the PDF417 codewords.</p>
- *
- * @author SITA Lab (kevin.osullivan@sita.aero)
- * @author Guenther Grau
- */
- var DecodedBitStreamParser = /** @class */function () {
- function DecodedBitStreamParser() {}
- // private DecodedBitStreamParser() {
- // }
- /**
- *
- * @param codewords
- * @param ecLevel
- *
- * @throws FormatException
- */
- DecodedBitStreamParser.decode = function (codewords, ecLevel) {
- // pass encoding to result (will be used for decode symbols in byte mode)
- var result = new _StringBuilder.default('');
- // let encoding: Charset = StandardCharsets.ISO_8859_1;
- var encoding = _CharacterSetECI.default.ISO8859_1;
- /**
- * @note the next command is specific from this TypeScript library
- * because TS can't properly cast some values to char and
- * convert it to string later correctly due to encoding
- * differences from Java version. As reported here:
- * https://github.com/zxing-js/library/pull/264/files#r382831593
- */
- result.enableDecoding(encoding);
- // Get compaction mode
- var codeIndex = 1;
- var code = codewords[codeIndex++];
- var resultMetadata = new _PDF417ResultMetadata.default();
- while (codeIndex < codewords[0]) {
- switch (code) {
- case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:
- codeIndex = DecodedBitStreamParser.textCompaction(codewords, codeIndex, result);
- break;
- case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH:
- case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH_6:
- codeIndex = DecodedBitStreamParser.byteCompaction(code, codewords, encoding, codeIndex, result);
- break;
- case DecodedBitStreamParser.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
- result.append( /*(char)*/codewords[codeIndex++]);
- break;
- case DecodedBitStreamParser.NUMERIC_COMPACTION_MODE_LATCH:
- codeIndex = DecodedBitStreamParser.numericCompaction(codewords, codeIndex, result);
- break;
- case DecodedBitStreamParser.ECI_CHARSET:
- var charsetECI = _CharacterSetECI.default.getCharacterSetECIByValue(codewords[codeIndex++]);
- // encoding = Charset.forName(charsetECI.getName());
- break;
- case DecodedBitStreamParser.ECI_GENERAL_PURPOSE:
- // Can't do anything with generic ECI; skip its 2 characters
- codeIndex += 2;
- break;
- case DecodedBitStreamParser.ECI_USER_DEFINED:
- // Can't do anything with user ECI; skip its 1 character
- codeIndex++;
- break;
- case DecodedBitStreamParser.BEGIN_MACRO_PDF417_CONTROL_BLOCK:
- codeIndex = DecodedBitStreamParser.decodeMacroBlock(codewords, codeIndex, resultMetadata);
- break;
- case DecodedBitStreamParser.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:
- case DecodedBitStreamParser.MACRO_PDF417_TERMINATOR:
- // Should not see these outside a macro block
- throw new _FormatException.default();
- default:
- // Default to text compaction. During testing numerous barcodes
- // appeared to be missing the starting mode. In these cases defaulting
- // to text compaction seems to work.
- codeIndex--;
- codeIndex = DecodedBitStreamParser.textCompaction(codewords, codeIndex, result);
- break;
- }
- if (codeIndex < codewords.length) {
- code = codewords[codeIndex++];
- } else {
- throw _FormatException.default.getFormatInstance();
- }
- }
- if (result.length() === 0) {
- throw _FormatException.default.getFormatInstance();
- }
- var decoderResult = new _DecoderResult.default(null, result.toString(), null, ecLevel);
- decoderResult.setOther(resultMetadata);
- return decoderResult;
- };
- /**
- *
- * @param int
- * @param param1
- * @param codewords
- * @param int
- * @param codeIndex
- * @param PDF417ResultMetadata
- * @param resultMetadata
- *
- * @throws FormatException
- */
- // @SuppressWarnings("deprecation")
- DecodedBitStreamParser.decodeMacroBlock = function (codewords, codeIndex, resultMetadata) {
- if (codeIndex + DecodedBitStreamParser.NUMBER_OF_SEQUENCE_CODEWORDS > codewords[0]) {
- // we must have at least two bytes left for the segment index
- throw _FormatException.default.getFormatInstance();
- }
- var segmentIndexArray = new Int32Array(DecodedBitStreamParser.NUMBER_OF_SEQUENCE_CODEWORDS);
- for (var i /*int*/ = 0; i < DecodedBitStreamParser.NUMBER_OF_SEQUENCE_CODEWORDS; i++, codeIndex++) {
- segmentIndexArray[i] = codewords[codeIndex];
- }
- resultMetadata.setSegmentIndex(_Integer.default.parseInt(DecodedBitStreamParser.decodeBase900toBase10(segmentIndexArray, DecodedBitStreamParser.NUMBER_OF_SEQUENCE_CODEWORDS)));
- var fileId = new _StringBuilder.default();
- codeIndex = DecodedBitStreamParser.textCompaction(codewords, codeIndex, fileId);
- resultMetadata.setFileId(fileId.toString());
- var optionalFieldsStart = -1;
- if (codewords[codeIndex] === DecodedBitStreamParser.BEGIN_MACRO_PDF417_OPTIONAL_FIELD) {
- optionalFieldsStart = codeIndex + 1;
- }
- while (codeIndex < codewords[0]) {
- switch (codewords[codeIndex]) {
- case DecodedBitStreamParser.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:
- codeIndex++;
- switch (codewords[codeIndex]) {
- case DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:
- var fileName = new _StringBuilder.default();
- codeIndex = DecodedBitStreamParser.textCompaction(codewords, codeIndex + 1, fileName);
- resultMetadata.setFileName(fileName.toString());
- break;
- case DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_SENDER:
- var sender = new _StringBuilder.default();
- codeIndex = DecodedBitStreamParser.textCompaction(codewords, codeIndex + 1, sender);
- resultMetadata.setSender(sender.toString());
- break;
- case DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:
- var addressee = new _StringBuilder.default();
- codeIndex = DecodedBitStreamParser.textCompaction(codewords, codeIndex + 1, addressee);
- resultMetadata.setAddressee(addressee.toString());
- break;
- case DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:
- var segmentCount = new _StringBuilder.default();
- codeIndex = DecodedBitStreamParser.numericCompaction(codewords, codeIndex + 1, segmentCount);
- resultMetadata.setSegmentCount(_Integer.default.parseInt(segmentCount.toString()));
- break;
- case DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:
- var timestamp = new _StringBuilder.default();
- codeIndex = DecodedBitStreamParser.numericCompaction(codewords, codeIndex + 1, timestamp);
- resultMetadata.setTimestamp(_Long.default.parseLong(timestamp.toString()));
- break;
- case DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:
- var checksum = new _StringBuilder.default();
- codeIndex = DecodedBitStreamParser.numericCompaction(codewords, codeIndex + 1, checksum);
- resultMetadata.setChecksum(_Integer.default.parseInt(checksum.toString()));
- break;
- case DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:
- var fileSize = new _StringBuilder.default();
- codeIndex = DecodedBitStreamParser.numericCompaction(codewords, codeIndex + 1, fileSize);
- resultMetadata.setFileSize(_Long.default.parseLong(fileSize.toString()));
- break;
- default:
- throw _FormatException.default.getFormatInstance();
- }
- break;
- case DecodedBitStreamParser.MACRO_PDF417_TERMINATOR:
- codeIndex++;
- resultMetadata.setLastSegment(true);
- break;
- default:
- throw _FormatException.default.getFormatInstance();
- }
- }
- // copy optional fields to additional options
- if (optionalFieldsStart !== -1) {
- var optionalFieldsLength = codeIndex - optionalFieldsStart;
- if (resultMetadata.isLastSegment()) {
- // do not include terminator
- optionalFieldsLength--;
- }
- resultMetadata.setOptionalData(_Arrays.default.copyOfRange(codewords, optionalFieldsStart, optionalFieldsStart + optionalFieldsLength));
- }
- return codeIndex;
- };
- /**
- * Text Compaction mode (see 5.4.1.5) permits all printable ASCII characters to be
- * encoded, i.e. values 32 - 126 inclusive in accordance with ISO/IEC 646 (IRV), as
- * well as selected control characters.
- *
- * @param codewords The array of codewords (data + error)
- * @param codeIndex The current index into the codeword array.
- * @param result The decoded data is appended to the result.
- * @return The next index into the codeword array.
- */
- DecodedBitStreamParser.textCompaction = function (codewords, codeIndex, result) {
- // 2 character per codeword
- var textCompactionData = new Int32Array((codewords[0] - codeIndex) * 2);
- // Used to hold the byte compaction value if there is a mode shift
- var byteCompactionData = new Int32Array((codewords[0] - codeIndex) * 2);
- var index = 0;
- var end = false;
- while (codeIndex < codewords[0] && !end) {
- var code = codewords[codeIndex++];
- if (code < DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH) {
- textCompactionData[index] = code / 30;
- textCompactionData[index + 1] = code % 30;
- index += 2;
- } else {
- switch (code) {
- case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:
- // reinitialize text compaction mode to alpha sub mode
- textCompactionData[index++] = DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH;
- break;
- case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH:
- case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH_6:
- case DecodedBitStreamParser.NUMERIC_COMPACTION_MODE_LATCH:
- case DecodedBitStreamParser.BEGIN_MACRO_PDF417_CONTROL_BLOCK:
- case DecodedBitStreamParser.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:
- case DecodedBitStreamParser.MACRO_PDF417_TERMINATOR:
- codeIndex--;
- end = true;
- break;
- case DecodedBitStreamParser.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
- // The Mode Shift codeword 913 shall cause a temporary
- // switch from Text Compaction mode to Byte Compaction mode.
- // This switch shall be in effect for only the next codeword,
- // after which the mode shall revert to the prevailing sub-mode
- // of the Text Compaction mode. Codeword 913 is only available
- // in Text Compaction mode; its use is described in 5.4.2.4.
- textCompactionData[index] = DecodedBitStreamParser.MODE_SHIFT_TO_BYTE_COMPACTION_MODE;
- code = codewords[codeIndex++];
- byteCompactionData[index] = code;
- index++;
- break;
- }
- }
- }
- DecodedBitStreamParser.decodeTextCompaction(textCompactionData, byteCompactionData, index, result);
- return codeIndex;
- };
- /**
- * The Text Compaction mode includes all the printable ASCII characters
- * (i.e. values from 32 to 126) and three ASCII control characters: HT or tab
- * (9: e), LF or line feed (10: e), and CR or carriage
- * return (13: e). The Text Compaction mode also includes various latch
- * and shift characters which are used exclusively within the mode. The Text
- * Compaction mode encodes up to 2 characters per codeword. The compaction rules
- * for converting data into PDF417 codewords are defined in 5.4.2.2. The sub-mode
- * switches are defined in 5.4.2.3.
- *
- * @param textCompactionData The text compaction data.
- * @param byteCompactionData The byte compaction data if there
- * was a mode shift.
- * @param length The size of the text compaction and byte compaction data.
- * @param result The decoded data is appended to the result.
- */
- DecodedBitStreamParser.decodeTextCompaction = function (textCompactionData, byteCompactionData, length, result) {
- // Beginning from an initial state of the Alpha sub-mode
- // The default compaction mode for PDF417 in effect at the start of each symbol shall always be Text
- // Compaction mode Alpha sub-mode (alphabetic: uppercase). A latch codeword from another mode to the Text
- // Compaction mode shall always switch to the Text Compaction Alpha sub-mode.
- var subMode = Mode.ALPHA;
- var priorToShiftMode = Mode.ALPHA;
- var i = 0;
- while (i < length) {
- var subModeCh = textCompactionData[i];
- var ch = /*char*/'';
- switch (subMode) {
- case Mode.ALPHA:
- // Alpha (alphabetic: uppercase)
- if (subModeCh < 26) {
- // Upper case Alpha Character
- // Note: 65 = 'A' ASCII -> there is byte code of symbol
- ch = /*(char)('A' + subModeCh) */String.fromCharCode(65 + subModeCh);
- } else {
- switch (subModeCh) {
- case 26:
- ch = ' ';
- break;
- case DecodedBitStreamParser.LL:
- subMode = Mode.LOWER;
- break;
- case DecodedBitStreamParser.ML:
- subMode = Mode.MIXED;
- break;
- case DecodedBitStreamParser.PS:
- // Shift to punctuation
- priorToShiftMode = subMode;
- subMode = Mode.PUNCT_SHIFT;
- break;
- case DecodedBitStreamParser.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
- result.append( /*(char)*/byteCompactionData[i]);
- break;
- case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:
- subMode = Mode.ALPHA;
- break;
- }
- }
- break;
- case Mode.LOWER:
- // Lower (alphabetic: lowercase)
- if (subModeCh < 26) {
- ch = /*(char)('a' + subModeCh)*/String.fromCharCode(97 + subModeCh);
- } else {
- switch (subModeCh) {
- case 26:
- ch = ' ';
- break;
- case DecodedBitStreamParser.AS:
- // Shift to alpha
- priorToShiftMode = subMode;
- subMode = Mode.ALPHA_SHIFT;
- break;
- case DecodedBitStreamParser.ML:
- subMode = Mode.MIXED;
- break;
- case DecodedBitStreamParser.PS:
- // Shift to punctuation
- priorToShiftMode = subMode;
- subMode = Mode.PUNCT_SHIFT;
- break;
- case DecodedBitStreamParser.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
- // TODO Does this need to use the current character encoding? See other occurrences below
- result.append( /*(char)*/byteCompactionData[i]);
- break;
- case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:
- subMode = Mode.ALPHA;
- break;
- }
- }
- break;
- case Mode.MIXED:
- // Mixed (punctuation: e)
- if (subModeCh < DecodedBitStreamParser.PL) {
- ch = DecodedBitStreamParser.MIXED_CHARS[subModeCh];
- } else {
- switch (subModeCh) {
- case DecodedBitStreamParser.PL:
- subMode = Mode.PUNCT;
- break;
- case 26:
- ch = ' ';
- break;
- case DecodedBitStreamParser.LL:
- subMode = Mode.LOWER;
- break;
- case DecodedBitStreamParser.AL:
- subMode = Mode.ALPHA;
- break;
- case DecodedBitStreamParser.PS:
- // Shift to punctuation
- priorToShiftMode = subMode;
- subMode = Mode.PUNCT_SHIFT;
- break;
- case DecodedBitStreamParser.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
- result.append( /*(char)*/byteCompactionData[i]);
- break;
- case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:
- subMode = Mode.ALPHA;
- break;
- }
- }
- break;
- case Mode.PUNCT:
- // Punctuation
- if (subModeCh < DecodedBitStreamParser.PAL) {
- ch = DecodedBitStreamParser.PUNCT_CHARS[subModeCh];
- } else {
- switch (subModeCh) {
- case DecodedBitStreamParser.PAL:
- subMode = Mode.ALPHA;
- break;
- case DecodedBitStreamParser.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
- result.append( /*(char)*/byteCompactionData[i]);
- break;
- case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:
- subMode = Mode.ALPHA;
- break;
- }
- }
- break;
- case Mode.ALPHA_SHIFT:
- // Restore sub-mode
- subMode = priorToShiftMode;
- if (subModeCh < 26) {
- ch = /*(char)('A' + subModeCh)*/String.fromCharCode(65 + subModeCh);
- } else {
- switch (subModeCh) {
- case 26:
- ch = ' ';
- break;
- case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:
- subMode = Mode.ALPHA;
- break;
- }
- }
- break;
- case Mode.PUNCT_SHIFT:
- // Restore sub-mode
- subMode = priorToShiftMode;
- if (subModeCh < DecodedBitStreamParser.PAL) {
- ch = DecodedBitStreamParser.PUNCT_CHARS[subModeCh];
- } else {
- switch (subModeCh) {
- case DecodedBitStreamParser.PAL:
- subMode = Mode.ALPHA;
- break;
- case DecodedBitStreamParser.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
- // PS before Shift-to-Byte is used as a padding character,
- // see 5.4.2.4 of the specification
- result.append( /*(char)*/byteCompactionData[i]);
- break;
- case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:
- subMode = Mode.ALPHA;
- break;
- }
- }
- break;
- }
- // if (ch !== 0) {
- if (ch !== '') {
- // Append decoded character to result
- result.append(ch);
- }
- i++;
- }
- };
- /**
- * Byte Compaction mode (see 5.4.3) permits all 256 possible 8-bit byte values to be encoded.
- * This includes all ASCII characters value 0 to 127 inclusive and provides for international
- * character set support.
- *
- * @param mode The byte compaction mode i.e. 901 or 924
- * @param codewords The array of codewords (data + error)
- * @param encoding Currently active character encoding
- * @param codeIndex The current index into the codeword array.
- * @param result The decoded data is appended to the result.
- * @return The next index into the codeword array.
- */
- DecodedBitStreamParser.byteCompaction = function (mode, codewords, encoding, codeIndex, result) {
- var decodedBytes = new _ByteArrayOutputStream.default();
- var count = 0;
- var value = /*long*/0;
- var end = false;
- switch (mode) {
- case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH:
- // Total number of Byte Compaction characters to be encoded
- // is not a multiple of 6
- var byteCompactedCodewords = new Int32Array(6);
- var nextCode = codewords[codeIndex++];
- while (codeIndex < codewords[0] && !end) {
- byteCompactedCodewords[count++] = nextCode;
- // Base 900
- value = 900 * value + nextCode;
- nextCode = codewords[codeIndex++];
- // perhaps it should be ok to check only nextCode >= TEXT_COMPACTION_MODE_LATCH
- switch (nextCode) {
- case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:
- case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH:
- case DecodedBitStreamParser.NUMERIC_COMPACTION_MODE_LATCH:
- case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH_6:
- case DecodedBitStreamParser.BEGIN_MACRO_PDF417_CONTROL_BLOCK:
- case DecodedBitStreamParser.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:
- case DecodedBitStreamParser.MACRO_PDF417_TERMINATOR:
- codeIndex--;
- end = true;
- break;
- default:
- if (count % 5 === 0 && count > 0) {
- // Decode every 5 codewords
- // Convert to Base 256
- for (var j /*int*/ = 0; j < 6; ++j) {
- /* @note
- * JavaScript stores numbers as 64 bits floating point numbers, but all bitwise operations are performed on 32 bits binary numbers.
- * So the next bitwise operation could not be done with simple numbers
- */
- decodedBytes.write( /*(byte)*/Number(createBigInt(value) >> createBigInt(8 * (5 - j))));
- }
- value = 0;
- count = 0;
- }
- break;
- }
- }
- // if the end of all codewords is reached the last codeword needs to be added
- if (codeIndex === codewords[0] && nextCode < DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH) {
- byteCompactedCodewords[count++] = nextCode;
- }
- // If Byte Compaction mode is invoked with codeword 901,
- // the last group of codewords is interpreted directly
- // as one byte per codeword, without compaction.
- for (var i /*int*/ = 0; i < count; i++) {
- decodedBytes.write( /*(byte)*/byteCompactedCodewords[i]);
- }
- break;
- case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH_6:
- // Total number of Byte Compaction characters to be encoded
- // is an integer multiple of 6
- while (codeIndex < codewords[0] && !end) {
- var code = codewords[codeIndex++];
- if (code < DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH) {
- count++;
- // Base 900
- value = 900 * value + code;
- } else {
- switch (code) {
- case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:
- case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH:
- case DecodedBitStreamParser.NUMERIC_COMPACTION_MODE_LATCH:
- case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH_6:
- case DecodedBitStreamParser.BEGIN_MACRO_PDF417_CONTROL_BLOCK:
- case DecodedBitStreamParser.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:
- case DecodedBitStreamParser.MACRO_PDF417_TERMINATOR:
- codeIndex--;
- end = true;
- break;
- }
- }
- if (count % 5 === 0 && count > 0) {
- // Decode every 5 codewords
- // Convert to Base 256
- /* @note
- * JavaScript stores numbers as 64 bits floating point numbers, but all bitwise operations are performed on 32 bits binary numbers.
- * So the next bitwise operation could not be done with simple numbers
- */
- for (var j /*int*/ = 0; j < 6; ++j) {
- decodedBytes.write( /*(byte)*/Number(createBigInt(value) >> createBigInt(8 * (5 - j))));
- }
- value = 0;
- count = 0;
- }
- }
- break;
- }
- result.append(_StringEncoding.default.decode(decodedBytes.toByteArray(), encoding));
- return codeIndex;
- };
- /**
- * Numeric Compaction mode (see 5.4.4) permits efficient encoding of numeric data strings.
- *
- * @param codewords The array of codewords (data + error)
- * @param codeIndex The current index into the codeword array.
- * @param result The decoded data is appended to the result.
- * @return The next index into the codeword array.
- *
- * @throws FormatException
- */
- DecodedBitStreamParser.numericCompaction = function (codewords, codeIndex /*int*/, result) {
- var count = 0;
- var end = false;
- var numericCodewords = new Int32Array(DecodedBitStreamParser.MAX_NUMERIC_CODEWORDS);
- while (codeIndex < codewords[0] && !end) {
- var code = codewords[codeIndex++];
- if (codeIndex === codewords[0]) {
- end = true;
- }
- if (code < DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH) {
- numericCodewords[count] = code;
- count++;
- } else {
- switch (code) {
- case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:
- case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH:
- case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH_6:
- case DecodedBitStreamParser.BEGIN_MACRO_PDF417_CONTROL_BLOCK:
- case DecodedBitStreamParser.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:
- case DecodedBitStreamParser.MACRO_PDF417_TERMINATOR:
- codeIndex--;
- end = true;
- break;
- }
- }
- if ((count % DecodedBitStreamParser.MAX_NUMERIC_CODEWORDS === 0 || code === DecodedBitStreamParser.NUMERIC_COMPACTION_MODE_LATCH || end) && count > 0) {
- // Re-invoking Numeric Compaction mode (by using codeword 902
- // while in Numeric Compaction mode) serves to terminate the
- // current Numeric Compaction mode grouping as described in 5.4.4.2,
- // and then to start a new one grouping.
- result.append(DecodedBitStreamParser.decodeBase900toBase10(numericCodewords, count));
- count = 0;
- }
- }
- return codeIndex;
- };
- /**
- * Convert a list of Numeric Compacted codewords from Base 900 to Base 10.
- *
- * @param codewords The array of codewords
- * @param count The number of codewords
- * @return The decoded string representing the Numeric data.
- *
- * EXAMPLE
- * Encode the fifteen digit numeric string 000213298174000
- * Prefix the numeric string with a 1 and set the initial value of
- * t = 1 000 213 298 174 000
- * Calculate codeword 0
- * d0 = 1 000 213 298 174 000 mod 900 = 200
- *
- * t = 1 000 213 298 174 000 div 900 = 1 111 348 109 082
- * Calculate codeword 1
- * d1 = 1 111 348 109 082 mod 900 = 282
- *
- * t = 1 111 348 109 082 div 900 = 1 234 831 232
- * Calculate codeword 2
- * d2 = 1 234 831 232 mod 900 = 632
- *
- * t = 1 234 831 232 div 900 = 1 372 034
- * Calculate codeword 3
- * d3 = 1 372 034 mod 900 = 434
- *
- * t = 1 372 034 div 900 = 1 524
- * Calculate codeword 4
- * d4 = 1 524 mod 900 = 624
- *
- * t = 1 524 div 900 = 1
- * Calculate codeword 5
- * d5 = 1 mod 900 = 1
- * t = 1 div 900 = 0
- * Codeword sequence is: 1, 624, 434, 632, 282, 200
- *
- * Decode the above codewords involves
- * 1 x 900 power of 5 + 624 x 900 power of 4 + 434 x 900 power of 3 +
- * 632 x 900 power of 2 + 282 x 900 power of 1 + 200 x 900 power of 0 = 1000213298174000
- *
- * Remove leading 1 => Result is 000213298174000
- *
- * @throws FormatException
- */
- DecodedBitStreamParser.decodeBase900toBase10 = function (codewords, count) {
- var result = createBigInt(0);
- for (var i /*int*/ = 0; i < count; i++) {
- result += DecodedBitStreamParser.EXP900[count - i - 1] * createBigInt(codewords[i]);
- }
- var resultString = result.toString();
- if (resultString.charAt(0) !== '1') {
- throw new _FormatException.default();
- }
- return resultString.substring(1);
- };
- DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH = 900;
- DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH = 901;
- DecodedBitStreamParser.NUMERIC_COMPACTION_MODE_LATCH = 902;
- DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH_6 = 924;
- DecodedBitStreamParser.ECI_USER_DEFINED = 925;
- DecodedBitStreamParser.ECI_GENERAL_PURPOSE = 926;
- DecodedBitStreamParser.ECI_CHARSET = 927;
- DecodedBitStreamParser.BEGIN_MACRO_PDF417_CONTROL_BLOCK = 928;
- DecodedBitStreamParser.BEGIN_MACRO_PDF417_OPTIONAL_FIELD = 923;
- DecodedBitStreamParser.MACRO_PDF417_TERMINATOR = 922;
- DecodedBitStreamParser.MODE_SHIFT_TO_BYTE_COMPACTION_MODE = 913;
- DecodedBitStreamParser.MAX_NUMERIC_CODEWORDS = 15;
- DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME = 0;
- DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT = 1;
- DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP = 2;
- DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_SENDER = 3;
- DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE = 4;
- DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE = 5;
- DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM = 6;
- DecodedBitStreamParser.PL = 25;
- DecodedBitStreamParser.LL = 27;
- DecodedBitStreamParser.AS = 27;
- DecodedBitStreamParser.ML = 28;
- DecodedBitStreamParser.AL = 28;
- DecodedBitStreamParser.PS = 29;
- DecodedBitStreamParser.PAL = 29;
- DecodedBitStreamParser.PUNCT_CHARS = ';<>@[\\]_`~!\r\t,:\n-.$/"|*()?{}\'';
- DecodedBitStreamParser.MIXED_CHARS = '0123456789&\r\t,:#-.$/+%*=^';
- /**
- * Table containing values for the exponent of 900.
- * This is used in the numeric compaction decode algorithm.
- */
- DecodedBitStreamParser.EXP900 = getBigIntConstructor() ? getEXP900() : [];
- DecodedBitStreamParser.NUMBER_OF_SEQUENCE_CODEWORDS = 2;
- return DecodedBitStreamParser;
- }();
- var _default = DecodedBitStreamParser;
- exports.default = _default;
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! (webpack)/buildin/global.js */ 3)))
- /***/ }),
- /* 452 */
- /*!***********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/PDF417ResultMetadata.js ***!
- \***********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- /*
- * Copyright 2013 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- // package com.google.zxing.pdf417;
- /**
- * @author Guenther Grau
- */
- var PDF417ResultMetadata = /** @class */function () {
- function PDF417ResultMetadata() {
- this.segmentCount = -1;
- this.fileSize = -1;
- this.timestamp = -1;
- this.checksum = -1;
- }
- /**
- * The Segment ID represents the segment of the whole file distributed over different symbols.
- *
- * @return File segment index
- */
- PDF417ResultMetadata.prototype.getSegmentIndex = function () {
- return this.segmentIndex;
- };
- PDF417ResultMetadata.prototype.setSegmentIndex = function (segmentIndex) {
- this.segmentIndex = segmentIndex;
- };
- /**
- * Is the same for each related PDF417 symbol
- *
- * @return File ID
- */
- PDF417ResultMetadata.prototype.getFileId = function () {
- return this.fileId;
- };
- PDF417ResultMetadata.prototype.setFileId = function (fileId) {
- this.fileId = fileId;
- };
- /**
- * @return always null
- * @deprecated use dedicated already parsed fields
- */
- // @Deprecated
- PDF417ResultMetadata.prototype.getOptionalData = function () {
- return this.optionalData;
- };
- /**
- * @param optionalData old optional data format as int array
- * @deprecated parse and use new fields
- */
- // @Deprecated
- PDF417ResultMetadata.prototype.setOptionalData = function (optionalData) {
- this.optionalData = optionalData;
- };
- /**
- * @return true if it is the last segment
- */
- PDF417ResultMetadata.prototype.isLastSegment = function () {
- return this.lastSegment;
- };
- PDF417ResultMetadata.prototype.setLastSegment = function (lastSegment) {
- this.lastSegment = lastSegment;
- };
- /**
- * @return count of segments, -1 if not set
- */
- PDF417ResultMetadata.prototype.getSegmentCount = function () {
- return this.segmentCount;
- };
- PDF417ResultMetadata.prototype.setSegmentCount = function (segmentCount /*int*/) {
- this.segmentCount = segmentCount;
- };
- PDF417ResultMetadata.prototype.getSender = function () {
- return this.sender || null;
- };
- PDF417ResultMetadata.prototype.setSender = function (sender) {
- this.sender = sender;
- };
- PDF417ResultMetadata.prototype.getAddressee = function () {
- return this.addressee || null;
- };
- PDF417ResultMetadata.prototype.setAddressee = function (addressee) {
- this.addressee = addressee;
- };
- /**
- * Filename of the encoded file
- *
- * @return filename
- */
- PDF417ResultMetadata.prototype.getFileName = function () {
- return this.fileName;
- };
- PDF417ResultMetadata.prototype.setFileName = function (fileName) {
- this.fileName = fileName;
- };
- /**
- * filesize in bytes of the encoded file
- *
- * @return filesize in bytes, -1 if not set
- */
- PDF417ResultMetadata.prototype.getFileSize = function () {
- return this.fileSize;
- };
- PDF417ResultMetadata.prototype.setFileSize = function (fileSize /*long*/) {
- this.fileSize = fileSize;
- };
- /**
- * 16-bit CRC checksum using CCITT-16
- *
- * @return crc checksum, -1 if not set
- */
- PDF417ResultMetadata.prototype.getChecksum = function () {
- return this.checksum;
- };
- PDF417ResultMetadata.prototype.setChecksum = function (checksum /*int*/) {
- this.checksum = checksum;
- };
- /**
- * unix epock timestamp, elapsed seconds since 1970-01-01
- *
- * @return elapsed seconds, -1 if not set
- */
- PDF417ResultMetadata.prototype.getTimestamp = function () {
- return this.timestamp;
- };
- PDF417ResultMetadata.prototype.setTimestamp = function (timestamp /*long*/) {
- this.timestamp = timestamp;
- };
- return PDF417ResultMetadata;
- }();
- var _default = PDF417ResultMetadata;
- exports.default = _default;
- /***/ }),
- /* 453 */
- /*!*****************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/util/Long.js ***!
- \*****************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- /**
- * Ponyfill for Java's Long class.
- */
- var Long = /** @class */function () {
- function Long() {}
- /**
- * Parses a string to a number, since JS has no really Int64.
- *
- * @param num Numeric string.
- * @param radix Destination radix.
- */
- Long.parseLong = function (num, radix) {
- if (radix === void 0) {
- radix = undefined;
- }
- return parseInt(num, radix);
- };
- return Long;
- }();
- var _default = Long;
- exports.default = _default;
- /***/ }),
- /* 454 */
- /*!**********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/util/ByteArrayOutputStream.js ***!
- \**********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _Arrays = _interopRequireDefault(__webpack_require__(/*! ./Arrays */ 314));
- var _OutputStream = _interopRequireDefault(__webpack_require__(/*! ./OutputStream */ 455));
- var _Integer = _interopRequireDefault(__webpack_require__(/*! ./Integer */ 318));
- var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../IllegalArgumentException */ 308));
- var _OutOfMemoryError = _interopRequireDefault(__webpack_require__(/*! ../OutOfMemoryError */ 457));
- var _System = _interopRequireDefault(__webpack_require__(/*! ./System */ 315));
- var _IndexOutOfBoundsException = _interopRequireDefault(__webpack_require__(/*! ../IndexOutOfBoundsException */ 317));
- /*
- * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- // package java.io;
- // import java.util.Arrays;
- /**
- * This class implements an output stream in which the data is
- * written into a byte array. The buffer automatically grows as data
- * is written to it.
- * The data can be retrieved using <code>toByteArray()</code> and
- * <code>toString()</code>.
- * <p>
- * Closing a <tt>ByteArrayOutputStream</tt> has no effect. The methods in
- * this class can be called after the stream has been closed without
- * generating an <tt>IOException</tt>.
- *
- * @author Arthur van Hoff
- * @since JDK1.0
- */
- var ByteArrayOutputStream = /** @class */function (_super) {
- __extends(ByteArrayOutputStream, _super);
- /**
- * Creates a new byte array output stream. The buffer capacity is
- * initially 32 bytes, though its size increases if necessary.
- */
- // public constructor() {
- // this(32);
- // }
- /**
- * Creates a new byte array output stream, with a buffer capacity of
- * the specified size, in bytes.
- *
- * @param size the initial size.
- * @exception IllegalArgumentException if size is negative.
- */
- function ByteArrayOutputStream(size) {
- if (size === void 0) {
- size = 32;
- }
- var _this = _super.call(this) || this;
- /**
- * The number of valid bytes in the buffer.
- */
- _this.count = 0;
- if (size < 0) {
- throw new _IllegalArgumentException.default('Negative initial size: ' + size);
- }
- _this.buf = new Uint8Array(size);
- return _this;
- }
- /**
- * Increases the capacity if necessary to ensure that it can hold
- * at least the number of elements specified by the minimum
- * capacity argument.
- *
- * @param minCapacity the desired minimum capacity
- * @throws OutOfMemoryError if {@code minCapacity < 0}. This is
- * interpreted as a request for the unsatisfiably large capacity
- * {@code (long) Integer.MAX_VALUE + (minCapacity - Integer.MAX_VALUE)}.
- */
- ByteArrayOutputStream.prototype.ensureCapacity = function (minCapacity) {
- // overflow-conscious code
- if (minCapacity - this.buf.length > 0) this.grow(minCapacity);
- };
- /**
- * Increases the capacity to ensure that it can hold at least the
- * number of elements specified by the minimum capacity argument.
- *
- * @param minCapacity the desired minimum capacity
- */
- ByteArrayOutputStream.prototype.grow = function (minCapacity) {
- // overflow-conscious code
- var oldCapacity = this.buf.length;
- var newCapacity = oldCapacity << 1;
- if (newCapacity - minCapacity < 0) newCapacity = minCapacity;
- if (newCapacity < 0) {
- if (minCapacity < 0)
- // overflow
- throw new _OutOfMemoryError.default();
- newCapacity = _Integer.default.MAX_VALUE;
- }
- this.buf = _Arrays.default.copyOfUint8Array(this.buf, newCapacity);
- };
- /**
- * Writes the specified byte to this byte array output stream.
- *
- * @param b the byte to be written.
- */
- ByteArrayOutputStream.prototype.write = function (b) {
- this.ensureCapacity(this.count + 1);
- this.buf[this.count] = /*(byte)*/b;
- this.count += 1;
- };
- /**
- * Writes <code>len</code> bytes from the specified byte array
- * starting at offset <code>off</code> to this byte array output stream.
- *
- * @param b the data.
- * @param off the start offset in the data.
- * @param len the number of bytes to write.
- */
- ByteArrayOutputStream.prototype.writeBytesOffset = function (b, off, len) {
- if (off < 0 || off > b.length || len < 0 || off + len - b.length > 0) {
- throw new _IndexOutOfBoundsException.default();
- }
- this.ensureCapacity(this.count + len);
- _System.default.arraycopy(b, off, this.buf, this.count, len);
- this.count += len;
- };
- /**
- * Writes the complete contents of this byte array output stream to
- * the specified output stream argument, as if by calling the output
- * stream's write method using <code>out.write(buf, 0, count)</code>.
- *
- * @param out the output stream to which to write the data.
- * @exception IOException if an I/O error occurs.
- */
- ByteArrayOutputStream.prototype.writeTo = function (out) {
- out.writeBytesOffset(this.buf, 0, this.count);
- };
- /**
- * Resets the <code>count</code> field of this byte array output
- * stream to zero, so that all currently accumulated output in the
- * output stream is discarded. The output stream can be used again,
- * reusing the already allocated buffer space.
- *
- * @see java.io.ByteArrayInputStream#count
- */
- ByteArrayOutputStream.prototype.reset = function () {
- this.count = 0;
- };
- /**
- * Creates a newly allocated byte array. Its size is the current
- * size of this output stream and the valid contents of the buffer
- * have been copied into it.
- *
- * @return the current contents of this output stream, as a byte array.
- * @see java.io.ByteArrayOutputStream#size()
- */
- ByteArrayOutputStream.prototype.toByteArray = function () {
- return _Arrays.default.copyOfUint8Array(this.buf, this.count);
- };
- /**
- * Returns the current size of the buffer.
- *
- * @return the value of the <code>count</code> field, which is the number
- * of valid bytes in this output stream.
- * @see java.io.ByteArrayOutputStream#count
- */
- ByteArrayOutputStream.prototype.size = function () {
- return this.count;
- };
- ByteArrayOutputStream.prototype.toString = function (param) {
- if (!param) {
- return this.toString_void();
- }
- if (typeof param === 'string') {
- return this.toString_string(param);
- }
- return this.toString_number(param);
- };
- /**
- * Converts the buffer's contents into a string decoding bytes using the
- * platform's default character set. The length of the new <tt>String</tt>
- * is a function of the character set, and hence may not be equal to the
- * size of the buffer.
- *
- * <p> This method always replaces malformed-input and unmappable-character
- * sequences with the default replacement string for the platform's
- * default character set. The {@linkplain java.nio.charset.CharsetDecoder}
- * class should be used when more control over the decoding process is
- * required.
- *
- * @return String decoded from the buffer's contents.
- * @since JDK1.1
- */
- ByteArrayOutputStream.prototype.toString_void = function () {
- return new String(this.buf /*, 0, this.count*/).toString();
- };
- /**
- * Converts the buffer's contents into a string by decoding the bytes using
- * the specified {@link java.nio.charset.Charset charsetName}. The length of
- * the new <tt>String</tt> is a function of the charset, and hence may not be
- * equal to the length of the byte array.
- *
- * <p> This method always replaces malformed-input and unmappable-character
- * sequences with this charset's default replacement string. The {@link
- * java.nio.charset.CharsetDecoder} class should be used when more control
- * over the decoding process is required.
- *
- * @param charsetName the name of a supported
- * {@linkplain java.nio.charset.Charset </code>charset<code>}
- * @return String decoded from the buffer's contents.
- * @exception UnsupportedEncodingException
- * If the named charset is not supported
- * @since JDK1.1
- */
- ByteArrayOutputStream.prototype.toString_string = function (charsetName) {
- return new String(this.buf /*, 0, this.count, charsetName*/).toString();
- };
- /**
- * Creates a newly allocated string. Its size is the current size of
- * the output stream and the valid contents of the buffer have been
- * copied into it. Each character <i>c</i> in the resulting string is
- * constructed from the corresponding element <i>b</i> in the byte
- * array such that:
- * <blockquote><pre>
- * c == (char)(((hibyte & 0xff) << 8) | (b & 0xff))
- * </pre></blockquote>
- *
- * @deprecated This method does not properly convert bytes into characters.
- * As of JDK 1.1, the preferred way to do this is via the
- * <code>toString(String enc)</code> method, which takes an encoding-name
- * argument, or the <code>toString()</code> method, which uses the
- * platform's default character encoding.
- *
- * @param hibyte the high byte of each resulting Unicode character.
- * @return the current contents of the output stream, as a string.
- * @see java.io.ByteArrayOutputStream#size()
- * @see java.io.ByteArrayOutputStream#toString(String)
- * @see java.io.ByteArrayOutputStream#toString()
- */
- // @Deprecated
- ByteArrayOutputStream.prototype.toString_number = function (hibyte) {
- return new String(this.buf /*, hibyte, 0, this.count*/).toString();
- };
- /**
- * Closing a <tt>ByteArrayOutputStream</tt> has no effect. The methods in
- * this class can be called after the stream has been closed without
- * generating an <tt>IOException</tt>.
- * <p>
- *
- * @throws IOException
- */
- ByteArrayOutputStream.prototype.close = function () {};
- return ByteArrayOutputStream;
- }(_OutputStream.default);
- var _default = ByteArrayOutputStream;
- exports.default = _default;
- /***/ }),
- /* 455 */
- /*!*************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/util/OutputStream.js ***!
- \*************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _IndexOutOfBoundsException = _interopRequireDefault(__webpack_require__(/*! ../IndexOutOfBoundsException */ 317));
- var _NullPointerException = _interopRequireDefault(__webpack_require__(/*! ../NullPointerException */ 456));
- /*
- * Copyright (c) 1994, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
- // package java.io;
- /**
- * This abstract class is the superclass of all classes representing
- * an output stream of bytes. An output stream accepts output bytes
- * and sends them to some sink.
- * <p>
- * Applications that need to define a subclass of
- * <code>OutputStream</code> must always provide at least a method
- * that writes one byte of output.
- *
- * @author Arthur van Hoff
- * @see java.io.BufferedOutputStream
- * @see java.io.ByteArrayOutputStream
- * @see java.io.DataOutputStream
- * @see java.io.FilterOutputStream
- * @see java.io.InputStream
- * @see java.io.OutputStream#write(int)
- * @since JDK1.0
- */
- var OutputStream /*implements Closeable, Flushable*/ = /** @class */function () {
- function OutputStream() {}
- /**
- * Writes <code>b.length</code> bytes from the specified byte array
- * to this output stream. The general contract for <code>write(b)</code>
- * is that it should have exactly the same effect as the call
- * <code>write(b, 0, b.length)</code>.
- *
- * @param b the data.
- * @exception IOException if an I/O error occurs.
- * @see java.io.OutputStream#write(byte[], int, int)
- */
- OutputStream.prototype.writeBytes = function (b) {
- this.writeBytesOffset(b, 0, b.length);
- };
- /**
- * Writes <code>len</code> bytes from the specified byte array
- * starting at offset <code>off</code> to this output stream.
- * The general contract for <code>write(b, off, len)</code> is that
- * some of the bytes in the array <code>b</code> are written to the
- * output stream in order; element <code>b[off]</code> is the first
- * byte written and <code>b[off+len-1]</code> is the last byte written
- * by this operation.
- * <p>
- * The <code>write</code> method of <code>OutputStream</code> calls
- * the write method of one argument on each of the bytes to be
- * written out. Subclasses are encouraged to override this method and
- * provide a more efficient implementation.
- * <p>
- * If <code>b</code> is <code>null</code>, a
- * <code>NullPointerException</code> is thrown.
- * <p>
- * If <code>off</code> is negative, or <code>len</code> is negative, or
- * <code>off+len</code> is greater than the length of the array
- * <code>b</code>, then an <tt>IndexOutOfBoundsException</tt> is thrown.
- *
- * @param b the data.
- * @param off the start offset in the data.
- * @param len the number of bytes to write.
- * @exception IOException if an I/O error occurs. In particular,
- * an <code>IOException</code> is thrown if the output
- * stream is closed.
- */
- OutputStream.prototype.writeBytesOffset = function (b, off, len) {
- if (b == null) {
- throw new _NullPointerException.default();
- } else if (off < 0 || off > b.length || len < 0 || off + len > b.length || off + len < 0) {
- throw new _IndexOutOfBoundsException.default();
- } else if (len === 0) {
- return;
- }
- for (var i = 0; i < len; i++) {
- this.write(b[off + i]);
- }
- };
- /**
- * Flushes this output stream and forces any buffered output bytes
- * to be written out. The general contract of <code>flush</code> is
- * that calling it is an indication that, if any bytes previously
- * written have been buffered by the implementation of the output
- * stream, such bytes should immediately be written to their
- * intended destination.
- * <p>
- * If the intended destination of this stream is an abstraction provided by
- * the underlying operating system, for example a file, then flushing the
- * stream guarantees only that bytes previously written to the stream are
- * passed to the operating system for writing; it does not guarantee that
- * they are actually written to a physical device such as a disk drive.
- * <p>
- * The <code>flush</code> method of <code>OutputStream</code> does nothing.
- *
- * @exception IOException if an I/O error occurs.
- */
- OutputStream.prototype.flush = function () {};
- /**
- * Closes this output stream and releases any system resources
- * associated with this stream. The general contract of <code>close</code>
- * is that it closes the output stream. A closed stream cannot perform
- * output operations and cannot be reopened.
- * <p>
- * The <code>close</code> method of <code>OutputStream</code> does nothing.
- *
- * @exception IOException if an I/O error occurs.
- */
- OutputStream.prototype.close = function () {};
- return OutputStream;
- }();
- var _default = OutputStream;
- exports.default = _default;
- /***/ }),
- /* 456 */
- /*!****************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/NullPointerException.js ***!
- \****************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _Exception = _interopRequireDefault(__webpack_require__(/*! ./Exception */ 305));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /**
- * Custom Error class of type Exception.
- */
- var NullPointerException = /** @class */function (_super) {
- __extends(NullPointerException, _super);
- function NullPointerException() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- NullPointerException.kind = 'NullPointerException';
- return NullPointerException;
- }(_Exception.default);
- var _default = NullPointerException;
- exports.default = _default;
- /***/ }),
- /* 457 */
- /*!************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/OutOfMemoryError.js ***!
- \************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _Exception = _interopRequireDefault(__webpack_require__(/*! ./Exception */ 305));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /**
- * Custom Error class of type Exception.
- */
- var OutOfMemoryError = /** @class */function (_super) {
- __extends(OutOfMemoryError, _super);
- function OutOfMemoryError() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- return OutOfMemoryError;
- }(_Exception.default);
- var _default = OutOfMemoryError;
- exports.default = _default;
- /***/ }),
- /* 458 */
- /*!***********************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/ReaderException.js ***!
- \***********************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _Exception = _interopRequireDefault(__webpack_require__(/*! ./Exception */ 305));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /**
- * Custom Error class of type Exception.
- */
- var ReaderException = /** @class */function (_super) {
- __extends(ReaderException, _super);
- function ReaderException() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ReaderException.kind = 'ReaderException';
- return ReaderException;
- }(_Exception.default);
- var _default = ReaderException;
- exports.default = _default;
- /***/ }),
- /* 459 */
- /*!******************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/browser/BrowserPDF417Reader.js ***!
- \******************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.BrowserPDF417Reader = void 0;
- var _BrowserCodeReader = __webpack_require__(/*! ./BrowserCodeReader */ 303);
- var _PDF417Reader = _interopRequireDefault(__webpack_require__(/*! ../core/pdf417/PDF417Reader */ 433));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /**
- * @deprecated Moving to @zxing/browser
- *
- * QR Code reader to use from browser.
- */
- var BrowserPDF417Reader = /** @class */function (_super) {
- __extends(BrowserPDF417Reader, _super);
- /**
- * Creates an instance of BrowserPDF417Reader.
- * @param {number} [timeBetweenScansMillis=500] the time delay between subsequent decode tries
- */
- function BrowserPDF417Reader(timeBetweenScansMillis) {
- if (timeBetweenScansMillis === void 0) {
- timeBetweenScansMillis = 500;
- }
- return _super.call(this, new _PDF417Reader.default(), timeBetweenScansMillis) || this;
- }
- return BrowserPDF417Reader;
- }(_BrowserCodeReader.BrowserCodeReader);
- exports.BrowserPDF417Reader = BrowserPDF417Reader;
- /***/ }),
- /* 460 */
- /*!******************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/browser/BrowserQRCodeReader.js ***!
- \******************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.BrowserQRCodeReader = void 0;
- var _BrowserCodeReader = __webpack_require__(/*! ./BrowserCodeReader */ 303);
- var _QRCodeReader = _interopRequireDefault(__webpack_require__(/*! ../core/qrcode/QRCodeReader */ 414));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /**
- * @deprecated Moving to @zxing/browser
- *
- * QR Code reader to use from browser.
- */
- var BrowserQRCodeReader = /** @class */function (_super) {
- __extends(BrowserQRCodeReader, _super);
- /**
- * Creates an instance of BrowserQRCodeReader.
- * @param {number} [timeBetweenScansMillis=500] the time delay between subsequent decode tries
- */
- function BrowserQRCodeReader(timeBetweenScansMillis) {
- if (timeBetweenScansMillis === void 0) {
- timeBetweenScansMillis = 500;
- }
- return _super.call(this, new _QRCodeReader.default(), timeBetweenScansMillis) || this;
- }
- return BrowserQRCodeReader;
- }(_BrowserCodeReader.BrowserCodeReader);
- exports.BrowserQRCodeReader = BrowserQRCodeReader;
- /***/ }),
- /* 461 */
- /*!*********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/browser/BrowserQRCodeSvgWriter.js ***!
- \*********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.BrowserQRCodeSvgWriter = void 0;
- var _EncodeHintType = _interopRequireDefault(__webpack_require__(/*! ../core/EncodeHintType */ 462));
- var _Encoder = _interopRequireDefault(__webpack_require__(/*! ../core/qrcode/encoder/Encoder */ 463));
- var _ErrorCorrectionLevel = _interopRequireDefault(__webpack_require__(/*! ../core/qrcode/decoder/ErrorCorrectionLevel */ 419));
- var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../core/IllegalArgumentException */ 308));
- var _IllegalStateException = _interopRequireDefault(__webpack_require__(/*! ../core/IllegalStateException */ 344));
- /**
- * @deprecated Moving to @zxing/browser
- */
- var BrowserQRCodeSvgWriter = /** @class */function () {
- function BrowserQRCodeSvgWriter() {}
- /**
- * Writes and renders a QRCode SVG element.
- *
- * @param contents
- * @param width
- * @param height
- * @param hints
- */
- BrowserQRCodeSvgWriter.prototype.write = function (contents, width, height, hints) {
- if (hints === void 0) {
- hints = null;
- }
- if (contents.length === 0) {
- throw new _IllegalArgumentException.default('Found empty contents');
- }
- // if (format != BarcodeFormat.QR_CODE) {
- // throw new IllegalArgumentException("Can only encode QR_CODE, but got " + format)
- // }
- if (width < 0 || height < 0) {
- throw new _IllegalArgumentException.default('Requested dimensions are too small: ' + width + 'x' + height);
- }
- var errorCorrectionLevel = _ErrorCorrectionLevel.default.L;
- var quietZone = BrowserQRCodeSvgWriter.QUIET_ZONE_SIZE;
- if (hints !== null) {
- if (undefined !== hints.get(_EncodeHintType.default.ERROR_CORRECTION)) {
- errorCorrectionLevel = _ErrorCorrectionLevel.default.fromString(hints.get(_EncodeHintType.default.ERROR_CORRECTION).toString());
- }
- if (undefined !== hints.get(_EncodeHintType.default.MARGIN)) {
- quietZone = Number.parseInt(hints.get(_EncodeHintType.default.MARGIN).toString(), 10);
- }
- }
- var code = _Encoder.default.encode(contents, errorCorrectionLevel, hints);
- return this.renderResult(code, width, height, quietZone);
- };
- /**
- * Renders the result and then appends it to the DOM.
- */
- BrowserQRCodeSvgWriter.prototype.writeToDom = function (containerElement, contents, width, height, hints) {
- if (hints === void 0) {
- hints = null;
- }
- if (typeof containerElement === 'string') {
- containerElement = document.querySelector(containerElement);
- }
- var svgElement = this.write(contents, width, height, hints);
- if (containerElement) containerElement.appendChild(svgElement);
- };
- /**
- * Note that the input matrix uses 0 == white, 1 == black.
- * The output matrix uses 0 == black, 255 == white (i.e. an 8 bit greyscale bitmap).
- */
- BrowserQRCodeSvgWriter.prototype.renderResult = function (code, width /*int*/, height /*int*/, quietZone /*int*/) {
- var input = code.getMatrix();
- if (input === null) {
- throw new _IllegalStateException.default();
- }
- var inputWidth = input.getWidth();
- var inputHeight = input.getHeight();
- var qrWidth = inputWidth + quietZone * 2;
- var qrHeight = inputHeight + quietZone * 2;
- var outputWidth = Math.max(width, qrWidth);
- var outputHeight = Math.max(height, qrHeight);
- var multiple = Math.min(Math.floor(outputWidth / qrWidth), Math.floor(outputHeight / qrHeight));
- // Padding includes both the quiet zone and the extra white pixels to accommodate the requested
- // dimensions. For example, if input is 25x25 the QR will be 33x33 including the quiet zone.
- // If the requested size is 200x160, the multiple will be 4, for a QR of 132x132. These will
- // handle all the padding from 100x100 (the actual QR) up to 200x160.
- var leftPadding = Math.floor((outputWidth - inputWidth * multiple) / 2);
- var topPadding = Math.floor((outputHeight - inputHeight * multiple) / 2);
- var svgElement = this.createSVGElement(outputWidth, outputHeight);
- for (var inputY = 0, outputY = topPadding; inputY < inputHeight; inputY++, outputY += multiple) {
- // Write the contents of this row of the barcode
- for (var inputX = 0, outputX = leftPadding; inputX < inputWidth; inputX++, outputX += multiple) {
- if (input.get(inputX, inputY) === 1) {
- var svgRectElement = this.createSvgRectElement(outputX, outputY, multiple, multiple);
- svgElement.appendChild(svgRectElement);
- }
- }
- }
- return svgElement;
- };
- /**
- * Creates a SVG element.
- *
- * @param w SVG's width attribute
- * @param h SVG's height attribute
- */
- BrowserQRCodeSvgWriter.prototype.createSVGElement = function (w, h) {
- var svgElement = document.createElementNS(BrowserQRCodeSvgWriter.SVG_NS, 'svg');
- svgElement.setAttributeNS(null, 'height', w.toString());
- svgElement.setAttributeNS(null, 'width', h.toString());
- return svgElement;
- };
- /**
- * Creates a SVG rect element.
- *
- * @param x Element's x coordinate
- * @param y Element's y coordinate
- * @param w Element's width attribute
- * @param h Element's height attribute
- */
- BrowserQRCodeSvgWriter.prototype.createSvgRectElement = function (x, y, w, h) {
- var rect = document.createElementNS(BrowserQRCodeSvgWriter.SVG_NS, 'rect');
- rect.setAttributeNS(null, 'x', x.toString());
- rect.setAttributeNS(null, 'y', y.toString());
- rect.setAttributeNS(null, 'height', w.toString());
- rect.setAttributeNS(null, 'width', h.toString());
- rect.setAttributeNS(null, 'fill', '#000000');
- return rect;
- };
- BrowserQRCodeSvgWriter.QUIET_ZONE_SIZE = 4;
- /**
- * SVG markup NameSpace
- */
- BrowserQRCodeSvgWriter.SVG_NS = 'http://www.w3.org/2000/svg';
- return BrowserQRCodeSvgWriter;
- }();
- exports.BrowserQRCodeSvgWriter = BrowserQRCodeSvgWriter;
- /***/ }),
- /* 462 */
- /*!**********************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/EncodeHintType.js ***!
- \**********************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- /*
- * Copyright 2009 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /*namespace com.google.zxing {*/
- /**
- * These are a set of hints that you may pass to Writers to specify their behavior.
- *
- * @author dswitkin@google.com (Daniel Switkin)
- */
- var EncodeHintType;
- (function (EncodeHintType) {
- /**
- * Specifies what degree of error correction to use, for example in QR Codes.
- * Type depends on the encoder. For example for QR codes it's type
- * {@link com.google.zxing.qrcode.decoder.ErrorCorrectionLevel ErrorCorrectionLevel}.
- * For Aztec it is of type {@link Integer}, representing the minimal percentage of error correction words.
- * For PDF417 it is of type {@link Integer}, valid values being 0 to 8.
- * In all cases, it can also be a {@link String} representation of the desired value as well.
- * Note: an Aztec symbol should have a minimum of 25% EC words.
- */
- EncodeHintType[EncodeHintType["ERROR_CORRECTION"] = 0] = "ERROR_CORRECTION";
- /**
- * Specifies what character encoding to use where applicable (type {@link String})
- */
- EncodeHintType[EncodeHintType["CHARACTER_SET"] = 1] = "CHARACTER_SET";
- /**
- * Specifies the matrix shape for Data Matrix (type {@link com.google.zxing.datamatrix.encoder.SymbolShapeHint})
- */
- EncodeHintType[EncodeHintType["DATA_MATRIX_SHAPE"] = 2] = "DATA_MATRIX_SHAPE";
- /**
- * Specifies whether to use compact mode for Data Matrix (type {@link Boolean}, or "true" or "false"
- * {@link String } value).
- * The compact encoding mode also supports the encoding of characters that are not in the ISO-8859-1
- * character set via ECIs.
- * Please note that in that case, the most compact character encoding is chosen for characters in
- * the input that are not in the ISO-8859-1 character set. Based on experience, some scanners do not
- * support encodings like cp-1256 (Arabic). In such cases the encoding can be forced to UTF-8 by
- * means of the {@link #CHARACTER_SET} encoding hint.
- * Compact encoding also provides GS1-FNC1 support when {@link #GS1_FORMAT} is selected. In this case
- * group-separator character (ASCII 29 decimal) can be used to encode the positions of FNC1 codewords
- * for the purpose of delimiting AIs.
- * This option and {@link #FORCE_C40} are mutually exclusive.
- */
- EncodeHintType[EncodeHintType["DATA_MATRIX_COMPACT"] = 3] = "DATA_MATRIX_COMPACT";
- /**
- * Specifies a minimum barcode size (type {@link Dimension}). Only applicable to Data Matrix now.
- *
- * @deprecated use width/height params in
- * {@link com.google.zxing.datamatrix.DataMatrixWriter#encode(String, BarcodeFormat, int, int)}
- */
- /*@Deprecated*/
- EncodeHintType[EncodeHintType["MIN_SIZE"] = 4] = "MIN_SIZE";
- /**
- * Specifies a maximum barcode size (type {@link Dimension}). Only applicable to Data Matrix now.
- *
- * @deprecated without replacement
- */
- /*@Deprecated*/
- EncodeHintType[EncodeHintType["MAX_SIZE"] = 5] = "MAX_SIZE";
- /**
- * Specifies margin, in pixels, to use when generating the barcode. The meaning can vary
- * by format; for example it controls margin before and after the barcode horizontally for
- * most 1D formats. (Type {@link Integer}, or {@link String} representation of the integer value).
- */
- EncodeHintType[EncodeHintType["MARGIN"] = 6] = "MARGIN";
- /**
- * Specifies whether to use compact mode for PDF417 (type {@link Boolean}, or "true" or "false"
- * {@link String} value).
- */
- EncodeHintType[EncodeHintType["PDF417_COMPACT"] = 7] = "PDF417_COMPACT";
- /**
- * Specifies what compaction mode to use for PDF417 (type
- * {@link com.google.zxing.pdf417.encoder.Compaction Compaction} or {@link String} value of one of its
- * enum values).
- */
- EncodeHintType[EncodeHintType["PDF417_COMPACTION"] = 8] = "PDF417_COMPACTION";
- /**
- * Specifies the minimum and maximum number of rows and columns for PDF417 (type
- * {@link com.google.zxing.pdf417.encoder.Dimensions Dimensions}).
- */
- EncodeHintType[EncodeHintType["PDF417_DIMENSIONS"] = 9] = "PDF417_DIMENSIONS";
- /**
- * Specifies the required number of layers for an Aztec code.
- * A negative number (-1, -2, -3, -4) specifies a compact Aztec code.
- * 0 indicates to use the minimum number of layers (the default).
- * A positive number (1, 2, .. 32) specifies a normal (non-compact) Aztec code.
- * (Type {@link Integer}, or {@link String} representation of the integer value).
- */
- EncodeHintType[EncodeHintType["AZTEC_LAYERS"] = 10] = "AZTEC_LAYERS";
- /**
- * Specifies the exact version of QR code to be encoded.
- * (Type {@link Integer}, or {@link String} representation of the integer value).
- */
- EncodeHintType[EncodeHintType["QR_VERSION"] = 11] = "QR_VERSION";
- /**
- * Specifies whether the data should be encoded to the GS1 standard (type {@link Boolean}, or "true" or "false"
- * {@link String } value).
- */
- EncodeHintType[EncodeHintType["GS1_FORMAT"] = 12] = "GS1_FORMAT";
- /**
- * Forces C40 encoding for data-matrix (type {@link Boolean}, or "true" or "false") {@link String } value). This
- * option and {@link #DATA_MATRIX_COMPACT} are mutually exclusive.
- */
- EncodeHintType[EncodeHintType["FORCE_C40"] = 13] = "FORCE_C40";
- })(EncodeHintType || (EncodeHintType = {}));
- var _default = EncodeHintType;
- exports.default = _default;
- /***/ }),
- /* 463 */
- /*!******************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/encoder/Encoder.js ***!
- \******************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _EncodeHintType = _interopRequireDefault(__webpack_require__(/*! ../../EncodeHintType */ 462));
- var _BitArray = _interopRequireDefault(__webpack_require__(/*! ../../common/BitArray */ 313));
- var _CharacterSetECI = _interopRequireDefault(__webpack_require__(/*! ../../common/CharacterSetECI */ 323));
- var _GenericGF = _interopRequireDefault(__webpack_require__(/*! ../../common/reedsolomon/GenericGF */ 338));
- var _ReedSolomonEncoder = _interopRequireDefault(__webpack_require__(/*! ../../common/reedsolomon/ReedSolomonEncoder */ 464));
- var _Mode = _interopRequireDefault(__webpack_require__(/*! ../decoder/Mode */ 425));
- var _Version = _interopRequireDefault(__webpack_require__(/*! ../decoder/Version */ 417));
- var _MaskUtil = _interopRequireDefault(__webpack_require__(/*! ./MaskUtil */ 465));
- var _ByteMatrix = _interopRequireDefault(__webpack_require__(/*! ./ByteMatrix */ 466));
- var _QRCode = _interopRequireDefault(__webpack_require__(/*! ./QRCode */ 467));
- var _MatrixUtil = _interopRequireDefault(__webpack_require__(/*! ./MatrixUtil */ 468));
- var _StringEncoding = _interopRequireDefault(__webpack_require__(/*! ../../util/StringEncoding */ 325));
- var _BlockPair = _interopRequireDefault(__webpack_require__(/*! ./BlockPair */ 470));
- var _WriterException = _interopRequireDefault(__webpack_require__(/*! ../../WriterException */ 469));
- /*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- /*namespace com.google.zxing.qrcode.encoder {*/
- /*import java.io.UnsupportedEncodingException;*/
- /*import java.util.ArrayList;*/
- /*import java.util.Collection;*/
- /*import java.util.Map;*/
- /**
- * @author satorux@google.com (Satoru Takabayashi) - creator
- * @author dswitkin@google.com (Daniel Switkin) - ported from C++
- */
- var Encoder = /** @class */function () {
- // TYPESCRIPTPORT: changed to UTF8, the default for js
- function Encoder() {}
- // The mask penalty calculation is complicated. See Table 21 of JISX0510:2004 (p.45) for details.
- // Basically it applies four rules and summate all penalties.
- Encoder.calculateMaskPenalty = function (matrix) {
- return _MaskUtil.default.applyMaskPenaltyRule1(matrix) + _MaskUtil.default.applyMaskPenaltyRule2(matrix) + _MaskUtil.default.applyMaskPenaltyRule3(matrix) + _MaskUtil.default.applyMaskPenaltyRule4(matrix);
- };
- /**
- * @param content text to encode
- * @param ecLevel error correction level to use
- * @return {@link QRCode} representing the encoded QR code
- * @throws WriterException if encoding can't succeed, because of for example invalid content
- * or configuration
- */
- // public static encode(content: string, ecLevel: ErrorCorrectionLevel): QRCode /*throws WriterException*/ {
- // return encode(content, ecLevel, null)
- // }
- Encoder.encode = function (content, ecLevel, hints) {
- if (hints === void 0) {
- hints = null;
- }
- // Determine what character encoding has been specified by the caller, if any
- var encoding = Encoder.DEFAULT_BYTE_MODE_ENCODING;
- var hasEncodingHint = hints !== null && undefined !== hints.get(_EncodeHintType.default.CHARACTER_SET);
- if (hasEncodingHint) {
- encoding = hints.get(_EncodeHintType.default.CHARACTER_SET).toString();
- }
- // Pick an encoding mode appropriate for the content. Note that this will not attempt to use
- // multiple modes / segments even if that were more efficient. Twould be nice.
- var mode = this.chooseMode(content, encoding);
- // This will store the header information, like mode and
- // length, as well as "header" segments like an ECI segment.
- var headerBits = new _BitArray.default();
- // Append ECI segment if applicable
- if (mode === _Mode.default.BYTE && (hasEncodingHint || Encoder.DEFAULT_BYTE_MODE_ENCODING !== encoding)) {
- var eci = _CharacterSetECI.default.getCharacterSetECIByName(encoding);
- if (eci !== undefined) {
- this.appendECI(eci, headerBits);
- }
- }
- // (With ECI in place,) Write the mode marker
- this.appendModeInfo(mode, headerBits);
- // Collect data within the main segment, separately, to count its size if needed. Don't add it to
- // main payload yet.
- var dataBits = new _BitArray.default();
- this.appendBytes(content, mode, dataBits, encoding);
- var version;
- if (hints !== null && undefined !== hints.get(_EncodeHintType.default.QR_VERSION)) {
- var versionNumber = Number.parseInt(hints.get(_EncodeHintType.default.QR_VERSION).toString(), 10);
- version = _Version.default.getVersionForNumber(versionNumber);
- var bitsNeeded = this.calculateBitsNeeded(mode, headerBits, dataBits, version);
- if (!this.willFit(bitsNeeded, version, ecLevel)) {
- throw new _WriterException.default('Data too big for requested version');
- }
- } else {
- version = this.recommendVersion(ecLevel, mode, headerBits, dataBits);
- }
- var headerAndDataBits = new _BitArray.default();
- headerAndDataBits.appendBitArray(headerBits);
- // Find "length" of main segment and write it
- var numLetters = mode === _Mode.default.BYTE ? dataBits.getSizeInBytes() : content.length;
- this.appendLengthInfo(numLetters, version, mode, headerAndDataBits);
- // Put data together into the overall payload
- headerAndDataBits.appendBitArray(dataBits);
- var ecBlocks = version.getECBlocksForLevel(ecLevel);
- var numDataBytes = version.getTotalCodewords() - ecBlocks.getTotalECCodewords();
- // Terminate the bits properly.
- this.terminateBits(numDataBytes, headerAndDataBits);
- // Interleave data bits with error correction code.
- var finalBits = this.interleaveWithECBytes(headerAndDataBits, version.getTotalCodewords(), numDataBytes, ecBlocks.getNumBlocks());
- var qrCode = new _QRCode.default();
- qrCode.setECLevel(ecLevel);
- qrCode.setMode(mode);
- qrCode.setVersion(version);
- // Choose the mask pattern and set to "qrCode".
- var dimension = version.getDimensionForVersion();
- var matrix = new _ByteMatrix.default(dimension, dimension);
- var maskPattern = this.chooseMaskPattern(finalBits, ecLevel, version, matrix);
- qrCode.setMaskPattern(maskPattern);
- // Build the matrix and set it to "qrCode".
- _MatrixUtil.default.buildMatrix(finalBits, ecLevel, version, maskPattern, matrix);
- qrCode.setMatrix(matrix);
- return qrCode;
- };
- /**
- * Decides the smallest version of QR code that will contain all of the provided data.
- *
- * @throws WriterException if the data cannot fit in any version
- */
- Encoder.recommendVersion = function (ecLevel, mode, headerBits, dataBits) {
- // Hard part: need to know version to know how many bits length takes. But need to know how many
- // bits it takes to know version. First we take a guess at version by assuming version will be
- // the minimum, 1:
- var provisionalBitsNeeded = this.calculateBitsNeeded(mode, headerBits, dataBits, _Version.default.getVersionForNumber(1));
- var provisionalVersion = this.chooseVersion(provisionalBitsNeeded, ecLevel);
- // Use that guess to calculate the right version. I am still not sure this works in 100% of cases.
- var bitsNeeded = this.calculateBitsNeeded(mode, headerBits, dataBits, provisionalVersion);
- return this.chooseVersion(bitsNeeded, ecLevel);
- };
- Encoder.calculateBitsNeeded = function (mode, headerBits, dataBits, version) {
- return headerBits.getSize() + mode.getCharacterCountBits(version) + dataBits.getSize();
- };
- /**
- * @return the code point of the table used in alphanumeric mode or
- * -1 if there is no corresponding code in the table.
- */
- Encoder.getAlphanumericCode = function (code /*int*/) {
- if (code < Encoder.ALPHANUMERIC_TABLE.length) {
- return Encoder.ALPHANUMERIC_TABLE[code];
- }
- return -1;
- };
- // public static chooseMode(content: string): Mode {
- // return chooseMode(content, null);
- // }
- /**
- * Choose the best mode by examining the content. Note that 'encoding' is used as a hint;
- * if it is Shift_JIS, and the input is only double-byte Kanji, then we return {@link Mode#KANJI}.
- */
- Encoder.chooseMode = function (content, encoding) {
- if (encoding === void 0) {
- encoding = null;
- }
- if (_CharacterSetECI.default.SJIS.getName() === encoding && this.isOnlyDoubleByteKanji(content)) {
- // Choose Kanji mode if all input are double-byte characters
- return _Mode.default.KANJI;
- }
- var hasNumeric = false;
- var hasAlphanumeric = false;
- for (var i = 0, length_1 = content.length; i < length_1; ++i) {
- var c = content.charAt(i);
- if (Encoder.isDigit(c)) {
- hasNumeric = true;
- } else if (this.getAlphanumericCode(c.charCodeAt(0)) !== -1) {
- hasAlphanumeric = true;
- } else {
- return _Mode.default.BYTE;
- }
- }
- if (hasAlphanumeric) {
- return _Mode.default.ALPHANUMERIC;
- }
- if (hasNumeric) {
- return _Mode.default.NUMERIC;
- }
- return _Mode.default.BYTE;
- };
- Encoder.isOnlyDoubleByteKanji = function (content) {
- var bytes;
- try {
- bytes = _StringEncoding.default.encode(content, _CharacterSetECI.default.SJIS); // content.getBytes("Shift_JIS"))
- } catch (ignored /*: UnsupportedEncodingException*/) {
- return false;
- }
- var length = bytes.length;
- if (length % 2 !== 0) {
- return false;
- }
- for (var i = 0; i < length; i += 2) {
- var byte1 = bytes[i] & 0xFF;
- if ((byte1 < 0x81 || byte1 > 0x9F) && (byte1 < 0xE0 || byte1 > 0xEB)) {
- return false;
- }
- }
- return true;
- };
- Encoder.chooseMaskPattern = function (bits, ecLevel, version, matrix) {
- var minPenalty = Number.MAX_SAFE_INTEGER; // Lower penalty is better.
- var bestMaskPattern = -1;
- // We try all mask patterns to choose the best one.
- for (var maskPattern = 0; maskPattern < _QRCode.default.NUM_MASK_PATTERNS; maskPattern++) {
- _MatrixUtil.default.buildMatrix(bits, ecLevel, version, maskPattern, matrix);
- var penalty = this.calculateMaskPenalty(matrix);
- if (penalty < minPenalty) {
- minPenalty = penalty;
- bestMaskPattern = maskPattern;
- }
- }
- return bestMaskPattern;
- };
- Encoder.chooseVersion = function (numInputBits /*int*/, ecLevel) {
- for (var versionNum = 1; versionNum <= 40; versionNum++) {
- var version = _Version.default.getVersionForNumber(versionNum);
- if (Encoder.willFit(numInputBits, version, ecLevel)) {
- return version;
- }
- }
- throw new _WriterException.default('Data too big');
- };
- /**
- * @return true if the number of input bits will fit in a code with the specified version and
- * error correction level.
- */
- Encoder.willFit = function (numInputBits /*int*/, version, ecLevel) {
- // In the following comments, we use numbers of Version 7-H.
- // numBytes = 196
- var numBytes = version.getTotalCodewords();
- // getNumECBytes = 130
- var ecBlocks = version.getECBlocksForLevel(ecLevel);
- var numEcBytes = ecBlocks.getTotalECCodewords();
- // getNumDataBytes = 196 - 130 = 66
- var numDataBytes = numBytes - numEcBytes;
- var totalInputBytes = (numInputBits + 7) / 8;
- return numDataBytes >= totalInputBytes;
- };
- /**
- * Terminate bits as described in 8.4.8 and 8.4.9 of JISX0510:2004 (p.24).
- */
- Encoder.terminateBits = function (numDataBytes /*int*/, bits) {
- var capacity = numDataBytes * 8;
- if (bits.getSize() > capacity) {
- throw new _WriterException.default('data bits cannot fit in the QR Code' + bits.getSize() + ' > ' + capacity);
- }
- for (var i = 0; i < 4 && bits.getSize() < capacity; ++i) {
- bits.appendBit(false);
- }
- // Append termination bits. See 8.4.8 of JISX0510:2004 (p.24) for details.
- // If the last byte isn't 8-bit aligned, we'll add padding bits.
- var numBitsInLastByte = bits.getSize() & 0x07;
- if (numBitsInLastByte > 0) {
- for (var i = numBitsInLastByte; i < 8; i++) {
- bits.appendBit(false);
- }
- }
- // If we have more space, we'll fill the space with padding patterns defined in 8.4.9 (p.24).
- var numPaddingBytes = numDataBytes - bits.getSizeInBytes();
- for (var i = 0; i < numPaddingBytes; ++i) {
- bits.appendBits((i & 0x01) === 0 ? 0xEC : 0x11, 8);
- }
- if (bits.getSize() !== capacity) {
- throw new _WriterException.default('Bits size does not equal capacity');
- }
- };
- /**
- * Get number of data bytes and number of error correction bytes for block id "blockID". Store
- * the result in "numDataBytesInBlock", and "numECBytesInBlock". See table 12 in 8.5.1 of
- * JISX0510:2004 (p.30)
- */
- Encoder.getNumDataBytesAndNumECBytesForBlockID = function (numTotalBytes /*int*/, numDataBytes /*int*/, numRSBlocks /*int*/, blockID /*int*/, numDataBytesInBlock, numECBytesInBlock) {
- if (blockID >= numRSBlocks) {
- throw new _WriterException.default('Block ID too large');
- }
- // numRsBlocksInGroup2 = 196 % 5 = 1
- var numRsBlocksInGroup2 = numTotalBytes % numRSBlocks;
- // numRsBlocksInGroup1 = 5 - 1 = 4
- var numRsBlocksInGroup1 = numRSBlocks - numRsBlocksInGroup2;
- // numTotalBytesInGroup1 = 196 / 5 = 39
- var numTotalBytesInGroup1 = Math.floor(numTotalBytes / numRSBlocks);
- // numTotalBytesInGroup2 = 39 + 1 = 40
- var numTotalBytesInGroup2 = numTotalBytesInGroup1 + 1;
- // numDataBytesInGroup1 = 66 / 5 = 13
- var numDataBytesInGroup1 = Math.floor(numDataBytes / numRSBlocks);
- // numDataBytesInGroup2 = 13 + 1 = 14
- var numDataBytesInGroup2 = numDataBytesInGroup1 + 1;
- // numEcBytesInGroup1 = 39 - 13 = 26
- var numEcBytesInGroup1 = numTotalBytesInGroup1 - numDataBytesInGroup1;
- // numEcBytesInGroup2 = 40 - 14 = 26
- var numEcBytesInGroup2 = numTotalBytesInGroup2 - numDataBytesInGroup2;
- // Sanity checks.
- // 26 = 26
- if (numEcBytesInGroup1 !== numEcBytesInGroup2) {
- throw new _WriterException.default('EC bytes mismatch');
- }
- // 5 = 4 + 1.
- if (numRSBlocks !== numRsBlocksInGroup1 + numRsBlocksInGroup2) {
- throw new _WriterException.default('RS blocks mismatch');
- }
- // 196 = (13 + 26) * 4 + (14 + 26) * 1
- if (numTotalBytes !== (numDataBytesInGroup1 + numEcBytesInGroup1) * numRsBlocksInGroup1 + (numDataBytesInGroup2 + numEcBytesInGroup2) * numRsBlocksInGroup2) {
- throw new _WriterException.default('Total bytes mismatch');
- }
- if (blockID < numRsBlocksInGroup1) {
- numDataBytesInBlock[0] = numDataBytesInGroup1;
- numECBytesInBlock[0] = numEcBytesInGroup1;
- } else {
- numDataBytesInBlock[0] = numDataBytesInGroup2;
- numECBytesInBlock[0] = numEcBytesInGroup2;
- }
- };
- /**
- * Interleave "bits" with corresponding error correction bytes. On success, store the result in
- * "result". The interleave rule is complicated. See 8.6 of JISX0510:2004 (p.37) for details.
- */
- Encoder.interleaveWithECBytes = function (bits, numTotalBytes /*int*/, numDataBytes /*int*/, numRSBlocks /*int*/) {
- var e_1, _a, e_2, _b;
- // "bits" must have "getNumDataBytes" bytes of data.
- if (bits.getSizeInBytes() !== numDataBytes) {
- throw new _WriterException.default('Number of bits and data bytes does not match');
- }
- // Step 1. Divide data bytes into blocks and generate error correction bytes for them. We'll
- // store the divided data bytes blocks and error correction bytes blocks into "blocks".
- var dataBytesOffset = 0;
- var maxNumDataBytes = 0;
- var maxNumEcBytes = 0;
- // Since, we know the number of reedsolmon blocks, we can initialize the vector with the number.
- var blocks = new Array(); // new Array<BlockPair>(numRSBlocks)
- for (var i = 0; i < numRSBlocks; ++i) {
- var numDataBytesInBlock = new Int32Array(1);
- var numEcBytesInBlock = new Int32Array(1);
- Encoder.getNumDataBytesAndNumECBytesForBlockID(numTotalBytes, numDataBytes, numRSBlocks, i, numDataBytesInBlock, numEcBytesInBlock);
- var size = numDataBytesInBlock[0];
- var dataBytes = new Uint8Array(size);
- bits.toBytes(8 * dataBytesOffset, dataBytes, 0, size);
- var ecBytes = Encoder.generateECBytes(dataBytes, numEcBytesInBlock[0]);
- blocks.push(new _BlockPair.default(dataBytes, ecBytes));
- maxNumDataBytes = Math.max(maxNumDataBytes, size);
- maxNumEcBytes = Math.max(maxNumEcBytes, ecBytes.length);
- dataBytesOffset += numDataBytesInBlock[0];
- }
- if (numDataBytes !== dataBytesOffset) {
- throw new _WriterException.default('Data bytes does not match offset');
- }
- var result = new _BitArray.default();
- // First, place data blocks.
- for (var i = 0; i < maxNumDataBytes; ++i) {
- try {
- for (var blocks_1 = (e_1 = void 0, __values(blocks)), blocks_1_1 = blocks_1.next(); !blocks_1_1.done; blocks_1_1 = blocks_1.next()) {
- var block = blocks_1_1.value;
- var dataBytes = block.getDataBytes();
- if (i < dataBytes.length) {
- result.appendBits(dataBytes[i], 8);
- }
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (blocks_1_1 && !blocks_1_1.done && (_a = blocks_1.return)) _a.call(blocks_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- }
- // Then, place error correction blocks.
- for (var i = 0; i < maxNumEcBytes; ++i) {
- try {
- for (var blocks_2 = (e_2 = void 0, __values(blocks)), blocks_2_1 = blocks_2.next(); !blocks_2_1.done; blocks_2_1 = blocks_2.next()) {
- var block = blocks_2_1.value;
- var ecBytes = block.getErrorCorrectionBytes();
- if (i < ecBytes.length) {
- result.appendBits(ecBytes[i], 8);
- }
- }
- } catch (e_2_1) {
- e_2 = {
- error: e_2_1
- };
- } finally {
- try {
- if (blocks_2_1 && !blocks_2_1.done && (_b = blocks_2.return)) _b.call(blocks_2);
- } finally {
- if (e_2) throw e_2.error;
- }
- }
- }
- if (numTotalBytes !== result.getSizeInBytes()) {
- // Should be same.
- throw new _WriterException.default('Interleaving error: ' + numTotalBytes + ' and ' + result.getSizeInBytes() + ' differ.');
- }
- return result;
- };
- Encoder.generateECBytes = function (dataBytes, numEcBytesInBlock /*int*/) {
- var numDataBytes = dataBytes.length;
- var toEncode = new Int32Array(numDataBytes + numEcBytesInBlock); // int[numDataBytes + numEcBytesInBlock]
- for (var i = 0; i < numDataBytes; i++) {
- toEncode[i] = dataBytes[i] & 0xFF;
- }
- new _ReedSolomonEncoder.default(_GenericGF.default.QR_CODE_FIELD_256).encode(toEncode, numEcBytesInBlock);
- var ecBytes = new Uint8Array(numEcBytesInBlock);
- for (var i = 0; i < numEcBytesInBlock; i++) {
- ecBytes[i] = /*(byte) */toEncode[numDataBytes + i];
- }
- return ecBytes;
- };
- /**
- * Append mode info. On success, store the result in "bits".
- */
- Encoder.appendModeInfo = function (mode, bits) {
- bits.appendBits(mode.getBits(), 4);
- };
- /**
- * Append length info. On success, store the result in "bits".
- */
- Encoder.appendLengthInfo = function (numLetters /*int*/, version, mode, bits) {
- var numBits = mode.getCharacterCountBits(version);
- if (numLetters >= 1 << numBits) {
- throw new _WriterException.default(numLetters + ' is bigger than ' + ((1 << numBits) - 1));
- }
- bits.appendBits(numLetters, numBits);
- };
- /**
- * Append "bytes" in "mode" mode (encoding) into "bits". On success, store the result in "bits".
- */
- Encoder.appendBytes = function (content, mode, bits, encoding) {
- switch (mode) {
- case _Mode.default.NUMERIC:
- Encoder.appendNumericBytes(content, bits);
- break;
- case _Mode.default.ALPHANUMERIC:
- Encoder.appendAlphanumericBytes(content, bits);
- break;
- case _Mode.default.BYTE:
- Encoder.append8BitBytes(content, bits, encoding);
- break;
- case _Mode.default.KANJI:
- Encoder.appendKanjiBytes(content, bits);
- break;
- default:
- throw new _WriterException.default('Invalid mode: ' + mode);
- }
- };
- Encoder.getDigit = function (singleCharacter) {
- return singleCharacter.charCodeAt(0) - 48;
- };
- Encoder.isDigit = function (singleCharacter) {
- var cn = Encoder.getDigit(singleCharacter);
- return cn >= 0 && cn <= 9;
- };
- Encoder.appendNumericBytes = function (content, bits) {
- var length = content.length;
- var i = 0;
- while (i < length) {
- var num1 = Encoder.getDigit(content.charAt(i));
- if (i + 2 < length) {
- // Encode three numeric letters in ten bits.
- var num2 = Encoder.getDigit(content.charAt(i + 1));
- var num3 = Encoder.getDigit(content.charAt(i + 2));
- bits.appendBits(num1 * 100 + num2 * 10 + num3, 10);
- i += 3;
- } else if (i + 1 < length) {
- // Encode two numeric letters in seven bits.
- var num2 = Encoder.getDigit(content.charAt(i + 1));
- bits.appendBits(num1 * 10 + num2, 7);
- i += 2;
- } else {
- // Encode one numeric letter in four bits.
- bits.appendBits(num1, 4);
- i++;
- }
- }
- };
- Encoder.appendAlphanumericBytes = function (content, bits) {
- var length = content.length;
- var i = 0;
- while (i < length) {
- var code1 = Encoder.getAlphanumericCode(content.charCodeAt(i));
- if (code1 === -1) {
- throw new _WriterException.default();
- }
- if (i + 1 < length) {
- var code2 = Encoder.getAlphanumericCode(content.charCodeAt(i + 1));
- if (code2 === -1) {
- throw new _WriterException.default();
- }
- // Encode two alphanumeric letters in 11 bits.
- bits.appendBits(code1 * 45 + code2, 11);
- i += 2;
- } else {
- // Encode one alphanumeric letter in six bits.
- bits.appendBits(code1, 6);
- i++;
- }
- }
- };
- Encoder.append8BitBytes = function (content, bits, encoding) {
- var bytes;
- try {
- bytes = _StringEncoding.default.encode(content, encoding);
- } catch (uee /*: UnsupportedEncodingException*/) {
- throw new _WriterException.default(uee);
- }
- for (var i = 0, length_2 = bytes.length; i !== length_2; i++) {
- var b = bytes[i];
- bits.appendBits(b, 8);
- }
- };
- /**
- * @throws WriterException
- */
- Encoder.appendKanjiBytes = function (content, bits) {
- var bytes;
- try {
- bytes = _StringEncoding.default.encode(content, _CharacterSetECI.default.SJIS);
- } catch (uee /*: UnsupportedEncodingException*/) {
- throw new _WriterException.default(uee);
- }
- var length = bytes.length;
- for (var i = 0; i < length; i += 2) {
- var byte1 = bytes[i] & 0xFF;
- var byte2 = bytes[i + 1] & 0xFF;
- var code = byte1 << 8 & 0xFFFFFFFF | byte2;
- var subtracted = -1;
- if (code >= 0x8140 && code <= 0x9ffc) {
- subtracted = code - 0x8140;
- } else if (code >= 0xe040 && code <= 0xebbf) {
- subtracted = code - 0xc140;
- }
- if (subtracted === -1) {
- throw new _WriterException.default('Invalid byte sequence');
- }
- var encoded = (subtracted >> 8) * 0xc0 + (subtracted & 0xff);
- bits.appendBits(encoded, 13);
- }
- };
- Encoder.appendECI = function (eci, bits) {
- bits.appendBits(_Mode.default.ECI.getBits(), 4);
- // This is correct for values up to 127, which is all we need now.
- bits.appendBits(eci.getValue(), 8);
- };
- // The original table is defined in the table 5 of JISX0510:2004 (p.19).
- Encoder.ALPHANUMERIC_TABLE = Int32Array.from([-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1]);
- Encoder.DEFAULT_BYTE_MODE_ENCODING = _CharacterSetECI.default.UTF8.getName(); // "ISO-8859-1"
- return Encoder;
- }();
- var _default = Encoder;
- exports.default = _default;
- /***/ }),
- /* 464 */
- /*!*********************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/reedsolomon/ReedSolomonEncoder.js ***!
- \*********************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _GenericGFPoly = _interopRequireDefault(__webpack_require__(/*! ./GenericGFPoly */ 339));
- var _System = _interopRequireDefault(__webpack_require__(/*! ../../util/System */ 315));
- var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalArgumentException */ 308));
- /*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /**
- * <p>Implements Reed-Solomon encoding, as the name implies.</p>
- *
- * @author Sean Owen
- * @author William Rucklidge
- */
- var ReedSolomonEncoder = /** @class */function () {
- /**
- * A reed solomon error-correcting encoding constructor is created by
- * passing as Galois Field with of size equal to the number of code
- * words (symbols) in the alphabet (the number of values in each
- * element of arrays that are encoded/decoded).
- * @param field A galois field with a number of elements equal to the size
- * of the alphabet of symbols to encode.
- */
- function ReedSolomonEncoder(field) {
- this.field = field;
- this.cachedGenerators = [];
- this.cachedGenerators.push(new _GenericGFPoly.default(field, Int32Array.from([1])));
- }
- ReedSolomonEncoder.prototype.buildGenerator = function (degree /*int*/) {
- var cachedGenerators = this.cachedGenerators;
- if (degree >= cachedGenerators.length) {
- var lastGenerator = cachedGenerators[cachedGenerators.length - 1];
- var field = this.field;
- for (var d = cachedGenerators.length; d <= degree; d++) {
- var nextGenerator = lastGenerator.multiply(new _GenericGFPoly.default(field, Int32Array.from([1, field.exp(d - 1 + field.getGeneratorBase())])));
- cachedGenerators.push(nextGenerator);
- lastGenerator = nextGenerator;
- }
- }
- return cachedGenerators[degree];
- };
- /**
- * <p>Encode a sequence of code words (symbols) using Reed-Solomon to allow decoders
- * to detect and correct errors that may have been introduced when the resulting
- * data is stored or transmitted.</p>
- *
- * @param toEncode array used for both and output. Caller initializes the array with
- * the code words (symbols) to be encoded followed by empty elements allocated to make
- * space for error-correction code words in the encoded output. The array contains
- * the encdoded output when encode returns. Code words are encoded as numbers from
- * 0 to n-1, where n is the number of possible code words (symbols), as determined
- * by the size of the Galois Field passed in the constructor of this object.
- * @param ecBytes the number of elements reserved in the array (first parameter)
- * to store error-correction code words. Thus, the number of code words (symbols)
- * to encode in the first parameter is thus toEncode.length - ecBytes.
- * Note, the use of "bytes" in the name of this parameter is misleading, as there may
- * be more or fewer than 256 symbols being encoded, as determined by the number of
- * elements in the Galois Field passed as a constructor to this object.
- * @throws IllegalArgumentException thrown in response to validation errros.
- */
- ReedSolomonEncoder.prototype.encode = function (toEncode, ecBytes /*int*/) {
- if (ecBytes === 0) {
- throw new _IllegalArgumentException.default('No error correction bytes');
- }
- var dataBytes = toEncode.length - ecBytes;
- if (dataBytes <= 0) {
- throw new _IllegalArgumentException.default('No data bytes provided');
- }
- var generator = this.buildGenerator(ecBytes);
- var infoCoefficients = new Int32Array(dataBytes);
- _System.default.arraycopy(toEncode, 0, infoCoefficients, 0, dataBytes);
- var info = new _GenericGFPoly.default(this.field, infoCoefficients);
- info = info.multiplyByMonomial(ecBytes, 1);
- var remainder = info.divide(generator)[1];
- var coefficients = remainder.getCoefficients();
- var numZeroCoefficients = ecBytes - coefficients.length;
- for (var i = 0; i < numZeroCoefficients; i++) {
- toEncode[dataBytes + i] = 0;
- }
- _System.default.arraycopy(coefficients, 0, toEncode, dataBytes + numZeroCoefficients, coefficients.length);
- };
- return ReedSolomonEncoder;
- }();
- var _default = ReedSolomonEncoder;
- exports.default = _default;
- /***/ }),
- /* 465 */
- /*!*******************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/encoder/MaskUtil.js ***!
- \*******************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalArgumentException */ 308));
- /*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /**
- * @author Satoru Takabayashi
- * @author Daniel Switkin
- * @author Sean Owen
- */
- var MaskUtil = /** @class */function () {
- function MaskUtil() {
- // do nothing
- }
- /**
- * Apply mask penalty rule 1 and return the penalty. Find repetitive cells with the same color and
- * give penalty to them. Example: 00000 or 11111.
- */
- MaskUtil.applyMaskPenaltyRule1 = function (matrix) {
- return MaskUtil.applyMaskPenaltyRule1Internal(matrix, true) + MaskUtil.applyMaskPenaltyRule1Internal(matrix, false);
- };
- /**
- * Apply mask penalty rule 2 and return the penalty. Find 2x2 blocks with the same color and give
- * penalty to them. This is actually equivalent to the spec's rule, which is to find MxN blocks and give a
- * penalty proportional to (M-1)x(N-1), because this is the number of 2x2 blocks inside such a block.
- */
- MaskUtil.applyMaskPenaltyRule2 = function (matrix) {
- var penalty = 0;
- var array = matrix.getArray();
- var width = matrix.getWidth();
- var height = matrix.getHeight();
- for (var y = 0; y < height - 1; y++) {
- var arrayY = array[y];
- for (var x = 0; x < width - 1; x++) {
- var value = arrayY[x];
- if (value === arrayY[x + 1] && value === array[y + 1][x] && value === array[y + 1][x + 1]) {
- penalty++;
- }
- }
- }
- return MaskUtil.N2 * penalty;
- };
- /**
- * Apply mask penalty rule 3 and return the penalty. Find consecutive runs of 1:1:3:1:1:4
- * starting with black, or 4:1:1:3:1:1 starting with white, and give penalty to them. If we
- * find patterns like 000010111010000, we give penalty once.
- */
- MaskUtil.applyMaskPenaltyRule3 = function (matrix) {
- var numPenalties = 0;
- var array = matrix.getArray();
- var width = matrix.getWidth();
- var height = matrix.getHeight();
- for (var y = 0; y < height; y++) {
- for (var x = 0; x < width; x++) {
- var arrayY = array[y]; // We can at least optimize this access
- if (x + 6 < width && arrayY[x] === 1 && arrayY[x + 1] === 0 && arrayY[x + 2] === 1 && arrayY[x + 3] === 1 && arrayY[x + 4] === 1 && arrayY[x + 5] === 0 && arrayY[x + 6] === 1 && (MaskUtil.isWhiteHorizontal(arrayY, x - 4, x) || MaskUtil.isWhiteHorizontal(arrayY, x + 7, x + 11))) {
- numPenalties++;
- }
- if (y + 6 < height && array[y][x] === 1 && array[y + 1][x] === 0 && array[y + 2][x] === 1 && array[y + 3][x] === 1 && array[y + 4][x] === 1 && array[y + 5][x] === 0 && array[y + 6][x] === 1 && (MaskUtil.isWhiteVertical(array, x, y - 4, y) || MaskUtil.isWhiteVertical(array, x, y + 7, y + 11))) {
- numPenalties++;
- }
- }
- }
- return numPenalties * MaskUtil.N3;
- };
- MaskUtil.isWhiteHorizontal = function (rowArray, from /*int*/, to /*int*/) {
- from = Math.max(from, 0);
- to = Math.min(to, rowArray.length);
- for (var i = from; i < to; i++) {
- if (rowArray[i] === 1) {
- return false;
- }
- }
- return true;
- };
- MaskUtil.isWhiteVertical = function (array, col /*int*/, from /*int*/, to /*int*/) {
- from = Math.max(from, 0);
- to = Math.min(to, array.length);
- for (var i = from; i < to; i++) {
- if (array[i][col] === 1) {
- return false;
- }
- }
- return true;
- };
- /**
- * Apply mask penalty rule 4 and return the penalty. Calculate the ratio of dark cells and give
- * penalty if the ratio is far from 50%. It gives 10 penalty for 5% distance.
- */
- MaskUtil.applyMaskPenaltyRule4 = function (matrix) {
- var numDarkCells = 0;
- var array = matrix.getArray();
- var width = matrix.getWidth();
- var height = matrix.getHeight();
- for (var y = 0; y < height; y++) {
- var arrayY = array[y];
- for (var x = 0; x < width; x++) {
- if (arrayY[x] === 1) {
- numDarkCells++;
- }
- }
- }
- var numTotalCells = matrix.getHeight() * matrix.getWidth();
- var fivePercentVariances = Math.floor(Math.abs(numDarkCells * 2 - numTotalCells) * 10 / numTotalCells);
- return fivePercentVariances * MaskUtil.N4;
- };
- /**
- * Return the mask bit for "getMaskPattern" at "x" and "y". See 8.8 of JISX0510:2004 for mask
- * pattern conditions.
- */
- MaskUtil.getDataMaskBit = function (maskPattern /*int*/, x /*int*/, y /*int*/) {
- var intermediate; /*int*/
- var temp; /*int*/
- switch (maskPattern) {
- case 0:
- intermediate = y + x & 0x1;
- break;
- case 1:
- intermediate = y & 0x1;
- break;
- case 2:
- intermediate = x % 3;
- break;
- case 3:
- intermediate = (y + x) % 3;
- break;
- case 4:
- intermediate = Math.floor(y / 2) + Math.floor(x / 3) & 0x1;
- break;
- case 5:
- temp = y * x;
- intermediate = (temp & 0x1) + temp % 3;
- break;
- case 6:
- temp = y * x;
- intermediate = (temp & 0x1) + temp % 3 & 0x1;
- break;
- case 7:
- temp = y * x;
- intermediate = temp % 3 + (y + x & 0x1) & 0x1;
- break;
- default:
- throw new _IllegalArgumentException.default('Invalid mask pattern: ' + maskPattern);
- }
- return intermediate === 0;
- };
- /**
- * Helper function for applyMaskPenaltyRule1. We need this for doing this calculation in both
- * vertical and horizontal orders respectively.
- */
- MaskUtil.applyMaskPenaltyRule1Internal = function (matrix, isHorizontal) {
- var penalty = 0;
- var iLimit = isHorizontal ? matrix.getHeight() : matrix.getWidth();
- var jLimit = isHorizontal ? matrix.getWidth() : matrix.getHeight();
- var array = matrix.getArray();
- for (var i = 0; i < iLimit; i++) {
- var numSameBitCells = 0;
- var prevBit = -1;
- for (var j = 0; j < jLimit; j++) {
- var bit = isHorizontal ? array[i][j] : array[j][i];
- if (bit === prevBit) {
- numSameBitCells++;
- } else {
- if (numSameBitCells >= 5) {
- penalty += MaskUtil.N1 + (numSameBitCells - 5);
- }
- numSameBitCells = 1; // Include the cell itself.
- prevBit = bit;
- }
- }
- if (numSameBitCells >= 5) {
- penalty += MaskUtil.N1 + (numSameBitCells - 5);
- }
- }
- return penalty;
- };
- // Penalty weights from section 6.8.2.1
- MaskUtil.N1 = 3;
- MaskUtil.N2 = 3;
- MaskUtil.N3 = 40;
- MaskUtil.N4 = 10;
- return MaskUtil;
- }();
- var _default = MaskUtil;
- exports.default = _default;
- /***/ }),
- /* 466 */
- /*!*********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/encoder/ByteMatrix.js ***!
- \*********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _Arrays = _interopRequireDefault(__webpack_require__(/*! ../../util/Arrays */ 314));
- var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../util/StringBuilder */ 320));
- /*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- /*namespace com.google.zxing.qrcode.encoder {*/
- /*import java.util.Arrays;*/
- /**
- * JAVAPORT: The original code was a 2D array of ints, but since it only ever gets assigned
- * -1, 0, and 1, I'm going to use less memory and go with bytes.
- *
- * @author dswitkin@google.com (Daniel Switkin)
- */
- var ByteMatrix = /** @class */function () {
- function ByteMatrix(width /*int*/, height /*int*/) {
- this.width = width;
- this.height = height;
- var bytes = new Array(height); // [height][width]
- for (var i = 0; i !== height; i++) {
- bytes[i] = new Uint8Array(width);
- }
- this.bytes = bytes;
- }
- ByteMatrix.prototype.getHeight = function () {
- return this.height;
- };
- ByteMatrix.prototype.getWidth = function () {
- return this.width;
- };
- ByteMatrix.prototype.get = function (x /*int*/, y /*int*/) {
- return this.bytes[y][x];
- };
- /**
- * @return an internal representation as bytes, in row-major order. array[y][x] represents point (x,y)
- */
- ByteMatrix.prototype.getArray = function () {
- return this.bytes;
- };
- // TYPESCRIPTPORT: preffer to let two methods instead of override to avoid type comparison inside
- ByteMatrix.prototype.setNumber = function (x /*int*/, y /*int*/, value /*byte|int*/) {
- this.bytes[y][x] = value;
- };
- // public set(x: number /*int*/, y: number /*int*/, value: number /*int*/): void {
- // bytes[y][x] = (byte) value
- // }
- ByteMatrix.prototype.setBoolean = function (x /*int*/, y /*int*/, value) {
- this.bytes[y][x] = /*(byte) */value ? 1 : 0;
- };
- ByteMatrix.prototype.clear = function (value /*byte*/) {
- var e_1, _a;
- try {
- for (var _b = __values(this.bytes), _c = _b.next(); !_c.done; _c = _b.next()) {
- var aByte = _c.value;
- _Arrays.default.fill(aByte, value);
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- };
- ByteMatrix.prototype.equals = function (o) {
- if (!(o instanceof ByteMatrix)) {
- return false;
- }
- var other = o;
- if (this.width !== other.width) {
- return false;
- }
- if (this.height !== other.height) {
- return false;
- }
- for (var y = 0, height = this.height; y < height; ++y) {
- var bytesY = this.bytes[y];
- var otherBytesY = other.bytes[y];
- for (var x = 0, width = this.width; x < width; ++x) {
- if (bytesY[x] !== otherBytesY[x]) {
- return false;
- }
- }
- }
- return true;
- };
- /*@Override*/
- ByteMatrix.prototype.toString = function () {
- var result = new _StringBuilder.default(); // (2 * width * height + 2)
- for (var y = 0, height = this.height; y < height; ++y) {
- var bytesY = this.bytes[y];
- for (var x = 0, width = this.width; x < width; ++x) {
- switch (bytesY[x]) {
- case 0:
- result.append(' 0');
- break;
- case 1:
- result.append(' 1');
- break;
- default:
- result.append(' ');
- break;
- }
- }
- result.append('\n');
- }
- return result.toString();
- };
- return ByteMatrix;
- }();
- var _default = ByteMatrix;
- exports.default = _default;
- /***/ }),
- /* 467 */
- /*!*****************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/encoder/QRCode.js ***!
- \*****************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../util/StringBuilder */ 320));
- /*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /**
- * @author satorux@google.com (Satoru Takabayashi) - creator
- * @author dswitkin@google.com (Daniel Switkin) - ported from C++
- */
- var QRCode = /** @class */function () {
- function QRCode() {
- this.maskPattern = -1;
- }
- QRCode.prototype.getMode = function () {
- return this.mode;
- };
- QRCode.prototype.getECLevel = function () {
- return this.ecLevel;
- };
- QRCode.prototype.getVersion = function () {
- return this.version;
- };
- QRCode.prototype.getMaskPattern = function () {
- return this.maskPattern;
- };
- QRCode.prototype.getMatrix = function () {
- return this.matrix;
- };
- /*@Override*/
- QRCode.prototype.toString = function () {
- var result = new _StringBuilder.default(); // (200)
- result.append('<<\n');
- result.append(' mode: ');
- result.append(this.mode ? this.mode.toString() : 'null');
- result.append('\n ecLevel: ');
- result.append(this.ecLevel ? this.ecLevel.toString() : 'null');
- result.append('\n version: ');
- result.append(this.version ? this.version.toString() : 'null');
- result.append('\n maskPattern: ');
- result.append(this.maskPattern.toString());
- if (this.matrix) {
- result.append('\n matrix:\n');
- result.append(this.matrix.toString());
- } else {
- result.append('\n matrix: null\n');
- }
- result.append('>>\n');
- return result.toString();
- };
- QRCode.prototype.setMode = function (value) {
- this.mode = value;
- };
- QRCode.prototype.setECLevel = function (value) {
- this.ecLevel = value;
- };
- QRCode.prototype.setVersion = function (version) {
- this.version = version;
- };
- QRCode.prototype.setMaskPattern = function (value /*int*/) {
- this.maskPattern = value;
- };
- QRCode.prototype.setMatrix = function (value) {
- this.matrix = value;
- };
- // Check if "mask_pattern" is valid.
- QRCode.isValidMaskPattern = function (maskPattern /*int*/) {
- return maskPattern >= 0 && maskPattern < QRCode.NUM_MASK_PATTERNS;
- };
- QRCode.NUM_MASK_PATTERNS = 8;
- return QRCode;
- }();
- var _default = QRCode;
- exports.default = _default;
- /***/ }),
- /* 468 */
- /*!*********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/encoder/MatrixUtil.js ***!
- \*********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _BitArray = _interopRequireDefault(__webpack_require__(/*! ../../common/BitArray */ 313));
- var _Integer = _interopRequireDefault(__webpack_require__(/*! ../../util/Integer */ 318));
- var _QRCode = _interopRequireDefault(__webpack_require__(/*! ./QRCode */ 467));
- var _MaskUtil = _interopRequireDefault(__webpack_require__(/*! ./MaskUtil */ 465));
- var _WriterException = _interopRequireDefault(__webpack_require__(/*! ../../WriterException */ 469));
- var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalArgumentException */ 308));
- /*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /*namespace com.google.zxing.qrcode.encoder {*/
- /**
- * @author satorux@google.com (Satoru Takabayashi) - creator
- * @author dswitkin@google.com (Daniel Switkin) - ported from C++
- */
- var MatrixUtil = /** @class */function () {
- function MatrixUtil() {
- // do nothing
- }
- // Set all cells to -1 (TYPESCRIPTPORT: 255). -1 (TYPESCRIPTPORT: 255) means that the cell is empty (not set yet).
- //
- // JAVAPORT: We shouldn't need to do this at all. The code should be rewritten to begin encoding
- // with the ByteMatrix initialized all to zero.
- MatrixUtil.clearMatrix = function (matrix) {
- // TYPESCRIPTPORT: we use UintArray se changed here from -1 to 255
- matrix.clear( /*(byte) */ /*-1*/255);
- };
- // Build 2D matrix of QR Code from "dataBits" with "ecLevel", "version" and "getMaskPattern". On
- // success, store the result in "matrix" and return true.
- MatrixUtil.buildMatrix = function (dataBits, ecLevel, version, maskPattern /*int*/, matrix) {
- MatrixUtil.clearMatrix(matrix);
- MatrixUtil.embedBasicPatterns(version, matrix);
- // Type information appear with any version.
- MatrixUtil.embedTypeInfo(ecLevel, maskPattern, matrix);
- // Version info appear if version >= 7.
- MatrixUtil.maybeEmbedVersionInfo(version, matrix);
- // Data should be embedded at end.
- MatrixUtil.embedDataBits(dataBits, maskPattern, matrix);
- };
- // Embed basic patterns. On success, modify the matrix and return true.
- // The basic patterns are:
- // - Position detection patterns
- // - Timing patterns
- // - Dark dot at the left bottom corner
- // - Position adjustment patterns, if need be
- MatrixUtil.embedBasicPatterns = function (version, matrix) {
- // Let's get started with embedding big squares at corners.
- MatrixUtil.embedPositionDetectionPatternsAndSeparators(matrix);
- // Then, embed the dark dot at the left bottom corner.
- MatrixUtil.embedDarkDotAtLeftBottomCorner(matrix);
- // Position adjustment patterns appear if version >= 2.
- MatrixUtil.maybeEmbedPositionAdjustmentPatterns(version, matrix);
- // Timing patterns should be embedded after position adj. patterns.
- MatrixUtil.embedTimingPatterns(matrix);
- };
- // Embed type information. On success, modify the matrix.
- MatrixUtil.embedTypeInfo = function (ecLevel, maskPattern /*int*/, matrix) {
- var typeInfoBits = new _BitArray.default();
- MatrixUtil.makeTypeInfoBits(ecLevel, maskPattern, typeInfoBits);
- for (var i = 0, size = typeInfoBits.getSize(); i < size; ++i) {
- // Place bits in LSB to MSB order. LSB (least significant bit) is the last value in
- // "typeInfoBits".
- var bit = typeInfoBits.get(typeInfoBits.getSize() - 1 - i);
- // Type info bits at the left top corner. See 8.9 of JISX0510:2004 (p.46).
- var coordinates = MatrixUtil.TYPE_INFO_COORDINATES[i];
- var x1 = coordinates[0];
- var y1 = coordinates[1];
- matrix.setBoolean(x1, y1, bit);
- if (i < 8) {
- // Right top corner.
- var x2 = matrix.getWidth() - i - 1;
- var y2 = 8;
- matrix.setBoolean(x2, y2, bit);
- } else {
- // Left bottom corner.
- var x2 = 8;
- var y2 = matrix.getHeight() - 7 + (i - 8);
- matrix.setBoolean(x2, y2, bit);
- }
- }
- };
- // Embed version information if need be. On success, modify the matrix and return true.
- // See 8.10 of JISX0510:2004 (p.47) for how to embed version information.
- MatrixUtil.maybeEmbedVersionInfo = function (version, matrix) {
- if (version.getVersionNumber() < 7) {
- // Version info is necessary if version >= 7.
- return; // Don't need version info.
- }
- var versionInfoBits = new _BitArray.default();
- MatrixUtil.makeVersionInfoBits(version, versionInfoBits);
- var bitIndex = 6 * 3 - 1; // It will decrease from 17 to 0.
- for (var i = 0; i < 6; ++i) {
- for (var j = 0; j < 3; ++j) {
- // Place bits in LSB (least significant bit) to MSB order.
- var bit = versionInfoBits.get(bitIndex);
- bitIndex--;
- // Left bottom corner.
- matrix.setBoolean(i, matrix.getHeight() - 11 + j, bit);
- // Right bottom corner.
- matrix.setBoolean(matrix.getHeight() - 11 + j, i, bit);
- }
- }
- };
- // Embed "dataBits" using "getMaskPattern". On success, modify the matrix and return true.
- // For debugging purposes, it skips masking process if "getMaskPattern" is -1(TYPESCRIPTPORT: 255).
- // See 8.7 of JISX0510:2004 (p.38) for how to embed data bits.
- MatrixUtil.embedDataBits = function (dataBits, maskPattern /*int*/, matrix) {
- var bitIndex = 0;
- var direction = -1;
- // Start from the right bottom cell.
- var x = matrix.getWidth() - 1;
- var y = matrix.getHeight() - 1;
- while (x > 0) {
- // Skip the vertical timing pattern.
- if (x === 6) {
- x -= 1;
- }
- while (y >= 0 && y < matrix.getHeight()) {
- for (var i = 0; i < 2; ++i) {
- var xx = x - i;
- // Skip the cell if it's not empty.
- if (!MatrixUtil.isEmpty(matrix.get(xx, y))) {
- continue;
- }
- var bit = void 0;
- if (bitIndex < dataBits.getSize()) {
- bit = dataBits.get(bitIndex);
- ++bitIndex;
- } else {
- // Padding bit. If there is no bit left, we'll fill the left cells with 0, as described
- // in 8.4.9 of JISX0510:2004 (p. 24).
- bit = false;
- }
- // Skip masking if mask_pattern is -1 (TYPESCRIPTPORT: 255).
- if (maskPattern !== 255 && _MaskUtil.default.getDataMaskBit(maskPattern, xx, y)) {
- bit = !bit;
- }
- matrix.setBoolean(xx, y, bit);
- }
- y += direction;
- }
- direction = -direction; // Reverse the direction.
- y += direction;
- x -= 2; // Move to the left.
- }
- // All bits should be consumed.
- if (bitIndex !== dataBits.getSize()) {
- throw new _WriterException.default('Not all bits consumed: ' + bitIndex + '/' + dataBits.getSize());
- }
- };
- // Return the position of the most significant bit set (one: to) in the "value". The most
- // significant bit is position 32. If there is no bit set, return 0. Examples:
- // - findMSBSet(0) => 0
- // - findMSBSet(1) => 1
- // - findMSBSet(255) => 8
- MatrixUtil.findMSBSet = function (value /*int*/) {
- return 32 - _Integer.default.numberOfLeadingZeros(value);
- };
- // Calculate BCH (Bose-Chaudhuri-Hocquenghem) code for "value" using polynomial "poly". The BCH
- // code is used for encoding type information and version information.
- // Example: Calculation of version information of 7.
- // f(x) is created from 7.
- // - 7 = 000111 in 6 bits
- // - f(x) = x^2 + x^1 + x^0
- // g(x) is given by the standard (p. 67)
- // - g(x) = x^12 + x^11 + x^10 + x^9 + x^8 + x^5 + x^2 + 1
- // Multiply f(x) by x^(18 - 6)
- // - f'(x) = f(x) * x^(18 - 6)
- // - f'(x) = x^14 + x^13 + x^12
- // Calculate the remainder of f'(x) / g(x)
- // x^2
- // __________________________________________________
- // g(x) )x^14 + x^13 + x^12
- // x^14 + x^13 + x^12 + x^11 + x^10 + x^7 + x^4 + x^2
- // --------------------------------------------------
- // x^11 + x^10 + x^7 + x^4 + x^2
- //
- // The remainder is x^11 + x^10 + x^7 + x^4 + x^2
- // Encode it in binary: 110010010100
- // The return value is 0xc94 (1100 1001 0100)
- //
- // Since all coefficients in the polynomials are 1 or 0, we can do the calculation by bit
- // operations. We don't care if coefficients are positive or negative.
- MatrixUtil.calculateBCHCode = function (value /*int*/, poly /*int*/) {
- if (poly === 0) {
- throw new _IllegalArgumentException.default('0 polynomial');
- }
- // If poly is "1 1111 0010 0101" (version info poly), msbSetInPoly is 13. We'll subtract 1
- // from 13 to make it 12.
- var msbSetInPoly = MatrixUtil.findMSBSet(poly);
- value <<= msbSetInPoly - 1;
- // Do the division business using exclusive-or operations.
- while (MatrixUtil.findMSBSet(value) >= msbSetInPoly) {
- value ^= poly << MatrixUtil.findMSBSet(value) - msbSetInPoly;
- }
- // Now the "value" is the remainder (i.e. the BCH code)
- return value;
- };
- // Make bit vector of type information. On success, store the result in "bits" and return true.
- // Encode error correction level and mask pattern. See 8.9 of
- // JISX0510:2004 (p.45) for details.
- MatrixUtil.makeTypeInfoBits = function (ecLevel, maskPattern /*int*/, bits) {
- if (!_QRCode.default.isValidMaskPattern(maskPattern)) {
- throw new _WriterException.default('Invalid mask pattern');
- }
- var typeInfo = ecLevel.getBits() << 3 | maskPattern;
- bits.appendBits(typeInfo, 5);
- var bchCode = MatrixUtil.calculateBCHCode(typeInfo, MatrixUtil.TYPE_INFO_POLY);
- bits.appendBits(bchCode, 10);
- var maskBits = new _BitArray.default();
- maskBits.appendBits(MatrixUtil.TYPE_INFO_MASK_PATTERN, 15);
- bits.xor(maskBits);
- if (bits.getSize() !== 15) {
- // Just in case.
- throw new _WriterException.default('should not happen but we got: ' + bits.getSize());
- }
- };
- // Make bit vector of version information. On success, store the result in "bits" and return true.
- // See 8.10 of JISX0510:2004 (p.45) for details.
- MatrixUtil.makeVersionInfoBits = function (version, bits) {
- bits.appendBits(version.getVersionNumber(), 6);
- var bchCode = MatrixUtil.calculateBCHCode(version.getVersionNumber(), MatrixUtil.VERSION_INFO_POLY);
- bits.appendBits(bchCode, 12);
- if (bits.getSize() !== 18) {
- // Just in case.
- throw new _WriterException.default('should not happen but we got: ' + bits.getSize());
- }
- };
- // Check if "value" is empty.
- MatrixUtil.isEmpty = function (value /*int*/) {
- return value === 255; // -1
- };
- MatrixUtil.embedTimingPatterns = function (matrix) {
- // -8 is for skipping position detection patterns (7: size), and two horizontal/vertical
- // separation patterns (1: size). Thus, 8 = 7 + 1.
- for (var i = 8; i < matrix.getWidth() - 8; ++i) {
- var bit = (i + 1) % 2;
- // Horizontal line.
- if (MatrixUtil.isEmpty(matrix.get(i, 6))) {
- matrix.setNumber(i, 6, bit);
- }
- // Vertical line.
- if (MatrixUtil.isEmpty(matrix.get(6, i))) {
- matrix.setNumber(6, i, bit);
- }
- }
- };
- // Embed the lonely dark dot at left bottom corner. JISX0510:2004 (p.46)
- MatrixUtil.embedDarkDotAtLeftBottomCorner = function (matrix) {
- if (matrix.get(8, matrix.getHeight() - 8) === 0) {
- throw new _WriterException.default();
- }
- matrix.setNumber(8, matrix.getHeight() - 8, 1);
- };
- MatrixUtil.embedHorizontalSeparationPattern = function (xStart /*int*/, yStart /*int*/, matrix) {
- for (var x = 0; x < 8; ++x) {
- if (!MatrixUtil.isEmpty(matrix.get(xStart + x, yStart))) {
- throw new _WriterException.default();
- }
- matrix.setNumber(xStart + x, yStart, 0);
- }
- };
- MatrixUtil.embedVerticalSeparationPattern = function (xStart /*int*/, yStart /*int*/, matrix) {
- for (var y = 0; y < 7; ++y) {
- if (!MatrixUtil.isEmpty(matrix.get(xStart, yStart + y))) {
- throw new _WriterException.default();
- }
- matrix.setNumber(xStart, yStart + y, 0);
- }
- };
- MatrixUtil.embedPositionAdjustmentPattern = function (xStart /*int*/, yStart /*int*/, matrix) {
- for (var y = 0; y < 5; ++y) {
- var patternY = MatrixUtil.POSITION_ADJUSTMENT_PATTERN[y];
- for (var x = 0; x < 5; ++x) {
- matrix.setNumber(xStart + x, yStart + y, patternY[x]);
- }
- }
- };
- MatrixUtil.embedPositionDetectionPattern = function (xStart /*int*/, yStart /*int*/, matrix) {
- for (var y = 0; y < 7; ++y) {
- var patternY = MatrixUtil.POSITION_DETECTION_PATTERN[y];
- for (var x = 0; x < 7; ++x) {
- matrix.setNumber(xStart + x, yStart + y, patternY[x]);
- }
- }
- };
- // Embed position detection patterns and surrounding vertical/horizontal separators.
- MatrixUtil.embedPositionDetectionPatternsAndSeparators = function (matrix) {
- // Embed three big squares at corners.
- var pdpWidth = MatrixUtil.POSITION_DETECTION_PATTERN[0].length;
- // Left top corner.
- MatrixUtil.embedPositionDetectionPattern(0, 0, matrix);
- // Right top corner.
- MatrixUtil.embedPositionDetectionPattern(matrix.getWidth() - pdpWidth, 0, matrix);
- // Left bottom corner.
- MatrixUtil.embedPositionDetectionPattern(0, matrix.getWidth() - pdpWidth, matrix);
- // Embed horizontal separation patterns around the squares.
- var hspWidth = 8;
- // Left top corner.
- MatrixUtil.embedHorizontalSeparationPattern(0, hspWidth - 1, matrix);
- // Right top corner.
- MatrixUtil.embedHorizontalSeparationPattern(matrix.getWidth() - hspWidth, hspWidth - 1, matrix);
- // Left bottom corner.
- MatrixUtil.embedHorizontalSeparationPattern(0, matrix.getWidth() - hspWidth, matrix);
- // Embed vertical separation patterns around the squares.
- var vspSize = 7;
- // Left top corner.
- MatrixUtil.embedVerticalSeparationPattern(vspSize, 0, matrix);
- // Right top corner.
- MatrixUtil.embedVerticalSeparationPattern(matrix.getHeight() - vspSize - 1, 0, matrix);
- // Left bottom corner.
- MatrixUtil.embedVerticalSeparationPattern(vspSize, matrix.getHeight() - vspSize, matrix);
- };
- // Embed position adjustment patterns if need be.
- MatrixUtil.maybeEmbedPositionAdjustmentPatterns = function (version, matrix) {
- if (version.getVersionNumber() < 2) {
- // The patterns appear if version >= 2
- return;
- }
- var index = version.getVersionNumber() - 1;
- var coordinates = MatrixUtil.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[index];
- for (var i = 0, length_1 = coordinates.length; i !== length_1; i++) {
- var y = coordinates[i];
- if (y >= 0) {
- for (var j = 0; j !== length_1; j++) {
- var x = coordinates[j];
- if (x >= 0 && MatrixUtil.isEmpty(matrix.get(x, y))) {
- // If the cell is unset, we embed the position adjustment pattern here.
- // -2 is necessary since the x/y coordinates point to the center of the pattern, not the
- // left top corner.
- MatrixUtil.embedPositionAdjustmentPattern(x - 2, y - 2, matrix);
- }
- }
- }
- }
- };
- MatrixUtil.POSITION_DETECTION_PATTERN = Array.from([Int32Array.from([1, 1, 1, 1, 1, 1, 1]), Int32Array.from([1, 0, 0, 0, 0, 0, 1]), Int32Array.from([1, 0, 1, 1, 1, 0, 1]), Int32Array.from([1, 0, 1, 1, 1, 0, 1]), Int32Array.from([1, 0, 1, 1, 1, 0, 1]), Int32Array.from([1, 0, 0, 0, 0, 0, 1]), Int32Array.from([1, 1, 1, 1, 1, 1, 1])]);
- MatrixUtil.POSITION_ADJUSTMENT_PATTERN = Array.from([Int32Array.from([1, 1, 1, 1, 1]), Int32Array.from([1, 0, 0, 0, 1]), Int32Array.from([1, 0, 1, 0, 1]), Int32Array.from([1, 0, 0, 0, 1]), Int32Array.from([1, 1, 1, 1, 1])]);
- // From Appendix E. Table 1, JIS0510X:2004 (71: p). The table was double-checked by komatsu.
- MatrixUtil.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE = Array.from([Int32Array.from([-1, -1, -1, -1, -1, -1, -1]), Int32Array.from([6, 18, -1, -1, -1, -1, -1]), Int32Array.from([6, 22, -1, -1, -1, -1, -1]), Int32Array.from([6, 26, -1, -1, -1, -1, -1]), Int32Array.from([6, 30, -1, -1, -1, -1, -1]), Int32Array.from([6, 34, -1, -1, -1, -1, -1]), Int32Array.from([6, 22, 38, -1, -1, -1, -1]), Int32Array.from([6, 24, 42, -1, -1, -1, -1]), Int32Array.from([6, 26, 46, -1, -1, -1, -1]), Int32Array.from([6, 28, 50, -1, -1, -1, -1]), Int32Array.from([6, 30, 54, -1, -1, -1, -1]), Int32Array.from([6, 32, 58, -1, -1, -1, -1]), Int32Array.from([6, 34, 62, -1, -1, -1, -1]), Int32Array.from([6, 26, 46, 66, -1, -1, -1]), Int32Array.from([6, 26, 48, 70, -1, -1, -1]), Int32Array.from([6, 26, 50, 74, -1, -1, -1]), Int32Array.from([6, 30, 54, 78, -1, -1, -1]), Int32Array.from([6, 30, 56, 82, -1, -1, -1]), Int32Array.from([6, 30, 58, 86, -1, -1, -1]), Int32Array.from([6, 34, 62, 90, -1, -1, -1]), Int32Array.from([6, 28, 50, 72, 94, -1, -1]), Int32Array.from([6, 26, 50, 74, 98, -1, -1]), Int32Array.from([6, 30, 54, 78, 102, -1, -1]), Int32Array.from([6, 28, 54, 80, 106, -1, -1]), Int32Array.from([6, 32, 58, 84, 110, -1, -1]), Int32Array.from([6, 30, 58, 86, 114, -1, -1]), Int32Array.from([6, 34, 62, 90, 118, -1, -1]), Int32Array.from([6, 26, 50, 74, 98, 122, -1]), Int32Array.from([6, 30, 54, 78, 102, 126, -1]), Int32Array.from([6, 26, 52, 78, 104, 130, -1]), Int32Array.from([6, 30, 56, 82, 108, 134, -1]), Int32Array.from([6, 34, 60, 86, 112, 138, -1]), Int32Array.from([6, 30, 58, 86, 114, 142, -1]), Int32Array.from([6, 34, 62, 90, 118, 146, -1]), Int32Array.from([6, 30, 54, 78, 102, 126, 150]), Int32Array.from([6, 24, 50, 76, 102, 128, 154]), Int32Array.from([6, 28, 54, 80, 106, 132, 158]), Int32Array.from([6, 32, 58, 84, 110, 136, 162]), Int32Array.from([6, 26, 54, 82, 110, 138, 166]), Int32Array.from([6, 30, 58, 86, 114, 142, 170])]);
- // Type info cells at the left top corner.
- MatrixUtil.TYPE_INFO_COORDINATES = Array.from([Int32Array.from([8, 0]), Int32Array.from([8, 1]), Int32Array.from([8, 2]), Int32Array.from([8, 3]), Int32Array.from([8, 4]), Int32Array.from([8, 5]), Int32Array.from([8, 7]), Int32Array.from([8, 8]), Int32Array.from([7, 8]), Int32Array.from([5, 8]), Int32Array.from([4, 8]), Int32Array.from([3, 8]), Int32Array.from([2, 8]), Int32Array.from([1, 8]), Int32Array.from([0, 8])]);
- // From Appendix D in JISX0510:2004 (p. 67)
- MatrixUtil.VERSION_INFO_POLY = 0x1f25; // 1 1111 0010 0101
- // From Appendix C in JISX0510:2004 (p.65).
- MatrixUtil.TYPE_INFO_POLY = 0x537;
- MatrixUtil.TYPE_INFO_MASK_PATTERN = 0x5412;
- return MatrixUtil;
- }();
- var _default = MatrixUtil;
- exports.default = _default;
- /***/ }),
- /* 469 */
- /*!***********************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/WriterException.js ***!
- \***********************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _Exception = _interopRequireDefault(__webpack_require__(/*! ./Exception */ 305));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /**
- * Custom Error class of type Exception.
- */
- var WriterException = /** @class */function (_super) {
- __extends(WriterException, _super);
- function WriterException() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- WriterException.kind = 'WriterException';
- return WriterException;
- }(_Exception.default);
- var _default = WriterException;
- exports.default = _default;
- /***/ }),
- /* 470 */
- /*!********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/encoder/BlockPair.js ***!
- \********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- /*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /*namespace com.google.zxing.qrcode.encoder {*/
- var BlockPair = /** @class */function () {
- function BlockPair(dataBytes, errorCorrectionBytes) {
- this.dataBytes = dataBytes;
- this.errorCorrectionBytes = errorCorrectionBytes;
- }
- BlockPair.prototype.getDataBytes = function () {
- return this.dataBytes;
- };
- BlockPair.prototype.getErrorCorrectionBytes = function () {
- return this.errorCorrectionBytes;
- };
- return BlockPair;
- }();
- var _default = BlockPair;
- exports.default = _default;
- /***/ }),
- /* 471 */
- /*!*************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/browser/DecodeContinuouslyCallback.js ***!
- \*************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- /***/ }),
- /* 472 */
- /*!*********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/browser/HTMLVisualMediaElement.js ***!
- \*********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- /***/ }),
- /* 473 */
- /*!*************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/MultiFormatWriter.js ***!
- \*************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _QRCodeWriter = _interopRequireDefault(__webpack_require__(/*! ./qrcode/QRCodeWriter */ 474));
- var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ./BarcodeFormat */ 334));
- var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ./IllegalArgumentException */ 308));
- /*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- // import DataMatrixWriter from './datamatrix/DataMatrixWriter'
- // import CodaBarWriter from './oned/CodaBarWriter'
- // import Code128Writer from './oned/Code128Writer'
- // import Code39Writer from './oned/Code39Writer'
- // import Code93Writer from './oned/Code93Writer'
- // import EAN13Writer from './oned/EAN13Writer'
- // import EAN8Writer from './oned/EAN8Writer'
- // import ITFWriter from './oned/ITFWriter'
- // import UPCAWriter from './oned/UPCAWriter'
- // import UPCEWriter from './oned/UPCEWriter'
- // import PDF417Writer from './pdf417/PDF417Writer'
- /*import java.util.Map;*/
- /**
- * This is a factory class which finds the appropriate Writer subclass for the BarcodeFormat
- * requested and encodes the barcode with the supplied contents.
- *
- * @author dswitkin@google.com (Daniel Switkin)
- */
- var MultiFormatWriter = /** @class */function () {
- function MultiFormatWriter() {}
- /*@Override*/
- // public encode(contents: string,
- // format: BarcodeFormat,
- // width: number /*int*/,
- // height: number /*int*/): BitMatrix /*throws WriterException */ {
- // return encode(contents, format, width, height, null)
- // }
- /*@Override*/
- MultiFormatWriter.prototype.encode = function (contents, format, width /*int*/, height /*int*/, hints) {
- var writer;
- switch (format) {
- // case BarcodeFormat.EAN_8:
- // writer = new EAN8Writer()
- // break
- // case BarcodeFormat.UPC_E:
- // writer = new UPCEWriter()
- // break
- // case BarcodeFormat.EAN_13:
- // writer = new EAN13Writer()
- // break
- // case BarcodeFormat.UPC_A:
- // writer = new UPCAWriter()
- // break
- case _BarcodeFormat.default.QR_CODE:
- writer = new _QRCodeWriter.default();
- break;
- // case BarcodeFormat.CODE_39:
- // writer = new Code39Writer()
- // break
- // case BarcodeFormat.CODE_93:
- // writer = new Code93Writer()
- // break
- // case BarcodeFormat.CODE_128:
- // writer = new Code128Writer()
- // break
- // case BarcodeFormat.ITF:
- // writer = new ITFWriter()
- // break
- // case BarcodeFormat.PDF_417:
- // writer = new PDF417Writer()
- // break
- // case BarcodeFormat.CODABAR:
- // writer = new CodaBarWriter()
- // break
- // case BarcodeFormat.DATA_MATRIX:
- // writer = new DataMatrixWriter()
- // break
- // case BarcodeFormat.AZTEC:
- // writer = new AztecWriter()
- // break
- default:
- throw new _IllegalArgumentException.default('No encoder available for format ' + format);
- }
- return writer.encode(contents, format, width, height, hints);
- };
- return MultiFormatWriter;
- }();
- var _default = MultiFormatWriter;
- exports.default = _default;
- /***/ }),
- /* 474 */
- /*!***************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/QRCodeWriter.js ***!
- \***************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
- var _EncodeHintType = _interopRequireDefault(__webpack_require__(/*! ../EncodeHintType */ 462));
- var _BitMatrix = _interopRequireDefault(__webpack_require__(/*! ../common/BitMatrix */ 319));
- var _ErrorCorrectionLevel = _interopRequireDefault(__webpack_require__(/*! ./decoder/ErrorCorrectionLevel */ 419));
- var _Encoder = _interopRequireDefault(__webpack_require__(/*! ./encoder/Encoder */ 463));
- var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../IllegalArgumentException */ 308));
- var _IllegalStateException = _interopRequireDefault(__webpack_require__(/*! ../IllegalStateException */ 344));
- /*
- * Copyright 2008 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /*namespace com.google.zxing.qrcode {*/
- /*import java.util.Map;*/
- /**
- * This object renders a QR Code as a BitMatrix 2D array of greyscale values.
- *
- * @author dswitkin@google.com (Daniel Switkin)
- */
- var QRCodeWriter = /** @class */function () {
- function QRCodeWriter() {}
- /*@Override*/
- // public encode(contents: string, format: BarcodeFormat, width: number /*int*/, height: number /*int*/): BitMatrix
- // /*throws WriterException */ {
- // return encode(contents, format, width, height, null)
- // }
- /*@Override*/
- QRCodeWriter.prototype.encode = function (contents, format, width /*int*/, height /*int*/, hints) {
- if (contents.length === 0) {
- throw new _IllegalArgumentException.default('Found empty contents');
- }
- if (format !== _BarcodeFormat.default.QR_CODE) {
- throw new _IllegalArgumentException.default('Can only encode QR_CODE, but got ' + format);
- }
- if (width < 0 || height < 0) {
- throw new _IllegalArgumentException.default("Requested dimensions are too small: " + width + "x" + height);
- }
- var errorCorrectionLevel = _ErrorCorrectionLevel.default.L;
- var quietZone = QRCodeWriter.QUIET_ZONE_SIZE;
- if (hints !== null) {
- if (undefined !== hints.get(_EncodeHintType.default.ERROR_CORRECTION)) {
- errorCorrectionLevel = _ErrorCorrectionLevel.default.fromString(hints.get(_EncodeHintType.default.ERROR_CORRECTION).toString());
- }
- if (undefined !== hints.get(_EncodeHintType.default.MARGIN)) {
- quietZone = Number.parseInt(hints.get(_EncodeHintType.default.MARGIN).toString(), 10);
- }
- }
- var code = _Encoder.default.encode(contents, errorCorrectionLevel, hints);
- return QRCodeWriter.renderResult(code, width, height, quietZone);
- };
- // Note that the input matrix uses 0 == white, 1 == black, while the output matrix uses
- // 0 == black, 255 == white (i.e. an 8 bit greyscale bitmap).
- QRCodeWriter.renderResult = function (code, width /*int*/, height /*int*/, quietZone /*int*/) {
- var input = code.getMatrix();
- if (input === null) {
- throw new _IllegalStateException.default();
- }
- var inputWidth = input.getWidth();
- var inputHeight = input.getHeight();
- var qrWidth = inputWidth + quietZone * 2;
- var qrHeight = inputHeight + quietZone * 2;
- var outputWidth = Math.max(width, qrWidth);
- var outputHeight = Math.max(height, qrHeight);
- var multiple = Math.min(Math.floor(outputWidth / qrWidth), Math.floor(outputHeight / qrHeight));
- // Padding includes both the quiet zone and the extra white pixels to accommodate the requested
- // dimensions. For example, if input is 25x25 the QR will be 33x33 including the quiet zone.
- // If the requested size is 200x160, the multiple will be 4, for a QR of 132x132. These will
- // handle all the padding from 100x100 (the actual QR) up to 200x160.
- var leftPadding = Math.floor((outputWidth - inputWidth * multiple) / 2);
- var topPadding = Math.floor((outputHeight - inputHeight * multiple) / 2);
- var output = new _BitMatrix.default(outputWidth, outputHeight);
- for (var inputY = 0, outputY = topPadding; inputY < inputHeight; inputY++, outputY += multiple) {
- // Write the contents of this row of the barcode
- for (var inputX = 0, outputX = leftPadding; inputX < inputWidth; inputX++, outputX += multiple) {
- if (input.get(inputX, inputY) === 1) {
- output.setRegion(outputX, outputY, multiple, multiple);
- }
- }
- }
- return output;
- };
- QRCodeWriter.QUIET_ZONE_SIZE = 4;
- return QRCodeWriter;
- }();
- var _default = QRCodeWriter;
- exports.default = _default;
- /***/ }),
- /* 475 */
- /*!********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/PlanarYUVLuminanceSource.js ***!
- \********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _System = _interopRequireDefault(__webpack_require__(/*! ./util/System */ 315));
- var _LuminanceSource = _interopRequireDefault(__webpack_require__(/*! ./LuminanceSource */ 330));
- var _InvertedLuminanceSource = _interopRequireDefault(__webpack_require__(/*! ./InvertedLuminanceSource */ 329));
- var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ./IllegalArgumentException */ 308));
- /*
- * Copyright 2009 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /*namespace com.google.zxing {*/
- /**
- * This object extends LuminanceSource around an array of YUV data returned from the camera driver,
- * with the option to crop to a rectangle within the full data. This can be used to exclude
- * superfluous pixels around the perimeter and speed up decoding.
- *
- * It works for any pixel format where the Y channel is planar and appears first, including
- * YCbCr_420_SP and YCbCr_422_SP.
- *
- * @author dswitkin@google.com (Daniel Switkin)
- */
- var PlanarYUVLuminanceSource = /** @class */function (_super) {
- __extends(PlanarYUVLuminanceSource, _super);
- function PlanarYUVLuminanceSource(yuvData, dataWidth /*int*/, dataHeight /*int*/, left /*int*/, top /*int*/, width /*int*/, height /*int*/, reverseHorizontal) {
- var _this = _super.call(this, width, height) || this;
- _this.yuvData = yuvData;
- _this.dataWidth = dataWidth;
- _this.dataHeight = dataHeight;
- _this.left = left;
- _this.top = top;
- if (left + width > dataWidth || top + height > dataHeight) {
- throw new _IllegalArgumentException.default('Crop rectangle does not fit within image data.');
- }
- if (reverseHorizontal) {
- _this.reverseHorizontal(width, height);
- }
- return _this;
- }
- /*@Override*/
- PlanarYUVLuminanceSource.prototype.getRow = function (y /*int*/, row) {
- if (y < 0 || y >= this.getHeight()) {
- throw new _IllegalArgumentException.default('Requested row is outside the image: ' + y);
- }
- var width = this.getWidth();
- if (row === null || row === undefined || row.length < width) {
- row = new Uint8ClampedArray(width);
- }
- var offset = (y + this.top) * this.dataWidth + this.left;
- _System.default.arraycopy(this.yuvData, offset, row, 0, width);
- return row;
- };
- /*@Override*/
- PlanarYUVLuminanceSource.prototype.getMatrix = function () {
- var width = this.getWidth();
- var height = this.getHeight();
- // If the caller asks for the entire underlying image, save the copy and give them the
- // original data. The docs specifically warn that result.length must be ignored.
- if (width === this.dataWidth && height === this.dataHeight) {
- return this.yuvData;
- }
- var area = width * height;
- var matrix = new Uint8ClampedArray(area);
- var inputOffset = this.top * this.dataWidth + this.left;
- // If the width matches the full width of the underlying data, perform a single copy.
- if (width === this.dataWidth) {
- _System.default.arraycopy(this.yuvData, inputOffset, matrix, 0, area);
- return matrix;
- }
- // Otherwise copy one cropped row at a time.
- for (var y = 0; y < height; y++) {
- var outputOffset = y * width;
- _System.default.arraycopy(this.yuvData, inputOffset, matrix, outputOffset, width);
- inputOffset += this.dataWidth;
- }
- return matrix;
- };
- /*@Override*/
- PlanarYUVLuminanceSource.prototype.isCropSupported = function () {
- return true;
- };
- /*@Override*/
- PlanarYUVLuminanceSource.prototype.crop = function (left /*int*/, top /*int*/, width /*int*/, height /*int*/) {
- return new PlanarYUVLuminanceSource(this.yuvData, this.dataWidth, this.dataHeight, this.left + left, this.top + top, width, height, false);
- };
- PlanarYUVLuminanceSource.prototype.renderThumbnail = function () {
- var width = this.getWidth() / PlanarYUVLuminanceSource.THUMBNAIL_SCALE_FACTOR;
- var height = this.getHeight() / PlanarYUVLuminanceSource.THUMBNAIL_SCALE_FACTOR;
- var pixels = new Int32Array(width * height);
- var yuv = this.yuvData;
- var inputOffset = this.top * this.dataWidth + this.left;
- for (var y = 0; y < height; y++) {
- var outputOffset = y * width;
- for (var x = 0; x < width; x++) {
- var grey = yuv[inputOffset + x * PlanarYUVLuminanceSource.THUMBNAIL_SCALE_FACTOR] & 0xff;
- pixels[outputOffset + x] = 0xFF000000 | grey * 0x00010101;
- }
- inputOffset += this.dataWidth * PlanarYUVLuminanceSource.THUMBNAIL_SCALE_FACTOR;
- }
- return pixels;
- };
- /**
- * @return width of image from {@link #renderThumbnail()}
- */
- PlanarYUVLuminanceSource.prototype.getThumbnailWidth = function () {
- return this.getWidth() / PlanarYUVLuminanceSource.THUMBNAIL_SCALE_FACTOR;
- };
- /**
- * @return height of image from {@link #renderThumbnail()}
- */
- PlanarYUVLuminanceSource.prototype.getThumbnailHeight = function () {
- return this.getHeight() / PlanarYUVLuminanceSource.THUMBNAIL_SCALE_FACTOR;
- };
- PlanarYUVLuminanceSource.prototype.reverseHorizontal = function (width /*int*/, height /*int*/) {
- var yuvData = this.yuvData;
- for (var y = 0, rowStart = this.top * this.dataWidth + this.left; y < height; y++, rowStart += this.dataWidth) {
- var middle = rowStart + width / 2;
- for (var x1 = rowStart, x2 = rowStart + width - 1; x1 < middle; x1++, x2--) {
- var temp = yuvData[x1];
- yuvData[x1] = yuvData[x2];
- yuvData[x2] = temp;
- }
- }
- };
- PlanarYUVLuminanceSource.prototype.invert = function () {
- return new _InvertedLuminanceSource.default(this);
- };
- PlanarYUVLuminanceSource.THUMBNAIL_SCALE_FACTOR = 2;
- return PlanarYUVLuminanceSource;
- }(_LuminanceSource.default);
- var _default = PlanarYUVLuminanceSource;
- exports.default = _default;
- /***/ }),
- /* 476 */
- /*!**************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/RGBLuminanceSource.js ***!
- \**************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _InvertedLuminanceSource = _interopRequireDefault(__webpack_require__(/*! ./InvertedLuminanceSource */ 329));
- var _LuminanceSource = _interopRequireDefault(__webpack_require__(/*! ./LuminanceSource */ 330));
- var _System = _interopRequireDefault(__webpack_require__(/*! ./util/System */ 315));
- var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ./IllegalArgumentException */ 308));
- /*
- * Copyright 2009 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /*namespace com.google.zxing {*/
- /**
- * This class is used to help decode images from files which arrive as RGB data from
- * an ARGB pixel array. It does not support rotation.
- *
- * @author dswitkin@google.com (Daniel Switkin)
- * @author Betaminos
- */
- var RGBLuminanceSource = /** @class */function (_super) {
- __extends(RGBLuminanceSource, _super);
- function RGBLuminanceSource(luminances, width /*int*/, height /*int*/, dataWidth /*int*/, dataHeight /*int*/, left /*int*/, top /*int*/) {
- var _this = _super.call(this, width, height) || this;
- _this.dataWidth = dataWidth;
- _this.dataHeight = dataHeight;
- _this.left = left;
- _this.top = top;
- if (luminances.BYTES_PER_ELEMENT === 4) {
- // Int32Array
- var size = width * height;
- var luminancesUint8Array = new Uint8ClampedArray(size);
- for (var offset = 0; offset < size; offset++) {
- var pixel = luminances[offset];
- var r = pixel >> 16 & 0xff; // red
- var g2 = pixel >> 7 & 0x1fe; // 2 * green
- var b = pixel & 0xff; // blue
- // Calculate green-favouring average cheaply
- luminancesUint8Array[offset] = /*(byte) */(r + g2 + b) / 4 & 0xFF;
- }
- _this.luminances = luminancesUint8Array;
- } else {
- _this.luminances = luminances;
- }
- if (undefined === dataWidth) {
- _this.dataWidth = width;
- }
- if (undefined === dataHeight) {
- _this.dataHeight = height;
- }
- if (undefined === left) {
- _this.left = 0;
- }
- if (undefined === top) {
- _this.top = 0;
- }
- if (_this.left + width > _this.dataWidth || _this.top + height > _this.dataHeight) {
- throw new _IllegalArgumentException.default('Crop rectangle does not fit within image data.');
- }
- return _this;
- }
- /*@Override*/
- RGBLuminanceSource.prototype.getRow = function (y /*int*/, row) {
- if (y < 0 || y >= this.getHeight()) {
- throw new _IllegalArgumentException.default('Requested row is outside the image: ' + y);
- }
- var width = this.getWidth();
- if (row === null || row === undefined || row.length < width) {
- row = new Uint8ClampedArray(width);
- }
- var offset = (y + this.top) * this.dataWidth + this.left;
- _System.default.arraycopy(this.luminances, offset, row, 0, width);
- return row;
- };
- /*@Override*/
- RGBLuminanceSource.prototype.getMatrix = function () {
- var width = this.getWidth();
- var height = this.getHeight();
- // If the caller asks for the entire underlying image, save the copy and give them the
- // original data. The docs specifically warn that result.length must be ignored.
- if (width === this.dataWidth && height === this.dataHeight) {
- return this.luminances;
- }
- var area = width * height;
- var matrix = new Uint8ClampedArray(area);
- var inputOffset = this.top * this.dataWidth + this.left;
- // If the width matches the full width of the underlying data, perform a single copy.
- if (width === this.dataWidth) {
- _System.default.arraycopy(this.luminances, inputOffset, matrix, 0, area);
- return matrix;
- }
- // Otherwise copy one cropped row at a time.
- for (var y = 0; y < height; y++) {
- var outputOffset = y * width;
- _System.default.arraycopy(this.luminances, inputOffset, matrix, outputOffset, width);
- inputOffset += this.dataWidth;
- }
- return matrix;
- };
- /*@Override*/
- RGBLuminanceSource.prototype.isCropSupported = function () {
- return true;
- };
- /*@Override*/
- RGBLuminanceSource.prototype.crop = function (left /*int*/, top /*int*/, width /*int*/, height /*int*/) {
- return new RGBLuminanceSource(this.luminances, width, height, this.dataWidth, this.dataHeight, this.left + left, this.top + top);
- };
- RGBLuminanceSource.prototype.invert = function () {
- return new _InvertedLuminanceSource.default(this);
- };
- return RGBLuminanceSource;
- }(_LuminanceSource.default);
- var _default = RGBLuminanceSource;
- exports.default = _default;
- /***/ }),
- /* 477 */
- /*!********************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/util/Charset.js ***!
- \********************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _CharacterSetECI = _interopRequireDefault(__webpack_require__(/*! ../common/CharacterSetECI */ 323));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- /**
- * Just to make a shortcut between Java code and TS code.
- */
- var Charset = /** @class */function (_super) {
- __extends(Charset, _super);
- function Charset() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- Charset.forName = function (name) {
- return this.getCharacterSetECIByName(name);
- };
- return Charset;
- }(_CharacterSetECI.default);
- var _default = Charset;
- exports.default = _default;
- /***/ }),
- /* 478 */
- /*!*****************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/util/StandardCharsets.js ***!
- \*****************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _CharacterSetECI = _interopRequireDefault(__webpack_require__(/*! ../common/CharacterSetECI */ 323));
- /**
- * Just to make a shortcut between Java code and TS code.
- */
- var StandardCharsets = /** @class */function () {
- function StandardCharsets() {}
- StandardCharsets.ISO_8859_1 = _CharacterSetECI.default.ISO8859_1;
- return StandardCharsets;
- }();
- var _default = StandardCharsets;
- exports.default = _default;
- /***/ }),
- /* 479 */
- /*!*******************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/encoder/DefaultPlacement.js ***!
- \*******************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _Arrays = _interopRequireDefault(__webpack_require__(/*! ../../util/Arrays */ 314));
- /**
- * Symbol Character Placement Program. Adapted from Annex M.1 in ISO/IEC 16022:2000(E).
- */
- var DefaultPlacement = /** @class */function () {
- /**
- * Main constructor
- *
- * @param codewords the codewords to place
- * @param numcols the number of columns
- * @param numrows the number of rows
- */
- function DefaultPlacement(codewords, numcols, numrows) {
- this.codewords = codewords;
- this.numcols = numcols;
- this.numrows = numrows;
- this.bits = new Uint8Array(numcols * numrows);
- _Arrays.default.fill(this.bits, 2); // Initialize with "not set" value
- }
- DefaultPlacement.prototype.getNumrows = function () {
- return this.numrows;
- };
- DefaultPlacement.prototype.getNumcols = function () {
- return this.numcols;
- };
- DefaultPlacement.prototype.getBits = function () {
- return this.bits;
- };
- DefaultPlacement.prototype.getBit = function (col, row) {
- return this.bits[row * this.numcols + col] === 1;
- };
- DefaultPlacement.prototype.setBit = function (col, row, bit) {
- this.bits[row * this.numcols + col] = bit ? 1 : 0;
- };
- DefaultPlacement.prototype.noBit = function (col, row) {
- return this.bits[row * this.numcols + col] === 2;
- };
- DefaultPlacement.prototype.place = function () {
- var pos = 0;
- var row = 4;
- var col = 0;
- do {
- // repeatedly first check for one of the special corner cases, then...
- if (row === this.numrows && col === 0) {
- this.corner1(pos++);
- }
- if (row === this.numrows - 2 && col === 0 && this.numcols % 4 !== 0) {
- this.corner2(pos++);
- }
- if (row === this.numrows - 2 && col === 0 && this.numcols % 8 === 4) {
- this.corner3(pos++);
- }
- if (row === this.numrows + 4 && col === 2 && this.numcols % 8 === 0) {
- this.corner4(pos++);
- }
- // sweep upward diagonally, inserting successive characters...
- do {
- if (row < this.numrows && col >= 0 && this.noBit(col, row)) {
- this.utah(row, col, pos++);
- }
- row -= 2;
- col += 2;
- } while (row >= 0 && col < this.numcols);
- row++;
- col += 3;
- // and then sweep downward diagonally, inserting successive characters, ...
- do {
- if (row >= 0 && col < this.numcols && this.noBit(col, row)) {
- this.utah(row, col, pos++);
- }
- row += 2;
- col -= 2;
- } while (row < this.numrows && col >= 0);
- row += 3;
- col++;
- // ...until the entire array is scanned
- } while (row < this.numrows || col < this.numcols);
- // Lastly, if the lower right-hand corner is untouched, fill in fixed pattern
- if (this.noBit(this.numcols - 1, this.numrows - 1)) {
- this.setBit(this.numcols - 1, this.numrows - 1, true);
- this.setBit(this.numcols - 2, this.numrows - 2, true);
- }
- };
- DefaultPlacement.prototype.module = function (row, col, pos, bit) {
- if (row < 0) {
- row += this.numrows;
- col += 4 - (this.numrows + 4) % 8;
- }
- if (col < 0) {
- col += this.numcols;
- row += 4 - (this.numcols + 4) % 8;
- }
- // Note the conversion:
- var v = this.codewords.charCodeAt(pos);
- v &= 1 << 8 - bit;
- this.setBit(col, row, v !== 0);
- };
- /**
- * Places the 8 bits of a utah-shaped symbol character in ECC200.
- *
- * @param row the row
- * @param col the column
- * @param pos character position
- */
- DefaultPlacement.prototype.utah = function (row, col, pos) {
- this.module(row - 2, col - 2, pos, 1);
- this.module(row - 2, col - 1, pos, 2);
- this.module(row - 1, col - 2, pos, 3);
- this.module(row - 1, col - 1, pos, 4);
- this.module(row - 1, col, pos, 5);
- this.module(row, col - 2, pos, 6);
- this.module(row, col - 1, pos, 7);
- this.module(row, col, pos, 8);
- };
- DefaultPlacement.prototype.corner1 = function (pos) {
- this.module(this.numrows - 1, 0, pos, 1);
- this.module(this.numrows - 1, 1, pos, 2);
- this.module(this.numrows - 1, 2, pos, 3);
- this.module(0, this.numcols - 2, pos, 4);
- this.module(0, this.numcols - 1, pos, 5);
- this.module(1, this.numcols - 1, pos, 6);
- this.module(2, this.numcols - 1, pos, 7);
- this.module(3, this.numcols - 1, pos, 8);
- };
- DefaultPlacement.prototype.corner2 = function (pos) {
- this.module(this.numrows - 3, 0, pos, 1);
- this.module(this.numrows - 2, 0, pos, 2);
- this.module(this.numrows - 1, 0, pos, 3);
- this.module(0, this.numcols - 4, pos, 4);
- this.module(0, this.numcols - 3, pos, 5);
- this.module(0, this.numcols - 2, pos, 6);
- this.module(0, this.numcols - 1, pos, 7);
- this.module(1, this.numcols - 1, pos, 8);
- };
- DefaultPlacement.prototype.corner3 = function (pos) {
- this.module(this.numrows - 3, 0, pos, 1);
- this.module(this.numrows - 2, 0, pos, 2);
- this.module(this.numrows - 1, 0, pos, 3);
- this.module(0, this.numcols - 2, pos, 4);
- this.module(0, this.numcols - 1, pos, 5);
- this.module(1, this.numcols - 1, pos, 6);
- this.module(2, this.numcols - 1, pos, 7);
- this.module(3, this.numcols - 1, pos, 8);
- };
- DefaultPlacement.prototype.corner4 = function (pos) {
- this.module(this.numrows - 1, 0, pos, 1);
- this.module(this.numrows - 1, this.numcols - 1, pos, 2);
- this.module(0, this.numcols - 3, pos, 3);
- this.module(0, this.numcols - 2, pos, 4);
- this.module(0, this.numcols - 1, pos, 5);
- this.module(1, this.numcols - 3, pos, 6);
- this.module(1, this.numcols - 2, pos, 7);
- this.module(1, this.numcols - 1, pos, 8);
- };
- return DefaultPlacement;
- }();
- var _default = DefaultPlacement;
- exports.default = _default;
- /***/ }),
- /* 480 */
- /*!******************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/encoder/ErrorCorrection.js ***!
- \******************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../util/StringBuilder */ 320));
- var _constants = __webpack_require__(/*! ./constants */ 481);
- /**
- * Error Correction Code for ECC200.
- */
- var ErrorCorrection = /** @class */function () {
- function ErrorCorrection() {}
- /**
- * Creates the ECC200 error correction for an encoded message.
- *
- * @param codewords the codewords
- * @param symbolInfo information about the symbol to be encoded
- * @return the codewords with interleaved error correction.
- */
- ErrorCorrection.encodeECC200 = function (codewords, symbolInfo) {
- if (codewords.length !== symbolInfo.getDataCapacity()) {
- throw new Error('The number of codewords does not match the selected symbol');
- }
- var sb = new _StringBuilder.default();
- sb.append(codewords);
- var blockCount = symbolInfo.getInterleavedBlockCount();
- if (blockCount === 1) {
- var ecc = this.createECCBlock(codewords, symbolInfo.getErrorCodewords());
- sb.append(ecc);
- } else {
- // sb.setLength(sb.capacity());
- var dataSizes = [];
- var errorSizes = [];
- for (var i = 0; i < blockCount; i++) {
- dataSizes[i] = symbolInfo.getDataLengthForInterleavedBlock(i + 1);
- errorSizes[i] = symbolInfo.getErrorLengthForInterleavedBlock(i + 1);
- }
- for (var block = 0; block < blockCount; block++) {
- var temp = new _StringBuilder.default();
- for (var d = block; d < symbolInfo.getDataCapacity(); d += blockCount) {
- temp.append(codewords.charAt(d));
- }
- var ecc = this.createECCBlock(temp.toString(), errorSizes[block]);
- var pos = 0;
- for (var e = block; e < errorSizes[block] * blockCount; e += blockCount) {
- sb.setCharAt(symbolInfo.getDataCapacity() + e, ecc.charAt(pos++));
- }
- }
- }
- return sb.toString();
- };
- ErrorCorrection.createECCBlock = function (codewords, numECWords) {
- var table = -1;
- for (var i = 0; i < _constants.FACTOR_SETS.length; i++) {
- if (_constants.FACTOR_SETS[i] === numECWords) {
- table = i;
- break;
- }
- }
- if (table < 0) {
- throw new Error('Illegal number of error correction codewords specified: ' + numECWords);
- }
- var poly = _constants.FACTORS[table];
- var ecc = [];
- for (var i = 0; i < numECWords; i++) {
- ecc[i] = 0;
- }
- for (var i = 0; i < codewords.length; i++) {
- var m = ecc[numECWords - 1] ^ codewords.charAt(i).charCodeAt(0);
- for (var k = numECWords - 1; k > 0; k--) {
- if (m !== 0 && poly[k] !== 0) {
- ecc[k] = ecc[k - 1] ^ _constants.ALOG[(_constants.LOG[m] + _constants.LOG[poly[k]]) % 255];
- } else {
- ecc[k] = ecc[k - 1];
- }
- }
- if (m !== 0 && poly[0] !== 0) {
- ecc[0] = _constants.ALOG[(_constants.LOG[m] + _constants.LOG[poly[0]]) % 255];
- } else {
- ecc[0] = 0;
- }
- }
- var eccReversed = [];
- for (var i = 0; i < numECWords; i++) {
- eccReversed[i] = ecc[numECWords - i - 1];
- }
- return eccReversed.map(function (c) {
- return String.fromCharCode(c);
- }).join('');
- };
- return ErrorCorrection;
- }();
- var _default = ErrorCorrection;
- exports.default = _default;
- /***/ }),
- /* 481 */
- /*!************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/encoder/constants.js ***!
- \************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.X12_UNLATCH = exports.X12_ENCODATION = exports.UPPER_SHIFT = exports.TEXT_ENCODATION = exports.SymbolShapeHint = exports.PAD = exports.MODULO_VALUE = exports.MACRO_TRAILER = exports.MACRO_06_HEADER = exports.MACRO_06 = exports.MACRO_05_HEADER = exports.MACRO_05 = exports.LOG = exports.LATCH_TO_TEXT = exports.LATCH_TO_EDIFACT = exports.LATCH_TO_C40 = exports.LATCH_TO_BASE256 = exports.LATCH_TO_ANSIX12 = exports.FACTOR_SETS = exports.FACTORS = exports.EDIFACT_ENCODATION = exports.C40_UNLATCH = exports.C40_ENCODATION = exports.BASE256_ENCODATION = exports.ASCII_ENCODATION = exports.ALOG = void 0;
- var _a;
- /**
- * Lookup table which factors to use for which number of error correction codewords.
- * See FACTORS.
- */
- var FACTOR_SETS = [5, 7, 10, 11, 12, 14, 18, 20, 24, 28, 36, 42, 48, 56, 62, 68];
- /**
- * Precomputed polynomial factors for ECC 200.
- */
- exports.FACTOR_SETS = FACTOR_SETS;
- var FACTORS = [[228, 48, 15, 111, 62], [23, 68, 144, 134, 240, 92, 254], [28, 24, 185, 166, 223, 248, 116, 255, 110, 61], [175, 138, 205, 12, 194, 168, 39, 245, 60, 97, 120], [41, 153, 158, 91, 61, 42, 142, 213, 97, 178, 100, 242], [156, 97, 192, 252, 95, 9, 157, 119, 138, 45, 18, 186, 83, 185], [83, 195, 100, 39, 188, 75, 66, 61, 241, 213, 109, 129, 94, 254, 225, 48, 90, 188], [15, 195, 244, 9, 233, 71, 168, 2, 188, 160, 153, 145, 253, 79, 108, 82, 27, 174, 186, 172], [52, 190, 88, 205, 109, 39, 176, 21, 155, 197, 251, 223, 155, 21, 5, 172, 254, 124, 12, 181, 184, 96, 50, 193], [211, 231, 43, 97, 71, 96, 103, 174, 37, 151, 170, 53, 75, 34, 249, 121, 17, 138, 110, 213, 141, 136, 120, 151, 233, 168, 93, 255], [245, 127, 242, 218, 130, 250, 162, 181, 102, 120, 84, 179, 220, 251, 80, 182, 229, 18, 2, 4, 68, 33, 101, 137, 95, 119, 115, 44, 175, 184, 59, 25, 225, 98, 81, 112], [77, 193, 137, 31, 19, 38, 22, 153, 247, 105, 122, 2, 245, 133, 242, 8, 175, 95, 100, 9, 167, 105, 214, 111, 57, 121, 21, 1, 253, 57, 54, 101, 248, 202, 69, 50, 150, 177, 226, 5, 9, 5], [245, 132, 172, 223, 96, 32, 117, 22, 238, 133, 238, 231, 205, 188, 237, 87, 191, 106, 16, 147, 118, 23, 37, 90, 170, 205, 131, 88, 120, 100, 66, 138, 186, 240, 82, 44, 176, 87, 187, 147, 160, 175, 69, 213, 92, 253, 225, 19], [175, 9, 223, 238, 12, 17, 220, 208, 100, 29, 175, 170, 230, 192, 215, 235, 150, 159, 36, 223, 38, 200, 132, 54, 228, 146, 218, 234, 117, 203, 29, 232, 144, 238, 22, 150, 201, 117, 62, 207, 164, 13, 137, 245, 127, 67, 247, 28, 155, 43, 203, 107, 233, 53, 143, 46], [242, 93, 169, 50, 144, 210, 39, 118, 202, 188, 201, 189, 143, 108, 196, 37, 185, 112, 134, 230, 245, 63, 197, 190, 250, 106, 185, 221, 175, 64, 114, 71, 161, 44, 147, 6, 27, 218, 51, 63, 87, 10, 40, 130, 188, 17, 163, 31, 176, 170, 4, 107, 232, 7, 94, 166, 224, 124, 86, 47, 11, 204], [220, 228, 173, 89, 251, 149, 159, 56, 89, 33, 147, 244, 154, 36, 73, 127, 213, 136, 248, 180, 234, 197, 158, 177, 68, 122, 93, 213, 15, 160, 227, 236, 66, 139, 153, 185, 202, 167, 179, 25, 220, 232, 96, 210, 231, 136, 223, 239, 181, 241, 59, 52, 172, 25, 49, 232, 211, 189, 64, 54, 108, 153, 132, 63, 96, 103, 82, 186]];
- exports.FACTORS = FACTORS;
- var /*final*/MODULO_VALUE = 0x12d;
- exports.MODULO_VALUE = MODULO_VALUE;
- var static_LOG = function static_LOG(LOG, ALOG) {
- var p = 1;
- for (var i = 0; i < 255; i++) {
- ALOG[i] = p;
- LOG[p] = i;
- p *= 2;
- if (p >= 256) {
- p ^= MODULO_VALUE;
- }
- }
- return {
- LOG: LOG,
- ALOG: ALOG
- };
- };
- var LOG = (_a = static_LOG([], []), _a.LOG),
- ALOG = _a.ALOG;
- exports.ALOG = ALOG;
- exports.LOG = LOG;
- var SymbolShapeHint;
- exports.SymbolShapeHint = SymbolShapeHint;
- (function (SymbolShapeHint) {
- SymbolShapeHint[SymbolShapeHint["FORCE_NONE"] = 0] = "FORCE_NONE";
- SymbolShapeHint[SymbolShapeHint["FORCE_SQUARE"] = 1] = "FORCE_SQUARE";
- SymbolShapeHint[SymbolShapeHint["FORCE_RECTANGLE"] = 2] = "FORCE_RECTANGLE";
- })(SymbolShapeHint || (exports.SymbolShapeHint = SymbolShapeHint = {}));
- /**
- * Padding character
- */
- var PAD = 129;
- /**
- * mode latch to C40 encodation mode
- */
- exports.PAD = PAD;
- var LATCH_TO_C40 = 230;
- /**
- * mode latch to Base 256 encodation mode
- */
- exports.LATCH_TO_C40 = LATCH_TO_C40;
- var LATCH_TO_BASE256 = 231;
- /**
- * FNC1 Codeword
- */
- // private static FNC1 = 232;
- /**
- * Structured Append Codeword
- */
- // private static STRUCTURED_APPEND = 233;
- /**
- * Reader Programming
- */
- // private static READER_PROGRAMMING = 234;
- /**
- * Upper Shift
- */
- exports.LATCH_TO_BASE256 = LATCH_TO_BASE256;
- var UPPER_SHIFT = 235;
- /**
- * 05 Macro
- */
- exports.UPPER_SHIFT = UPPER_SHIFT;
- var MACRO_05 = 236;
- /**
- * 06 Macro
- */
- exports.MACRO_05 = MACRO_05;
- var MACRO_06 = 237;
- /**
- * mode latch to ANSI X.12 encodation mode
- */
- exports.MACRO_06 = MACRO_06;
- var LATCH_TO_ANSIX12 = 238;
- /**
- * mode latch to Text encodation mode
- */
- exports.LATCH_TO_ANSIX12 = LATCH_TO_ANSIX12;
- var LATCH_TO_TEXT = 239;
- /**
- * mode latch to EDIFACT encodation mode
- */
- exports.LATCH_TO_TEXT = LATCH_TO_TEXT;
- var LATCH_TO_EDIFACT = 240;
- /**
- * ECI character (Extended Channel Interpretation)
- */
- // private export const ECI = 241;
- /**
- * Unlatch from C40 encodation
- */
- exports.LATCH_TO_EDIFACT = LATCH_TO_EDIFACT;
- var C40_UNLATCH = 254;
- /**
- * Unlatch from X12 encodation
- */
- exports.C40_UNLATCH = C40_UNLATCH;
- var X12_UNLATCH = 254;
- /**
- * 05 Macro header
- */
- exports.X12_UNLATCH = X12_UNLATCH;
- var MACRO_05_HEADER = "[)>\x1E05\x1D";
- /**
- * 06 Macro header
- */
- exports.MACRO_05_HEADER = MACRO_05_HEADER;
- var MACRO_06_HEADER = "[)>\x1E06\x1D";
- /**
- * Macro trailer
- */
- exports.MACRO_06_HEADER = MACRO_06_HEADER;
- var MACRO_TRAILER = "\x1E\x04";
- exports.MACRO_TRAILER = MACRO_TRAILER;
- var ASCII_ENCODATION = 0;
- exports.ASCII_ENCODATION = ASCII_ENCODATION;
- var C40_ENCODATION = 1;
- exports.C40_ENCODATION = C40_ENCODATION;
- var TEXT_ENCODATION = 2;
- exports.TEXT_ENCODATION = TEXT_ENCODATION;
- var X12_ENCODATION = 3;
- exports.X12_ENCODATION = X12_ENCODATION;
- var EDIFACT_ENCODATION = 4;
- exports.EDIFACT_ENCODATION = EDIFACT_ENCODATION;
- var BASE256_ENCODATION = 5;
- exports.BASE256_ENCODATION = BASE256_ENCODATION;
- /***/ }),
- /* 482 */
- /*!*******************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/encoder/HighLevelEncoder.js ***!
- \*******************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _ASCIIEncoder = __webpack_require__(/*! ./ASCIIEncoder */ 483);
- var _Base256Encoder = __webpack_require__(/*! ./Base256Encoder */ 484);
- var _C40Encoder = __webpack_require__(/*! ./C40Encoder */ 485);
- var _constants = __webpack_require__(/*! ./constants */ 481);
- var _EdifactEncoder = __webpack_require__(/*! ./EdifactEncoder */ 486);
- var _EncoderContext = __webpack_require__(/*! ./EncoderContext */ 487);
- var _X12Encoder = __webpack_require__(/*! ./X12Encoder */ 489);
- var _TextEncoder = __webpack_require__(/*! ./TextEncoder */ 490);
- var _Arrays = _interopRequireDefault(__webpack_require__(/*! ../../util/Arrays */ 314));
- var _Integer = _interopRequireDefault(__webpack_require__(/*! ../../util/Integer */ 318));
- // tslint:disable-next-line:no-circular-imports
- // tslint:disable-next-line:no-circular-imports
- // tslint:disable-next-line:no-circular-imports
- // tslint:disable-next-line:no-circular-imports
- // tslint:disable-next-line:no-circular-imports
- // tslint:disable-next-line:no-circular-imports
- /**
- * DataMatrix ECC 200 data encoder following the algorithm described in ISO/IEC 16022:200(E) in
- * annex S.
- */
- var HighLevelEncoder = /** @class */function () {
- function HighLevelEncoder() {}
- HighLevelEncoder.randomize253State = function (codewordPosition) {
- var pseudoRandom = 149 * codewordPosition % 253 + 1;
- var tempVariable = _constants.PAD + pseudoRandom;
- return tempVariable <= 254 ? tempVariable : tempVariable - 254;
- };
- /**
- * Performs message encoding of a DataMatrix message using the algorithm described in annex P
- * of ISO/IEC 16022:2000(E).
- *
- * @param msg the message
- * @param shape requested shape. May be {@code SymbolShapeHint.FORCE_NONE},
- * {@code SymbolShapeHint.FORCE_SQUARE} or {@code SymbolShapeHint.FORCE_RECTANGLE}.
- * @param minSize the minimum symbol size constraint or null for no constraint
- * @param maxSize the maximum symbol size constraint or null for no constraint
- * @param forceC40 enforce C40 encoding
- * @return the encoded message (the char values range from 0 to 255)
- */
- HighLevelEncoder.encodeHighLevel = function (msg, shape, minSize, maxSize, forceC40) {
- if (shape === void 0) {
- shape = 0 /* FORCE_NONE */;
- }
- if (minSize === void 0) {
- minSize = null;
- }
- if (maxSize === void 0) {
- maxSize = null;
- }
- if (forceC40 === void 0) {
- forceC40 = false;
- }
- // the codewords 0..255 are encoded as Unicode characters
- var c40Encoder = new _C40Encoder.C40Encoder();
- var encoders = [new _ASCIIEncoder.ASCIIEncoder(), c40Encoder, new _TextEncoder.TextEncoder(), new _X12Encoder.X12Encoder(), new _EdifactEncoder.EdifactEncoder(), new _Base256Encoder.Base256Encoder()];
- var context = new _EncoderContext.EncoderContext(msg);
- context.setSymbolShape(shape);
- context.setSizeConstraints(minSize, maxSize);
- if (msg.startsWith(_constants.MACRO_05_HEADER) && msg.endsWith(_constants.MACRO_TRAILER)) {
- context.writeCodeword(_constants.MACRO_05);
- context.setSkipAtEnd(2);
- context.pos += _constants.MACRO_05_HEADER.length;
- } else if (msg.startsWith(_constants.MACRO_06_HEADER) && msg.endsWith(_constants.MACRO_TRAILER)) {
- context.writeCodeword(_constants.MACRO_06);
- context.setSkipAtEnd(2);
- context.pos += _constants.MACRO_06_HEADER.length;
- }
- var encodingMode = _constants.ASCII_ENCODATION; // Default mode
- if (forceC40) {
- c40Encoder.encodeMaximal(context);
- encodingMode = context.getNewEncoding();
- context.resetEncoderSignal();
- }
- while (context.hasMoreCharacters()) {
- encoders[encodingMode].encode(context);
- if (context.getNewEncoding() >= 0) {
- encodingMode = context.getNewEncoding();
- context.resetEncoderSignal();
- }
- }
- var len = context.getCodewordCount();
- context.updateSymbolInfo();
- var capacity = context.getSymbolInfo().getDataCapacity();
- if (len < capacity && encodingMode !== _constants.ASCII_ENCODATION && encodingMode !== _constants.BASE256_ENCODATION && encodingMode !== _constants.EDIFACT_ENCODATION) {
- context.writeCodeword("\xFE"); // Unlatch (254)
- }
- // Padding
- var codewords = context.getCodewords();
- if (codewords.length() < capacity) {
- codewords.append(_constants.PAD);
- }
- while (codewords.length() < capacity) {
- codewords.append(this.randomize253State(codewords.length() + 1));
- }
- return context.getCodewords().toString();
- };
- HighLevelEncoder.lookAheadTest = function (msg, startpos, currentMode) {
- var newMode = this.lookAheadTestIntern(msg, startpos, currentMode);
- if (currentMode === _constants.X12_ENCODATION && newMode === _constants.X12_ENCODATION) {
- var endpos = Math.min(startpos + 3, msg.length);
- for (var i = startpos; i < endpos; i++) {
- if (!this.isNativeX12(msg.charCodeAt(i))) {
- return _constants.ASCII_ENCODATION;
- }
- }
- } else if (currentMode === _constants.EDIFACT_ENCODATION && newMode === _constants.EDIFACT_ENCODATION) {
- var endpos = Math.min(startpos + 4, msg.length);
- for (var i = startpos; i < endpos; i++) {
- if (!this.isNativeEDIFACT(msg.charCodeAt(i))) {
- return _constants.ASCII_ENCODATION;
- }
- }
- }
- return newMode;
- };
- HighLevelEncoder.lookAheadTestIntern = function (msg, startpos, currentMode) {
- if (startpos >= msg.length) {
- return currentMode;
- }
- var charCounts;
- // step J
- if (currentMode === _constants.ASCII_ENCODATION) {
- charCounts = [0, 1, 1, 1, 1, 1.25];
- } else {
- charCounts = [1, 2, 2, 2, 2, 2.25];
- charCounts[currentMode] = 0;
- }
- var charsProcessed = 0;
- var mins = new Uint8Array(6);
- var intCharCounts = [];
- while (true) {
- // step K
- if (startpos + charsProcessed === msg.length) {
- _Arrays.default.fill(mins, 0);
- _Arrays.default.fill(intCharCounts, 0);
- var min = this.findMinimums(charCounts, intCharCounts, _Integer.default.MAX_VALUE, mins);
- var minCount = this.getMinimumCount(mins);
- if (intCharCounts[_constants.ASCII_ENCODATION] === min) {
- return _constants.ASCII_ENCODATION;
- }
- if (minCount === 1) {
- if (mins[_constants.BASE256_ENCODATION] > 0) {
- return _constants.BASE256_ENCODATION;
- }
- if (mins[_constants.EDIFACT_ENCODATION] > 0) {
- return _constants.EDIFACT_ENCODATION;
- }
- if (mins[_constants.TEXT_ENCODATION] > 0) {
- return _constants.TEXT_ENCODATION;
- }
- if (mins[_constants.X12_ENCODATION] > 0) {
- return _constants.X12_ENCODATION;
- }
- }
- return _constants.C40_ENCODATION;
- }
- var c = msg.charCodeAt(startpos + charsProcessed);
- charsProcessed++;
- // step L
- if (this.isDigit(c)) {
- charCounts[_constants.ASCII_ENCODATION] += 0.5;
- } else if (this.isExtendedASCII(c)) {
- charCounts[_constants.ASCII_ENCODATION] = Math.ceil(charCounts[_constants.ASCII_ENCODATION]);
- charCounts[_constants.ASCII_ENCODATION] += 2.0;
- } else {
- charCounts[_constants.ASCII_ENCODATION] = Math.ceil(charCounts[_constants.ASCII_ENCODATION]);
- charCounts[_constants.ASCII_ENCODATION]++;
- }
- // step M
- if (this.isNativeC40(c)) {
- charCounts[_constants.C40_ENCODATION] += 2.0 / 3.0;
- } else if (this.isExtendedASCII(c)) {
- charCounts[_constants.C40_ENCODATION] += 8.0 / 3.0;
- } else {
- charCounts[_constants.C40_ENCODATION] += 4.0 / 3.0;
- }
- // step N
- if (this.isNativeText(c)) {
- charCounts[_constants.TEXT_ENCODATION] += 2.0 / 3.0;
- } else if (this.isExtendedASCII(c)) {
- charCounts[_constants.TEXT_ENCODATION] += 8.0 / 3.0;
- } else {
- charCounts[_constants.TEXT_ENCODATION] += 4.0 / 3.0;
- }
- // step O
- if (this.isNativeX12(c)) {
- charCounts[_constants.X12_ENCODATION] += 2.0 / 3.0;
- } else if (this.isExtendedASCII(c)) {
- charCounts[_constants.X12_ENCODATION] += 13.0 / 3.0;
- } else {
- charCounts[_constants.X12_ENCODATION] += 10.0 / 3.0;
- }
- // step P
- if (this.isNativeEDIFACT(c)) {
- charCounts[_constants.EDIFACT_ENCODATION] += 3.0 / 4.0;
- } else if (this.isExtendedASCII(c)) {
- charCounts[_constants.EDIFACT_ENCODATION] += 17.0 / 4.0;
- } else {
- charCounts[_constants.EDIFACT_ENCODATION] += 13.0 / 4.0;
- }
- // step Q
- if (this.isSpecialB256(c)) {
- charCounts[_constants.BASE256_ENCODATION] += 4.0;
- } else {
- charCounts[_constants.BASE256_ENCODATION]++;
- }
- // step R
- if (charsProcessed >= 4) {
- _Arrays.default.fill(mins, 0);
- _Arrays.default.fill(intCharCounts, 0);
- this.findMinimums(charCounts, intCharCounts, _Integer.default.MAX_VALUE, mins);
- if (intCharCounts[_constants.ASCII_ENCODATION] < this.min(intCharCounts[_constants.BASE256_ENCODATION], intCharCounts[_constants.C40_ENCODATION], intCharCounts[_constants.TEXT_ENCODATION], intCharCounts[_constants.X12_ENCODATION], intCharCounts[_constants.EDIFACT_ENCODATION])) {
- return _constants.ASCII_ENCODATION;
- }
- if (intCharCounts[_constants.BASE256_ENCODATION] < intCharCounts[_constants.ASCII_ENCODATION] || intCharCounts[_constants.BASE256_ENCODATION] + 1 < this.min(intCharCounts[_constants.C40_ENCODATION], intCharCounts[_constants.TEXT_ENCODATION], intCharCounts[_constants.X12_ENCODATION], intCharCounts[_constants.EDIFACT_ENCODATION])) {
- return _constants.BASE256_ENCODATION;
- }
- if (intCharCounts[_constants.EDIFACT_ENCODATION] + 1 < this.min(intCharCounts[_constants.BASE256_ENCODATION], intCharCounts[_constants.C40_ENCODATION], intCharCounts[_constants.TEXT_ENCODATION], intCharCounts[_constants.X12_ENCODATION], intCharCounts[_constants.ASCII_ENCODATION])) {
- return _constants.EDIFACT_ENCODATION;
- }
- if (intCharCounts[_constants.TEXT_ENCODATION] + 1 < this.min(intCharCounts[_constants.BASE256_ENCODATION], intCharCounts[_constants.C40_ENCODATION], intCharCounts[_constants.EDIFACT_ENCODATION], intCharCounts[_constants.X12_ENCODATION], intCharCounts[_constants.ASCII_ENCODATION])) {
- return _constants.TEXT_ENCODATION;
- }
- if (intCharCounts[_constants.X12_ENCODATION] + 1 < this.min(intCharCounts[_constants.BASE256_ENCODATION], intCharCounts[_constants.C40_ENCODATION], intCharCounts[_constants.EDIFACT_ENCODATION], intCharCounts[_constants.TEXT_ENCODATION], intCharCounts[_constants.ASCII_ENCODATION])) {
- return _constants.X12_ENCODATION;
- }
- if (intCharCounts[_constants.C40_ENCODATION] + 1 < this.min(intCharCounts[_constants.ASCII_ENCODATION], intCharCounts[_constants.BASE256_ENCODATION], intCharCounts[_constants.EDIFACT_ENCODATION], intCharCounts[_constants.TEXT_ENCODATION])) {
- if (intCharCounts[_constants.C40_ENCODATION] < intCharCounts[_constants.X12_ENCODATION]) {
- return _constants.C40_ENCODATION;
- }
- if (intCharCounts[_constants.C40_ENCODATION] === intCharCounts[_constants.X12_ENCODATION]) {
- var p = startpos + charsProcessed + 1;
- while (p < msg.length) {
- var tc = msg.charCodeAt(p);
- if (this.isX12TermSep(tc)) {
- return _constants.X12_ENCODATION;
- }
- if (!this.isNativeX12(tc)) {
- break;
- }
- p++;
- }
- return _constants.C40_ENCODATION;
- }
- }
- }
- }
- };
- HighLevelEncoder.min = function (f1, f2, f3, f4, f5) {
- var val = Math.min(f1, Math.min(f2, Math.min(f3, f4)));
- if (f5 === undefined) {
- return val;
- } else {
- return Math.min(val, f5);
- }
- };
- HighLevelEncoder.findMinimums = function (charCounts, intCharCounts, min, mins) {
- for (var i = 0; i < 6; i++) {
- var current = intCharCounts[i] = Math.ceil(charCounts[i]);
- if (min > current) {
- min = current;
- _Arrays.default.fill(mins, 0);
- }
- if (min === current) {
- mins[i] = mins[i] + 1;
- }
- }
- return min;
- };
- HighLevelEncoder.getMinimumCount = function (mins) {
- var minCount = 0;
- for (var i = 0; i < 6; i++) {
- minCount += mins[i];
- }
- return minCount || 0;
- };
- HighLevelEncoder.isDigit = function (ch) {
- return ch >= '0'.charCodeAt(0) && ch <= '9'.charCodeAt(0);
- };
- HighLevelEncoder.isExtendedASCII = function (ch) {
- return ch >= 128 && ch <= 255;
- };
- HighLevelEncoder.isNativeC40 = function (ch) {
- return ch === ' '.charCodeAt(0) || ch >= '0'.charCodeAt(0) && ch <= '9'.charCodeAt(0) || ch >= 'A'.charCodeAt(0) && ch <= 'Z'.charCodeAt(0);
- };
- HighLevelEncoder.isNativeText = function (ch) {
- return ch === ' '.charCodeAt(0) || ch >= '0'.charCodeAt(0) && ch <= '9'.charCodeAt(0) || ch >= 'a'.charCodeAt(0) && ch <= 'z'.charCodeAt(0);
- };
- HighLevelEncoder.isNativeX12 = function (ch) {
- return this.isX12TermSep(ch) || ch === ' '.charCodeAt(0) || ch >= '0'.charCodeAt(0) && ch <= '9'.charCodeAt(0) || ch >= 'A'.charCodeAt(0) && ch <= 'Z'.charCodeAt(0);
- };
- HighLevelEncoder.isX12TermSep = function (ch) {
- return ch === 13 ||
- // CR
- ch === '*'.charCodeAt(0) || ch === '>'.charCodeAt(0);
- };
- HighLevelEncoder.isNativeEDIFACT = function (ch) {
- return ch >= ' '.charCodeAt(0) && ch <= '^'.charCodeAt(0);
- };
- HighLevelEncoder.isSpecialB256 = function (ch) {
- return false; // TODO NOT IMPLEMENTED YET!!!
- };
- /**
- * Determines the number of consecutive characters that are encodable using numeric compaction.
- *
- * @param msg the message
- * @param startpos the start position within the message
- * @return the requested character count
- */
- HighLevelEncoder.determineConsecutiveDigitCount = function (msg, startpos) {
- if (startpos === void 0) {
- startpos = 0;
- }
- var len = msg.length;
- var idx = startpos;
- while (idx < len && this.isDigit(msg.charCodeAt(idx))) {
- idx++;
- }
- return idx - startpos;
- };
- HighLevelEncoder.illegalCharacter = function (singleCharacter) {
- var hex = _Integer.default.toHexString(singleCharacter.charCodeAt(0));
- hex = '0000'.substring(0, 4 - hex.length) + hex;
- throw new Error('Illegal character: ' + singleCharacter + ' (0x' + hex + ')');
- };
- return HighLevelEncoder;
- }();
- var _default = HighLevelEncoder;
- exports.default = _default;
- /***/ }),
- /* 483 */
- /*!***************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/encoder/ASCIIEncoder.js ***!
- \***************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.ASCIIEncoder = void 0;
- var _constants = __webpack_require__(/*! ./constants */ 481);
- var _HighLevelEncoder = _interopRequireDefault(__webpack_require__(/*! ./HighLevelEncoder */ 482));
- // tslint:disable-next-line:no-circular-imports
- var ASCIIEncoder = /** @class */function () {
- function ASCIIEncoder() {}
- ASCIIEncoder.prototype.getEncodingMode = function () {
- return _constants.ASCII_ENCODATION;
- };
- ASCIIEncoder.prototype.encode = function (context) {
- // step B
- var n = _HighLevelEncoder.default.determineConsecutiveDigitCount(context.getMessage(), context.pos);
- if (n >= 2) {
- context.writeCodeword(this.encodeASCIIDigits(context.getMessage().charCodeAt(context.pos), context.getMessage().charCodeAt(context.pos + 1)));
- context.pos += 2;
- } else {
- var c = context.getCurrentChar();
- var newMode = _HighLevelEncoder.default.lookAheadTest(context.getMessage(), context.pos, this.getEncodingMode());
- if (newMode !== this.getEncodingMode()) {
- switch (newMode) {
- case _constants.BASE256_ENCODATION:
- context.writeCodeword(_constants.LATCH_TO_BASE256);
- context.signalEncoderChange(_constants.BASE256_ENCODATION);
- return;
- case _constants.C40_ENCODATION:
- context.writeCodeword(_constants.LATCH_TO_C40);
- context.signalEncoderChange(_constants.C40_ENCODATION);
- return;
- case _constants.X12_ENCODATION:
- context.writeCodeword(_constants.LATCH_TO_ANSIX12);
- context.signalEncoderChange(_constants.X12_ENCODATION);
- break;
- case _constants.TEXT_ENCODATION:
- context.writeCodeword(_constants.LATCH_TO_TEXT);
- context.signalEncoderChange(_constants.TEXT_ENCODATION);
- break;
- case _constants.EDIFACT_ENCODATION:
- context.writeCodeword(_constants.LATCH_TO_EDIFACT);
- context.signalEncoderChange(_constants.EDIFACT_ENCODATION);
- break;
- default:
- throw new Error('Illegal mode: ' + newMode);
- }
- } else if (_HighLevelEncoder.default.isExtendedASCII(c)) {
- context.writeCodeword(_constants.UPPER_SHIFT);
- context.writeCodeword(c - 128 + 1);
- context.pos++;
- } else {
- context.writeCodeword(c + 1);
- context.pos++;
- }
- }
- };
- ASCIIEncoder.prototype.encodeASCIIDigits = function (digit1, digit2) {
- if (_HighLevelEncoder.default.isDigit(digit1) && _HighLevelEncoder.default.isDigit(digit2)) {
- var num = (digit1 - 48) * 10 + (digit2 - 48);
- return num + 130;
- }
- throw new Error('not digits: ' + digit1 + digit2);
- };
- return ASCIIEncoder;
- }();
- exports.ASCIIEncoder = ASCIIEncoder;
- /***/ }),
- /* 484 */
- /*!*****************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/encoder/Base256Encoder.js ***!
- \*****************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.Base256Encoder = void 0;
- var _StringUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/StringUtils */ 321));
- var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../util/StringBuilder */ 320));
- var _HighLevelEncoder = _interopRequireDefault(__webpack_require__(/*! ./HighLevelEncoder */ 482));
- var _constants = __webpack_require__(/*! ./constants */ 481);
- var Base256Encoder = /** @class */function () {
- function Base256Encoder() {}
- Base256Encoder.prototype.getEncodingMode = function () {
- return _constants.BASE256_ENCODATION;
- };
- Base256Encoder.prototype.encode = function (context) {
- var buffer = new _StringBuilder.default();
- buffer.append(0); // Initialize length field
- while (context.hasMoreCharacters()) {
- var c = context.getCurrentChar();
- buffer.append(c);
- context.pos++;
- var newMode = _HighLevelEncoder.default.lookAheadTest(context.getMessage(), context.pos, this.getEncodingMode());
- if (newMode !== this.getEncodingMode()) {
- // Return to ASCII encodation, which will actually handle latch to new mode
- context.signalEncoderChange(_constants.ASCII_ENCODATION);
- break;
- }
- }
- var dataCount = buffer.length() - 1;
- var lengthFieldSize = 1;
- var currentSize = context.getCodewordCount() + dataCount + lengthFieldSize;
- context.updateSymbolInfo(currentSize);
- var mustPad = context.getSymbolInfo().getDataCapacity() - currentSize > 0;
- if (context.hasMoreCharacters() || mustPad) {
- if (dataCount <= 249) {
- buffer.setCharAt(0, _StringUtils.default.getCharAt(dataCount));
- } else if (dataCount <= 1555) {
- buffer.setCharAt(0, _StringUtils.default.getCharAt(Math.floor(dataCount / 250) + 249));
- buffer.insert(1, _StringUtils.default.getCharAt(dataCount % 250));
- } else {
- throw new Error('Message length not in valid ranges: ' + dataCount);
- }
- }
- for (var i = 0, c = buffer.length(); i < c; i++) {
- context.writeCodeword(this.randomize255State(buffer.charAt(i).charCodeAt(0), context.getCodewordCount() + 1));
- }
- };
- Base256Encoder.prototype.randomize255State = function (ch, codewordPosition) {
- var pseudoRandom = 149 * codewordPosition % 255 + 1;
- var tempVariable = ch + pseudoRandom;
- if (tempVariable <= 255) {
- return tempVariable;
- } else {
- return tempVariable - 256;
- }
- };
- return Base256Encoder;
- }();
- exports.Base256Encoder = Base256Encoder;
- /***/ }),
- /* 485 */
- /*!*************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/encoder/C40Encoder.js ***!
- \*************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.C40Encoder = void 0;
- var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../util/StringBuilder */ 320));
- var _HighLevelEncoder = _interopRequireDefault(__webpack_require__(/*! ./HighLevelEncoder */ 482));
- var _constants = __webpack_require__(/*! ./constants */ 481);
- var C40Encoder = /** @class */function () {
- function C40Encoder() {}
- C40Encoder.prototype.getEncodingMode = function () {
- return _constants.C40_ENCODATION;
- };
- C40Encoder.prototype.encodeMaximal = function (context) {
- var buffer = new _StringBuilder.default();
- var lastCharSize = 0;
- var backtrackStartPosition = context.pos;
- var backtrackBufferLength = 0;
- while (context.hasMoreCharacters()) {
- var c = context.getCurrentChar();
- context.pos++;
- lastCharSize = this.encodeChar(c, buffer);
- if (buffer.length() % 3 === 0) {
- backtrackStartPosition = context.pos;
- backtrackBufferLength = buffer.length();
- }
- }
- if (backtrackBufferLength !== buffer.length()) {
- var unwritten = Math.floor(buffer.length() / 3 * 2);
- var curCodewordCount = Math.floor(context.getCodewordCount() + unwritten + 1); // +1 for the latch to C40
- context.updateSymbolInfo(curCodewordCount);
- var available = context.getSymbolInfo().getDataCapacity() - curCodewordCount;
- var rest = Math.floor(buffer.length() % 3);
- if (rest === 2 && available !== 2 || rest === 1 && (lastCharSize > 3 || available !== 1)) {
- // buffer.setLength(backtrackBufferLength);
- context.pos = backtrackStartPosition;
- }
- }
- if (buffer.length() > 0) {
- context.writeCodeword(_constants.LATCH_TO_C40);
- }
- this.handleEOD(context, buffer);
- };
- C40Encoder.prototype.encode = function (context) {
- // step C
- var buffer = new _StringBuilder.default();
- while (context.hasMoreCharacters()) {
- var c = context.getCurrentChar();
- context.pos++;
- var lastCharSize = this.encodeChar(c, buffer);
- var unwritten = Math.floor(buffer.length() / 3) * 2;
- var curCodewordCount = context.getCodewordCount() + unwritten;
- context.updateSymbolInfo(curCodewordCount);
- var available = context.getSymbolInfo().getDataCapacity() - curCodewordCount;
- if (!context.hasMoreCharacters()) {
- // Avoid having a single C40 value in the last triplet
- var removed = new _StringBuilder.default();
- if (buffer.length() % 3 === 2 && available !== 2) {
- lastCharSize = this.backtrackOneCharacter(context, buffer, removed, lastCharSize);
- }
- while (buffer.length() % 3 === 1 && (lastCharSize > 3 || available !== 1)) {
- lastCharSize = this.backtrackOneCharacter(context, buffer, removed, lastCharSize);
- }
- break;
- }
- var count = buffer.length();
- if (count % 3 === 0) {
- var newMode = _HighLevelEncoder.default.lookAheadTest(context.getMessage(), context.pos, this.getEncodingMode());
- if (newMode !== this.getEncodingMode()) {
- // Return to ASCII encodation, which will actually handle latch to new mode
- context.signalEncoderChange(_constants.ASCII_ENCODATION);
- break;
- }
- }
- }
- this.handleEOD(context, buffer);
- };
- C40Encoder.prototype.backtrackOneCharacter = function (context, buffer, removed, lastCharSize) {
- var count = buffer.length();
- var test = buffer.toString().substring(0, count - lastCharSize);
- buffer.setLengthToZero();
- buffer.append(test);
- // buffer.delete(count - lastCharSize, count);
- /*for (let i = count - lastCharSize; i < count; i++) {
- buffer.deleteCharAt(i);
- }*/
- context.pos--;
- var c = context.getCurrentChar();
- lastCharSize = this.encodeChar(c, removed);
- context.resetSymbolInfo(); // Deal with possible reduction in symbol size
- return lastCharSize;
- };
- C40Encoder.prototype.writeNextTriplet = function (context, buffer) {
- context.writeCodewords(this.encodeToCodewords(buffer.toString()));
- var test = buffer.toString().substring(3);
- buffer.setLengthToZero();
- buffer.append(test);
- // buffer.delete(0, 3);
- /*for (let i = 0; i < 3; i++) {
- buffer.deleteCharAt(i);
- }*/
- };
- /**
- * Handle "end of data" situations
- *
- * @param context the encoder context
- * @param buffer the buffer with the remaining encoded characters
- */
- C40Encoder.prototype.handleEOD = function (context, buffer) {
- var unwritten = Math.floor(buffer.length() / 3 * 2);
- var rest = buffer.length() % 3;
- var curCodewordCount = context.getCodewordCount() + unwritten;
- context.updateSymbolInfo(curCodewordCount);
- var available = context.getSymbolInfo().getDataCapacity() - curCodewordCount;
- if (rest === 2) {
- buffer.append('\0'); // Shift 1
- while (buffer.length() >= 3) {
- this.writeNextTriplet(context, buffer);
- }
- if (context.hasMoreCharacters()) {
- context.writeCodeword(_constants.C40_UNLATCH);
- }
- } else if (available === 1 && rest === 1) {
- while (buffer.length() >= 3) {
- this.writeNextTriplet(context, buffer);
- }
- if (context.hasMoreCharacters()) {
- context.writeCodeword(_constants.C40_UNLATCH);
- }
- // else no unlatch
- context.pos--;
- } else if (rest === 0) {
- while (buffer.length() >= 3) {
- this.writeNextTriplet(context, buffer);
- }
- if (available > 0 || context.hasMoreCharacters()) {
- context.writeCodeword(_constants.C40_UNLATCH);
- }
- } else {
- throw new Error('Unexpected case. Please report!');
- }
- context.signalEncoderChange(_constants.ASCII_ENCODATION);
- };
- C40Encoder.prototype.encodeChar = function (c, sb) {
- if (c === ' '.charCodeAt(0)) {
- sb.append(3);
- return 1;
- }
- if (c >= '0'.charCodeAt(0) && c <= '9'.charCodeAt(0)) {
- sb.append(c - 48 + 4);
- return 1;
- }
- if (c >= 'A'.charCodeAt(0) && c <= 'Z'.charCodeAt(0)) {
- sb.append(c - 65 + 14);
- return 1;
- }
- if (c < ' '.charCodeAt(0)) {
- sb.append(0); // Shift 1 Set
- sb.append(c);
- return 2;
- }
- if (c <= '/'.charCodeAt(0)) {
- sb.append(1); // Shift 2 Set
- sb.append(c - 33);
- return 2;
- }
- if (c <= '@'.charCodeAt(0)) {
- sb.append(1); // Shift 2 Set
- sb.append(c - 58 + 15);
- return 2;
- }
- if (c <= '_'.charCodeAt(0)) {
- sb.append(1); // Shift 2 Set
- sb.append(c - 91 + 22);
- return 2;
- }
- if (c <= 127) {
- sb.append(2); // Shift 3 Set
- sb.append(c - 96);
- return 2;
- }
- sb.append(1 + "\x1E"); // Shift 2, Upper Shift
- var len = 2;
- len += this.encodeChar(c - 128, sb);
- return len;
- };
- C40Encoder.prototype.encodeToCodewords = function (sb) {
- var v = 1600 * sb.charCodeAt(0) + 40 * sb.charCodeAt(1) + sb.charCodeAt(2) + 1;
- var cw1 = v / 256;
- var cw2 = v % 256;
- var result = new _StringBuilder.default();
- result.append(cw1);
- result.append(cw2);
- return result.toString();
- };
- return C40Encoder;
- }();
- exports.C40Encoder = C40Encoder;
- /***/ }),
- /* 486 */
- /*!*****************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/encoder/EdifactEncoder.js ***!
- \*****************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.EdifactEncoder = void 0;
- var _StringUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/StringUtils */ 321));
- var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../util/StringBuilder */ 320));
- var _constants = __webpack_require__(/*! ./constants */ 481);
- var _HighLevelEncoder = _interopRequireDefault(__webpack_require__(/*! ./HighLevelEncoder */ 482));
- var EdifactEncoder = /** @class */function () {
- function EdifactEncoder() {}
- EdifactEncoder.prototype.getEncodingMode = function () {
- return _constants.EDIFACT_ENCODATION;
- };
- EdifactEncoder.prototype.encode = function (context) {
- // step F
- var buffer = new _StringBuilder.default();
- while (context.hasMoreCharacters()) {
- var c = context.getCurrentChar();
- this.encodeChar(c, buffer);
- context.pos++;
- var count = buffer.length();
- if (count >= 4) {
- context.writeCodewords(this.encodeToCodewords(buffer.toString()));
- var test_1 = buffer.toString().substring(4);
- buffer.setLengthToZero();
- buffer.append(test_1);
- // buffer.delete(0, 4);
- // for (let i = 0; i < 4; i++) {
- // buffer.deleteCharAt(i);
- // }
- var newMode = _HighLevelEncoder.default.lookAheadTest(context.getMessage(), context.pos, this.getEncodingMode());
- if (newMode !== this.getEncodingMode()) {
- // Return to ASCII encodation, which will actually handle latch to new mode
- context.signalEncoderChange(_constants.ASCII_ENCODATION);
- break;
- }
- }
- }
- buffer.append(_StringUtils.default.getCharAt(31)); // Unlatch
- this.handleEOD(context, buffer);
- };
- /**
- * Handle "end of data" situations
- *
- * @param context the encoder context
- * @param buffer the buffer with the remaining encoded characters
- */
- EdifactEncoder.prototype.handleEOD = function (context, buffer) {
- try {
- var count = buffer.length();
- if (count === 0) {
- return; // Already finished
- }
- if (count === 1) {
- // Only an unlatch at the end
- context.updateSymbolInfo();
- var available = context.getSymbolInfo().getDataCapacity() - context.getCodewordCount();
- var remaining = context.getRemainingCharacters();
- // The following two lines are a hack inspired by the 'fix' from https://sourceforge.net/p/barcode4j/svn/221/
- if (remaining > available) {
- context.updateSymbolInfo(context.getCodewordCount() + 1);
- available = context.getSymbolInfo().getDataCapacity() - context.getCodewordCount();
- }
- if (remaining <= available && available <= 2) {
- return; // No unlatch
- }
- }
- if (count > 4) {
- throw new Error('Count must not exceed 4');
- }
- var restChars = count - 1;
- var encoded = this.encodeToCodewords(buffer.toString());
- var endOfSymbolReached = !context.hasMoreCharacters();
- var restInAscii = endOfSymbolReached && restChars <= 2;
- if (restChars <= 2) {
- context.updateSymbolInfo(context.getCodewordCount() + restChars);
- var available = context.getSymbolInfo().getDataCapacity() - context.getCodewordCount();
- if (available >= 3) {
- restInAscii = false;
- context.updateSymbolInfo(context.getCodewordCount() + encoded.length);
- // available = context.symbolInfo.dataCapacity - context.getCodewordCount();
- }
- }
- if (restInAscii) {
- context.resetSymbolInfo();
- context.pos -= restChars;
- } else {
- context.writeCodewords(encoded);
- }
- } finally {
- context.signalEncoderChange(_constants.ASCII_ENCODATION);
- }
- };
- EdifactEncoder.prototype.encodeChar = function (c, sb) {
- if (c >= ' '.charCodeAt(0) && c <= '?'.charCodeAt(0)) {
- sb.append(c);
- } else if (c >= '@'.charCodeAt(0) && c <= '^'.charCodeAt(0)) {
- sb.append(_StringUtils.default.getCharAt(c - 64));
- } else {
- _HighLevelEncoder.default.illegalCharacter(_StringUtils.default.getCharAt(c));
- }
- };
- EdifactEncoder.prototype.encodeToCodewords = function (sb) {
- var len = sb.length;
- if (len === 0) {
- throw new Error('StringBuilder must not be empty');
- }
- var c1 = sb.charAt(0).charCodeAt(0);
- var c2 = len >= 2 ? sb.charAt(1).charCodeAt(0) : 0;
- var c3 = len >= 3 ? sb.charAt(2).charCodeAt(0) : 0;
- var c4 = len >= 4 ? sb.charAt(3).charCodeAt(0) : 0;
- var v = (c1 << 18) + (c2 << 12) + (c3 << 6) + c4;
- var cw1 = v >> 16 & 255;
- var cw2 = v >> 8 & 255;
- var cw3 = v & 255;
- var res = new _StringBuilder.default();
- res.append(cw1);
- if (len >= 2) {
- res.append(cw2);
- }
- if (len >= 3) {
- res.append(cw3);
- }
- return res.toString();
- };
- return EdifactEncoder;
- }();
- exports.EdifactEncoder = EdifactEncoder;
- /***/ }),
- /* 487 */
- /*!*****************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/encoder/EncoderContext.js ***!
- \*****************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.EncoderContext = void 0;
- var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../util/StringBuilder */ 320));
- var _SymbolInfo = _interopRequireDefault(__webpack_require__(/*! ./SymbolInfo */ 488));
- var EncoderContext = /** @class */function () {
- function EncoderContext(msg) {
- this.msg = msg;
- this.pos = 0;
- this.skipAtEnd = 0;
- // From this point on Strings are not Unicode anymore!
- var msgBinary = msg.split('').map(function (c) {
- return c.charCodeAt(0);
- });
- var sb = new _StringBuilder.default();
- for (var i = 0, c = msgBinary.length; i < c; i++) {
- var ch = String.fromCharCode(msgBinary[i] & 0xff);
- if (ch === '?' && msg.charAt(i) !== '?') {
- throw new Error('Message contains characters outside ISO-8859-1 encoding.');
- }
- sb.append(ch);
- }
- this.msg = sb.toString(); // Not Unicode here!
- this.shape = 0 /* FORCE_NONE */;
- this.codewords = new _StringBuilder.default();
- this.newEncoding = -1;
- }
- EncoderContext.prototype.setSymbolShape = function (shape) {
- this.shape = shape;
- };
- EncoderContext.prototype.setSizeConstraints = function (minSize, maxSize) {
- this.minSize = minSize;
- this.maxSize = maxSize;
- };
- EncoderContext.prototype.getMessage = function () {
- return this.msg;
- };
- EncoderContext.prototype.setSkipAtEnd = function (count) {
- this.skipAtEnd = count;
- };
- EncoderContext.prototype.getCurrentChar = function () {
- return this.msg.charCodeAt(this.pos);
- };
- EncoderContext.prototype.getCurrent = function () {
- return this.msg.charCodeAt(this.pos);
- };
- EncoderContext.prototype.getCodewords = function () {
- return this.codewords;
- };
- EncoderContext.prototype.writeCodewords = function (codewords) {
- this.codewords.append(codewords);
- };
- EncoderContext.prototype.writeCodeword = function (codeword) {
- this.codewords.append(codeword);
- };
- EncoderContext.prototype.getCodewordCount = function () {
- return this.codewords.length();
- };
- EncoderContext.prototype.getNewEncoding = function () {
- return this.newEncoding;
- };
- EncoderContext.prototype.signalEncoderChange = function (encoding) {
- this.newEncoding = encoding;
- };
- EncoderContext.prototype.resetEncoderSignal = function () {
- this.newEncoding = -1;
- };
- EncoderContext.prototype.hasMoreCharacters = function () {
- return this.pos < this.getTotalMessageCharCount();
- };
- EncoderContext.prototype.getTotalMessageCharCount = function () {
- return this.msg.length - this.skipAtEnd;
- };
- EncoderContext.prototype.getRemainingCharacters = function () {
- return this.getTotalMessageCharCount() - this.pos;
- };
- EncoderContext.prototype.getSymbolInfo = function () {
- return this.symbolInfo;
- };
- EncoderContext.prototype.updateSymbolInfo = function (len) {
- if (len === void 0) {
- len = this.getCodewordCount();
- }
- if (this.symbolInfo == null || len > this.symbolInfo.getDataCapacity()) {
- this.symbolInfo = _SymbolInfo.default.lookup(len, this.shape, this.minSize, this.maxSize, true);
- }
- };
- EncoderContext.prototype.resetSymbolInfo = function () {
- this.symbolInfo = null;
- };
- return EncoderContext;
- }();
- exports.EncoderContext = EncoderContext;
- /***/ }),
- /* 488 */
- /*!*************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/encoder/SymbolInfo.js ***!
- \*************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = exports.PROD_SYMBOLS = void 0;
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- /**
- * Symbol info table for DataMatrix.
- */
- var SymbolInfo = /** @class */function () {
- function SymbolInfo(rectangular, dataCapacity, errorCodewords, matrixWidth, matrixHeight, dataRegions, rsBlockData, rsBlockError) {
- if (rsBlockData === void 0) {
- rsBlockData = 0;
- }
- if (rsBlockError === void 0) {
- rsBlockError = 0;
- }
- this.rectangular = rectangular;
- this.dataCapacity = dataCapacity;
- this.errorCodewords = errorCodewords;
- this.matrixWidth = matrixWidth;
- this.matrixHeight = matrixHeight;
- this.dataRegions = dataRegions;
- this.rsBlockData = rsBlockData;
- this.rsBlockError = rsBlockError;
- }
- SymbolInfo.lookup = function (dataCodewords, shape, minSize, maxSize, fail) {
- var e_1, _a;
- if (shape === void 0) {
- shape = 0 /* FORCE_NONE */;
- }
- if (minSize === void 0) {
- minSize = null;
- }
- if (maxSize === void 0) {
- maxSize = null;
- }
- if (fail === void 0) {
- fail = true;
- }
- try {
- for (var PROD_SYMBOLS_1 = __values(PROD_SYMBOLS), PROD_SYMBOLS_1_1 = PROD_SYMBOLS_1.next(); !PROD_SYMBOLS_1_1.done; PROD_SYMBOLS_1_1 = PROD_SYMBOLS_1.next()) {
- var symbol = PROD_SYMBOLS_1_1.value;
- if (shape === 1 /* FORCE_SQUARE */ && symbol.rectangular) {
- continue;
- }
- if (shape === 2 /* FORCE_RECTANGLE */ && !symbol.rectangular) {
- continue;
- }
- if (minSize != null && (symbol.getSymbolWidth() < minSize.getWidth() || symbol.getSymbolHeight() < minSize.getHeight())) {
- continue;
- }
- if (maxSize != null && (symbol.getSymbolWidth() > maxSize.getWidth() || symbol.getSymbolHeight() > maxSize.getHeight())) {
- continue;
- }
- if (dataCodewords <= symbol.dataCapacity) {
- return symbol;
- }
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (PROD_SYMBOLS_1_1 && !PROD_SYMBOLS_1_1.done && (_a = PROD_SYMBOLS_1.return)) _a.call(PROD_SYMBOLS_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- if (fail) {
- throw new Error("Can't find a symbol arrangement that matches the message. Data codewords: " + dataCodewords);
- }
- return null;
- };
- SymbolInfo.prototype.getHorizontalDataRegions = function () {
- switch (this.dataRegions) {
- case 1:
- return 1;
- case 2:
- case 4:
- return 2;
- case 16:
- return 4;
- case 36:
- return 6;
- default:
- throw new Error('Cannot handle this number of data regions');
- }
- };
- SymbolInfo.prototype.getVerticalDataRegions = function () {
- switch (this.dataRegions) {
- case 1:
- case 2:
- return 1;
- case 4:
- return 2;
- case 16:
- return 4;
- case 36:
- return 6;
- default:
- throw new Error('Cannot handle this number of data regions');
- }
- };
- SymbolInfo.prototype.getSymbolDataWidth = function () {
- return this.getHorizontalDataRegions() * this.matrixWidth;
- };
- SymbolInfo.prototype.getSymbolDataHeight = function () {
- return this.getVerticalDataRegions() * this.matrixHeight;
- };
- SymbolInfo.prototype.getSymbolWidth = function () {
- return this.getSymbolDataWidth() + this.getHorizontalDataRegions() * 2;
- };
- SymbolInfo.prototype.getSymbolHeight = function () {
- return this.getSymbolDataHeight() + this.getVerticalDataRegions() * 2;
- };
- SymbolInfo.prototype.getCodewordCount = function () {
- return this.dataCapacity + this.errorCodewords;
- };
- SymbolInfo.prototype.getInterleavedBlockCount = function () {
- if (!this.rsBlockData) return 1;
- return this.dataCapacity / this.rsBlockData;
- };
- SymbolInfo.prototype.getDataCapacity = function () {
- return this.dataCapacity;
- };
- SymbolInfo.prototype.getErrorCodewords = function () {
- return this.errorCodewords;
- };
- SymbolInfo.prototype.getDataLengthForInterleavedBlock = function (index) {
- return this.rsBlockData;
- };
- SymbolInfo.prototype.getErrorLengthForInterleavedBlock = function (index) {
- return this.rsBlockError;
- };
- return SymbolInfo;
- }();
- var _default = SymbolInfo;
- exports.default = _default;
- var DataMatrixSymbolInfo144 = /** @class */function (_super) {
- __extends(DataMatrixSymbolInfo144, _super);
- function DataMatrixSymbolInfo144() {
- return _super.call(this, false, 1558, 620, 22, 22, 36, -1, 62) || this;
- }
- DataMatrixSymbolInfo144.prototype.getInterleavedBlockCount = function () {
- return 10;
- };
- DataMatrixSymbolInfo144.prototype.getDataLengthForInterleavedBlock = function (index) {
- return index <= 8 ? 156 : 155;
- };
- return DataMatrixSymbolInfo144;
- }(SymbolInfo);
- var PROD_SYMBOLS = [new SymbolInfo(false, 3, 5, 8, 8, 1), new SymbolInfo(false, 5, 7, 10, 10, 1), /*rect*/new SymbolInfo(true, 5, 7, 16, 6, 1), new SymbolInfo(false, 8, 10, 12, 12, 1), /*rect*/new SymbolInfo(true, 10, 11, 14, 6, 2), new SymbolInfo(false, 12, 12, 14, 14, 1), /*rect*/new SymbolInfo(true, 16, 14, 24, 10, 1), new SymbolInfo(false, 18, 14, 16, 16, 1), new SymbolInfo(false, 22, 18, 18, 18, 1), /*rect*/new SymbolInfo(true, 22, 18, 16, 10, 2), new SymbolInfo(false, 30, 20, 20, 20, 1), /*rect*/new SymbolInfo(true, 32, 24, 16, 14, 2), new SymbolInfo(false, 36, 24, 22, 22, 1), new SymbolInfo(false, 44, 28, 24, 24, 1), /*rect*/new SymbolInfo(true, 49, 28, 22, 14, 2), new SymbolInfo(false, 62, 36, 14, 14, 4), new SymbolInfo(false, 86, 42, 16, 16, 4), new SymbolInfo(false, 114, 48, 18, 18, 4), new SymbolInfo(false, 144, 56, 20, 20, 4), new SymbolInfo(false, 174, 68, 22, 22, 4), new SymbolInfo(false, 204, 84, 24, 24, 4, 102, 42), new SymbolInfo(false, 280, 112, 14, 14, 16, 140, 56), new SymbolInfo(false, 368, 144, 16, 16, 16, 92, 36), new SymbolInfo(false, 456, 192, 18, 18, 16, 114, 48), new SymbolInfo(false, 576, 224, 20, 20, 16, 144, 56), new SymbolInfo(false, 696, 272, 22, 22, 16, 174, 68), new SymbolInfo(false, 816, 336, 24, 24, 16, 136, 56), new SymbolInfo(false, 1050, 408, 18, 18, 36, 175, 68), new SymbolInfo(false, 1304, 496, 20, 20, 36, 163, 62), new DataMatrixSymbolInfo144()];
- exports.PROD_SYMBOLS = PROD_SYMBOLS;
- /***/ }),
- /* 489 */
- /*!*************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/encoder/X12Encoder.js ***!
- \*************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.X12Encoder = void 0;
- var _StringUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/StringUtils */ 321));
- var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../util/StringBuilder */ 320));
- var _C40Encoder = __webpack_require__(/*! ./C40Encoder */ 485);
- var _HighLevelEncoder = _interopRequireDefault(__webpack_require__(/*! ./HighLevelEncoder */ 482));
- var _constants = __webpack_require__(/*! ./constants */ 481);
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var X12Encoder = /** @class */function (_super) {
- __extends(X12Encoder, _super);
- function X12Encoder() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- X12Encoder.prototype.getEncodingMode = function () {
- return _constants.X12_ENCODATION;
- };
- X12Encoder.prototype.encode = function (context) {
- // step C
- var buffer = new _StringBuilder.default();
- while (context.hasMoreCharacters()) {
- var c = context.getCurrentChar();
- context.pos++;
- this.encodeChar(c, buffer);
- var count = buffer.length();
- if (count % 3 === 0) {
- this.writeNextTriplet(context, buffer);
- var newMode = _HighLevelEncoder.default.lookAheadTest(context.getMessage(), context.pos, this.getEncodingMode());
- if (newMode !== this.getEncodingMode()) {
- // Return to ASCII encodation, which will actually handle latch to new mode
- context.signalEncoderChange(_constants.ASCII_ENCODATION);
- break;
- }
- }
- }
- this.handleEOD(context, buffer);
- };
- X12Encoder.prototype.encodeChar = function (c, sb) {
- switch (c) {
- case 13:
- // CR (Carriage return)
- sb.append(0);
- break;
- case '*'.charCodeAt(0):
- sb.append(1);
- break;
- case '>'.charCodeAt(0):
- sb.append(2);
- break;
- case ' '.charCodeAt(0):
- sb.append(3);
- break;
- default:
- if (c >= '0'.charCodeAt(0) && c <= '9'.charCodeAt(0)) {
- sb.append(c - 48 + 4);
- } else if (c >= 'A'.charCodeAt(0) && c <= 'Z'.charCodeAt(0)) {
- sb.append(c - 65 + 14);
- } else {
- _HighLevelEncoder.default.illegalCharacter(_StringUtils.default.getCharAt(c));
- }
- break;
- }
- return 1;
- };
- X12Encoder.prototype.handleEOD = function (context, buffer) {
- context.updateSymbolInfo();
- var available = context.getSymbolInfo().getDataCapacity() - context.getCodewordCount();
- var count = buffer.length();
- context.pos -= count;
- if (context.getRemainingCharacters() > 1 || available > 1 || context.getRemainingCharacters() !== available) {
- context.writeCodeword(_constants.X12_UNLATCH);
- }
- if (context.getNewEncoding() < 0) {
- context.signalEncoderChange(_constants.ASCII_ENCODATION);
- }
- };
- return X12Encoder;
- }(_C40Encoder.C40Encoder);
- exports.X12Encoder = X12Encoder;
- /***/ }),
- /* 490 */
- /*!**************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/encoder/TextEncoder.js ***!
- \**************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.TextEncoder = void 0;
- var _C40Encoder = __webpack_require__(/*! ./C40Encoder */ 485);
- var _constants = __webpack_require__(/*! ./constants */ 481);
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var TextEncoder = /** @class */function (_super) {
- __extends(TextEncoder, _super);
- function TextEncoder() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- TextEncoder.prototype.getEncodingMode = function () {
- return _constants.TEXT_ENCODATION;
- };
- TextEncoder.prototype.encodeChar = function (c, sb) {
- if (c === ' '.charCodeAt(0)) {
- sb.append(3);
- return 1;
- }
- if (c >= '0'.charCodeAt(0) && c <= '9'.charCodeAt(0)) {
- sb.append(c - 48 + 4);
- return 1;
- }
- if (c >= 'a'.charCodeAt(0) && c <= 'z'.charCodeAt(0)) {
- sb.append(c - 97 + 14);
- return 1;
- }
- if (c < ' '.charCodeAt(0)) {
- sb.append(0); // Shift 1 Set
- sb.append(c);
- return 2;
- }
- if (c <= '/'.charCodeAt(0)) {
- sb.append(1); // Shift 2 Set
- sb.append(c - 33);
- return 2;
- }
- if (c <= '@'.charCodeAt(0)) {
- sb.append(1); // Shift 2 Set
- sb.append(c - 58 + 15);
- return 2;
- }
- if (c >= '['.charCodeAt(0) && c <= '_'.charCodeAt(0)) {
- sb.append(1); // Shift 2 Set
- sb.append(c - 91 + 22);
- return 2;
- }
- if (c === '`'.charCodeAt(0)) {
- sb.append(2); // Shift 3 Set
- sb.append(0); // '`' - 96 == 0
- return 2;
- }
- if (c <= 'Z'.charCodeAt(0)) {
- sb.append(2); // Shift 3 Set
- sb.append(c - 65 + 1);
- return 2;
- }
- if (c <= 127) {
- sb.append(2); // Shift 3 Set
- sb.append(c - 123 + 27);
- return 2;
- }
- sb.append(1 + "\x1E"); // Shift 2, Upper Shift
- var len = 2;
- len += this.encodeChar(c - 128, sb);
- return len;
- };
- return TextEncoder;
- }(_C40Encoder.C40Encoder);
- exports.TextEncoder = TextEncoder;
- /***/ }),
- /* 491 */
- /*!***********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/DataMatrixWriter.js ***!
- \***********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
- var _BitMatrix = _interopRequireDefault(__webpack_require__(/*! ../common/BitMatrix */ 319));
- var _EncodeHintType = _interopRequireDefault(__webpack_require__(/*! ../EncodeHintType */ 462));
- var _ByteMatrix = _interopRequireDefault(__webpack_require__(/*! ../qrcode/encoder/ByteMatrix */ 466));
- var _Charset = _interopRequireDefault(__webpack_require__(/*! ../util/Charset */ 477));
- var _encoder = __webpack_require__(/*! ./encoder */ 492);
- var DataMatrixWriter = /** @class */function () {
- function DataMatrixWriter() {}
- DataMatrixWriter.prototype.encode = function (contents, format, width, height, hints) {
- if (hints === void 0) {
- hints = null;
- }
- if (contents.trim() === '') {
- throw new Error('Found empty contents');
- }
- if (format !== _BarcodeFormat.default.DATA_MATRIX) {
- throw new Error('Can only encode DATA_MATRIX, but got ' + format);
- }
- if (width < 0 || height < 0) {
- throw new Error('Requested dimensions can\'t be negative: ' + width + 'x' + height);
- }
- // Try to get force shape & min / max size
- var shape = 0 /* FORCE_NONE */;
- var minSize = null;
- var maxSize = null;
- if (hints != null) {
- var requestedShape = hints.get(_EncodeHintType.default.DATA_MATRIX_SHAPE);
- if (requestedShape != null) {
- shape = requestedShape;
- }
- var requestedMinSize = hints.get(_EncodeHintType.default.MIN_SIZE);
- if (requestedMinSize != null) {
- minSize = requestedMinSize;
- }
- var requestedMaxSize = hints.get(_EncodeHintType.default.MAX_SIZE);
- if (requestedMaxSize != null) {
- maxSize = requestedMaxSize;
- }
- }
- // 1. step: Data encodation
- var encoded;
- var hasCompactionHint = hints != null && hints.has(_EncodeHintType.default.DATA_MATRIX_COMPACT) && Boolean(hints.get(_EncodeHintType.default.DATA_MATRIX_COMPACT).toString());
- if (hasCompactionHint) {
- var hasGS1FormatHint = hints.has(_EncodeHintType.default.GS1_FORMAT) && Boolean(hints.get(_EncodeHintType.default.GS1_FORMAT).toString());
- var charset = null;
- var hasEncodingHint = hints.has(_EncodeHintType.default.CHARACTER_SET);
- if (hasEncodingHint) {
- charset = _Charset.default.forName(hints.get(_EncodeHintType.default.CHARACTER_SET).toString());
- }
- encoded = _encoder.MinimalEncoder.encodeHighLevel(contents, charset, hasGS1FormatHint ? 0x1d : -1, shape);
- } else {
- var hasForceC40Hint = hints != null && hints.has(_EncodeHintType.default.FORCE_C40) && Boolean(hints.get(_EncodeHintType.default.FORCE_C40).toString());
- encoded = _encoder.HighLevelEncoder.encodeHighLevel(contents, shape, minSize, maxSize, hasForceC40Hint);
- }
- var symbolInfo = _encoder.SymbolInfo.lookup(encoded.length, shape, minSize, maxSize, true);
- // 2. step: ECC generation
- var codewords = _encoder.ErrorCorrection.encodeECC200(encoded, symbolInfo);
- // 3. step: Module placement in Matrix
- var placement = new _encoder.DefaultPlacement(codewords, symbolInfo.getSymbolDataWidth(), symbolInfo.getSymbolDataHeight());
- placement.place();
- // 4. step: low-level encoding
- return this.encodeLowLevel(placement, symbolInfo, width, height);
- };
- /**
- * Encode the given symbol info to a bit matrix.
- *
- * @param placement The DataMatrix placement.
- * @param symbolInfo The symbol info to encode.
- * @return The bit matrix generated.
- */
- DataMatrixWriter.prototype.encodeLowLevel = function (placement, symbolInfo, width, height) {
- var symbolWidth = symbolInfo.getSymbolDataWidth();
- var symbolHeight = symbolInfo.getSymbolDataHeight();
- var matrix = new _ByteMatrix.default(symbolInfo.getSymbolWidth(), symbolInfo.getSymbolHeight());
- var matrixY = 0;
- for (var y = 0; y < symbolHeight; y++) {
- // Fill the top edge with alternate 0 / 1
- var matrixX = void 0;
- if (y % symbolInfo.matrixHeight === 0) {
- matrixX = 0;
- for (var x = 0; x < symbolInfo.getSymbolWidth(); x++) {
- matrix.setBoolean(matrixX, matrixY, x % 2 === 0);
- matrixX++;
- }
- matrixY++;
- }
- matrixX = 0;
- for (var x = 0; x < symbolWidth; x++) {
- // Fill the right edge with full 1
- if (x % symbolInfo.matrixWidth === 0) {
- matrix.setBoolean(matrixX, matrixY, true);
- matrixX++;
- }
- matrix.setBoolean(matrixX, matrixY, placement.getBit(x, y));
- matrixX++;
- // Fill the right edge with alternate 0 / 1
- if (x % symbolInfo.matrixWidth === symbolInfo.matrixWidth - 1) {
- matrix.setBoolean(matrixX, matrixY, y % 2 === 0);
- matrixX++;
- }
- }
- matrixY++;
- // Fill the bottom edge with full 1
- if (y % symbolInfo.matrixHeight === symbolInfo.matrixHeight - 1) {
- matrixX = 0;
- for (var x = 0; x < symbolInfo.getSymbolWidth(); x++) {
- matrix.setBoolean(matrixX, matrixY, true);
- matrixX++;
- }
- matrixY++;
- }
- }
- return this.convertByteMatrixToBitMatrix(matrix, width, height);
- };
- /**
- * Convert the ByteMatrix to BitMatrix.
- *
- * @param reqHeight The requested height of the image (in pixels) with the Datamatrix code
- * @param reqWidth The requested width of the image (in pixels) with the Datamatrix code
- * @param matrix The input matrix.
- * @return The output matrix.
- */
- DataMatrixWriter.prototype.convertByteMatrixToBitMatrix = function (matrix, reqWidth, reqHeight) {
- var matrixWidth = matrix.getWidth();
- var matrixHeight = matrix.getHeight();
- var outputWidth = Math.max(reqWidth, matrixWidth);
- var outputHeight = Math.max(reqHeight, matrixHeight);
- var multiple = Math.min(outputWidth / matrixWidth, outputHeight / matrixHeight);
- var leftPadding = (outputWidth - matrixWidth * multiple) / 2;
- var topPadding = (outputHeight - matrixHeight * multiple) / 2;
- var output;
- // remove padding if requested width and height are too small
- if (reqHeight < matrixHeight || reqWidth < matrixWidth) {
- leftPadding = 0;
- topPadding = 0;
- output = new _BitMatrix.default(matrixWidth, matrixHeight);
- } else {
- output = new _BitMatrix.default(reqWidth, reqHeight);
- }
- output.clear();
- for (var inputY = 0, outputY = topPadding; inputY < matrixHeight; inputY++, outputY += multiple) {
- // Write the contents of this row of the bytematrix
- for (var inputX = 0, outputX = leftPadding; inputX < matrixWidth; inputX++, outputX += multiple) {
- if (matrix.get(inputX, inputY) === 1) {
- output.setRegion(outputX, outputY, multiple, multiple);
- }
- }
- }
- return output;
- };
- return DataMatrixWriter;
- }();
- var _default = DataMatrixWriter;
- exports.default = _default;
- /***/ }),
- /* 492 */
- /*!********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/encoder/index.js ***!
- \********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- Object.defineProperty(exports, "ASCIIEncoder", {
- enumerable: true,
- get: function get() {
- return _ASCIIEncoder.ASCIIEncoder;
- }
- });
- Object.defineProperty(exports, "Base256Encoder", {
- enumerable: true,
- get: function get() {
- return _Base256Encoder.Base256Encoder;
- }
- });
- Object.defineProperty(exports, "C40Encoder", {
- enumerable: true,
- get: function get() {
- return _C40Encoder.C40Encoder;
- }
- });
- Object.defineProperty(exports, "DefaultPlacement", {
- enumerable: true,
- get: function get() {
- return _DefaultPlacement.default;
- }
- });
- Object.defineProperty(exports, "EdifactEncoder", {
- enumerable: true,
- get: function get() {
- return _EdifactEncoder.EdifactEncoder;
- }
- });
- Object.defineProperty(exports, "EncoderContext", {
- enumerable: true,
- get: function get() {
- return _EncoderContext.EncoderContext;
- }
- });
- Object.defineProperty(exports, "ErrorCorrection", {
- enumerable: true,
- get: function get() {
- return _ErrorCorrection.default;
- }
- });
- Object.defineProperty(exports, "HighLevelEncoder", {
- enumerable: true,
- get: function get() {
- return _HighLevelEncoder.default;
- }
- });
- Object.defineProperty(exports, "MinimalEncoder", {
- enumerable: true,
- get: function get() {
- return _MinimalEncoder.MinimalEncoder;
- }
- });
- Object.defineProperty(exports, "SymbolInfo", {
- enumerable: true,
- get: function get() {
- return _SymbolInfo.default;
- }
- });
- Object.defineProperty(exports, "TextEncoder", {
- enumerable: true,
- get: function get() {
- return _TextEncoder.TextEncoder;
- }
- });
- Object.defineProperty(exports, "X12Encoder", {
- enumerable: true,
- get: function get() {
- return _X12Encoder.X12Encoder;
- }
- });
- var _ASCIIEncoder = __webpack_require__(/*! ./ASCIIEncoder */ 483);
- var _Base256Encoder = __webpack_require__(/*! ./Base256Encoder */ 484);
- var _C40Encoder = __webpack_require__(/*! ./C40Encoder */ 485);
- var _DefaultPlacement = _interopRequireDefault(__webpack_require__(/*! ./DefaultPlacement */ 479));
- var _EdifactEncoder = __webpack_require__(/*! ./EdifactEncoder */ 486);
- var _EncoderContext = __webpack_require__(/*! ./EncoderContext */ 487);
- var _ErrorCorrection = _interopRequireDefault(__webpack_require__(/*! ./ErrorCorrection */ 480));
- var _HighLevelEncoder = _interopRequireDefault(__webpack_require__(/*! ./HighLevelEncoder */ 482));
- var _MinimalEncoder = __webpack_require__(/*! ./MinimalEncoder */ 493);
- var _SymbolInfo = _interopRequireDefault(__webpack_require__(/*! ./SymbolInfo */ 488));
- var _TextEncoder = __webpack_require__(/*! ./TextEncoder */ 490);
- var _X12Encoder = __webpack_require__(/*! ./X12Encoder */ 489);
- /***/ }),
- /* 493 */
- /*!*****************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/encoder/MinimalEncoder.js ***!
- \*****************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.MinimalEncoder = void 0;
- var _constants = __webpack_require__(/*! ./constants */ 481);
- var _HighLevelEncoder = _interopRequireDefault(__webpack_require__(/*! ./HighLevelEncoder */ 482));
- var _MinimalECIInput = __webpack_require__(/*! ../../common/MinimalECIInput */ 494);
- var _Integer = _interopRequireDefault(__webpack_require__(/*! ../../util/Integer */ 318));
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- var __read = void 0 && (void 0).__read || function (o, n) {
- var m = typeof Symbol === "function" && o[Symbol.iterator];
- if (!m) return o;
- var i = m.call(o),
- r,
- ar = [],
- e;
- try {
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
- ar.push(r.value);
- }
- } catch (error) {
- e = {
- error: error
- };
- } finally {
- try {
- if (r && !r.done && (m = i["return"])) m.call(i);
- } finally {
- if (e) throw e.error;
- }
- }
- return ar;
- };
- var __spread = void 0 && (void 0).__spread || function () {
- for (var ar = [], i = 0; i < arguments.length; i++) {
- ar = ar.concat(__read(arguments[i]));
- }
- return ar;
- };
- var Mode;
- (function (Mode) {
- Mode[Mode["ASCII"] = 0] = "ASCII";
- Mode[Mode["C40"] = 1] = "C40";
- Mode[Mode["TEXT"] = 2] = "TEXT";
- Mode[Mode["X12"] = 3] = "X12";
- Mode[Mode["EDF"] = 4] = "EDF";
- Mode[Mode["B256"] = 5] = "B256";
- })(Mode || (Mode = {}));
- var C40_SHIFT2_CHARS = ['!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_'];
- var MinimalEncoder = /** @class */function () {
- function MinimalEncoder() {}
- MinimalEncoder.isExtendedASCII = function (ch, fnc1) {
- return ch !== fnc1 && ch >= 128 && ch <= 255;
- };
- MinimalEncoder.isInC40Shift1Set = function (ch) {
- return ch <= 31;
- };
- MinimalEncoder.isInC40Shift2Set = function (ch, fnc1) {
- var e_1, _a;
- try {
- for (var C40_SHIFT2_CHARS_1 = __values(C40_SHIFT2_CHARS), C40_SHIFT2_CHARS_1_1 = C40_SHIFT2_CHARS_1.next(); !C40_SHIFT2_CHARS_1_1.done; C40_SHIFT2_CHARS_1_1 = C40_SHIFT2_CHARS_1.next()) {
- var c40Shift2Char = C40_SHIFT2_CHARS_1_1.value;
- if (c40Shift2Char.charCodeAt(0) === ch) {
- return true;
- }
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (C40_SHIFT2_CHARS_1_1 && !C40_SHIFT2_CHARS_1_1.done && (_a = C40_SHIFT2_CHARS_1.return)) _a.call(C40_SHIFT2_CHARS_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- return ch === fnc1;
- };
- MinimalEncoder.isInTextShift1Set = function (ch) {
- return this.isInC40Shift1Set(ch);
- };
- MinimalEncoder.isInTextShift2Set = function (ch, fnc1) {
- return this.isInC40Shift2Set(ch, fnc1);
- };
- /**
- * Performs message encoding of a DataMatrix message
- *
- * @param msg the message
- * @param priorityCharset The preferred {@link Charset}. When the value of the argument is null, the algorithm
- * chooses charsets that leads to a minimal representation. Otherwise the algorithm will use the priority
- * charset to encode any character in the input that can be encoded by it if the charset is among the
- * supported charsets.
- * @param fnc1 denotes the character in the input that represents the FNC1 character or -1 if this is not a GS1
- * bar code. If the value is not -1 then a FNC1 is also prepended.
- * @param shape requested shape.
- * @return the encoded message (the char values range from 0 to 255)
- */
- MinimalEncoder.encodeHighLevel = function (msg, priorityCharset, fnc1, shape) {
- if (priorityCharset === void 0) {
- priorityCharset = null;
- }
- if (fnc1 === void 0) {
- fnc1 = -1;
- }
- if (shape === void 0) {
- shape = 0 /* FORCE_NONE */;
- }
- var macroId = 0;
- if (msg.startsWith(_constants.MACRO_05_HEADER) && msg.endsWith(_constants.MACRO_TRAILER)) {
- macroId = 5;
- msg = msg.substring(_constants.MACRO_05_HEADER.length, msg.length - 2);
- } else if (msg.startsWith(_constants.MACRO_06_HEADER) && msg.endsWith(_constants.MACRO_TRAILER)) {
- macroId = 6;
- msg = msg.substring(_constants.MACRO_06_HEADER.length, msg.length - 2);
- }
- return decodeURIComponent(escape(String.fromCharCode.apply(String, __spread(this.encode(msg, priorityCharset, fnc1, shape, macroId)))));
- };
- /**
- * Encodes input minimally and returns an array of the codewords
- *
- * @param input The string to encode
- * @param priorityCharset The preferred {@link Charset}. When the value of the argument is null, the algorithm
- * chooses charsets that leads to a minimal representation. Otherwise the algorithm will use the priority
- * charset to encode any character in the input that can be encoded by it if the charset is among the
- * supported charsets.
- * @param fnc1 denotes the character in the input that represents the FNC1 character or -1 if this is not a GS1
- * bar code. If the value is not -1 then a FNC1 is also prepended.
- * @param shape requested shape.
- * @param macroId Prepends the specified macro function in case that a value of 5 or 6 is specified.
- * @return An array of bytes representing the codewords of a minimal encoding.
- */
- MinimalEncoder.encode = function (input, priorityCharset, fnc1, shape, macroId) {
- return this.encodeMinimally(new Input(input, priorityCharset, fnc1, shape, macroId)).getBytes();
- };
- MinimalEncoder.addEdge = function (edges, edge) {
- var vertexIndex = edge.fromPosition + edge.characterLength;
- if (edges[vertexIndex][edge.getEndMode()] === null || edges[vertexIndex][edge.getEndMode()].cachedTotalSize > edge.cachedTotalSize) {
- edges[vertexIndex][edge.getEndMode()] = edge;
- }
- };
- /** @return the number of words in which the string starting at from can be encoded in c40 or text mode.
- * The number of characters encoded is returned in characterLength.
- * The number of characters encoded is also minimal in the sense that the algorithm stops as soon
- * as a character encoding fills a C40 word competely (three C40 values). An exception is at the
- * end of the string where two C40 values are allowed (according to the spec the third c40 value
- * is filled with 0 (Shift 1) in this case).
- */
- MinimalEncoder.getNumberOfC40Words = function (input, from, c40, characterLength) {
- var thirdsCount = 0;
- for (var i = from; i < input.length(); i++) {
- if (input.isECI(i)) {
- characterLength[0] = 0;
- return 0;
- }
- var ci = input.charAt(i);
- if (c40 && _HighLevelEncoder.default.isNativeC40(ci) || !c40 && _HighLevelEncoder.default.isNativeText(ci)) {
- thirdsCount++; // native
- } else if (!MinimalEncoder.isExtendedASCII(ci, input.getFNC1Character())) {
- thirdsCount += 2; // shift
- } else {
- var asciiValue = ci & 0xff;
- if (asciiValue >= 128 && (c40 && _HighLevelEncoder.default.isNativeC40(asciiValue - 128) || !c40 && _HighLevelEncoder.default.isNativeText(asciiValue - 128))) {
- thirdsCount += 3; // shift, Upper shift
- } else {
- thirdsCount += 4; // shift, Upper shift, shift
- }
- }
- if (thirdsCount % 3 === 0 || (thirdsCount - 2) % 3 === 0 && i + 1 === input.length()) {
- characterLength[0] = i - from + 1;
- return Math.ceil(thirdsCount / 3.0);
- }
- }
- characterLength[0] = 0;
- return 0;
- };
- MinimalEncoder.addEdges = function (input, edges, from, previous) {
- var e_2, _a;
- if (input.isECI(from)) {
- this.addEdge(edges, new Edge(input, Mode.ASCII, from, 1, previous));
- return;
- }
- var ch = input.charAt(from);
- if (previous === null || previous.getEndMode() !== Mode.EDF) {
- // not possible to unlatch a full EDF edge to something
- // else
- if (_HighLevelEncoder.default.isDigit(ch) && input.haveNCharacters(from, 2) && _HighLevelEncoder.default.isDigit(input.charAt(from + 1))) {
- // two digits ASCII encoded
- this.addEdge(edges, new Edge(input, Mode.ASCII, from, 2, previous));
- } else {
- // one ASCII encoded character or an extended character via Upper Shift
- this.addEdge(edges, new Edge(input, Mode.ASCII, from, 1, previous));
- }
- var modes = [Mode.C40, Mode.TEXT];
- try {
- for (var modes_1 = __values(modes), modes_1_1 = modes_1.next(); !modes_1_1.done; modes_1_1 = modes_1.next()) {
- var mode = modes_1_1.value;
- var characterLength = [];
- if (MinimalEncoder.getNumberOfC40Words(input, from, mode === Mode.C40, characterLength) > 0) {
- this.addEdge(edges, new Edge(input, mode, from, characterLength[0], previous));
- }
- }
- } catch (e_2_1) {
- e_2 = {
- error: e_2_1
- };
- } finally {
- try {
- if (modes_1_1 && !modes_1_1.done && (_a = modes_1.return)) _a.call(modes_1);
- } finally {
- if (e_2) throw e_2.error;
- }
- }
- if (input.haveNCharacters(from, 3) && _HighLevelEncoder.default.isNativeX12(input.charAt(from)) && _HighLevelEncoder.default.isNativeX12(input.charAt(from + 1)) && _HighLevelEncoder.default.isNativeX12(input.charAt(from + 2))) {
- this.addEdge(edges, new Edge(input, Mode.X12, from, 3, previous));
- }
- this.addEdge(edges, new Edge(input, Mode.B256, from, 1, previous));
- }
- // We create 4 EDF edges, with 1, 2 3 or 4 characters length. The fourth normally doesn't have a latch to ASCII
- // unless it is 2 characters away from the end of the input.
- var i;
- for (i = 0; i < 3; i++) {
- var pos = from + i;
- if (input.haveNCharacters(pos, 1) && _HighLevelEncoder.default.isNativeEDIFACT(input.charAt(pos))) {
- this.addEdge(edges, new Edge(input, Mode.EDF, from, i + 1, previous));
- } else {
- break;
- }
- }
- if (i === 3 && input.haveNCharacters(from, 4) && _HighLevelEncoder.default.isNativeEDIFACT(input.charAt(from + 3))) {
- this.addEdge(edges, new Edge(input, Mode.EDF, from, 4, previous));
- }
- };
- MinimalEncoder.encodeMinimally = function (input) {
- /* The minimal encoding is computed by Dijkstra. The acyclic graph is modeled as follows:
- * A vertex represents a combination of a position in the input and an encoding mode where position 0
- * denotes the position left of the first character, 1 the position left of the second character and so on.
- * Likewise the end vertices are located after the last character at position input.length().
- * For any position there might be up to six vertices, one for each of the encoding types ASCII, C40, TEXT, X12,
- * EDF and B256.
- *
- * As an example consider the input string "ABC123" then at position 0 there is only one vertex with the default
- * ASCII encodation. At position 3 there might be vertices for the types ASCII, C40, X12, EDF and B256.
- *
- * An edge leading to such a vertex encodes one or more of the characters left of the position that the vertex
- * represents. It encodes the characters in the encoding mode of the vertex that it ends on. In other words,
- * all edges leading to a particular vertex encode the same characters (the length of the suffix can vary) using the same
- * encoding mode.
- * As an example consider the input string "ABC123" and the vertex (4,EDF). Possible edges leading to this vertex
- * are:
- * (0,ASCII) --EDF(ABC1)--> (4,EDF)
- * (1,ASCII) --EDF(BC1)--> (4,EDF)
- * (1,B256) --EDF(BC1)--> (4,EDF)
- * (1,EDF) --EDF(BC1)--> (4,EDF)
- * (2,ASCII) --EDF(C1)--> (4,EDF)
- * (2,B256) --EDF(C1)--> (4,EDF)
- * (2,EDF) --EDF(C1)--> (4,EDF)
- * (3,ASCII) --EDF(1)--> (4,EDF)
- * (3,B256) --EDF(1)--> (4,EDF)
- * (3,EDF) --EDF(1)--> (4,EDF)
- * (3,C40) --EDF(1)--> (4,EDF)
- * (3,X12) --EDF(1)--> (4,EDF)
- *
- * The edges leading to a vertex are stored in such a way that there is a fast way to enumerate the edges ending
- * on a particular vertex.
- *
- * The algorithm processes the vertices in order of their position thereby performing the following:
- *
- * For every vertex at position i the algorithm enumerates the edges ending on the vertex and removes all but the
- * shortest from that list.
- * Then it processes the vertices for the position i+1. If i+1 == input.length() then the algorithm ends
- * and chooses the the edge with the smallest size from any of the edges leading to vertices at this position.
- * Otherwise the algorithm computes all possible outgoing edges for the vertices at the position i+1
- *
- * Examples:
- * The process is illustrated by showing the graph (edges) after each iteration from left to right over the input:
- * An edge is drawn as follows "(" + fromVertex + ") -- " + encodingMode + "(" + encodedInput + ") (" +
- * accumulatedSize + ") --> (" + toVertex + ")"
- *
- * Example 1 encoding the string "ABCDEFG":
- *
- *
- * Situation after adding edges to the start vertex (0,ASCII)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII)
- * (0,ASCII) B256(A) (3) --> (1,B256)
- * (0,ASCII) EDF(AB) (4) --> (2,EDF)
- * (0,ASCII) C40(ABC) (3) --> (3,C40)
- * (0,ASCII) TEXT(ABC) (5) --> (3,TEXT)
- * (0,ASCII) X12(ABC) (3) --> (3,X12)
- * (0,ASCII) EDF(ABC) (4) --> (3,EDF)
- * (0,ASCII) EDF(ABCD) (4) --> (4,EDF)
- *
- * Situation after adding edges to vertices at position 1
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII)
- * (0,ASCII) B256(A) (3) --> (1,B256)
- * (0,ASCII) EDF(AB) (4) --> (2,EDF)
- * (0,ASCII) C40(ABC) (3) --> (3,C40)
- * (0,ASCII) TEXT(ABC) (5) --> (3,TEXT)
- * (0,ASCII) X12(ABC) (3) --> (3,X12)
- * (0,ASCII) EDF(ABC) (4) --> (3,EDF)
- * (0,ASCII) EDF(ABCD) (4) --> (4,EDF)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) B256(B) (4) --> (2,B256)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) EDF(BC) (5) --> (3,EDF)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) C40(BCD) (4) --> (4,C40)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) TEXT(BCD) (6) --> (4,TEXT)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) X12(BCD) (4) --> (4,X12)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) EDF(BCD) (5) --> (4,EDF)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) EDF(BCDE) (5) --> (5,EDF)
- * (0,ASCII) B256(A) (3) --> (1,B256) ASCII(B) (4) --> (2,ASCII)
- * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256)
- * (0,ASCII) B256(A) (3) --> (1,B256) EDF(BC) (6) --> (3,EDF)
- * (0,ASCII) B256(A) (3) --> (1,B256) C40(BCD) (5) --> (4,C40)
- * (0,ASCII) B256(A) (3) --> (1,B256) TEXT(BCD) (7) --> (4,TEXT)
- * (0,ASCII) B256(A) (3) --> (1,B256) X12(BCD) (5) --> (4,X12)
- * (0,ASCII) B256(A) (3) --> (1,B256) EDF(BCD) (6) --> (4,EDF)
- * (0,ASCII) B256(A) (3) --> (1,B256) EDF(BCDE) (6) --> (5,EDF)
- *
- * Edge "(1,ASCII) ASCII(B) (2) --> (2,ASCII)" is minimal for the vertex (2,ASCII) so that edge "(1,B256) ASCII(B) (4) --> (2,ASCII)" is removed.
- * Edge "(1,B256) B256(B) (3) --> (2,B256)" is minimal for the vertext (2,B256) so that the edge "(1,ASCII) B256(B) (4) --> (2,B256)" is removed.
- *
- * Situation after adding edges to vertices at position 2
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII)
- * (0,ASCII) B256(A) (3) --> (1,B256)
- * (0,ASCII) EDF(AB) (4) --> (2,EDF)
- * (0,ASCII) C40(ABC) (3) --> (3,C40)
- * (0,ASCII) TEXT(ABC) (5) --> (3,TEXT)
- * (0,ASCII) X12(ABC) (3) --> (3,X12)
- * (0,ASCII) EDF(ABC) (4) --> (3,EDF)
- * (0,ASCII) EDF(ABCD) (4) --> (4,EDF)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) EDF(BC) (5) --> (3,EDF)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) C40(BCD) (4) --> (4,C40)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) TEXT(BCD) (6) --> (4,TEXT)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) X12(BCD) (4) --> (4,X12)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) EDF(BCD) (5) --> (4,EDF)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) EDF(BCDE) (5) --> (5,EDF)
- * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256)
- * (0,ASCII) B256(A) (3) --> (1,B256) EDF(BC) (6) --> (3,EDF)
- * (0,ASCII) B256(A) (3) --> (1,B256) C40(BCD) (5) --> (4,C40)
- * (0,ASCII) B256(A) (3) --> (1,B256) TEXT(BCD) (7) --> (4,TEXT)
- * (0,ASCII) B256(A) (3) --> (1,B256) X12(BCD) (5) --> (4,X12)
- * (0,ASCII) B256(A) (3) --> (1,B256) EDF(BCD) (6) --> (4,EDF)
- * (0,ASCII) B256(A) (3) --> (1,B256) EDF(BCDE) (6) --> (5,EDF)
- * (0,ASCII) EDF(AB) (4) --> (2,EDF) ASCII(C) (5) --> (3,ASCII)
- * (0,ASCII) EDF(AB) (4) --> (2,EDF) B256(C) (6) --> (3,B256)
- * (0,ASCII) EDF(AB) (4) --> (2,EDF) EDF(CD) (7) --> (4,EDF)
- * (0,ASCII) EDF(AB) (4) --> (2,EDF) C40(CDE) (6) --> (5,C40)
- * (0,ASCII) EDF(AB) (4) --> (2,EDF) TEXT(CDE) (8) --> (5,TEXT)
- * (0,ASCII) EDF(AB) (4) --> (2,EDF) X12(CDE) (6) --> (5,X12)
- * (0,ASCII) EDF(AB) (4) --> (2,EDF) EDF(CDE) (7) --> (5,EDF)
- * (0,ASCII) EDF(AB) (4) --> (2,EDF) EDF(CDEF) (7) --> (6,EDF)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) ASCII(C) (3) --> (3,ASCII)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) B256(C) (5) --> (3,B256)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) EDF(CD) (6) --> (4,EDF)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) C40(CDE) (5) --> (5,C40)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) TEXT(CDE) (7) --> (5,TEXT)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) X12(CDE) (5) --> (5,X12)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) EDF(CDE) (6) --> (5,EDF)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) EDF(CDEF) (6) --> (6,EDF)
- * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256) ASCII(C) (4) --> (3,ASCII)
- * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256) B256(C) (4) --> (3,B256)
- * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256) EDF(CD) (6) --> (4,EDF)
- * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256) C40(CDE) (5) --> (5,C40)
- * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256) TEXT(CDE) (7) --> (5,TEXT)
- * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256) X12(CDE) (5) --> (5,X12)
- * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256) EDF(CDE) (6) --> (5,EDF)
- * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256) EDF(CDEF) (6) --> (6,EDF)
- *
- * Edge "(2,ASCII) ASCII(C) (3) --> (3,ASCII)" is minimal for the vertex (3,ASCII) so that edges "(2,EDF) ASCII(C) (5) --> (3,ASCII)"
- * and "(2,B256) ASCII(C) (4) --> (3,ASCII)" can be removed.
- * Edge "(0,ASCII) EDF(ABC) (4) --> (3,EDF)" is minimal for the vertex (3,EDF) so that edges "(1,ASCII) EDF(BC) (5) --> (3,EDF)"
- * and "(1,B256) EDF(BC) (6) --> (3,EDF)" can be removed.
- * Edge "(2,B256) B256(C) (4) --> (3,B256)" is minimal for the vertex (3,B256) so that edges "(2,ASCII) B256(C) (5) --> (3,B256)"
- * and "(2,EDF) B256(C) (6) --> (3,B256)" can be removed.
- *
- * This continues for vertices 3 thru 7
- *
- * Situation after adding edges to vertices at position 7
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII)
- * (0,ASCII) B256(A) (3) --> (1,B256)
- * (0,ASCII) EDF(AB) (4) --> (2,EDF)
- * (0,ASCII) C40(ABC) (3) --> (3,C40)
- * (0,ASCII) TEXT(ABC) (5) --> (3,TEXT)
- * (0,ASCII) X12(ABC) (3) --> (3,X12)
- * (0,ASCII) EDF(ABC) (4) --> (3,EDF)
- * (0,ASCII) EDF(ABCD) (4) --> (4,EDF)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) C40(BCD) (4) --> (4,C40)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) TEXT(BCD) (6) --> (4,TEXT)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) X12(BCD) (4) --> (4,X12)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) EDF(BCDE) (5) --> (5,EDF)
- * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256)
- * (0,ASCII) C40(ABC) (3) --> (3,C40) C40(DEF) (5) --> (6,C40)
- * (0,ASCII) X12(ABC) (3) --> (3,X12) X12(DEF) (5) --> (6,X12)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) ASCII(C) (3) --> (3,ASCII)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) C40(CDE) (5) --> (5,C40)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) TEXT(CDE) (7) --> (5,TEXT)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) X12(CDE) (5) --> (5,X12)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) EDF(CDEF) (6) --> (6,EDF)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) C40(BCD) (4) --> (4,C40) C40(EFG) (6) --> (7,C40) //Solution 1
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) X12(BCD) (4) --> (4,X12) X12(EFG) (6) --> (7,X12) //Solution 2
- * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256) B256(C) (4) --> (3,B256)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) ASCII(C) (3) --> (3,ASCII) ASCII(D) (4) --> (4,ASCII)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) ASCII(C) (3) --> (3,ASCII) TEXT(DEF) (8) --> (6,TEXT)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) ASCII(C) (3) --> (3,ASCII) EDF(DEFG) (7) --> (7,EDF)
- * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256) B256(C) (4) --> (3,B256) B256(D) (5) --> (4,B256)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) ASCII(C) (3) --> (3,ASCII) ASCII(D) (4) --> (4,ASCII) ASCII(E) (5) --> (5,ASCII)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) ASCII(C) (3) --> (3,ASCII) ASCII(D) (4) --> (4,ASCII) TEXT(EFG) (9) --> (7,TEXT)
- * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256) B256(C) (4) --> (3,B256) B256(D) (5) --> (4,B256) B256(E) (6) --> (5,B256)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) ASCII(C) (3) --> (3,ASCII) ASCII(D) (4) --> (4,ASCII) ASCII(E) (5) --> (5,ASCII) ASCII(F) (6) --> (6,ASCII)
- * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256) B256(C) (4) --> (3,B256) B256(D) (5) --> (4,B256) B256(E) (6) --> (5,B256) B256(F) (7) --> (6,B256)
- * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) ASCII(C) (3) --> (3,ASCII) ASCII(D) (4) --> (4,ASCII) ASCII(E) (5) --> (5,ASCII) ASCII(F) (6) --> (6,ASCII) ASCII(G) (7) --> (7,ASCII)
- * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256) B256(C) (4) --> (3,B256) B256(D) (5) --> (4,B256) B256(E) (6) --> (5,B256) B256(F) (7) --> (6,B256) B256(G) (8) --> (7,B256)
- *
- * Hence a minimal encoding of "ABCDEFG" is either ASCII(A),C40(BCDEFG) or ASCII(A), X12(BCDEFG) with a size of 5 bytes.
- */
- var inputLength = input.length();
- // Array that represents vertices. There is a vertex for every character and mode.
- // The last dimension in the array below encodes the 6 modes ASCII, C40, TEXT, X12, EDF and B256
- var edges = Array(inputLength + 1).fill(null).map(function () {
- return Array(6).fill(0);
- });
- this.addEdges(input, edges, 0, null);
- for (var i = 1; i <= inputLength; i++) {
- for (var j = 0; j < 6; j++) {
- if (edges[i][j] !== null && i < inputLength) {
- this.addEdges(input, edges, i, edges[i][j]);
- }
- }
- // optimize memory by removing edges that have been passed.
- for (var j = 0; j < 6; j++) {
- edges[i - 1][j] = null;
- }
- }
- var minimalJ = -1;
- var minimalSize = _Integer.default.MAX_VALUE;
- for (var j = 0; j < 6; j++) {
- if (edges[inputLength][j] !== null) {
- var edge = edges[inputLength][j];
- var size = j >= 1 && j <= 3 ? edge.cachedTotalSize + 1 : edge.cachedTotalSize; // C40, TEXT and X12 need an
- // extra unlatch at the end
- if (size < minimalSize) {
- minimalSize = size;
- minimalJ = j;
- }
- }
- }
- if (minimalJ < 0) {
- throw new Error('Failed to encode "' + input + '"');
- }
- return new Result(edges[inputLength][minimalJ]);
- };
- return MinimalEncoder;
- }();
- exports.MinimalEncoder = MinimalEncoder;
- var Result = /** @class */function () {
- function Result(solution) {
- var input = solution.input;
- var size = 0;
- var bytesAL = [];
- var randomizePostfixLength = [];
- var randomizeLengths = [];
- if ((solution.mode === Mode.C40 || solution.mode === Mode.TEXT || solution.mode === Mode.X12) && solution.getEndMode() !== Mode.ASCII) {
- size += this.prepend(Edge.getBytes(254), bytesAL);
- }
- var current = solution;
- while (current !== null) {
- size += this.prepend(current.getDataBytes(), bytesAL);
- if (current.previous === null || current.getPreviousStartMode() !== current.getMode()) {
- if (current.getMode() === Mode.B256) {
- if (size <= 249) {
- bytesAL.unshift(size);
- size++;
- } else {
- bytesAL.unshift(size % 250);
- bytesAL.unshift(size / 250 + 249);
- size += 2;
- }
- randomizePostfixLength.push(bytesAL.length);
- randomizeLengths.push(size);
- }
- this.prepend(current.getLatchBytes(), bytesAL);
- size = 0;
- }
- current = current.previous;
- }
- if (input.getMacroId() === 5) {
- size += this.prepend(Edge.getBytes(236), bytesAL);
- } else if (input.getMacroId() === 6) {
- size += this.prepend(Edge.getBytes(237), bytesAL);
- }
- if (input.getFNC1Character() > 0) {
- size += this.prepend(Edge.getBytes(232), bytesAL);
- }
- for (var i = 0; i < randomizePostfixLength.length; i++) {
- this.applyRandomPattern(bytesAL, bytesAL.length - randomizePostfixLength[i], randomizeLengths[i]);
- }
- // add padding
- var capacity = solution.getMinSymbolSize(bytesAL.length);
- if (bytesAL.length < capacity) {
- bytesAL.push(129);
- }
- while (bytesAL.length < capacity) {
- bytesAL.push(this.randomize253State(bytesAL.length + 1));
- }
- this.bytes = new Uint8Array(bytesAL.length);
- for (var i = 0; i < this.bytes.length; i++) {
- this.bytes[i] = bytesAL[i];
- }
- }
- Result.prototype.prepend = function (bytes, into) {
- for (var i = bytes.length - 1; i >= 0; i--) {
- into.unshift(bytes[i]);
- }
- return bytes.length;
- };
- Result.prototype.randomize253State = function (codewordPosition) {
- var pseudoRandom = 149 * codewordPosition % 253 + 1;
- var tempVariable = 129 + pseudoRandom;
- return tempVariable <= 254 ? tempVariable : tempVariable - 254;
- };
- Result.prototype.applyRandomPattern = function (bytesAL, startPosition, length) {
- for (var i = 0; i < length; i++) {
- // See "B.1 253-state algorithm
- var Pad_codeword_position = startPosition + i;
- var Pad_codeword_value = bytesAL[Pad_codeword_position] & 0xff;
- var pseudo_random_number = 149 * (Pad_codeword_position + 1) % 255 + 1;
- var temp_variable = Pad_codeword_value + pseudo_random_number;
- bytesAL[Pad_codeword_position] = temp_variable <= 255 ? temp_variable : temp_variable - 256;
- }
- };
- Result.prototype.getBytes = function () {
- return this.bytes;
- };
- return Result;
- }();
- var Edge = /** @class */function () {
- function Edge(input, mode, fromPosition, characterLength, previous) {
- this.input = input;
- this.mode = mode;
- this.fromPosition = fromPosition;
- this.characterLength = characterLength;
- this.previous = previous;
- this.allCodewordCapacities = [3, 5, 8, 10, 12, 16, 18, 22, 30, 32, 36, 44, 49, 62, 86, 114, 144, 174, 204, 280, 368, 456, 576, 696, 816, 1050, 1304, 1558];
- this.squareCodewordCapacities = [3, 5, 8, 12, 18, 22, 30, 36, 44, 62, 86, 114, 144, 174, 204, 280, 368, 456, 576, 696, 816, 1050, 1304, 1558];
- this.rectangularCodewordCapacities = [5, 10, 16, 33, 32, 49];
- if (!(fromPosition + characterLength <= input.length())) {
- throw new Error('Invalid edge');
- }
- var size = previous !== null ? previous.cachedTotalSize : 0;
- var previousMode = this.getPreviousMode();
- /*
- * Switching modes
- * ASCII -> C40: latch 230
- * ASCII -> TEXT: latch 239
- * ASCII -> X12: latch 238
- * ASCII -> EDF: latch 240
- * ASCII -> B256: latch 231
- * C40 -> ASCII: word(c1,c2,c3), 254
- * TEXT -> ASCII: word(c1,c2,c3), 254
- * X12 -> ASCII: word(c1,c2,c3), 254
- * EDIFACT -> ASCII: Unlatch character,0,0,0 or c1,Unlatch character,0,0 or c1,c2,Unlatch character,0 or
- * c1,c2,c3,Unlatch character
- * B256 -> ASCII: without latch after n bytes
- */
- switch (mode) {
- case Mode.ASCII:
- size++;
- if (input.isECI(fromPosition) || MinimalEncoder.isExtendedASCII(input.charAt(fromPosition), input.getFNC1Character())) {
- size++;
- }
- if (previousMode === Mode.C40 || previousMode === Mode.TEXT || previousMode === Mode.X12) {
- size++; // unlatch 254 to ASCII
- }
- break;
- case Mode.B256:
- size++;
- if (previousMode !== Mode.B256) {
- size++; // byte count
- } else if (this.getB256Size() === 250) {
- size++; // extra byte count
- }
- if (previousMode === Mode.ASCII) {
- size++; // latch to B256
- } else if (previousMode === Mode.C40 || previousMode === Mode.TEXT || previousMode === Mode.X12) {
- size += 2; // unlatch to ASCII, latch to B256
- }
- break;
- case Mode.C40:
- case Mode.TEXT:
- case Mode.X12:
- if (mode === Mode.X12) {
- size += 2;
- } else {
- var charLen = [];
- size += MinimalEncoder.getNumberOfC40Words(input, fromPosition, mode === Mode.C40, charLen) * 2;
- }
- if (previousMode === Mode.ASCII || previousMode === Mode.B256) {
- size++; // additional byte for latch from ASCII to this mode
- } else if (previousMode !== mode && (previousMode === Mode.C40 || previousMode === Mode.TEXT || previousMode === Mode.X12)) {
- size += 2; // unlatch 254 to ASCII followed by latch to this mode
- }
- break;
- case Mode.EDF:
- size += 3;
- if (previousMode === Mode.ASCII || previousMode === Mode.B256) {
- size++; // additional byte for latch from ASCII to this mode
- } else if (previousMode === Mode.C40 || previousMode === Mode.TEXT || previousMode === Mode.X12) {
- size += 2; // unlatch 254 to ASCII followed by latch to this mode
- }
- break;
- }
- this.cachedTotalSize = size;
- }
- // does not count beyond 250
- Edge.prototype.getB256Size = function () {
- var cnt = 0;
- var current = this;
- while (current !== null && current.mode === Mode.B256 && cnt <= 250) {
- cnt++;
- current = current.previous;
- }
- return cnt;
- };
- Edge.prototype.getPreviousStartMode = function () {
- return this.previous === null ? Mode.ASCII : this.previous.mode;
- };
- Edge.prototype.getPreviousMode = function () {
- return this.previous === null ? Mode.ASCII : this.previous.getEndMode();
- };
- /** Returns Mode.ASCII in case that:
- * - Mode is EDIFACT and characterLength is less than 4 or the remaining characters can be encoded in at most 2
- * ASCII bytes.
- * - Mode is C40, TEXT or X12 and the remaining characters can be encoded in at most 1 ASCII byte.
- * Returns mode in all other cases.
- * */
- Edge.prototype.getEndMode = function () {
- if (this.mode === Mode.EDF) {
- if (this.characterLength < 4) {
- return Mode.ASCII;
- }
- var lastASCII = this.getLastASCII(); // see 5.2.8.2 EDIFACT encodation Rules
- if (lastASCII > 0 && this.getCodewordsRemaining(this.cachedTotalSize + lastASCII) <= 2 - lastASCII) {
- return Mode.ASCII;
- }
- }
- if (this.mode === Mode.C40 || this.mode === Mode.TEXT || this.mode === Mode.X12) {
- // see 5.2.5.2 C40 encodation rules and 5.2.7.2 ANSI X12 encodation rules
- if (this.fromPosition + this.characterLength >= this.input.length() && this.getCodewordsRemaining(this.cachedTotalSize) === 0) {
- return Mode.ASCII;
- }
- var lastASCII = this.getLastASCII();
- if (lastASCII === 1 && this.getCodewordsRemaining(this.cachedTotalSize + 1) === 0) {
- return Mode.ASCII;
- }
- }
- return this.mode;
- };
- Edge.prototype.getMode = function () {
- return this.mode;
- };
- /** Peeks ahead and returns 1 if the postfix consists of exactly two digits, 2 if the postfix consists of exactly
- * two consecutive digits and a non extended character or of 4 digits.
- * Returns 0 in any other case
- **/
- Edge.prototype.getLastASCII = function () {
- var length = this.input.length();
- var from = this.fromPosition + this.characterLength;
- if (length - from > 4 || from >= length) {
- return 0;
- }
- if (length - from === 1) {
- if (MinimalEncoder.isExtendedASCII(this.input.charAt(from), this.input.getFNC1Character())) {
- return 0;
- }
- return 1;
- }
- if (length - from === 2) {
- if (MinimalEncoder.isExtendedASCII(this.input.charAt(from), this.input.getFNC1Character()) || MinimalEncoder.isExtendedASCII(this.input.charAt(from + 1), this.input.getFNC1Character())) {
- return 0;
- }
- if (_HighLevelEncoder.default.isDigit(this.input.charAt(from)) && _HighLevelEncoder.default.isDigit(this.input.charAt(from + 1))) {
- return 1;
- }
- return 2;
- }
- if (length - from === 3) {
- if (_HighLevelEncoder.default.isDigit(this.input.charAt(from)) && _HighLevelEncoder.default.isDigit(this.input.charAt(from + 1)) && !MinimalEncoder.isExtendedASCII(this.input.charAt(from + 2), this.input.getFNC1Character())) {
- return 2;
- }
- if (_HighLevelEncoder.default.isDigit(this.input.charAt(from + 1)) && _HighLevelEncoder.default.isDigit(this.input.charAt(from + 2)) && !MinimalEncoder.isExtendedASCII(this.input.charAt(from), this.input.getFNC1Character())) {
- return 2;
- }
- return 0;
- }
- if (_HighLevelEncoder.default.isDigit(this.input.charAt(from)) && _HighLevelEncoder.default.isDigit(this.input.charAt(from + 1)) && _HighLevelEncoder.default.isDigit(this.input.charAt(from + 2)) && _HighLevelEncoder.default.isDigit(this.input.charAt(from + 3))) {
- return 2;
- }
- return 0;
- };
- /** Returns the capacity in codewords of the smallest symbol that has enough capacity to fit the given minimal
- * number of codewords.
- **/
- Edge.prototype.getMinSymbolSize = function (minimum) {
- var e_3, _a, e_4, _b, e_5, _c;
- switch (this.input.getShapeHint()) {
- case 1 /* FORCE_SQUARE */:
- try {
- for (var _d = __values(this.squareCodewordCapacities), _e = _d.next(); !_e.done; _e = _d.next()) {
- var capacity = _e.value;
- if (capacity >= minimum) {
- return capacity;
- }
- }
- } catch (e_3_1) {
- e_3 = {
- error: e_3_1
- };
- } finally {
- try {
- if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
- } finally {
- if (e_3) throw e_3.error;
- }
- }
- break;
- case 2 /* FORCE_RECTANGLE */:
- try {
- for (var _f = __values(this.rectangularCodewordCapacities), _g = _f.next(); !_g.done; _g = _f.next()) {
- var capacity = _g.value;
- if (capacity >= minimum) {
- return capacity;
- }
- }
- } catch (e_4_1) {
- e_4 = {
- error: e_4_1
- };
- } finally {
- try {
- if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
- } finally {
- if (e_4) throw e_4.error;
- }
- }
- break;
- }
- try {
- for (var _h = __values(this.allCodewordCapacities), _j = _h.next(); !_j.done; _j = _h.next()) {
- var capacity = _j.value;
- if (capacity >= minimum) {
- return capacity;
- }
- }
- } catch (e_5_1) {
- e_5 = {
- error: e_5_1
- };
- } finally {
- try {
- if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
- } finally {
- if (e_5) throw e_5.error;
- }
- }
- return this.allCodewordCapacities[this.allCodewordCapacities.length - 1];
- };
- /** Returns the remaining capacity in codewords of the smallest symbol that has enough capacity to fit the given
- * minimal number of codewords.
- **/
- Edge.prototype.getCodewordsRemaining = function (minimum) {
- return this.getMinSymbolSize(minimum) - minimum;
- };
- Edge.getBytes = function (c1, c2) {
- var result = new Uint8Array(c2 ? 2 : 1);
- result[0] = c1;
- if (c2) {
- result[1] = c2;
- }
- return result;
- };
- Edge.prototype.setC40Word = function (bytes, offset, c1, c2, c3) {
- var val16 = 1600 * (c1 & 0xff) + 40 * (c2 & 0xff) + (c3 & 0xff) + 1;
- bytes[offset] = val16 / 256;
- bytes[offset + 1] = val16 % 256;
- };
- Edge.prototype.getX12Value = function (c) {
- return c === 13 ? 0 : c === 42 ? 1 : c === 62 ? 2 : c === 32 ? 3 : c >= 48 && c <= 57 ? c - 44 : c >= 65 && c <= 90 ? c - 51 : c;
- };
- Edge.prototype.getX12Words = function () {
- if (!(this.characterLength % 3 === 0)) {
- throw new Error('X12 words must be a multiple of 3');
- }
- var result = new Uint8Array(this.characterLength / 3 * 2);
- for (var i = 0; i < result.length; i += 2) {
- this.setC40Word(result, i, this.getX12Value(this.input.charAt(this.fromPosition + i / 2 * 3)), this.getX12Value(this.input.charAt(this.fromPosition + i / 2 * 3 + 1)), this.getX12Value(this.input.charAt(this.fromPosition + i / 2 * 3 + 2)));
- }
- return result;
- };
- Edge.prototype.getShiftValue = function (c, c40, fnc1) {
- return c40 && MinimalEncoder.isInC40Shift1Set(c) || !c40 && MinimalEncoder.isInTextShift1Set(c) ? 0 : c40 && MinimalEncoder.isInC40Shift2Set(c, fnc1) || !c40 && MinimalEncoder.isInTextShift2Set(c, fnc1) ? 1 : 2;
- };
- Edge.prototype.getC40Value = function (c40, setIndex, c, fnc1) {
- if (c === fnc1) {
- if (!(setIndex === 2)) {
- throw new Error('FNC1 cannot be used in C40 shift 2');
- }
- return 27;
- }
- if (c40) {
- return c <= 31 ? c : c === 32 ? 3 : c <= 47 ? c - 33 : c <= 57 ? c - 44 : c <= 64 ? c - 43 : c <= 90 ? c - 51 : c <= 95 ? c - 69 : c <= 127 ? c - 96 : c;
- } else {
- return c === 0 ? 0 : setIndex === 0 && c <= 3 ? c - 1 // is this a bug in the spec?
- : setIndex === 1 && c <= 31 ? c : c === 32 ? 3 : c >= 33 && c <= 47 ? c - 33 : c >= 48 && c <= 57 ? c - 44 : c >= 58 && c <= 64 ? c - 43 : c >= 65 && c <= 90 ? c - 64 : c >= 91 && c <= 95 ? c - 69 : c === 96 ? 0 : c >= 97 && c <= 122 ? c - 83 : c >= 123 && c <= 127 ? c - 96 : c;
- }
- };
- Edge.prototype.getC40Words = function (c40, fnc1) {
- var c40Values = [];
- for (var i = 0; i < this.characterLength; i++) {
- var ci = this.input.charAt(this.fromPosition + i);
- if (c40 && _HighLevelEncoder.default.isNativeC40(ci) || !c40 && _HighLevelEncoder.default.isNativeText(ci)) {
- c40Values.push(this.getC40Value(c40, 0, ci, fnc1));
- } else if (!MinimalEncoder.isExtendedASCII(ci, fnc1)) {
- var shiftValue = this.getShiftValue(ci, c40, fnc1);
- c40Values.push(shiftValue); // Shift[123]
- c40Values.push(this.getC40Value(c40, shiftValue, ci, fnc1));
- } else {
- var asciiValue = (ci & 0xff) - 128;
- if (c40 && _HighLevelEncoder.default.isNativeC40(asciiValue) || !c40 && _HighLevelEncoder.default.isNativeText(asciiValue)) {
- c40Values.push(1); // Shift 2
- c40Values.push(30); // Upper Shift
- c40Values.push(this.getC40Value(c40, 0, asciiValue, fnc1));
- } else {
- c40Values.push(1); // Shift 2
- c40Values.push(30); // Upper Shift
- var shiftValue = this.getShiftValue(asciiValue, c40, fnc1);
- c40Values.push(shiftValue); // Shift[123]
- c40Values.push(this.getC40Value(c40, shiftValue, asciiValue, fnc1));
- }
- }
- }
- if (c40Values.length % 3 !== 0) {
- if (!((c40Values.length - 2) % 3 === 0 && this.fromPosition + this.characterLength === this.input.length())) {
- throw new Error('C40 words must be a multiple of 3');
- }
- c40Values.push(0); // pad with 0 (Shift 1)
- }
- var result = new Uint8Array(c40Values.length / 3 * 2);
- var byteIndex = 0;
- for (var i = 0; i < c40Values.length; i += 3) {
- this.setC40Word(result, byteIndex, c40Values[i] & 0xff, c40Values[i + 1] & 0xff, c40Values[i + 2] & 0xff);
- byteIndex += 2;
- }
- return result;
- };
- Edge.prototype.getEDFBytes = function () {
- var numberOfThirds = Math.ceil(this.characterLength / 4.0);
- var result = new Uint8Array(numberOfThirds * 3);
- var pos = this.fromPosition;
- var endPos = Math.min(this.fromPosition + this.characterLength - 1, this.input.length() - 1);
- for (var i = 0; i < numberOfThirds; i += 3) {
- var edfValues = [];
- for (var j = 0; j < 4; j++) {
- if (pos <= endPos) {
- edfValues[j] = this.input.charAt(pos++) & 0x3f;
- } else {
- edfValues[j] = pos === endPos + 1 ? 0x1f : 0;
- }
- }
- var val24 = edfValues[0] << 18;
- val24 |= edfValues[1] << 12;
- val24 |= edfValues[2] << 6;
- val24 |= edfValues[3];
- result[i] = val24 >> 16 & 0xff;
- result[i + 1] = val24 >> 8 & 0xff;
- result[i + 2] = val24 & 0xff;
- }
- return result;
- };
- Edge.prototype.getLatchBytes = function () {
- switch (this.getPreviousMode()) {
- case Mode.ASCII:
- case Mode.B256:
- // after B256 ends (via length) we are back to ASCII
- switch (this.mode) {
- case Mode.B256:
- return Edge.getBytes(231);
- case Mode.C40:
- return Edge.getBytes(230);
- case Mode.TEXT:
- return Edge.getBytes(239);
- case Mode.X12:
- return Edge.getBytes(238);
- case Mode.EDF:
- return Edge.getBytes(240);
- }
- break;
- case Mode.C40:
- case Mode.TEXT:
- case Mode.X12:
- if (this.mode !== this.getPreviousMode()) {
- switch (this.mode) {
- case Mode.ASCII:
- return Edge.getBytes(254);
- case Mode.B256:
- return Edge.getBytes(254, 231);
- case Mode.C40:
- return Edge.getBytes(254, 230);
- case Mode.TEXT:
- return Edge.getBytes(254, 239);
- case Mode.X12:
- return Edge.getBytes(254, 238);
- case Mode.EDF:
- return Edge.getBytes(254, 240);
- }
- }
- break;
- case Mode.EDF:
- // The rightmost EDIFACT edge always contains an unlatch character
- if (this.mode !== Mode.EDF) {
- throw new Error('Cannot switch from EDF to ' + this.mode);
- }
- break;
- }
- return new Uint8Array(0);
- };
- // Important: The function does not return the length bytes (one or two) in case of B256 encoding
- Edge.prototype.getDataBytes = function () {
- switch (this.mode) {
- case Mode.ASCII:
- if (this.input.isECI(this.fromPosition)) {
- return Edge.getBytes(241, this.input.getECIValue(this.fromPosition) + 1);
- } else if (MinimalEncoder.isExtendedASCII(this.input.charAt(this.fromPosition), this.input.getFNC1Character())) {
- return Edge.getBytes(235, this.input.charAt(this.fromPosition) - 127);
- } else if (this.characterLength === 2) {
- return Edge.getBytes(this.input.charAt(this.fromPosition) * 10 + this.input.charAt(this.fromPosition + 1) + 130);
- } else if (this.input.isFNC1(this.fromPosition)) {
- return Edge.getBytes(232);
- } else {
- return Edge.getBytes(this.input.charAt(this.fromPosition) + 1);
- }
- case Mode.B256:
- return Edge.getBytes(this.input.charAt(this.fromPosition));
- case Mode.C40:
- return this.getC40Words(true, this.input.getFNC1Character());
- case Mode.TEXT:
- return this.getC40Words(false, this.input.getFNC1Character());
- case Mode.X12:
- return this.getX12Words();
- case Mode.EDF:
- return this.getEDFBytes();
- }
- };
- return Edge;
- }();
- var Input = /** @class */function (_super) {
- __extends(Input, _super);
- function Input(stringToEncode, priorityCharset, fnc1, shape, macroId) {
- var _this = _super.call(this, stringToEncode, priorityCharset, fnc1) || this;
- _this.shape = shape;
- _this.macroId = macroId;
- return _this;
- }
- Input.prototype.getMacroId = function () {
- return this.macroId;
- };
- Input.prototype.getShapeHint = function () {
- return this.shape;
- };
- return Input;
- }(_MinimalECIInput.MinimalECIInput);
- /***/ }),
- /* 494 */
- /*!******************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/MinimalECIInput.js ***!
- \******************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.MinimalECIInput = void 0;
- var _ECIEncoderSet = __webpack_require__(/*! ./ECIEncoderSet */ 495);
- var _Integer = _interopRequireDefault(__webpack_require__(/*! ../util/Integer */ 318));
- var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../util/StringBuilder */ 320));
- var COST_PER_ECI = 3; // approximated (latch + 2 codewords)
- var MinimalECIInput = /** @class */function () {
- /**
- * Constructs a minimal input
- *
- * @param stringToEncode the character string to encode
- * @param priorityCharset The preferred {@link Charset}. When the value of the argument is null, the algorithm
- * chooses charsets that leads to a minimal representation. Otherwise the algorithm will use the priority
- * charset to encode any character in the input that can be encoded by it if the charset is among the
- * supported charsets.
- * @param fnc1 denotes the character in the input that represents the FNC1 character or -1 if this is not GS1
- * input.
- */
- function MinimalECIInput(stringToEncode, priorityCharset, fnc1) {
- this.fnc1 = fnc1;
- var encoderSet = new _ECIEncoderSet.ECIEncoderSet(stringToEncode, priorityCharset, fnc1);
- if (encoderSet.length() === 1) {
- // optimization for the case when all can be encoded without ECI in ISO-8859-1
- for (var i = 0; i < this.bytes.length; i++) {
- var c = stringToEncode.charAt(i).charCodeAt(0);
- this.bytes[i] = c === fnc1 ? 1000 : c;
- }
- } else {
- this.bytes = this.encodeMinimally(stringToEncode, encoderSet, fnc1);
- }
- }
- MinimalECIInput.prototype.getFNC1Character = function () {
- return this.fnc1;
- };
- /**
- * Returns the length of this input. The length is the number
- * of {@code byte}s, FNC1 characters or ECIs in the sequence.
- *
- * @return the number of {@code char}s in this sequence
- */
- MinimalECIInput.prototype.length = function () {
- return this.bytes.length;
- };
- MinimalECIInput.prototype.haveNCharacters = function (index, n) {
- if (index + n - 1 >= this.bytes.length) {
- return false;
- }
- for (var i = 0; i < n; i++) {
- if (this.isECI(index + i)) {
- return false;
- }
- }
- return true;
- };
- /**
- * Returns the {@code byte} value at the specified index. An index ranges from zero
- * to {@code length() - 1}. The first {@code byte} value of the sequence is at
- * index zero, the next at index one, and so on, as for array
- * indexing.
- *
- * @param index the index of the {@code byte} value to be returned
- *
- * @return the specified {@code byte} value as character or the FNC1 character
- *
- * @throws IndexOutOfBoundsException
- * if the {@code index} argument is negative or not less than
- * {@code length()}
- * @throws IllegalArgumentException
- * if the value at the {@code index} argument is an ECI (@see #isECI)
- */
- MinimalECIInput.prototype.charAt = function (index) {
- if (index < 0 || index >= this.length()) {
- throw new Error('' + index);
- }
- if (this.isECI(index)) {
- throw new Error('value at ' + index + ' is not a character but an ECI');
- }
- return this.isFNC1(index) ? this.fnc1 : this.bytes[index];
- };
- /**
- * Returns a {@code CharSequence} that is a subsequence of this sequence.
- * The subsequence starts with the {@code char} value at the specified index and
- * ends with the {@code char} value at index {@code end - 1}. The length
- * (in {@code char}s) of the
- * returned sequence is {@code end - start}, so if {@code start == end}
- * then an empty sequence is returned.
- *
- * @param start the start index, inclusive
- * @param end the end index, exclusive
- *
- * @return the specified subsequence
- *
- * @throws IndexOutOfBoundsException
- * if {@code start} or {@code end} are negative,
- * if {@code end} is greater than {@code length()},
- * or if {@code start} is greater than {@code end}
- * @throws IllegalArgumentException
- * if a value in the range {@code start}-{@code end} is an ECI (@see #isECI)
- */
- MinimalECIInput.prototype.subSequence = function (start, end) {
- if (start < 0 || start > end || end > this.length()) {
- throw new Error('' + start);
- }
- var result = new _StringBuilder.default();
- for (var i = start; i < end; i++) {
- if (this.isECI(i)) {
- throw new Error('value at ' + i + ' is not a character but an ECI');
- }
- result.append(this.charAt(i));
- }
- return result.toString();
- };
- /**
- * Determines if a value is an ECI
- *
- * @param index the index of the value
- *
- * @return true if the value at position {@code index} is an ECI
- *
- * @throws IndexOutOfBoundsException
- * if the {@code index} argument is negative or not less than
- * {@code length()}
- */
- MinimalECIInput.prototype.isECI = function (index) {
- if (index < 0 || index >= this.length()) {
- throw new Error('' + index);
- }
- return this.bytes[index] > 255 && this.bytes[index] <= 999;
- };
- /**
- * Determines if a value is the FNC1 character
- *
- * @param index the index of the value
- *
- * @return true if the value at position {@code index} is the FNC1 character
- *
- * @throws IndexOutOfBoundsException
- * if the {@code index} argument is negative or not less than
- * {@code length()}
- */
- MinimalECIInput.prototype.isFNC1 = function (index) {
- if (index < 0 || index >= this.length()) {
- throw new Error('' + index);
- }
- return this.bytes[index] === 1000;
- };
- /**
- * Returns the {@code int} ECI value at the specified index. An index ranges from zero
- * to {@code length() - 1}. The first {@code byte} value of the sequence is at
- * index zero, the next at index one, and so on, as for array
- * indexing.
- *
- * @param index the index of the {@code int} value to be returned
- *
- * @return the specified {@code int} ECI value.
- * The ECI specified the encoding of all bytes with a higher index until the
- * next ECI or until the end of the input if no other ECI follows.
- *
- * @throws IndexOutOfBoundsException
- * if the {@code index} argument is negative or not less than
- * {@code length()}
- * @throws IllegalArgumentException
- * if the value at the {@code index} argument is not an ECI (@see #isECI)
- */
- MinimalECIInput.prototype.getECIValue = function (index) {
- if (index < 0 || index >= this.length()) {
- throw new Error('' + index);
- }
- if (!this.isECI(index)) {
- throw new Error('value at ' + index + ' is not an ECI but a character');
- }
- return this.bytes[index] - 256;
- };
- MinimalECIInput.prototype.addEdge = function (edges, to, edge) {
- if (edges[to][edge.encoderIndex] == null || edges[to][edge.encoderIndex].cachedTotalSize > edge.cachedTotalSize) {
- edges[to][edge.encoderIndex] = edge;
- }
- };
- MinimalECIInput.prototype.addEdges = function (stringToEncode, encoderSet, edges, from, previous, fnc1) {
- var ch = stringToEncode.charAt(from).charCodeAt(0);
- var start = 0;
- var end = encoderSet.length();
- if (encoderSet.getPriorityEncoderIndex() >= 0 && (ch === fnc1 || encoderSet.canEncode(ch, encoderSet.getPriorityEncoderIndex()))) {
- start = encoderSet.getPriorityEncoderIndex();
- end = start + 1;
- }
- for (var i = start; i < end; i++) {
- if (ch === fnc1 || encoderSet.canEncode(ch, i)) {
- this.addEdge(edges, from + 1, new InputEdge(ch, encoderSet, i, previous, fnc1));
- }
- }
- };
- MinimalECIInput.prototype.encodeMinimally = function (stringToEncode, encoderSet, fnc1) {
- var inputLength = stringToEncode.length;
- // Array that represents vertices. There is a vertex for every character and encoding.
- var edges = new InputEdge[inputLength + 1][encoderSet.length()]();
- this.addEdges(stringToEncode, encoderSet, edges, 0, null, fnc1);
- for (var i = 1; i <= inputLength; i++) {
- for (var j = 0; j < encoderSet.length(); j++) {
- if (edges[i][j] != null && i < inputLength) {
- this.addEdges(stringToEncode, encoderSet, edges, i, edges[i][j], fnc1);
- }
- }
- // optimize memory by removing edges that have been passed.
- for (var j = 0; j < encoderSet.length(); j++) {
- edges[i - 1][j] = null;
- }
- }
- var minimalJ = -1;
- var minimalSize = _Integer.default.MAX_VALUE;
- for (var j = 0; j < encoderSet.length(); j++) {
- if (edges[inputLength][j] != null) {
- var edge = edges[inputLength][j];
- if (edge.cachedTotalSize < minimalSize) {
- minimalSize = edge.cachedTotalSize;
- minimalJ = j;
- }
- }
- }
- if (minimalJ < 0) {
- throw new Error('Failed to encode "' + stringToEncode + '"');
- }
- var intsAL = [];
- var current = edges[inputLength][minimalJ];
- while (current != null) {
- if (current.isFNC1()) {
- intsAL.unshift(1000);
- } else {
- var bytes = encoderSet.encode(current.c, current.encoderIndex);
- for (var i = bytes.length - 1; i >= 0; i--) {
- intsAL.unshift(bytes[i] & 0xff);
- }
- }
- var previousEncoderIndex = current.previous === null ? 0 : current.previous.encoderIndex;
- if (previousEncoderIndex !== current.encoderIndex) {
- intsAL.unshift(256 + encoderSet.getECIValue(current.encoderIndex));
- }
- current = current.previous;
- }
- var ints = [];
- for (var i = 0; i < ints.length; i++) {
- ints[i] = intsAL[i];
- }
- return ints;
- };
- return MinimalECIInput;
- }();
- exports.MinimalECIInput = MinimalECIInput;
- var InputEdge = /** @class */function () {
- function InputEdge(c, encoderSet, encoderIndex, previous, fnc1) {
- this.c = c;
- this.encoderSet = encoderSet;
- this.encoderIndex = encoderIndex;
- this.previous = previous;
- this.fnc1 = fnc1;
- this.c = c === fnc1 ? 1000 : c;
- var size = this.isFNC1() ? 1 : encoderSet.encode(c, encoderIndex).length;
- var previousEncoderIndex = previous === null ? 0 : previous.encoderIndex;
- if (previousEncoderIndex !== encoderIndex) {
- size += COST_PER_ECI;
- }
- if (previous != null) {
- size += previous.cachedTotalSize;
- }
- this.cachedTotalSize = size;
- }
- InputEdge.prototype.isFNC1 = function () {
- return this.c === 1000;
- };
- return InputEdge;
- }();
- /***/ }),
- /* 495 */
- /*!****************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/ECIEncoderSet.js ***!
- \****************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.ECIEncoderSet = void 0;
- var _Charset = _interopRequireDefault(__webpack_require__(/*! ../util/Charset */ 477));
- var _StandardCharsets = _interopRequireDefault(__webpack_require__(/*! ../util/StandardCharsets */ 478));
- var _StringEncoding = _interopRequireDefault(__webpack_require__(/*! ../util/StringEncoding */ 325));
- var _StringUtils = _interopRequireDefault(__webpack_require__(/*! ./StringUtils */ 321));
- /**
- * Set of CharsetEncoders for a given input string
- *
- * Invariants:
- * - The list contains only encoders from CharacterSetECI (list is shorter then the list of encoders available on
- * the platform for which ECI values are defined).
- * - The list contains encoders at least one encoder for every character in the input.
- * - The first encoder in the list is always the ISO-8859-1 encoder even of no character in the input can be encoded
- * by it.
- * - If the input contains a character that is not in ISO-8859-1 then the last two entries in the list will be the
- * UTF-8 encoder and the UTF-16BE encoder.
- *
- * @author Alex Geller
- */
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- var CharsetEncoder = /** @class */function () {
- function CharsetEncoder(charset) {
- this.charset = charset;
- this.name = charset.name;
- }
- CharsetEncoder.prototype.canEncode = function (c) {
- try {
- return _StringEncoding.default.encode(c, this.charset) != null;
- } catch (ex) {
- return false;
- }
- };
- return CharsetEncoder;
- }();
- var ECIEncoderSet = /** @class */function () {
- /**
- * Constructs an encoder set
- *
- * @param stringToEncode the string that needs to be encoded
- * @param priorityCharset The preferred {@link Charset} or null.
- * @param fnc1 fnc1 denotes the character in the input that represents the FNC1 character or -1 for a non-GS1 bar
- * code. When specified, it is considered an error to pass it as argument to the methods canEncode() or encode().
- */
- function ECIEncoderSet(stringToEncode, priorityCharset, fnc1) {
- var e_1, _a, e_2, _b, e_3, _c;
- this.ENCODERS = ['IBM437', 'ISO-8859-2', 'ISO-8859-3', 'ISO-8859-4', 'ISO-8859-5', 'ISO-8859-6', 'ISO-8859-7', 'ISO-8859-8', 'ISO-8859-9', 'ISO-8859-10', 'ISO-8859-11', 'ISO-8859-13', 'ISO-8859-14', 'ISO-8859-15', 'ISO-8859-16', 'windows-1250', 'windows-1251', 'windows-1252', 'windows-1256', 'Shift_JIS'].map(function (name) {
- return new CharsetEncoder(_Charset.default.forName(name));
- });
- this.encoders = [];
- var neededEncoders = [];
- // we always need the ISO-8859-1 encoder. It is the default encoding
- neededEncoders.push(new CharsetEncoder(_StandardCharsets.default.ISO_8859_1));
- var needUnicodeEncoder = priorityCharset != null && priorityCharset.name.startsWith('UTF');
- // Walk over the input string and see if all characters can be encoded with the list of encoders
- for (var i = 0; i < stringToEncode.length; i++) {
- var canEncode = false;
- try {
- for (var neededEncoders_1 = (e_1 = void 0, __values(neededEncoders)), neededEncoders_1_1 = neededEncoders_1.next(); !neededEncoders_1_1.done; neededEncoders_1_1 = neededEncoders_1.next()) {
- var encoder = neededEncoders_1_1.value;
- var singleCharacter = stringToEncode.charAt(i);
- var c = singleCharacter.charCodeAt(0);
- if (c === fnc1 || encoder.canEncode(singleCharacter)) {
- canEncode = true;
- break;
- }
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (neededEncoders_1_1 && !neededEncoders_1_1.done && (_a = neededEncoders_1.return)) _a.call(neededEncoders_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- if (!canEncode) {
- try {
- // for the character at position i we don't yet have an encoder in the list
- for (var _d = (e_2 = void 0, __values(this.ENCODERS)), _e = _d.next(); !_e.done; _e = _d.next()) {
- var encoder = _e.value;
- if (encoder.canEncode(stringToEncode.charAt(i))) {
- // Good, we found an encoder that can encode the character. We add him to the list and continue scanning
- // the input
- neededEncoders.push(encoder);
- canEncode = true;
- break;
- }
- }
- } catch (e_2_1) {
- e_2 = {
- error: e_2_1
- };
- } finally {
- try {
- if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
- } finally {
- if (e_2) throw e_2.error;
- }
- }
- }
- if (!canEncode) {
- // The character is not encodeable by any of the single byte encoders so we remember that we will need a
- // Unicode encoder.
- needUnicodeEncoder = true;
- }
- }
- if (neededEncoders.length === 1 && !needUnicodeEncoder) {
- // the entire input can be encoded by the ISO-8859-1 encoder
- this.encoders = [neededEncoders[0]];
- } else {
- // we need more than one single byte encoder or we need a Unicode encoder.
- // In this case we append a UTF-8 and UTF-16 encoder to the list
- this.encoders = [];
- var index = 0;
- try {
- for (var neededEncoders_2 = __values(neededEncoders), neededEncoders_2_1 = neededEncoders_2.next(); !neededEncoders_2_1.done; neededEncoders_2_1 = neededEncoders_2.next()) {
- var encoder = neededEncoders_2_1.value;
- this.encoders[index++] = encoder;
- }
- } catch (e_3_1) {
- e_3 = {
- error: e_3_1
- };
- } finally {
- try {
- if (neededEncoders_2_1 && !neededEncoders_2_1.done && (_c = neededEncoders_2.return)) _c.call(neededEncoders_2);
- } finally {
- if (e_3) throw e_3.error;
- }
- }
- // this.encoders[index] = new CharsetEncoder(StandardCharsets.UTF_8);
- // this.encoders[index + 1] = new CharsetEncoder(StandardCharsets.UTF_16BE);
- }
- // Compute priorityEncoderIndex by looking up priorityCharset in encoders
- var priorityEncoderIndexValue = -1;
- if (priorityCharset != null) {
- for (var i = 0; i < this.encoders.length; i++) {
- if (this.encoders[i] != null && priorityCharset.name === this.encoders[i].name) {
- priorityEncoderIndexValue = i;
- break;
- }
- }
- }
- this.priorityEncoderIndex = priorityEncoderIndexValue;
- // invariants
- // if(this?.encoders?.[0].name !== StandardCharsets.ISO_8859_1)){
- // throw new Error("ISO-8859-1 must be the first encoder");
- // }
- }
- ECIEncoderSet.prototype.length = function () {
- return this.encoders.length;
- };
- ECIEncoderSet.prototype.getCharsetName = function (index) {
- if (!(index < this.length())) {
- throw new Error('index must be less than length');
- }
- return this.encoders[index].name;
- };
- ECIEncoderSet.prototype.getCharset = function (index) {
- if (!(index < this.length())) {
- throw new Error('index must be less than length');
- }
- return this.encoders[index].charset;
- };
- ECIEncoderSet.prototype.getECIValue = function (encoderIndex) {
- return this.encoders[encoderIndex].charset.getValueIdentifier();
- };
- /*
- * returns -1 if no priority charset was defined
- */
- ECIEncoderSet.prototype.getPriorityEncoderIndex = function () {
- return this.priorityEncoderIndex;
- };
- ECIEncoderSet.prototype.canEncode = function (c, encoderIndex) {
- if (!(encoderIndex < this.length())) {
- throw new Error('index must be less than length');
- }
- return true;
- };
- ECIEncoderSet.prototype.encode = function (c, encoderIndex) {
- if (!(encoderIndex < this.length())) {
- throw new Error('index must be less than length');
- }
- return _StringEncoding.default.encode(_StringUtils.default.getCharAt(c), this.encoders[encoderIndex].name);
- };
- return ECIEncoderSet;
- }();
- exports.ECIEncoderSet = ECIEncoderSet;
- /***/ }),
- /* 496 */
- /*!*************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/AztecWriter.js ***!
- \*************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
- var _EncodeHintType = _interopRequireDefault(__webpack_require__(/*! ../EncodeHintType */ 462));
- var _Encoder = _interopRequireDefault(__webpack_require__(/*! ./encoder/Encoder */ 497));
- var _BitMatrix = _interopRequireDefault(__webpack_require__(/*! ../common/BitMatrix */ 319));
- var _Charset = _interopRequireDefault(__webpack_require__(/*! ../util/Charset */ 477));
- var _StandardCharsets = _interopRequireDefault(__webpack_require__(/*! ../util/StandardCharsets */ 478));
- var _Integer = _interopRequireDefault(__webpack_require__(/*! ../util/Integer */ 318));
- var _IllegalStateException = _interopRequireDefault(__webpack_require__(/*! ../IllegalStateException */ 344));
- var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../IllegalArgumentException */ 308));
- var _StringUtils = _interopRequireDefault(__webpack_require__(/*! ../common/StringUtils */ 321));
- /*
- * Copyright 2013 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- // package com.google.zxing.aztec;
- // import com.google.zxing.BarcodeFormat;
- // import com.google.zxing.EncodeHintType;
- // import com.google.zxing.aztec.encoder.Encoder;
- // import com.google.zxing.common.BitMatrix;
- // import java.nio.charset.Charset;
- // import java.nio.charset.StandardCharsets;
- // import java.util.Map;
- /**
- * Renders an Aztec code as a {@link BitMatrix}.
- */
- var AztecWriter = /** @class */function () {
- function AztecWriter() {}
- // @Override
- AztecWriter.prototype.encode = function (contents, format, width, height) {
- return this.encodeWithHints(contents, format, width, height, null);
- };
- // @Override
- AztecWriter.prototype.encodeWithHints = function (contents, format, width, height, hints) {
- var charset = _StandardCharsets.default.ISO_8859_1;
- var eccPercent = _Encoder.default.DEFAULT_EC_PERCENT;
- var layers = _Encoder.default.DEFAULT_AZTEC_LAYERS;
- if (hints != null) {
- if (hints.has(_EncodeHintType.default.CHARACTER_SET)) {
- charset = _Charset.default.forName(hints.get(_EncodeHintType.default.CHARACTER_SET).toString());
- }
- if (hints.has(_EncodeHintType.default.ERROR_CORRECTION)) {
- eccPercent = _Integer.default.parseInt(hints.get(_EncodeHintType.default.ERROR_CORRECTION).toString());
- }
- if (hints.has(_EncodeHintType.default.AZTEC_LAYERS)) {
- layers = _Integer.default.parseInt(hints.get(_EncodeHintType.default.AZTEC_LAYERS).toString());
- }
- }
- return AztecWriter.encodeLayers(contents, format, width, height, charset, eccPercent, layers);
- };
- AztecWriter.encodeLayers = function (contents, format, width, height, charset, eccPercent, layers) {
- if (format !== _BarcodeFormat.default.AZTEC) {
- throw new _IllegalArgumentException.default('Can only encode AZTEC, but got ' + format);
- }
- var aztec = _Encoder.default.encode(_StringUtils.default.getBytes(contents, charset), eccPercent, layers);
- return AztecWriter.renderResult(aztec, width, height);
- };
- AztecWriter.renderResult = function (code, width, height) {
- var input = code.getMatrix();
- if (input == null) {
- throw new _IllegalStateException.default();
- }
- var inputWidth = input.getWidth();
- var inputHeight = input.getHeight();
- var outputWidth = Math.max(width, inputWidth);
- var outputHeight = Math.max(height, inputHeight);
- var multiple = Math.min(outputWidth / inputWidth, outputHeight / inputHeight);
- var leftPadding = (outputWidth - inputWidth * multiple) / 2;
- var topPadding = (outputHeight - inputHeight * multiple) / 2;
- var output = new _BitMatrix.default(outputWidth, outputHeight);
- for (var inputY /*int*/ = 0, outputY = topPadding; inputY < inputHeight; inputY++, outputY += multiple) {
- // Write the contents of this row of the barcode
- for (var inputX /*int*/ = 0, outputX = leftPadding; inputX < inputWidth; inputX++, outputX += multiple) {
- if (input.get(inputX, inputY)) {
- output.setRegion(outputX, outputY, multiple, multiple);
- }
- }
- }
- return output;
- };
- return AztecWriter;
- }();
- var _default = AztecWriter;
- exports.default = _default;
- /***/ }),
- /* 497 */
- /*!*****************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/encoder/Encoder.js ***!
- \*****************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _BitArray = _interopRequireDefault(__webpack_require__(/*! ../../common/BitArray */ 313));
- var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalArgumentException */ 308));
- var _StringUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/StringUtils */ 321));
- var _BitMatrix = _interopRequireDefault(__webpack_require__(/*! ../../common/BitMatrix */ 319));
- var _AztecCode = _interopRequireDefault(__webpack_require__(/*! ./AztecCode */ 498));
- var _ReedSolomonEncoder = _interopRequireDefault(__webpack_require__(/*! ../../common/reedsolomon/ReedSolomonEncoder */ 464));
- var _GenericGF = _interopRequireDefault(__webpack_require__(/*! ../../common/reedsolomon/GenericGF */ 338));
- var _HighLevelEncoder = _interopRequireDefault(__webpack_require__(/*! ./HighLevelEncoder */ 499));
- var _Integer = _interopRequireDefault(__webpack_require__(/*! ../../util/Integer */ 318));
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- /*
- * Copyright 2013 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- // package com.google.zxing.aztec.encoder;
- // import com.google.zxing.common.BitArray;
- // import com.google.zxing.common.BitMatrix;
- // import com.google.zxing.common.reedsolomon.GenericGF;
- // import com.google.zxing.common.reedsolomon.ReedSolomonEncoder;
- /**
- * Generates Aztec 2D barcodes.
- *
- * @author Rustam Abdullaev
- */
- var Encoder = /** @class */function () {
- function Encoder() {}
- /**
- * Encodes the given binary content as an Aztec symbol
- *
- * @param data input data string
- * @return Aztec symbol matrix with metadata
- */
- Encoder.encodeBytes = function (data) {
- return Encoder.encode(data, Encoder.DEFAULT_EC_PERCENT, Encoder.DEFAULT_AZTEC_LAYERS);
- };
- /**
- * Encodes the given binary content as an Aztec symbol
- *
- * @param data input data string
- * @param minECCPercent minimal percentage of error check words (According to ISO/IEC 24778:2008,
- * a minimum of 23% + 3 words is recommended)
- * @param userSpecifiedLayers if non-zero, a user-specified value for the number of layers
- * @return Aztec symbol matrix with metadata
- */
- Encoder.encode = function (data, minECCPercent, userSpecifiedLayers) {
- // High-level encode
- var bits = new _HighLevelEncoder.default(data).encode();
- // stuff bits and choose symbol size
- var eccBits = _Integer.default.truncDivision(bits.getSize() * minECCPercent, 100) + 11;
- var totalSizeBits = bits.getSize() + eccBits;
- var compact;
- var layers;
- var totalBitsInLayer;
- var wordSize;
- var stuffedBits;
- if (userSpecifiedLayers !== Encoder.DEFAULT_AZTEC_LAYERS) {
- compact = userSpecifiedLayers < 0;
- layers = Math.abs(userSpecifiedLayers);
- if (layers > (compact ? Encoder.MAX_NB_BITS_COMPACT : Encoder.MAX_NB_BITS)) {
- throw new _IllegalArgumentException.default(_StringUtils.default.format('Illegal value %s for layers', userSpecifiedLayers));
- }
- totalBitsInLayer = Encoder.totalBitsInLayer(layers, compact);
- wordSize = Encoder.WORD_SIZE[layers];
- var usableBitsInLayers = totalBitsInLayer - totalBitsInLayer % wordSize;
- stuffedBits = Encoder.stuffBits(bits, wordSize);
- if (stuffedBits.getSize() + eccBits > usableBitsInLayers) {
- throw new _IllegalArgumentException.default('Data to large for user specified layer');
- }
- if (compact && stuffedBits.getSize() > wordSize * 64) {
- // Compact format only allows 64 data words, though C4 can hold more words than that
- throw new _IllegalArgumentException.default('Data to large for user specified layer');
- }
- } else {
- wordSize = 0;
- stuffedBits = null;
- // We look at the possible table sizes in the order Compact1, Compact2, Compact3,
- // Compact4, Normal4,... Normal(i) for i < 4 isn't typically used since Compact(i+1)
- // is the same size, but has more data.
- for (var i /*int*/ = 0;; i++) {
- if (i > Encoder.MAX_NB_BITS) {
- throw new _IllegalArgumentException.default('Data too large for an Aztec code');
- }
- compact = i <= 3;
- layers = compact ? i + 1 : i;
- totalBitsInLayer = Encoder.totalBitsInLayer(layers, compact);
- if (totalSizeBits > totalBitsInLayer) {
- continue;
- }
- // [Re]stuff the bits if this is the first opportunity, or if the
- // wordSize has changed
- if (stuffedBits == null || wordSize !== Encoder.WORD_SIZE[layers]) {
- wordSize = Encoder.WORD_SIZE[layers];
- stuffedBits = Encoder.stuffBits(bits, wordSize);
- }
- var usableBitsInLayers = totalBitsInLayer - totalBitsInLayer % wordSize;
- if (compact && stuffedBits.getSize() > wordSize * 64) {
- // Compact format only allows 64 data words, though C4 can hold more words than that
- continue;
- }
- if (stuffedBits.getSize() + eccBits <= usableBitsInLayers) {
- break;
- }
- }
- }
- var messageBits = Encoder.generateCheckWords(stuffedBits, totalBitsInLayer, wordSize);
- // generate mode message
- var messageSizeInWords = stuffedBits.getSize() / wordSize;
- var modeMessage = Encoder.generateModeMessage(compact, layers, messageSizeInWords);
- // allocate symbol
- var baseMatrixSize = (compact ? 11 : 14) + layers * 4; // not including alignment lines
- var alignmentMap = new Int32Array(baseMatrixSize);
- var matrixSize;
- if (compact) {
- // no alignment marks in compact mode, alignmentMap is a no-op
- matrixSize = baseMatrixSize;
- for (var i /*int*/ = 0; i < alignmentMap.length; i++) {
- alignmentMap[i] = i;
- }
- } else {
- matrixSize = baseMatrixSize + 1 + 2 * _Integer.default.truncDivision(_Integer.default.truncDivision(baseMatrixSize, 2) - 1, 15);
- var origCenter = _Integer.default.truncDivision(baseMatrixSize, 2);
- var center = _Integer.default.truncDivision(matrixSize, 2);
- for (var i /*int*/ = 0; i < origCenter; i++) {
- var newOffset = i + _Integer.default.truncDivision(i, 15);
- alignmentMap[origCenter - i - 1] = center - newOffset - 1;
- alignmentMap[origCenter + i] = center + newOffset + 1;
- }
- }
- var matrix = new _BitMatrix.default(matrixSize);
- // draw data bits
- for (var i /*int*/ = 0, rowOffset = 0; i < layers; i++) {
- var rowSize = (layers - i) * 4 + (compact ? 9 : 12);
- for (var j /*int*/ = 0; j < rowSize; j++) {
- var columnOffset = j * 2;
- for (var k /*int*/ = 0; k < 2; k++) {
- if (messageBits.get(rowOffset + columnOffset + k)) {
- matrix.set(alignmentMap[i * 2 + k], alignmentMap[i * 2 + j]);
- }
- if (messageBits.get(rowOffset + rowSize * 2 + columnOffset + k)) {
- matrix.set(alignmentMap[i * 2 + j], alignmentMap[baseMatrixSize - 1 - i * 2 - k]);
- }
- if (messageBits.get(rowOffset + rowSize * 4 + columnOffset + k)) {
- matrix.set(alignmentMap[baseMatrixSize - 1 - i * 2 - k], alignmentMap[baseMatrixSize - 1 - i * 2 - j]);
- }
- if (messageBits.get(rowOffset + rowSize * 6 + columnOffset + k)) {
- matrix.set(alignmentMap[baseMatrixSize - 1 - i * 2 - j], alignmentMap[i * 2 + k]);
- }
- }
- }
- rowOffset += rowSize * 8;
- }
- // draw mode message
- Encoder.drawModeMessage(matrix, compact, matrixSize, modeMessage);
- // draw alignment marks
- if (compact) {
- Encoder.drawBullsEye(matrix, _Integer.default.truncDivision(matrixSize, 2), 5);
- } else {
- Encoder.drawBullsEye(matrix, _Integer.default.truncDivision(matrixSize, 2), 7);
- for (var i /*int*/ = 0, j = 0; i < _Integer.default.truncDivision(baseMatrixSize, 2) - 1; i += 15, j += 16) {
- for (var k /*int*/ = _Integer.default.truncDivision(matrixSize, 2) & 1; k < matrixSize; k += 2) {
- matrix.set(_Integer.default.truncDivision(matrixSize, 2) - j, k);
- matrix.set(_Integer.default.truncDivision(matrixSize, 2) + j, k);
- matrix.set(k, _Integer.default.truncDivision(matrixSize, 2) - j);
- matrix.set(k, _Integer.default.truncDivision(matrixSize, 2) + j);
- }
- }
- }
- var aztec = new _AztecCode.default();
- aztec.setCompact(compact);
- aztec.setSize(matrixSize);
- aztec.setLayers(layers);
- aztec.setCodeWords(messageSizeInWords);
- aztec.setMatrix(matrix);
- return aztec;
- };
- Encoder.drawBullsEye = function (matrix, center, size) {
- for (var i /*int*/ = 0; i < size; i += 2) {
- for (var j /*int*/ = center - i; j <= center + i; j++) {
- matrix.set(j, center - i);
- matrix.set(j, center + i);
- matrix.set(center - i, j);
- matrix.set(center + i, j);
- }
- }
- matrix.set(center - size, center - size);
- matrix.set(center - size + 1, center - size);
- matrix.set(center - size, center - size + 1);
- matrix.set(center + size, center - size);
- matrix.set(center + size, center - size + 1);
- matrix.set(center + size, center + size - 1);
- };
- Encoder.generateModeMessage = function (compact, layers, messageSizeInWords) {
- var modeMessage = new _BitArray.default();
- if (compact) {
- modeMessage.appendBits(layers - 1, 2);
- modeMessage.appendBits(messageSizeInWords - 1, 6);
- modeMessage = Encoder.generateCheckWords(modeMessage, 28, 4);
- } else {
- modeMessage.appendBits(layers - 1, 5);
- modeMessage.appendBits(messageSizeInWords - 1, 11);
- modeMessage = Encoder.generateCheckWords(modeMessage, 40, 4);
- }
- return modeMessage;
- };
- Encoder.drawModeMessage = function (matrix, compact, matrixSize, modeMessage) {
- var center = _Integer.default.truncDivision(matrixSize, 2);
- if (compact) {
- for (var i /*int*/ = 0; i < 7; i++) {
- var offset = center - 3 + i;
- if (modeMessage.get(i)) {
- matrix.set(offset, center - 5);
- }
- if (modeMessage.get(i + 7)) {
- matrix.set(center + 5, offset);
- }
- if (modeMessage.get(20 - i)) {
- matrix.set(offset, center + 5);
- }
- if (modeMessage.get(27 - i)) {
- matrix.set(center - 5, offset);
- }
- }
- } else {
- for (var i /*int*/ = 0; i < 10; i++) {
- var offset = center - 5 + i + _Integer.default.truncDivision(i, 5);
- if (modeMessage.get(i)) {
- matrix.set(offset, center - 7);
- }
- if (modeMessage.get(i + 10)) {
- matrix.set(center + 7, offset);
- }
- if (modeMessage.get(29 - i)) {
- matrix.set(offset, center + 7);
- }
- if (modeMessage.get(39 - i)) {
- matrix.set(center - 7, offset);
- }
- }
- }
- };
- Encoder.generateCheckWords = function (bitArray, totalBits, wordSize) {
- var e_1, _a;
- // bitArray is guaranteed to be a multiple of the wordSize, so no padding needed
- var messageSizeInWords = bitArray.getSize() / wordSize;
- var rs = new _ReedSolomonEncoder.default(Encoder.getGF(wordSize));
- var totalWords = _Integer.default.truncDivision(totalBits, wordSize);
- var messageWords = Encoder.bitsToWords(bitArray, wordSize, totalWords);
- rs.encode(messageWords, totalWords - messageSizeInWords);
- var startPad = totalBits % wordSize;
- var messageBits = new _BitArray.default();
- messageBits.appendBits(0, startPad);
- try {
- for (var _b = __values(Array.from(messageWords)), _c = _b.next(); !_c.done; _c = _b.next()) {
- var messageWord = _c.value /*: int*/;
- messageBits.appendBits(messageWord, wordSize);
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- return messageBits;
- };
- Encoder.bitsToWords = function (stuffedBits, wordSize, totalWords) {
- var message = new Int32Array(totalWords);
- var i;
- var n;
- for (i = 0, n = stuffedBits.getSize() / wordSize; i < n; i++) {
- var value = 0;
- for (var j /*int*/ = 0; j < wordSize; j++) {
- value |= stuffedBits.get(i * wordSize + j) ? 1 << wordSize - j - 1 : 0;
- }
- message[i] = value;
- }
- return message;
- };
- Encoder.getGF = function (wordSize) {
- switch (wordSize) {
- case 4:
- return _GenericGF.default.AZTEC_PARAM;
- case 6:
- return _GenericGF.default.AZTEC_DATA_6;
- case 8:
- return _GenericGF.default.AZTEC_DATA_8;
- case 10:
- return _GenericGF.default.AZTEC_DATA_10;
- case 12:
- return _GenericGF.default.AZTEC_DATA_12;
- default:
- throw new _IllegalArgumentException.default('Unsupported word size ' + wordSize);
- }
- };
- Encoder.stuffBits = function (bits, wordSize) {
- var out = new _BitArray.default();
- var n = bits.getSize();
- var mask = (1 << wordSize) - 2;
- for (var i /*int*/ = 0; i < n; i += wordSize) {
- var word = 0;
- for (var j /*int*/ = 0; j < wordSize; j++) {
- if (i + j >= n || bits.get(i + j)) {
- word |= 1 << wordSize - 1 - j;
- }
- }
- if ((word & mask) === mask) {
- out.appendBits(word & mask, wordSize);
- i--;
- } else if ((word & mask) === 0) {
- out.appendBits(word | 1, wordSize);
- i--;
- } else {
- out.appendBits(word, wordSize);
- }
- }
- return out;
- };
- Encoder.totalBitsInLayer = function (layers, compact) {
- return ((compact ? 88 : 112) + 16 * layers) * layers;
- };
- Encoder.DEFAULT_EC_PERCENT = 33; // default minimal percentage of error check words
- Encoder.DEFAULT_AZTEC_LAYERS = 0;
- Encoder.MAX_NB_BITS = 32;
- Encoder.MAX_NB_BITS_COMPACT = 4;
- Encoder.WORD_SIZE = Int32Array.from([4, 6, 6, 8, 8, 8, 8, 8, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12]);
- return Encoder;
- }();
- var _default = Encoder;
- exports.default = _default;
- /***/ }),
- /* 498 */
- /*!*******************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/encoder/AztecCode.js ***!
- \*******************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- /*
- * Copyright 2013 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /**
- * Aztec 2D code representation
- *
- * @author Rustam Abdullaev
- */
- var AztecCode = /** @class */function () {
- function AztecCode() {}
- /**
- * @return {@code true} if compact instead of full mode
- */
- AztecCode.prototype.isCompact = function () {
- return this.compact;
- };
- AztecCode.prototype.setCompact = function (compact) {
- this.compact = compact;
- };
- /**
- * @return size in pixels (width and height)
- */
- AztecCode.prototype.getSize = function () {
- return this.size;
- };
- AztecCode.prototype.setSize = function (size) {
- this.size = size;
- };
- /**
- * @return number of levels
- */
- AztecCode.prototype.getLayers = function () {
- return this.layers;
- };
- AztecCode.prototype.setLayers = function (layers) {
- this.layers = layers;
- };
- /**
- * @return number of data codewords
- */
- AztecCode.prototype.getCodeWords = function () {
- return this.codeWords;
- };
- AztecCode.prototype.setCodeWords = function (codeWords) {
- this.codeWords = codeWords;
- };
- /**
- * @return the symbol image
- */
- AztecCode.prototype.getMatrix = function () {
- return this.matrix;
- };
- AztecCode.prototype.setMatrix = function (matrix) {
- this.matrix = matrix;
- };
- return AztecCode;
- }();
- var _default = AztecCode;
- exports.default = _default;
- /***/ }),
- /* 499 */
- /*!**************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/encoder/HighLevelEncoder.js ***!
- \**************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ 13);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _Collections = _interopRequireDefault(__webpack_require__(/*! ../../util/Collections */ 500));
- var _State = _interopRequireDefault(__webpack_require__(/*! ./State */ 501));
- var C = _interopRequireWildcard(__webpack_require__(/*! ./EncoderConstants */ 506));
- var CharMap = _interopRequireWildcard(__webpack_require__(/*! ./CharMap */ 509));
- var ShiftTable = _interopRequireWildcard(__webpack_require__(/*! ./ShiftTable */ 508));
- var _StringUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/StringUtils */ 321));
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
- /*
- * Copyright 2013 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- // import java.util.Collection;
- // import java.util.Collections;
- /**
- * This produces nearly optimal encodings of text into the first-level of
- * encoding used by Aztec code.
- *
- * It uses a dynamic algorithm. For each prefix of the string, it determines
- * a set of encodings that could lead to this prefix. We repeatedly add a
- * character and generate a new set of optimal encodings until we have read
- * through the entire input.
- *
- * @author Frank Yellin
- * @author Rustam Abdullaev
- */
- var HighLevelEncoder = /** @class */function () {
- function HighLevelEncoder(text) {
- this.text = text;
- }
- /**
- * @return text represented by this encoder encoded as a {@link BitArray}
- */
- HighLevelEncoder.prototype.encode = function () {
- var spaceCharCode = _StringUtils.default.getCharCode(' ');
- var lineBreakCharCode = _StringUtils.default.getCharCode('\n');
- var states = _Collections.default.singletonList(_State.default.INITIAL_STATE);
- for (var index = 0; index < this.text.length; index++) {
- var pairCode = void 0;
- var nextChar = index + 1 < this.text.length ? this.text[index + 1] : 0;
- switch (this.text[index]) {
- case _StringUtils.default.getCharCode('\r'):
- pairCode = nextChar === lineBreakCharCode ? 2 : 0;
- break;
- case _StringUtils.default.getCharCode('.'):
- pairCode = nextChar === spaceCharCode ? 3 : 0;
- break;
- case _StringUtils.default.getCharCode(','):
- pairCode = nextChar === spaceCharCode ? 4 : 0;
- break;
- case _StringUtils.default.getCharCode(':'):
- pairCode = nextChar === spaceCharCode ? 5 : 0;
- break;
- default:
- pairCode = 0;
- }
- if (pairCode > 0) {
- // We have one of the four special PUNCT pairs. Treat them specially.
- // Get a new set of states for the two new characters.
- states = HighLevelEncoder.updateStateListForPair(states, index, pairCode);
- index++;
- } else {
- // Get a new set of states for the new character.
- states = this.updateStateListForChar(states, index);
- }
- }
- // We are left with a set of states. Find the shortest one.
- var minState = _Collections.default.min(states, function (a, b) {
- return a.getBitCount() - b.getBitCount();
- });
- // Convert it to a bit array, and return.
- return minState.toBitArray(this.text);
- };
- // We update a set of states for a new character by updating each state
- // for the new character, merging the results, and then removing the
- // non-optimal states.
- HighLevelEncoder.prototype.updateStateListForChar = function (states, index) {
- var e_1, _a;
- var result = [];
- try {
- for (var states_1 = __values(states), states_1_1 = states_1.next(); !states_1_1.done; states_1_1 = states_1.next()) {
- var state = states_1_1.value /*State*/;
- this.updateStateForChar(state, index, result);
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (states_1_1 && !states_1_1.done && (_a = states_1.return)) _a.call(states_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- return HighLevelEncoder.simplifyStates(result);
- };
- // Return a set of states that represent the possible ways of updating this
- // state for the next character. The resulting set of states are added to
- // the "result" list.
- HighLevelEncoder.prototype.updateStateForChar = function (state, index, result) {
- var ch = this.text[index] & 0xff;
- var charInCurrentTable = CharMap.CHAR_MAP[state.getMode()][ch] > 0;
- var stateNoBinary = null;
- for (var mode /*int*/ = 0; mode <= C.MODE_PUNCT; mode++) {
- var charInMode = CharMap.CHAR_MAP[mode][ch];
- if (charInMode > 0) {
- if (stateNoBinary == null) {
- // Only create stateNoBinary the first time it's required.
- stateNoBinary = state.endBinaryShift(index);
- }
- // Try generating the character by latching to its mode
- if (!charInCurrentTable || mode === state.getMode() || mode === C.MODE_DIGIT) {
- // If the character is in the current table, we don't want to latch to
- // any other mode except possibly digit (which uses only 4 bits). Any
- // other latch would be equally successful *after* this character, and
- // so wouldn't save any bits.
- var latchState = stateNoBinary.latchAndAppend(mode, charInMode);
- result.push(latchState);
- }
- // Try generating the character by switching to its mode.
- if (!charInCurrentTable && ShiftTable.SHIFT_TABLE[state.getMode()][mode] >= 0) {
- // It never makes sense to temporarily shift to another mode if the
- // character exists in the current mode. That can never save bits.
- var shiftState = stateNoBinary.shiftAndAppend(mode, charInMode);
- result.push(shiftState);
- }
- }
- }
- if (state.getBinaryShiftByteCount() > 0 || CharMap.CHAR_MAP[state.getMode()][ch] === 0) {
- // It's never worthwhile to go into binary shift mode if you're not already
- // in binary shift mode, and the character exists in your current mode.
- // That can never save bits over just outputting the char in the current mode.
- var binaryState = state.addBinaryShiftChar(index);
- result.push(binaryState);
- }
- };
- HighLevelEncoder.updateStateListForPair = function (states, index, pairCode) {
- var e_2, _a;
- var result = [];
- try {
- for (var states_2 = __values(states), states_2_1 = states_2.next(); !states_2_1.done; states_2_1 = states_2.next()) {
- var state = states_2_1.value /*State*/;
- this.updateStateForPair(state, index, pairCode, result);
- }
- } catch (e_2_1) {
- e_2 = {
- error: e_2_1
- };
- } finally {
- try {
- if (states_2_1 && !states_2_1.done && (_a = states_2.return)) _a.call(states_2);
- } finally {
- if (e_2) throw e_2.error;
- }
- }
- return this.simplifyStates(result);
- };
- HighLevelEncoder.updateStateForPair = function (state, index, pairCode, result) {
- var stateNoBinary = state.endBinaryShift(index);
- // Possibility 1. Latch to C.MODE_PUNCT, and then append this code
- result.push(stateNoBinary.latchAndAppend(C.MODE_PUNCT, pairCode));
- if (state.getMode() !== C.MODE_PUNCT) {
- // Possibility 2. Shift to C.MODE_PUNCT, and then append this code.
- // Every state except C.MODE_PUNCT (handled above) can shift
- result.push(stateNoBinary.shiftAndAppend(C.MODE_PUNCT, pairCode));
- }
- if (pairCode === 3 || pairCode === 4) {
- // both characters are in DIGITS. Sometimes better to just add two digits
- var digitState = stateNoBinary.latchAndAppend(C.MODE_DIGIT, 16 - pairCode) // period or comma in DIGIT
- .latchAndAppend(C.MODE_DIGIT, 1); // space in DIGIT
- result.push(digitState);
- }
- if (state.getBinaryShiftByteCount() > 0) {
- // It only makes sense to do the characters as binary if we're already
- // in binary mode.
- var binaryState = state.addBinaryShiftChar(index).addBinaryShiftChar(index + 1);
- result.push(binaryState);
- }
- };
- HighLevelEncoder.simplifyStates = function (states) {
- var e_3, _a, e_4, _b;
- var result = [];
- try {
- for (var states_3 = __values(states), states_3_1 = states_3.next(); !states_3_1.done; states_3_1 = states_3.next()) {
- var newState = states_3_1.value;
- var add = true;
- var _loop_1 = function _loop_1(oldState) {
- if (oldState.isBetterThanOrEqualTo(newState)) {
- add = false;
- return "break";
- }
- if (newState.isBetterThanOrEqualTo(oldState)) {
- // iterator.remove();
- result = result.filter(function (x) {
- return x !== oldState;
- }); // remove old state
- }
- };
- try {
- for (var result_1 = (e_4 = void 0, __values(result)), result_1_1 = result_1.next(); !result_1_1.done; result_1_1 = result_1.next()) {
- var oldState = result_1_1.value;
- var state_1 = _loop_1(oldState);
- if (state_1 === "break") break;
- }
- } catch (e_4_1) {
- e_4 = {
- error: e_4_1
- };
- } finally {
- try {
- if (result_1_1 && !result_1_1.done && (_b = result_1.return)) _b.call(result_1);
- } finally {
- if (e_4) throw e_4.error;
- }
- }
- if (add) {
- result.push(newState);
- }
- }
- } catch (e_3_1) {
- e_3 = {
- error: e_3_1
- };
- } finally {
- try {
- if (states_3_1 && !states_3_1.done && (_a = states_3.return)) _a.call(states_3);
- } finally {
- if (e_3) throw e_3.error;
- }
- }
- return result;
- };
- return HighLevelEncoder;
- }();
- var _default = HighLevelEncoder;
- exports.default = _default;
- /***/ }),
- /* 500 */
- /*!************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/util/Collections.js ***!
- \************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var Collections = /** @class */function () {
- function Collections() {}
- /**
- * The singletonList(T) method is used to return an immutable list containing only the specified object.
- */
- Collections.singletonList = function (item) {
- return [item];
- };
- /**
- * The min(Collection<? extends T>, Comparator<? super T>) method is used to return the minimum element of the given collection, according to the order induced by the specified comparator.
- */
- Collections.min = function (collection, comparator) {
- return collection.sort(comparator)[0];
- };
- return Collections;
- }();
- var _default = Collections;
- exports.default = _default;
- /***/ }),
- /* 501 */
- /*!***************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/encoder/State.js ***!
- \***************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ 13);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _BitArray = _interopRequireDefault(__webpack_require__(/*! ../../common/BitArray */ 313));
- var TokenHelpers = _interopRequireWildcard(__webpack_require__(/*! ./TokenHelpers */ 502));
- var C = _interopRequireWildcard(__webpack_require__(/*! ./EncoderConstants */ 506));
- var LatchTable = _interopRequireWildcard(__webpack_require__(/*! ./LatchTable */ 507));
- var ShiftTable = _interopRequireWildcard(__webpack_require__(/*! ./ShiftTable */ 508));
- var _StringUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/StringUtils */ 321));
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
- /*
- * Copyright 2013 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- // package com.google.zxing.aztec.encoder;
- // import java.util.Deque;
- // import java.util.LinkedList;
- // import com.google.zxing.common.BitArray;
- /**
- * State represents all information about a sequence necessary to generate the current output.
- * Note that a state is immutable.
- */
- var State = /** @class */function () {
- function State(token, mode, binaryBytes, bitCount) {
- this.token = token;
- this.mode = mode;
- this.binaryShiftByteCount = binaryBytes;
- this.bitCount = bitCount;
- // Make sure we match the token
- // int binaryShiftBitCount = (binaryShiftByteCount * 8) +
- // (binaryShiftByteCount === 0 ? 0 :
- // binaryShiftByteCount <= 31 ? 10 :
- // binaryShiftByteCount <= 62 ? 20 : 21);
- // assert this.bitCount === token.getTotalBitCount() + binaryShiftBitCount;
- }
- State.prototype.getMode = function () {
- return this.mode;
- };
- State.prototype.getToken = function () {
- return this.token;
- };
- State.prototype.getBinaryShiftByteCount = function () {
- return this.binaryShiftByteCount;
- };
- State.prototype.getBitCount = function () {
- return this.bitCount;
- };
- // Create a new state representing this state with a latch to a (not
- // necessary different) mode, and then a code.
- State.prototype.latchAndAppend = function (mode, value) {
- // assert binaryShiftByteCount === 0;
- var bitCount = this.bitCount;
- var token = this.token;
- if (mode !== this.mode) {
- var latch = LatchTable.LATCH_TABLE[this.mode][mode];
- token = TokenHelpers.add(token, latch & 0xffff, latch >> 16);
- bitCount += latch >> 16;
- }
- var latchModeBitCount = mode === C.MODE_DIGIT ? 4 : 5;
- token = TokenHelpers.add(token, value, latchModeBitCount);
- return new State(token, mode, 0, bitCount + latchModeBitCount);
- };
- // Create a new state representing this state, with a temporary shift
- // to a different mode to output a single value.
- State.prototype.shiftAndAppend = function (mode, value) {
- // assert binaryShiftByteCount === 0 && this.mode !== mode;
- var token = this.token;
- var thisModeBitCount = this.mode === C.MODE_DIGIT ? 4 : 5;
- // Shifts exist only to UPPER and PUNCT, both with tokens size 5.
- token = TokenHelpers.add(token, ShiftTable.SHIFT_TABLE[this.mode][mode], thisModeBitCount);
- token = TokenHelpers.add(token, value, 5);
- return new State(token, this.mode, 0, this.bitCount + thisModeBitCount + 5);
- };
- // Create a new state representing this state, but an additional character
- // output in Binary Shift mode.
- State.prototype.addBinaryShiftChar = function (index) {
- var token = this.token;
- var mode = this.mode;
- var bitCount = this.bitCount;
- if (this.mode === C.MODE_PUNCT || this.mode === C.MODE_DIGIT) {
- // assert binaryShiftByteCount === 0;
- var latch = LatchTable.LATCH_TABLE[mode][C.MODE_UPPER];
- token = TokenHelpers.add(token, latch & 0xffff, latch >> 16);
- bitCount += latch >> 16;
- mode = C.MODE_UPPER;
- }
- var deltaBitCount = this.binaryShiftByteCount === 0 || this.binaryShiftByteCount === 31 ? 18 : this.binaryShiftByteCount === 62 ? 9 : 8;
- var result = new State(token, mode, this.binaryShiftByteCount + 1, bitCount + deltaBitCount);
- if (result.binaryShiftByteCount === 2047 + 31) {
- // The string is as long as it's allowed to be. We should end it.
- result = result.endBinaryShift(index + 1);
- }
- return result;
- };
- // Create the state identical to this one, but we are no longer in
- // Binary Shift mode.
- State.prototype.endBinaryShift = function (index) {
- if (this.binaryShiftByteCount === 0) {
- return this;
- }
- var token = this.token;
- token = TokenHelpers.addBinaryShift(token, index - this.binaryShiftByteCount, this.binaryShiftByteCount);
- // assert token.getTotalBitCount() === this.bitCount;
- return new State(token, this.mode, 0, this.bitCount);
- };
- // Returns true if "this" state is better (equal: or) to be in than "that"
- // state under all possible circumstances.
- State.prototype.isBetterThanOrEqualTo = function (other) {
- var newModeBitCount = this.bitCount + (LatchTable.LATCH_TABLE[this.mode][other.mode] >> 16);
- if (this.binaryShiftByteCount < other.binaryShiftByteCount) {
- // add additional B/S encoding cost of other, if any
- newModeBitCount += State.calculateBinaryShiftCost(other) - State.calculateBinaryShiftCost(this);
- } else if (this.binaryShiftByteCount > other.binaryShiftByteCount && other.binaryShiftByteCount > 0) {
- // maximum possible additional cost (it: h)
- newModeBitCount += 10;
- }
- return newModeBitCount <= other.bitCount;
- };
- State.prototype.toBitArray = function (text) {
- var e_1, _a;
- // Reverse the tokens, so that they are in the order that they should
- // be output
- var symbols = [];
- for (var token = this.endBinaryShift(text.length).token; token !== null; token = token.getPrevious()) {
- symbols.unshift(token);
- }
- var bitArray = new _BitArray.default();
- try {
- // Add each token to the result.
- for (var symbols_1 = __values(symbols), symbols_1_1 = symbols_1.next(); !symbols_1_1.done; symbols_1_1 = symbols_1.next()) {
- var symbol = symbols_1_1.value;
- symbol.appendTo(bitArray, text);
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (symbols_1_1 && !symbols_1_1.done && (_a = symbols_1.return)) _a.call(symbols_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- // assert bitArray.getSize() === this.bitCount;
- return bitArray;
- };
- /**
- * @Override
- */
- State.prototype.toString = function () {
- return _StringUtils.default.format('%s bits=%d bytes=%d', C.MODE_NAMES[this.mode], this.bitCount, this.binaryShiftByteCount);
- };
- State.calculateBinaryShiftCost = function (state) {
- if (state.binaryShiftByteCount > 62) {
- return 21; // B/S with extended length
- }
- if (state.binaryShiftByteCount > 31) {
- return 20; // two B/S
- }
- if (state.binaryShiftByteCount > 0) {
- return 10; // one B/S
- }
- return 0;
- };
- State.INITIAL_STATE = new State(C.EMPTY_TOKEN, C.MODE_UPPER, 0, 0);
- return State;
- }();
- var _default = State;
- exports.default = _default;
- /***/ }),
- /* 502 */
- /*!**********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/encoder/TokenHelpers.js ***!
- \**********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.add = add;
- exports.addBinaryShift = addBinaryShift;
- var _SimpleToken = _interopRequireDefault(__webpack_require__(/*! ./SimpleToken */ 503));
- var _BinaryShiftToken = _interopRequireDefault(__webpack_require__(/*! ./BinaryShiftToken */ 505));
- function addBinaryShift(token, start, byteCount) {
- // int bitCount = (byteCount * 8) + (byteCount <= 31 ? 10 : byteCount <= 62 ? 20 : 21);
- return new _BinaryShiftToken.default(token, start, byteCount);
- }
- function add(token, value, bitCount) {
- return new _SimpleToken.default(token, value, bitCount);
- }
- /***/ }),
- /* 503 */
- /*!*********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/encoder/SimpleToken.js ***!
- \*********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _Token = _interopRequireDefault(__webpack_require__(/*! ./Token */ 504));
- var _Integer = _interopRequireDefault(__webpack_require__(/*! ../../util/Integer */ 318));
- /*
- * Copyright 2013 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var SimpleToken = /** @class */function (_super) {
- __extends(SimpleToken, _super);
- function SimpleToken(previous, value, bitCount) {
- var _this = _super.call(this, previous) || this;
- _this.value = value;
- _this.bitCount = bitCount;
- return _this;
- }
- /**
- * @Override
- */
- SimpleToken.prototype.appendTo = function (bitArray, text) {
- bitArray.appendBits(this.value, this.bitCount);
- };
- SimpleToken.prototype.add = function (value, bitCount) {
- return new SimpleToken(this, value, bitCount);
- };
- SimpleToken.prototype.addBinaryShift = function (start, byteCount) {
- // no-op can't binary shift a simple token
- console.warn('addBinaryShift on SimpleToken, this simply returns a copy of this token');
- return new SimpleToken(this, start, byteCount);
- };
- /**
- * @Override
- */
- SimpleToken.prototype.toString = function () {
- var value = this.value & (1 << this.bitCount) - 1;
- value |= 1 << this.bitCount;
- return '<' + _Integer.default.toBinaryString(value | 1 << this.bitCount).substring(1) + '>';
- };
- return SimpleToken;
- }(_Token.default);
- var _default = SimpleToken;
- exports.default = _default;
- /***/ }),
- /* 504 */
- /*!***************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/encoder/Token.js ***!
- \***************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- /*
- * Copyright 2013 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var Token = /** @class */function () {
- function Token(previous) {
- this.previous = previous;
- }
- Token.prototype.getPrevious = function () {
- return this.previous;
- };
- return Token;
- }();
- var _default = Token;
- exports.default = _default;
- /***/ }),
- /* 505 */
- /*!**************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/encoder/BinaryShiftToken.js ***!
- \**************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _SimpleToken = _interopRequireDefault(__webpack_require__(/*! ./SimpleToken */ 503));
- /*
- * Copyright 2013 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var __extends = void 0 && (void 0).__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) {
- if (b.hasOwnProperty(p)) d[p] = b[p];
- }
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var BinaryShiftToken = /** @class */function (_super) {
- __extends(BinaryShiftToken, _super);
- function BinaryShiftToken(previous, binaryShiftStart, binaryShiftByteCount) {
- var _this = _super.call(this, previous, 0, 0) || this;
- _this.binaryShiftStart = binaryShiftStart;
- _this.binaryShiftByteCount = binaryShiftByteCount;
- return _this;
- }
- /**
- * @Override
- */
- BinaryShiftToken.prototype.appendTo = function (bitArray, text) {
- for (var i = 0; i < this.binaryShiftByteCount; i++) {
- if (i === 0 || i === 31 && this.binaryShiftByteCount <= 62) {
- // We need a header before the first character, and before
- // character 31 when the total byte code is <= 62
- bitArray.appendBits(31, 5); // BINARY_SHIFT
- if (this.binaryShiftByteCount > 62) {
- bitArray.appendBits(this.binaryShiftByteCount - 31, 16);
- } else if (i === 0) {
- // 1 <= binaryShiftByteCode <= 62
- bitArray.appendBits(Math.min(this.binaryShiftByteCount, 31), 5);
- } else {
- // 32 <= binaryShiftCount <= 62 and i == 31
- bitArray.appendBits(this.binaryShiftByteCount - 31, 5);
- }
- }
- bitArray.appendBits(text[this.binaryShiftStart + i], 8);
- }
- };
- BinaryShiftToken.prototype.addBinaryShift = function (start, byteCount) {
- // int bitCount = (byteCount * 8) + (byteCount <= 31 ? 10 : byteCount <= 62 ? 20 : 21);
- return new BinaryShiftToken(this, start, byteCount);
- };
- /**
- * @Override
- */
- BinaryShiftToken.prototype.toString = function () {
- return '<' + this.binaryShiftStart + '::' + (this.binaryShiftStart + this.binaryShiftByteCount - 1) + '>';
- };
- return BinaryShiftToken;
- }(_SimpleToken.default);
- var _default = BinaryShiftToken;
- exports.default = _default;
- /***/ }),
- /* 506 */
- /*!**************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/encoder/EncoderConstants.js ***!
- \**************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.MODE_UPPER = exports.MODE_PUNCT = exports.MODE_NAMES = exports.MODE_MIXED = exports.MODE_LOWER = exports.MODE_DIGIT = exports.EMPTY_TOKEN = void 0;
- var _SimpleToken = _interopRequireDefault(__webpack_require__(/*! ./SimpleToken */ 503));
- var /*final*/MODE_NAMES = ['UPPER', 'LOWER', 'DIGIT', 'MIXED', 'PUNCT'];
- exports.MODE_NAMES = MODE_NAMES;
- var /*final*/MODE_UPPER = 0; // 5 bits
- exports.MODE_UPPER = MODE_UPPER;
- var /*final*/MODE_LOWER = 1; // 5 bits
- exports.MODE_LOWER = MODE_LOWER;
- var /*final*/MODE_DIGIT = 2; // 4 bits
- exports.MODE_DIGIT = MODE_DIGIT;
- var /*final*/MODE_MIXED = 3; // 5 bits
- exports.MODE_MIXED = MODE_MIXED;
- var /*final*/MODE_PUNCT = 4; // 5 bits
- exports.MODE_PUNCT = MODE_PUNCT;
- var EMPTY_TOKEN = new _SimpleToken.default(null, 0, 0);
- exports.EMPTY_TOKEN = EMPTY_TOKEN;
- /***/ }),
- /* 507 */
- /*!********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/encoder/LatchTable.js ***!
- \********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.LATCH_TABLE = void 0;
- // The Latch Table shows, for each pair of Modes, the optimal method for
- // getting from one mode to another. In the worst possible case, this can
- // be up to 14 bits. In the best possible case, we are already there!
- // The high half-word of each entry gives the number of bits.
- // The low half-word of each entry are the actual bits necessary to change
- var LATCH_TABLE = [Int32Array.from([0, (5 << 16) + 28, (5 << 16) + 30, (5 << 16) + 29, (10 << 16) + (29 << 5) + 30 // UPPER -> MIXED -> PUNCT
- ]), Int32Array.from([(9 << 16) + (30 << 4) + 14, 0, (5 << 16) + 30, (5 << 16) + 29, (10 << 16) + (29 << 5) + 30 // LOWER -> MIXED -> PUNCT
- ]), Int32Array.from([(4 << 16) + 14, (9 << 16) + (14 << 5) + 28, 0, (9 << 16) + (14 << 5) + 29, (14 << 16) + (14 << 10) + (29 << 5) + 30
- // DIGIT -> UPPER -> MIXED -> PUNCT
- ]), Int32Array.from([(5 << 16) + 29, (5 << 16) + 28, (10 << 16) + (29 << 5) + 30, 0, (5 << 16) + 30 // MIXED -> PUNCT
- ]), Int32Array.from([(5 << 16) + 31, (10 << 16) + (31 << 5) + 28, (10 << 16) + (31 << 5) + 30, (10 << 16) + (31 << 5) + 29, 0])];
- exports.LATCH_TABLE = LATCH_TABLE;
- /***/ }),
- /* 508 */
- /*!********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/encoder/ShiftTable.js ***!
- \********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ 13);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.SHIFT_TABLE = void 0;
- exports.static_SHIFT_TABLE = static_SHIFT_TABLE;
- var _Arrays = _interopRequireDefault(__webpack_require__(/*! ../../util/Arrays */ 314));
- var C = _interopRequireWildcard(__webpack_require__(/*! ./EncoderConstants */ 506));
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
- var __values = void 0 && (void 0).__values || function (o) {
- var s = typeof Symbol === "function" && Symbol.iterator,
- m = s && o[s],
- i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function next() {
- if (o && i >= o.length) o = void 0;
- return {
- value: o && o[i++],
- done: !o
- };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- };
- function static_SHIFT_TABLE(SHIFT_TABLE) {
- var e_1, _a;
- try {
- for (var SHIFT_TABLE_1 = __values(SHIFT_TABLE), SHIFT_TABLE_1_1 = SHIFT_TABLE_1.next(); !SHIFT_TABLE_1_1.done; SHIFT_TABLE_1_1 = SHIFT_TABLE_1.next()) {
- var table = SHIFT_TABLE_1_1.value /*Int32Array*/;
- _Arrays.default.fill(table, -1);
- }
- } catch (e_1_1) {
- e_1 = {
- error: e_1_1
- };
- } finally {
- try {
- if (SHIFT_TABLE_1_1 && !SHIFT_TABLE_1_1.done && (_a = SHIFT_TABLE_1.return)) _a.call(SHIFT_TABLE_1);
- } finally {
- if (e_1) throw e_1.error;
- }
- }
- SHIFT_TABLE[C.MODE_UPPER][C.MODE_PUNCT] = 0;
- SHIFT_TABLE[C.MODE_LOWER][C.MODE_PUNCT] = 0;
- SHIFT_TABLE[C.MODE_LOWER][C.MODE_UPPER] = 28;
- SHIFT_TABLE[C.MODE_MIXED][C.MODE_PUNCT] = 0;
- SHIFT_TABLE[C.MODE_DIGIT][C.MODE_PUNCT] = 0;
- SHIFT_TABLE[C.MODE_DIGIT][C.MODE_UPPER] = 15;
- return SHIFT_TABLE;
- }
- var /*final*/SHIFT_TABLE = static_SHIFT_TABLE(_Arrays.default.createInt32Array(6, 6)); // mode shift codes, per table
- exports.SHIFT_TABLE = SHIFT_TABLE;
- /***/ }),
- /* 509 */
- /*!*****************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/encoder/CharMap.js ***!
- \*****************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ 13);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.CHAR_MAP = void 0;
- exports.static_CHAR_MAP = static_CHAR_MAP;
- var C = _interopRequireWildcard(__webpack_require__(/*! ./EncoderConstants */ 506));
- var _Arrays = _interopRequireDefault(__webpack_require__(/*! ../../util/Arrays */ 314));
- var _StringUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/StringUtils */ 321));
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
- function static_CHAR_MAP(CHAR_MAP) {
- var spaceCharCode = _StringUtils.default.getCharCode(' ');
- var pointCharCode = _StringUtils.default.getCharCode('.');
- var commaCharCode = _StringUtils.default.getCharCode(',');
- CHAR_MAP[C.MODE_UPPER][spaceCharCode] = 1;
- var zUpperCharCode = _StringUtils.default.getCharCode('Z');
- var aUpperCharCode = _StringUtils.default.getCharCode('A');
- for (var c = aUpperCharCode; c <= zUpperCharCode; c++) {
- CHAR_MAP[C.MODE_UPPER][c] = c - aUpperCharCode + 2;
- }
- CHAR_MAP[C.MODE_LOWER][spaceCharCode] = 1;
- var zLowerCharCode = _StringUtils.default.getCharCode('z');
- var aLowerCharCode = _StringUtils.default.getCharCode('a');
- for (var c = aLowerCharCode; c <= zLowerCharCode; c++) {
- CHAR_MAP[C.MODE_LOWER][c] = c - aLowerCharCode + 2;
- }
- CHAR_MAP[C.MODE_DIGIT][spaceCharCode] = 1;
- var nineCharCode = _StringUtils.default.getCharCode('9');
- var zeroCharCode = _StringUtils.default.getCharCode('0');
- for (var c = zeroCharCode; c <= nineCharCode; c++) {
- CHAR_MAP[C.MODE_DIGIT][c] = c - zeroCharCode + 2;
- }
- CHAR_MAP[C.MODE_DIGIT][commaCharCode] = 12;
- CHAR_MAP[C.MODE_DIGIT][pointCharCode] = 13;
- var mixedTable = ['\x00', ' ', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\b', '\t', '\n', '\x0b', '\f', '\r', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', '@', '\\', '^', '_', '`', '|', '~', '\x7f'];
- for (var i = 0; i < mixedTable.length; i++) {
- CHAR_MAP[C.MODE_MIXED][_StringUtils.default.getCharCode(mixedTable[i])] = i;
- }
- var punctTable = ['\x00', '\r', '\x00', '\x00', '\x00', '\x00', '!', '\'', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '[', ']', '{', '}'];
- for (var i = 0; i < punctTable.length; i++) {
- if (_StringUtils.default.getCharCode(punctTable[i]) > 0) {
- CHAR_MAP[C.MODE_PUNCT][_StringUtils.default.getCharCode(punctTable[i])] = i;
- }
- }
- return CHAR_MAP;
- }
- var CHAR_MAP = static_CHAR_MAP(_Arrays.default.createInt32Array(5, 256));
- exports.CHAR_MAP = CHAR_MAP;
- /***/ }),
- /* 510 */
- /*!************************************************!*\
- !*** E:/git/2021项目/v3-H5/utils/scanTheCode.js ***!
- \************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(uni) {
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.scanCode = scanCode;
- exports.scanTheCodeDataTreating = scanTheCodeDataTreating;
- var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ 50));
- var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 52));
- var _index = __webpack_require__(/*! @/pages/api/index.js */ 63);
- /*************** 扫码相关方法 ***************/
- // 公共扫码-方法
- function scanCode(path) {
- /*************** H5方法 ***************/
- /*************** 微信方法 ***************/
- uni.scanCode({
- onlyFromCamera: true,
- success: function success(res) {
- scanTheCodeDataTreating(path, res.result);
- },
- fail: function fail(err) {
- uni.showToast({
- mask: true,
- icon: "none",
- position: "center",
- title: err,
- duration: 2000
- });
- return false;
- }
- });
- }
- //公共扫码-参数处理方法
- function scanTheCodeDataTreating(path, result) {
- if (result.indexOf('type') != -1) {
- //项目二维码
- var list = result.split("?")[1].split("&");
- var codeData = {};
- list.forEach(function (item) {
- codeData[item.split("=")[0]] = item.split("=")[1];
- });
- if (codeData.type == 1 || codeData.type == 2 || codeData.type == 3 || codeData.type == 7 || codeData.type == 8 || codeData.type == 10 || codeData.type == 11 || codeData.type == 12 || codeData.type == 13 || codeData.type == 14) {
- // 基础扫码逻辑
- goCodePage(path, result);
- } else if (codeData.type == 5) {
- // 同位素实验室相关-暂时注释
- // laboratorySubPassOutIsotopeSubSignF(path,codeData.subId,result);
- uni.reLaunch({
- url: '/pages/views/saoCode/saoCode?q=' + encodeURIComponent(result)
- });
- } else if (codeData.type == 9) {
- chemicalAppletSelectStockInfoF(path, codeData.code);
- }
- } else {
- chemicalAppletSelectStockInfoF(path, result);
- }
- }
- //通用二维码页面
- function goCodePage(path, result) {
- if (path == 'home') {
- uni.reLaunch({
- url: '/pages/views/saoCode/saoCode?q=' + encodeURIComponent(result)
- });
- } else {
- uni.showToast({
- mask: true,
- icon: "none",
- position: "center",
- title: "当前页面无法使用该二维码",
- duration: 2000
- });
- setTimeout(function () {
- uni.navigateBack();
- }, 2000);
- }
- }
- //查询是否是同位素实验并且有签退
- function laboratorySubPassOutIsotopeSubSignF(_x, _x2, _x3) {
- return _laboratorySubPassOutIsotopeSubSignF.apply(this, arguments);
- } //扫码查询-化学品基本信息
- function _laboratorySubPassOutIsotopeSubSignF() {
- _laboratorySubPassOutIsotopeSubSignF = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(path, subId, result) {
- var _yield$laboratorySubP, data, obj;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- if (!(path == 'home')) {
- _context.next = 8;
- break;
- }
- _context.next = 3;
- return (0, _index.laboratorySubPassOutIsotopeSubSign)({
- subId: subId
- });
- case 3:
- _yield$laboratorySubP = _context.sent;
- data = _yield$laboratorySubP.data;
- if (data.code == 200) {
- if (data.data.isotope) {
- obj = {
- subId: subId,
- subName: data.data.subName,
- passOutId: data.data.passOutId
- };
- uni.navigateTo({
- url: "/pages_basics/views/photoInspection?item=" + encodeURIComponent(JSON.stringify(obj))
- });
- } else {
- uni.reLaunch({
- url: '/pages/views/saoCode/saoCode?q=' + encodeURIComponent(result)
- });
- }
- }
- _context.next = 10;
- break;
- case 8:
- uni.showToast({
- mask: true,
- icon: "none",
- position: "center",
- title: "当前页面无法使用该二维码",
- duration: 2000
- });
- setTimeout(function () {
- uni.navigateBack();
- }, 2000);
- case 10:
- case "end":
- return _context.stop();
- }
- }
- }, _callee);
- }));
- return _laboratorySubPassOutIsotopeSubSignF.apply(this, arguments);
- }
- function chemicalAppletSelectStockInfoF(_x4, _x5) {
- return _chemicalAppletSelectStockInfoF.apply(this, arguments);
- }
- function _chemicalAppletSelectStockInfoF() {
- _chemicalAppletSelectStockInfoF = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(path, code) {
- var _yield$chemicalApplet, data;
- return _regenerator.default.wrap(function _callee2$(_context2) {
- while (1) {
- switch (_context2.prev = _context2.next) {
- case 0:
- if (!(path == 'home')) {
- _context2.next = 8;
- break;
- }
- _context2.next = 3;
- return (0, _index.chemicalAppletSelectStockInfo)({
- tagCode: code
- });
- case 3:
- _yield$chemicalApplet = _context2.sent;
- data = _yield$chemicalApplet.data;
- if (data.code == 200) {
- if (data.data) {
- data.data.code = code;
- //化学品信息
- uni.navigateTo({
- url: "/pages_basics/views/chemicalsInfo/chemicalsInfo?item=" + encodeURIComponent(JSON.stringify(data.data))
- });
- } else {
- uni.showToast({
- mask: true,
- icon: "none",
- position: "center",
- title: '未找到相关信息,请扫描正确的二维码',
- duration: 2000
- });
- }
- }
- _context2.next = 10;
- break;
- case 8:
- uni.showToast({
- mask: true,
- icon: "none",
- position: "center",
- title: "当前页面无法使用该二维码",
- duration: 2000
- });
- setTimeout(function () {
- uni.navigateBack();
- }, 2000);
- case 10:
- case "end":
- return _context2.stop();
- }
- }
- }, _callee2);
- }));
- return _chemicalAppletSelectStockInfoF.apply(this, arguments);
- }
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
- /***/ }),
- /* 511 */,
- /* 512 */,
- /* 513 */,
- /* 514 */,
- /* 515 */,
- /* 516 */,
- /* 517 */,
- /* 518 */,
- /* 519 */,
- /* 520 */,
- /* 521 */,
- /* 522 */,
- /* 523 */,
- /* 524 */,
- /* 525 */,
- /* 526 */,
- /* 527 */,
- /* 528 */,
- /* 529 */,
- /* 530 */,
- /* 531 */,
- /* 532 */,
- /* 533 */,
- /* 534 */,
- /* 535 */,
- /* 536 */,
- /* 537 */,
- /* 538 */,
- /* 539 */,
- /* 540 */,
- /* 541 */,
- /* 542 */,
- /* 543 */,
- /* 544 */,
- /* 545 */,
- /* 546 */,
- /* 547 */,
- /* 548 */,
- /* 549 */,
- /* 550 */,
- /* 551 */,
- /* 552 */,
- /* 553 */,
- /* 554 */,
- /* 555 */,
- /* 556 */,
- /* 557 */,
- /* 558 */,
- /* 559 */,
- /* 560 */,
- /* 561 */,
- /* 562 */,
- /* 563 */,
- /* 564 */,
- /* 565 */,
- /* 566 */,
- /* 567 */,
- /* 568 */,
- /* 569 */,
- /* 570 */,
- /* 571 */,
- /* 572 */,
- /* 573 */,
- /* 574 */,
- /* 575 */,
- /* 576 */,
- /* 577 */,
- /* 578 */,
- /* 579 */,
- /* 580 */,
- /* 581 */,
- /* 582 */,
- /* 583 */,
- /* 584 */,
- /* 585 */,
- /* 586 */,
- /* 587 */,
- /* 588 */,
- /* 589 */,
- /* 590 */,
- /* 591 */,
- /* 592 */,
- /* 593 */
- /*!*****************************************************!*\
- !*** E:/git/2021项目/v3-H5/pages_basics/api/index.js ***!
- \*****************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.updateSignature = exports.systemUserSelectByPage = exports.systemUserPersonalData = exports.systemUserEditUser = exports.systemUserDetail = exports.systemMineWarningNoticeList = exports.systemMineWarningNoticeDetail = exports.systemMineUserEdit = exports.systemMineLinkGetEquipmentDetail = exports.systemMineLinkGetEducationExamDetail = exports.systemMineLinkGetCagePositionDetail = exports.querygenSign = exports.querySignature = exports.menuLinkPost = exports.laboratoryEventFindByEventId = exports.laboratoryAppletSignSubList = exports.laboratoryAppletSignOutSubmit = exports.laboratoryAppletPhotoInspectList = exports.laboratoryAppletPassOutList = exports.laboratoryAppletPassOutCount = exports.laboratoryAppletOutCheckList = exports.laboratoryAppletAddPhotoInspect = exports.gradingControlFinish = exports.gradingControlDetail = exports.gradingControlAdd = exports.gradingControl = exports.chemicalAppletSelectStockRecord = exports.authNumCaptchaNotRegistered = exports.authNumCaptcha = exports.authForgetPassword = void 0;
- var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
- var _request = __webpack_require__(/*! @/api/request/request.js */ 64);
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
- //用户修改头像接口
- var systemMineUserEdit = function systemMineUserEdit(data) {
- return (0, _request.apiResquest)({
- url: "/system/mine/user/edit",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //预警记录-列表
- exports.systemMineUserEdit = systemMineUserEdit;
- var systemMineWarningNoticeList = function systemMineWarningNoticeList(data) {
- return (0, _request.apiResquest)({
- url: "/system/mine/warningNoticeList",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //预警记录-非预案详情
- exports.systemMineWarningNoticeList = systemMineWarningNoticeList;
- var systemMineWarningNoticeDetail = function systemMineWarningNoticeDetail(data) {
- return (0, _request.apiResquest)({
- url: "/system/mine/warningNoticeDetail",
- method: 'get',
- data: _objectSpread({}, data)
- });
- };
- //预警记录-预案详情
- exports.systemMineWarningNoticeDetail = systemMineWarningNoticeDetail;
- var laboratoryEventFindByEventId = function laboratoryEventFindByEventId(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/event/findByEventId",
- method: 'get',
- data: _objectSpread({}, data)
- });
- };
- //进出记录/离开检查-实验室列表
- exports.laboratoryEventFindByEventId = laboratoryEventFindByEventId;
- var laboratoryAppletSignSubList = function laboratoryAppletSignSubList(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/applet/signSubList",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //进出记录-头部数据
- exports.laboratoryAppletSignSubList = laboratoryAppletSignSubList;
- var laboratoryAppletPassOutCount = function laboratoryAppletPassOutCount(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/applet/passOutCount",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //进出记录-列表
- exports.laboratoryAppletPassOutCount = laboratoryAppletPassOutCount;
- var laboratoryAppletPassOutList = function laboratoryAppletPassOutList(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/applet/passOutList",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //进出记录-照片列表
- exports.laboratoryAppletPassOutList = laboratoryAppletPassOutList;
- var laboratoryAppletPhotoInspectList = function laboratoryAppletPhotoInspectList(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/applet/photoInspectList",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //离开检查-检查项查询
- exports.laboratoryAppletPhotoInspectList = laboratoryAppletPhotoInspectList;
- var laboratoryAppletOutCheckList = function laboratoryAppletOutCheckList(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/applet/outCheckList",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //离开检查-提交
- exports.laboratoryAppletOutCheckList = laboratoryAppletOutCheckList;
- var laboratoryAppletAddPhotoInspect = function laboratoryAppletAddPhotoInspect(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/applet/addPhotoInspect",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //离开检查-直接离开
- exports.laboratoryAppletAddPhotoInspect = laboratoryAppletAddPhotoInspect;
- var laboratoryAppletSignOutSubmit = function laboratoryAppletSignOutSubmit(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/applet/signOutSubmit",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //查询用户电子签名
- exports.laboratoryAppletSignOutSubmit = laboratoryAppletSignOutSubmit;
- var querySignature = function querySignature(data) {
- return (0, _request.apiResquest)({
- url: "/system/user/querySignature",
- method: 'get',
- data: _objectSpread({}, data)
- });
- };
- //小程序电子签名抠图生成图片
- exports.querySignature = querySignature;
- var querygenSign = function querygenSign(data) {
- return (0, _request.apiResquest)({
- url: "/system/user/genSign",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //小程序用户修改签名
- exports.querygenSign = querygenSign;
- var updateSignature = function updateSignature(data) {
- return (0, _request.apiResquest)({
- url: "/system/user/appSignature",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //设备资产管理
- exports.updateSignature = updateSignature;
- var systemMineLinkGetEquipmentDetail = function systemMineLinkGetEquipmentDetail(data) {
- return (0, _request.apiResquest)({
- url: "/system/mine/link/getEquipmentDetail",
- method: 'get',
- data: _objectSpread({}, data)
- });
- };
- //笼位管理
- exports.systemMineLinkGetEquipmentDetail = systemMineLinkGetEquipmentDetail;
- var systemMineLinkGetCagePositionDetail = function systemMineLinkGetCagePositionDetail(data) {
- return (0, _request.apiResquest)({
- url: "/system/mine/link/getCagePositionDetail",
- method: 'get',
- data: _objectSpread({}, data)
- });
- };
- //安全教育与考试
- exports.systemMineLinkGetCagePositionDetail = systemMineLinkGetCagePositionDetail;
- var systemMineLinkGetEducationExamDetail = function systemMineLinkGetEducationExamDetail(data) {
- return (0, _request.apiResquest)({
- url: "/system/mine/link/getEducationExamDetail",
- method: 'get',
- data: _objectSpread({}, data)
- });
- };
- //设备资产管理/笼位管理获取跳转参数
- exports.systemMineLinkGetEducationExamDetail = systemMineLinkGetEducationExamDetail;
- var menuLinkPost = function menuLinkPost(url, data) {
- return (0, _request.apiResquestOutside)({
- url: url,
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //分级管控未完成工作列表
- exports.menuLinkPost = menuLinkPost;
- var gradingControl = function gradingControl(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/app/lab/manage/havingList",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //完成分级管控工作
- exports.gradingControl = gradingControl;
- var gradingControlAdd = function gradingControlAdd(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/app/lab/manage/finish",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //分级管控已完成工作列表
- exports.gradingControlAdd = gradingControlAdd;
- var gradingControlFinish = function gradingControlFinish(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/app/lab/manage/finishList",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //分级管控详细信息
- exports.gradingControlFinish = gradingControlFinish;
- var gradingControlDetail = function gradingControlDetail(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/app/lab/manage/getInfo/" + data,
- method: 'GET'
- //data: data,
- });
- };
- //通过手机号码-获取数字验证码(需要手机号已存在)
- exports.gradingControlDetail = gradingControlDetail;
- var authNumCaptcha = function authNumCaptcha(data) {
- return (0, _request.apiResquest)({
- url: "/auth/numCaptcha",
- method: 'get',
- data: _objectSpread({}, data)
- });
- };
- //通过手机号码-获取数字验证码(需要手机号不存在)
- exports.authNumCaptcha = authNumCaptcha;
- var authNumCaptchaNotRegistered = function authNumCaptchaNotRegistered(data) {
- return (0, _request.apiResquest)({
- url: "/auth/numCaptchaNotRegistered",
- method: 'get',
- data: _objectSpread({}, data)
- });
- };
- //忘记密码/修改密码-提交
- exports.authNumCaptchaNotRegistered = authNumCaptchaNotRegistered;
- var authForgetPassword = function authForgetPassword(data) {
- return (0, _request.apiResquest)({
- url: "/auth/forgetPassword",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //查询用户信息-(初始密码/手机号/导师/身份)
- exports.authForgetPassword = authForgetPassword;
- var systemUserPersonalData = function systemUserPersonalData(data) {
- return (0, _request.apiResquest)({
- url: "/system/user/personalData",
- method: 'get'
- });
- };
- //根据用户id查询用户详情
- exports.systemUserPersonalData = systemUserPersonalData;
- var systemUserDetail = function systemUserDetail(data) {
- return (0, _request.apiResquest)({
- url: "/system/user/detail",
- method: 'get',
- data: _objectSpread({}, data)
- });
- };
- //查询导师列表
- exports.systemUserDetail = systemUserDetail;
- var systemUserSelectByPage = function systemUserSelectByPage(data) {
- return (0, _request.apiResquest)({
- url: "/system/user/selectByPage",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //完善用户信息-提交
- exports.systemUserSelectByPage = systemUserSelectByPage;
- var systemUserEditUser = function systemUserEditUser(data) {
- return (0, _request.apiResquest)({
- url: "/system/user/editUser",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //扫码查询-化学品使用记录
- exports.systemUserEditUser = systemUserEditUser;
- var chemicalAppletSelectStockRecord = function chemicalAppletSelectStockRecord(data) {
- return (0, _request.apiResquest)({
- url: "/chemical/applet/selectStockRecord",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- exports.chemicalAppletSelectStockRecord = chemicalAppletSelectStockRecord;
- /***/ }),
- /* 594 */,
- /* 595 */,
- /* 596 */,
- /* 597 */,
- /* 598 */,
- /* 599 */,
- /* 600 */,
- /* 601 */,
- /* 602 */,
- /* 603 */,
- /* 604 */,
- /* 605 */,
- /* 606 */,
- /* 607 */,
- /* 608 */,
- /* 609 */,
- /* 610 */,
- /* 611 */,
- /* 612 */,
- /* 613 */,
- /* 614 */,
- /* 615 */,
- /* 616 */,
- /* 617 */,
- /* 618 */,
- /* 619 */,
- /* 620 */,
- /* 621 */,
- /* 622 */,
- /* 623 */,
- /* 624 */,
- /* 625 */,
- /* 626 */,
- /* 627 */,
- /* 628 */,
- /* 629 */,
- /* 630 */,
- /* 631 */,
- /* 632 */,
- /* 633 */,
- /* 634 */,
- /* 635 */,
- /* 636 */,
- /* 637 */,
- /* 638 */,
- /* 639 */,
- /* 640 */,
- /* 641 */,
- /* 642 */,
- /* 643 */,
- /* 644 */,
- /* 645 */,
- /* 646 */,
- /* 647 */,
- /* 648 */,
- /* 649 */,
- /* 650 */,
- /* 651 */,
- /* 652 */,
- /* 653 */,
- /* 654 */,
- /* 655 */,
- /* 656 */,
- /* 657 */,
- /* 658 */,
- /* 659 */,
- /* 660 */,
- /* 661 */,
- /* 662 */,
- /* 663 */,
- /* 664 */,
- /* 665 */,
- /* 666 */,
- /* 667 */,
- /* 668 */,
- /* 669 */,
- /* 670 */,
- /* 671 */,
- /* 672 */,
- /* 673 */,
- /* 674 */
- /*!*****************************************************!*\
- !*** E:/git/2021项目/v3-H5/pages_manage/api/index.js ***!
- \*****************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.applyRemoteOpenLockConfirm = applyRemoteOpenLockConfirm;
- exports.laboratoryAppletGetSubDetailInfo = exports.laboratoryAppletGetApplyDetails = exports.laboratoryAppletEditApp = exports.laboratoryAppletAuditListByApply = exports.iotAppSpeakerPlayVoice = exports.iotAppSpeakerFindHorn = exports.iotAppSensorFindBySubId = exports.iotAppHardwareOperatingHardware = exports.iotAppHardwareFindByType = exports.iotAppDeviceFindByType = void 0;
- exports.laboratoryAppletLabLockApplyDelete = laboratoryAppletLabLockApplyDelete;
- exports.laboratoryAppletLabLockApplyList = laboratoryAppletLabLockApplyList;
- exports.laboratoryAppletSubList = void 0;
- exports.laboratoryApplyAddAddApply = laboratoryApplyAddAddApply;
- exports.laboratoryApplyGetUserInfo = laboratoryApplyGetUserInfo;
- exports.laboratoryApplyRemoteOpenLock = laboratoryApplyRemoteOpenLock;
- exports.laboratoryGradeManageList = exports.laboratoryGradeManageExecute = exports.laboratoryExitRelayOpenLight = exports.laboratoryExitRelayCloseLight = exports.laboratoryExitLineGetRedisEvacuation = exports.laboratoryExitLineExecuteEvacuation = exports.laboratoryClassTypeGetList = exports.laboratoryClassLevelGetList = exports.laboratoryBigViewSelectTriggerInfo = exports.laboratoryBigViewGetFloorByBigView = exports.laboratoryBigViewGetBuildByBigView = void 0;
- exports.laboratoryLabOpenLockLogUpdateLockData = laboratoryLabOpenLockLogUpdateLockData;
- exports.systemDeptDropList = exports.laboratoryexitLineEndEvacuation = exports.laboratorySubRelInfoSelectAdminBySubPage = exports.laboratoryPlanCloseRiskPlan = void 0;
- exports.systemSubjectGetAppSubject = systemSubjectGetAppSubject;
- exports.systemSubjectGetAppSubjectByLogin = systemSubjectGetAppSubjectByLogin;
- var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
- var _request = __webpack_require__(/*! @/api/request/request.js */ 64);
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
- //实验室-列表-获取学院列表下拉列表
- var systemDeptDropList = function systemDeptDropList(data) {
- return (0, _request.apiResquest)({
- url: "/system/dept/dropList",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //实验室-列表-获取分类下拉列表
- exports.systemDeptDropList = systemDeptDropList;
- var laboratoryClassTypeGetList = function laboratoryClassTypeGetList(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/classType/getList",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //实验室-列表-获取分级
- exports.laboratoryClassTypeGetList = laboratoryClassTypeGetList;
- var laboratoryClassLevelGetList = function laboratoryClassLevelGetList(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/classLevel/getList",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //实验室-列表
- exports.laboratoryClassLevelGetList = laboratoryClassLevelGetList;
- var laboratoryAppletSubList = function laboratoryAppletSubList(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/applet/subList",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //实验室-详情
- exports.laboratoryAppletSubList = laboratoryAppletSubList;
- var laboratoryAppletGetSubDetailInfo = function laboratoryAppletGetSubDetailInfo(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/applet/getSubDetailInfo",
- method: 'GET',
- data: data
- });
- };
- //实验室-查询传感器状态
- exports.laboratoryAppletGetSubDetailInfo = laboratoryAppletGetSubDetailInfo;
- var iotAppSensorFindBySubId = function iotAppSensorFindBySubId(data) {
- return (0, _request.apiResquest)({
- url: "/iot/app/sensor/findBySubId",
- method: 'GET',
- data: data
- });
- };
- //实验室-查询硬件设备
- exports.iotAppSensorFindBySubId = iotAppSensorFindBySubId;
- var iotAppHardwareFindByType = function iotAppHardwareFindByType(data) {
- return (0, _request.apiResquest)({
- url: "/iot/app/hardware/findByType",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //实验室-硬件设备-开关
- exports.iotAppHardwareFindByType = iotAppHardwareFindByType;
- var iotAppHardwareOperatingHardware = function iotAppHardwareOperatingHardware(data) {
- return (0, _request.apiResquest)({
- url: "/iot/app/hardware/operatingHardware",
- method: 'GET',
- data: data
- });
- };
- //实验室-查询物联设备
- exports.iotAppHardwareOperatingHardware = iotAppHardwareOperatingHardware;
- var iotAppDeviceFindByType = function iotAppDeviceFindByType(data) {
- return (0, _request.apiResquest)({
- url: "/iot/app/device/findByType",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //实验室-查询喇叭列表
- exports.iotAppDeviceFindByType = iotAppDeviceFindByType;
- var iotAppSpeakerFindHorn = function iotAppSpeakerFindHorn(data) {
- return (0, _request.apiResquest)({
- url: "/iot/app/speaker/findHorn",
- method: 'GET',
- data: data
- });
- };
- //实验室-喇叭播放
- exports.iotAppSpeakerFindHorn = iotAppSpeakerFindHorn;
- var iotAppSpeakerPlayVoice = function iotAppSpeakerPlayVoice(data) {
- return (0, _request.apiResquest)({
- url: "/iot/app/speaker/playVoice",
- method: 'GET',
- data: data
- });
- };
- //应急处置-查询楼栋楼层
- exports.iotAppSpeakerPlayVoice = iotAppSpeakerPlayVoice;
- var laboratoryBigViewGetBuildByBigView = function laboratoryBigViewGetBuildByBigView(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/bigView/getBuildByBigView",
- method: 'GET',
- data: data
- });
- };
- //应急疏散-新实验室列表(替代原楼栋-楼层-实验室页面)
- exports.laboratoryBigViewGetBuildByBigView = laboratoryBigViewGetBuildByBigView;
- var laboratorySubRelInfoSelectAdminBySubPage = function laboratorySubRelInfoSelectAdminBySubPage(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/subRelInfo/selectAdminBySubPage",
- method: 'post',
- data: data
- });
- };
- /****************疏散相关接口****************/
- //查询当前用户下的预案触发数据
- exports.laboratorySubRelInfoSelectAdminBySubPage = laboratorySubRelInfoSelectAdminBySubPage;
- var laboratoryBigViewSelectTriggerInfo = function laboratoryBigViewSelectTriggerInfo(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/bigView/selectTriggerInfo",
- method: 'GET',
- data: data
- });
- };
- //-应急处置-楼层布局数据
- exports.laboratoryBigViewSelectTriggerInfo = laboratoryBigViewSelectTriggerInfo;
- var laboratoryBigViewGetFloorByBigView = function laboratoryBigViewGetFloorByBigView(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/bigView/getFloorByBigView",
- method: 'GET',
- data: data
- });
- };
- //查询当前发生的疏散
- exports.laboratoryBigViewGetFloorByBigView = laboratoryBigViewGetFloorByBigView;
- var laboratoryExitLineGetRedisEvacuation = function laboratoryExitLineGetRedisEvacuation(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/exitLine/getRedisEvacuation",
- method: 'post',
- data: data
- });
- };
- //应急处置-执行疏散
- exports.laboratoryExitLineGetRedisEvacuation = laboratoryExitLineGetRedisEvacuation;
- var laboratoryExitLineExecuteEvacuation = function laboratoryExitLineExecuteEvacuation(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/exitLine/executeEvacuation",
- method: 'post',
- data: data
- });
- };
- //应急处置-结束疏散
- exports.laboratoryExitLineExecuteEvacuation = laboratoryExitLineExecuteEvacuation;
- var laboratoryexitLineEndEvacuation = function laboratoryexitLineEndEvacuation(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/exitLine/endEvacuation",
- method: 'post',
- data: data
- });
- };
- //应急处置-开灯
- exports.laboratoryexitLineEndEvacuation = laboratoryexitLineEndEvacuation;
- var laboratoryExitRelayOpenLight = function laboratoryExitRelayOpenLight(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/exitRelay/openLight",
- method: 'post',
- data: data
- });
- };
- //应急处置-关灯
- exports.laboratoryExitRelayOpenLight = laboratoryExitRelayOpenLight;
- var laboratoryExitRelayCloseLight = function laboratoryExitRelayCloseLight(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/exitRelay/closeLight",
- method: 'post',
- data: data
- });
- };
- //应急处置-结束预案
- exports.laboratoryExitRelayCloseLight = laboratoryExitRelayCloseLight;
- var laboratoryPlanCloseRiskPlan = function laboratoryPlanCloseRiskPlan(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/plan/closeRiskPlan",
- method: 'GET',
- data: data
- });
- };
- //安全准入审核列表接口
- exports.laboratoryPlanCloseRiskPlan = laboratoryPlanCloseRiskPlan;
- var laboratoryAppletAuditListByApply = function laboratoryAppletAuditListByApply(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/applet/auditListByApply",
- method: 'POST',
- data: _objectSpread({}, data)
- });
- };
- //审核信息详情(管理端)
- exports.laboratoryAppletAuditListByApply = laboratoryAppletAuditListByApply;
- var laboratoryAppletGetApplyDetails = function laboratoryAppletGetApplyDetails(data) {
- return (0, _request.apiResquest)({
- url: "/laboratory/applet/getApplyDetails",
- method: 'GET',
- data: data
- });
- };
- //安全准入审批接口
- exports.laboratoryAppletGetApplyDetails = laboratoryAppletGetApplyDetails;
- var laboratoryAppletEditApp = function laboratoryAppletEditApp(data) {
- return (0, _request.apiResquest)({
- url: '/laboratory/applet/editApp',
- method: 'POST',
- data: data
- });
- };
- //分级管控-列表
- exports.laboratoryAppletEditApp = laboratoryAppletEditApp;
- var laboratoryGradeManageList = function laboratoryGradeManageList(data) {
- return (0, _request.apiResquest)({
- url: '/laboratory/gradeManage/list',
- method: 'POST',
- data: data
- });
- };
- //分级管控-执行
- exports.laboratoryGradeManageList = laboratoryGradeManageList;
- var laboratoryGradeManageExecute = function laboratoryGradeManageExecute(data) {
- return (0, _request.apiResquest)({
- url: '/laboratory/gradeManage/execute',
- method: 'POST',
- data: data
- });
- };
- /* *门禁授权* */
- //授权开门-查询实验室列表
- exports.laboratoryGradeManageExecute = laboratoryGradeManageExecute;
- function systemSubjectGetAppSubject(data) {
- return (0, _request.apiResquest)({
- url: '/system/subject/getAppSubject',
- method: 'post',
- data: _objectSpread({}, data)
- });
- }
- //授权开门-查询被授权人
- function laboratoryApplyGetUserInfo(data) {
- return (0, _request.apiResquest)({
- url: '/laboratory/apply/getUserInfo',
- method: 'post',
- data: _objectSpread({}, data)
- });
- }
- //授权开门-授权
- function laboratoryApplyAddAddApply(data) {
- return (0, _request.apiResquest)({
- url: '/laboratory/apply/addAddApply',
- method: 'post',
- data: _objectSpread({}, data)
- });
- }
- //远程开门-开门
- function laboratoryApplyRemoteOpenLock(data) {
- return (0, _request.apiResquest)({
- url: '/laboratory/apply/remoteOpenLock',
- method: 'post',
- data: _objectSpread({}, data)
- });
- }
- //开门5秒后状态查询
- function applyRemoteOpenLockConfirm(data) {
- return (0, _request.apiResquest)({
- url: '/laboratory/apply/remoteOpenLock/confirm',
- method: 'GET',
- data: data
- });
- }
- //授权记录
- function laboratoryAppletLabLockApplyList(data) {
- return (0, _request.apiResquest)({
- url: '/laboratory/applet/labLockApply/list',
- method: 'post',
- data: _objectSpread({}, data)
- });
- }
- //删除-授权记录
- function laboratoryAppletLabLockApplyDelete(data) {
- return (0, _request.apiResquest)({
- url: '/laboratory/applet/labLockApply/delete',
- method: 'post',
- data: _objectSpread({}, data)
- });
- }
- //查询-负责人/安全员 所属的实验室列表
- function systemSubjectGetAppSubjectByLogin(data) {
- return (0, _request.apiResquest)({
- url: '/system/subject/getAppSubjectByLogin',
- method: 'post',
- data: _objectSpread({}, data)
- });
- }
- //远程开门-记录开门时间/开门状态
- function laboratoryLabOpenLockLogUpdateLockData(data) {
- return (0, _request.apiResquest)({
- url: '/laboratory/labOpenLockLog/updateLockData',
- method: 'post',
- data: _objectSpread({}, data)
- });
- }
- /***/ }),
- /* 675 */,
- /* 676 */,
- /* 677 */,
- /* 678 */,
- /* 679 */,
- /* 680 */,
- /* 681 */,
- /* 682 */,
- /* 683 */,
- /* 684 */,
- /* 685 */,
- /* 686 */,
- /* 687 */,
- /* 688 */,
- /* 689 */,
- /* 690 */,
- /* 691 */,
- /* 692 */,
- /* 693 */,
- /* 694 */,
- /* 695 */,
- /* 696 */,
- /* 697 */,
- /* 698 */,
- /* 699 */,
- /* 700 */,
- /* 701 */,
- /* 702 */,
- /* 703 */,
- /* 704 */,
- /* 705 */,
- /* 706 */,
- /* 707 */,
- /* 708 */,
- /* 709 */,
- /* 710 */,
- /* 711 */,
- /* 712 */,
- /* 713 */,
- /* 714 */,
- /* 715 */,
- /* 716 */,
- /* 717 */,
- /* 718 */,
- /* 719 */,
- /* 720 */,
- /* 721 */,
- /* 722 */,
- /* 723 */,
- /* 724 */,
- /* 725 */,
- /* 726 */,
- /* 727 */,
- /* 728 */,
- /* 729 */,
- /* 730 */,
- /* 731 */,
- /* 732 */,
- /* 733 */,
- /* 734 */,
- /* 735 */,
- /* 736 */,
- /* 737 */,
- /* 738 */,
- /* 739 */,
- /* 740 */,
- /* 741 */,
- /* 742 */,
- /* 743 */,
- /* 744 */,
- /* 745 */,
- /* 746 */,
- /* 747 */,
- /* 748 */,
- /* 749 */,
- /* 750 */,
- /* 751 */,
- /* 752 */,
- /* 753 */,
- /* 754 */,
- /* 755 */,
- /* 756 */,
- /* 757 */,
- /* 758 */,
- /* 759 */,
- /* 760 */,
- /* 761 */,
- /* 762 */,
- /* 763 */,
- /* 764 */,
- /* 765 */,
- /* 766 */,
- /* 767 */,
- /* 768 */,
- /* 769 */,
- /* 770 */,
- /* 771 */,
- /* 772 */,
- /* 773 */,
- /* 774 */,
- /* 775 */,
- /* 776 */,
- /* 777 */,
- /* 778 */,
- /* 779 */,
- /* 780 */,
- /* 781 */,
- /* 782 */,
- /* 783 */,
- /* 784 */,
- /* 785 */,
- /* 786 */,
- /* 787 */,
- /* 788 */,
- /* 789 */,
- /* 790 */,
- /* 791 */,
- /* 792 */,
- /* 793 */,
- /* 794 */,
- /* 795 */,
- /* 796 */,
- /* 797 */,
- /* 798 */,
- /* 799 */,
- /* 800 */,
- /* 801 */,
- /* 802 */,
- /* 803 */,
- /* 804 */,
- /* 805 */,
- /* 806 */,
- /* 807 */,
- /* 808 */,
- /* 809 */,
- /* 810 */,
- /* 811 */,
- /* 812 */,
- /* 813 */,
- /* 814 */,
- /* 815 */,
- /* 816 */,
- /* 817 */,
- /* 818 */,
- /* 819 */,
- /* 820 */,
- /* 821 */,
- /* 822 */,
- /* 823 */,
- /* 824 */,
- /* 825 */,
- /* 826 */,
- /* 827 */,
- /* 828 */,
- /* 829 */,
- /* 830 */,
- /* 831 */,
- /* 832 */,
- /* 833 */,
- /* 834 */,
- /* 835 */,
- /* 836 */,
- /* 837 */,
- /* 838 */,
- /* 839 */,
- /* 840 */,
- /* 841 */,
- /* 842 */,
- /* 843 */,
- /* 844 */,
- /* 845 */,
- /* 846 */,
- /* 847 */,
- /* 848 */,
- /* 849 */,
- /* 850 */,
- /* 851 */,
- /* 852 */,
- /* 853 */,
- /* 854 */,
- /* 855 */,
- /* 856 */,
- /* 857 */,
- /* 858 */,
- /* 859 */,
- /* 860 */,
- /* 861 */,
- /* 862 */,
- /* 863 */,
- /* 864 */
- /*!******************************************!*\
- !*** E:/git/2021项目/v3-H5/utils/index.js ***!
- \******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(uni) {
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.controlsRestrictVerify = controlsRestrictVerify;
- exports.itoOrVideoLimits = itoOrVideoLimits;
- exports.pageRestrictVerify = pageRestrictVerify;
- var _config = __webpack_require__(/*! @/api/request/config.js */ 33);
- /* 操作权限验证
- * str 为权限字符 用于匹配操作角色的字符
- * str === performEvacuation 应急疏散操作权限
- * str === checkGentle 安全检查
- */
- function controlsRestrictVerify(str) {
- if (str) {
- var controlsRestrict = uni.getStorageSync('controlsRestrict');
- return controlsRestrict.indexOf(str) != -1;
- } else {
- return false;
- }
- }
- /* 页面权限验证
- * str 为权限字符 用于匹配操作角色的字符
- */
- function pageRestrictVerify(str) {
- if (str) {
- var permissions = uni.getStorageSync('permissions') + '';
- return permissions.indexOf(str) != -1;
- } else {
- return false;
- }
- }
- /* 硬件控制与视频监控权限验证(校级管理员/院级管理员/实验室管理员)
- subAdminId 传入的实验室管理员ID
- schoolId 校级管理员身份ID
- collegeId 院级管理员身份ID
- userInfo.position 当前用户身份ID (系统用户为NULL)
- userInfo.userId 当前用户userID
- */
- function itoOrVideoLimits(subAdminId) {
- var userInfo = uni.getStorageSync('user');
- var schoolId = _config.config.schoolId;
- var collegeId = _config.config.collegeId;
- if (userInfo.position == null) {
- //如果是管理员(系统用户)
- return true;
- } else if (userInfo.position == schoolId || userInfo.position == collegeId) {
- //如果是校级管理员/院级管理员
- return true;
- } else if (userInfo.userId == subAdminId) {
- //如果当前用户userId 与 管理员ID相等
- return true;
- } else {
- return false;
- }
- }
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
- /***/ }),
- /* 865 */,
- /* 866 */,
- /* 867 */,
- /* 868 */,
- /* 869 */,
- /* 870 */,
- /* 871 */,
- /* 872 */,
- /* 873 */,
- /* 874 */,
- /* 875 */,
- /* 876 */,
- /* 877 */,
- /* 878 */,
- /* 879 */,
- /* 880 */,
- /* 881 */,
- /* 882 */,
- /* 883 */,
- /* 884 */,
- /* 885 */,
- /* 886 */,
- /* 887 */,
- /* 888 */,
- /* 889 */,
- /* 890 */,
- /* 891 */,
- /* 892 */,
- /* 893 */,
- /* 894 */,
- /* 895 */,
- /* 896 */,
- /* 897 */,
- /* 898 */,
- /* 899 */,
- /* 900 */,
- /* 901 */,
- /* 902 */,
- /* 903 */,
- /* 904 */,
- /* 905 */,
- /* 906 */,
- /* 907 */,
- /* 908 */,
- /* 909 */,
- /* 910 */,
- /* 911 */,
- /* 912 */,
- /* 913 */,
- /* 914 */,
- /* 915 */,
- /* 916 */,
- /* 917 */,
- /* 918 */,
- /* 919 */,
- /* 920 */,
- /* 921 */,
- /* 922 */,
- /* 923 */,
- /* 924 */,
- /* 925 */,
- /* 926 */,
- /* 927 */,
- /* 928 */,
- /* 929 */,
- /* 930 */,
- /* 931 */,
- /* 932 */,
- /* 933 */,
- /* 934 */,
- /* 935 */,
- /* 936 */,
- /* 937 */,
- /* 938 */,
- /* 939 */,
- /* 940 */,
- /* 941 */,
- /* 942 */,
- /* 943 */,
- /* 944 */,
- /* 945 */,
- /* 946 */,
- /* 947 */,
- /* 948 */,
- /* 949 */,
- /* 950 */,
- /* 951 */
- /*!*******************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/uni_modules/uni-icons/components/uni-icons/uniicons_file_vue.js ***!
- \*******************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.fontData = void 0;
- var fontData = [{
- "font_class": "arrow-down",
- "unicode": "\uE6BE"
- }, {
- "font_class": "arrow-left",
- "unicode": "\uE6BC"
- }, {
- "font_class": "arrow-right",
- "unicode": "\uE6BB"
- }, {
- "font_class": "arrow-up",
- "unicode": "\uE6BD"
- }, {
- "font_class": "auth",
- "unicode": "\uE6AB"
- }, {
- "font_class": "auth-filled",
- "unicode": "\uE6CC"
- }, {
- "font_class": "back",
- "unicode": "\uE6B9"
- }, {
- "font_class": "bars",
- "unicode": "\uE627"
- }, {
- "font_class": "calendar",
- "unicode": "\uE6A0"
- }, {
- "font_class": "calendar-filled",
- "unicode": "\uE6C0"
- }, {
- "font_class": "camera",
- "unicode": "\uE65A"
- }, {
- "font_class": "camera-filled",
- "unicode": "\uE658"
- }, {
- "font_class": "cart",
- "unicode": "\uE631"
- }, {
- "font_class": "cart-filled",
- "unicode": "\uE6D0"
- }, {
- "font_class": "chat",
- "unicode": "\uE65D"
- }, {
- "font_class": "chat-filled",
- "unicode": "\uE659"
- }, {
- "font_class": "chatboxes",
- "unicode": "\uE696"
- }, {
- "font_class": "chatboxes-filled",
- "unicode": "\uE692"
- }, {
- "font_class": "chatbubble",
- "unicode": "\uE697"
- }, {
- "font_class": "chatbubble-filled",
- "unicode": "\uE694"
- }, {
- "font_class": "checkbox",
- "unicode": "\uE62B"
- }, {
- "font_class": "checkbox-filled",
- "unicode": "\uE62C"
- }, {
- "font_class": "checkmarkempty",
- "unicode": "\uE65C"
- }, {
- "font_class": "circle",
- "unicode": "\uE65B"
- }, {
- "font_class": "circle-filled",
- "unicode": "\uE65E"
- }, {
- "font_class": "clear",
- "unicode": "\uE66D"
- }, {
- "font_class": "close",
- "unicode": "\uE673"
- }, {
- "font_class": "closeempty",
- "unicode": "\uE66C"
- }, {
- "font_class": "cloud-download",
- "unicode": "\uE647"
- }, {
- "font_class": "cloud-download-filled",
- "unicode": "\uE646"
- }, {
- "font_class": "cloud-upload",
- "unicode": "\uE645"
- }, {
- "font_class": "cloud-upload-filled",
- "unicode": "\uE648"
- }, {
- "font_class": "color",
- "unicode": "\uE6CF"
- }, {
- "font_class": "color-filled",
- "unicode": "\uE6C9"
- }, {
- "font_class": "compose",
- "unicode": "\uE67F"
- }, {
- "font_class": "contact",
- "unicode": "\uE693"
- }, {
- "font_class": "contact-filled",
- "unicode": "\uE695"
- }, {
- "font_class": "down",
- "unicode": "\uE6B8"
- }, {
- "font_class": "bottom",
- "unicode": "\uE6B8"
- }, {
- "font_class": "download",
- "unicode": "\uE68D"
- }, {
- "font_class": "download-filled",
- "unicode": "\uE681"
- }, {
- "font_class": "email",
- "unicode": "\uE69E"
- }, {
- "font_class": "email-filled",
- "unicode": "\uE69A"
- }, {
- "font_class": "eye",
- "unicode": "\uE651"
- }, {
- "font_class": "eye-filled",
- "unicode": "\uE66A"
- }, {
- "font_class": "eye-slash",
- "unicode": "\uE6B3"
- }, {
- "font_class": "eye-slash-filled",
- "unicode": "\uE6B4"
- }, {
- "font_class": "fire",
- "unicode": "\uE6A1"
- }, {
- "font_class": "fire-filled",
- "unicode": "\uE6C5"
- }, {
- "font_class": "flag",
- "unicode": "\uE65F"
- }, {
- "font_class": "flag-filled",
- "unicode": "\uE660"
- }, {
- "font_class": "folder-add",
- "unicode": "\uE6A9"
- }, {
- "font_class": "folder-add-filled",
- "unicode": "\uE6C8"
- }, {
- "font_class": "font",
- "unicode": "\uE6A3"
- }, {
- "font_class": "forward",
- "unicode": "\uE6BA"
- }, {
- "font_class": "gear",
- "unicode": "\uE664"
- }, {
- "font_class": "gear-filled",
- "unicode": "\uE661"
- }, {
- "font_class": "gift",
- "unicode": "\uE6A4"
- }, {
- "font_class": "gift-filled",
- "unicode": "\uE6C4"
- }, {
- "font_class": "hand-down",
- "unicode": "\uE63D"
- }, {
- "font_class": "hand-down-filled",
- "unicode": "\uE63C"
- }, {
- "font_class": "hand-up",
- "unicode": "\uE63F"
- }, {
- "font_class": "hand-up-filled",
- "unicode": "\uE63E"
- }, {
- "font_class": "headphones",
- "unicode": "\uE630"
- }, {
- "font_class": "heart",
- "unicode": "\uE639"
- }, {
- "font_class": "heart-filled",
- "unicode": "\uE641"
- }, {
- "font_class": "help",
- "unicode": "\uE679"
- }, {
- "font_class": "help-filled",
- "unicode": "\uE674"
- }, {
- "font_class": "home",
- "unicode": "\uE662"
- }, {
- "font_class": "home-filled",
- "unicode": "\uE663"
- }, {
- "font_class": "image",
- "unicode": "\uE670"
- }, {
- "font_class": "image-filled",
- "unicode": "\uE678"
- }, {
- "font_class": "images",
- "unicode": "\uE650"
- }, {
- "font_class": "images-filled",
- "unicode": "\uE64B"
- }, {
- "font_class": "info",
- "unicode": "\uE669"
- }, {
- "font_class": "info-filled",
- "unicode": "\uE649"
- }, {
- "font_class": "left",
- "unicode": "\uE6B7"
- }, {
- "font_class": "link",
- "unicode": "\uE6A5"
- }, {
- "font_class": "list",
- "unicode": "\uE644"
- }, {
- "font_class": "location",
- "unicode": "\uE6AE"
- }, {
- "font_class": "location-filled",
- "unicode": "\uE6AF"
- }, {
- "font_class": "locked",
- "unicode": "\uE66B"
- }, {
- "font_class": "locked-filled",
- "unicode": "\uE668"
- }, {
- "font_class": "loop",
- "unicode": "\uE633"
- }, {
- "font_class": "mail-open",
- "unicode": "\uE643"
- }, {
- "font_class": "mail-open-filled",
- "unicode": "\uE63A"
- }, {
- "font_class": "map",
- "unicode": "\uE667"
- }, {
- "font_class": "map-filled",
- "unicode": "\uE666"
- }, {
- "font_class": "map-pin",
- "unicode": "\uE6AD"
- }, {
- "font_class": "map-pin-ellipse",
- "unicode": "\uE6AC"
- }, {
- "font_class": "medal",
- "unicode": "\uE6A2"
- }, {
- "font_class": "medal-filled",
- "unicode": "\uE6C3"
- }, {
- "font_class": "mic",
- "unicode": "\uE671"
- }, {
- "font_class": "mic-filled",
- "unicode": "\uE677"
- }, {
- "font_class": "micoff",
- "unicode": "\uE67E"
- }, {
- "font_class": "micoff-filled",
- "unicode": "\uE6B0"
- }, {
- "font_class": "minus",
- "unicode": "\uE66F"
- }, {
- "font_class": "minus-filled",
- "unicode": "\uE67D"
- }, {
- "font_class": "more",
- "unicode": "\uE64D"
- }, {
- "font_class": "more-filled",
- "unicode": "\uE64E"
- }, {
- "font_class": "navigate",
- "unicode": "\uE66E"
- }, {
- "font_class": "navigate-filled",
- "unicode": "\uE67A"
- }, {
- "font_class": "notification",
- "unicode": "\uE6A6"
- }, {
- "font_class": "notification-filled",
- "unicode": "\uE6C1"
- }, {
- "font_class": "paperclip",
- "unicode": "\uE652"
- }, {
- "font_class": "paperplane",
- "unicode": "\uE672"
- }, {
- "font_class": "paperplane-filled",
- "unicode": "\uE675"
- }, {
- "font_class": "person",
- "unicode": "\uE699"
- }, {
- "font_class": "person-filled",
- "unicode": "\uE69D"
- }, {
- "font_class": "personadd",
- "unicode": "\uE69F"
- }, {
- "font_class": "personadd-filled",
- "unicode": "\uE698"
- }, {
- "font_class": "personadd-filled-copy",
- "unicode": "\uE6D1"
- }, {
- "font_class": "phone",
- "unicode": "\uE69C"
- }, {
- "font_class": "phone-filled",
- "unicode": "\uE69B"
- }, {
- "font_class": "plus",
- "unicode": "\uE676"
- }, {
- "font_class": "plus-filled",
- "unicode": "\uE6C7"
- }, {
- "font_class": "plusempty",
- "unicode": "\uE67B"
- }, {
- "font_class": "pulldown",
- "unicode": "\uE632"
- }, {
- "font_class": "pyq",
- "unicode": "\uE682"
- }, {
- "font_class": "qq",
- "unicode": "\uE680"
- }, {
- "font_class": "redo",
- "unicode": "\uE64A"
- }, {
- "font_class": "redo-filled",
- "unicode": "\uE655"
- }, {
- "font_class": "refresh",
- "unicode": "\uE657"
- }, {
- "font_class": "refresh-filled",
- "unicode": "\uE656"
- }, {
- "font_class": "refreshempty",
- "unicode": "\uE6BF"
- }, {
- "font_class": "reload",
- "unicode": "\uE6B2"
- }, {
- "font_class": "right",
- "unicode": "\uE6B5"
- }, {
- "font_class": "scan",
- "unicode": "\uE62A"
- }, {
- "font_class": "search",
- "unicode": "\uE654"
- }, {
- "font_class": "settings",
- "unicode": "\uE653"
- }, {
- "font_class": "settings-filled",
- "unicode": "\uE6CE"
- }, {
- "font_class": "shop",
- "unicode": "\uE62F"
- }, {
- "font_class": "shop-filled",
- "unicode": "\uE6CD"
- }, {
- "font_class": "smallcircle",
- "unicode": "\uE67C"
- }, {
- "font_class": "smallcircle-filled",
- "unicode": "\uE665"
- }, {
- "font_class": "sound",
- "unicode": "\uE684"
- }, {
- "font_class": "sound-filled",
- "unicode": "\uE686"
- }, {
- "font_class": "spinner-cycle",
- "unicode": "\uE68A"
- }, {
- "font_class": "staff",
- "unicode": "\uE6A7"
- }, {
- "font_class": "staff-filled",
- "unicode": "\uE6CB"
- }, {
- "font_class": "star",
- "unicode": "\uE688"
- }, {
- "font_class": "star-filled",
- "unicode": "\uE68F"
- }, {
- "font_class": "starhalf",
- "unicode": "\uE683"
- }, {
- "font_class": "trash",
- "unicode": "\uE687"
- }, {
- "font_class": "trash-filled",
- "unicode": "\uE685"
- }, {
- "font_class": "tune",
- "unicode": "\uE6AA"
- }, {
- "font_class": "tune-filled",
- "unicode": "\uE6CA"
- }, {
- "font_class": "undo",
- "unicode": "\uE64F"
- }, {
- "font_class": "undo-filled",
- "unicode": "\uE64C"
- }, {
- "font_class": "up",
- "unicode": "\uE6B6"
- }, {
- "font_class": "top",
- "unicode": "\uE6B6"
- }, {
- "font_class": "upload",
- "unicode": "\uE690"
- }, {
- "font_class": "upload-filled",
- "unicode": "\uE68E"
- }, {
- "font_class": "videocam",
- "unicode": "\uE68C"
- }, {
- "font_class": "videocam-filled",
- "unicode": "\uE689"
- }, {
- "font_class": "vip",
- "unicode": "\uE6A8"
- }, {
- "font_class": "vip-filled",
- "unicode": "\uE6C6"
- }, {
- "font_class": "wallet",
- "unicode": "\uE6B1"
- }, {
- "font_class": "wallet-filled",
- "unicode": "\uE6C2"
- }, {
- "font_class": "weibo",
- "unicode": "\uE68B"
- }, {
- "font_class": "weixin",
- "unicode": "\uE691"
- }];
- // export const fontData = JSON.parse<IconsDataItem>(fontDataJson)
- exports.fontData = fontData;
- /***/ }),
- /* 952 */,
- /* 953 */,
- /* 954 */,
- /* 955 */,
- /* 956 */,
- /* 957 */,
- /* 958 */,
- /* 959 */,
- /* 960 */,
- /* 961 */,
- /* 962 */,
- /* 963 */,
- /* 964 */,
- /* 965 */,
- /* 966 */,
- /* 967 */,
- /* 968 */,
- /* 969 */,
- /* 970 */,
- /* 971 */,
- /* 972 */,
- /* 973 */
- /*!********************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/index.js ***!
- \********************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _en = _interopRequireDefault(__webpack_require__(/*! ./en.json */ 974));
- var _zhHans = _interopRequireDefault(__webpack_require__(/*! ./zh-Hans.json */ 975));
- var _zhHant = _interopRequireDefault(__webpack_require__(/*! ./zh-Hant.json */ 976));
- var _default = {
- en: _en.default,
- 'zh-Hans': _zhHans.default,
- 'zh-Hant': _zhHant.default
- };
- exports.default = _default;
- /***/ }),
- /* 974 */
- /*!*******************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/en.json ***!
- \*******************************************************************************************************/
- /*! exports provided: uni-datetime-picker.selectDate, uni-datetime-picker.selectTime, uni-datetime-picker.selectDateTime, uni-datetime-picker.startDate, uni-datetime-picker.endDate, uni-datetime-picker.startTime, uni-datetime-picker.endTime, uni-datetime-picker.ok, uni-datetime-picker.clear, uni-datetime-picker.cancel, uni-datetime-picker.year, uni-datetime-picker.month, uni-calender.MON, uni-calender.TUE, uni-calender.WED, uni-calender.THU, uni-calender.FRI, uni-calender.SAT, uni-calender.SUN, uni-calender.confirm, default */
- /***/ (function(module) {
- module.exports = JSON.parse("{\"uni-datetime-picker.selectDate\":\"select date\",\"uni-datetime-picker.selectTime\":\"select time\",\"uni-datetime-picker.selectDateTime\":\"select date and time\",\"uni-datetime-picker.startDate\":\"start date\",\"uni-datetime-picker.endDate\":\"end date\",\"uni-datetime-picker.startTime\":\"start time\",\"uni-datetime-picker.endTime\":\"end time\",\"uni-datetime-picker.ok\":\"ok\",\"uni-datetime-picker.clear\":\"clear\",\"uni-datetime-picker.cancel\":\"cancel\",\"uni-datetime-picker.year\":\"-\",\"uni-datetime-picker.month\":\"\",\"uni-calender.MON\":\"MON\",\"uni-calender.TUE\":\"TUE\",\"uni-calender.WED\":\"WED\",\"uni-calender.THU\":\"THU\",\"uni-calender.FRI\":\"FRI\",\"uni-calender.SAT\":\"SAT\",\"uni-calender.SUN\":\"SUN\",\"uni-calender.confirm\":\"confirm\"}");
- /***/ }),
- /* 975 */
- /*!************************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hans.json ***!
- \************************************************************************************************************/
- /*! exports provided: uni-datetime-picker.selectDate, uni-datetime-picker.selectTime, uni-datetime-picker.selectDateTime, uni-datetime-picker.startDate, uni-datetime-picker.endDate, uni-datetime-picker.startTime, uni-datetime-picker.endTime, uni-datetime-picker.ok, uni-datetime-picker.clear, uni-datetime-picker.cancel, uni-datetime-picker.year, uni-datetime-picker.month, uni-calender.SUN, uni-calender.MON, uni-calender.TUE, uni-calender.WED, uni-calender.THU, uni-calender.FRI, uni-calender.SAT, uni-calender.confirm, default */
- /***/ (function(module) {
- module.exports = JSON.parse("{\"uni-datetime-picker.selectDate\":\"选择日期\",\"uni-datetime-picker.selectTime\":\"选择时间\",\"uni-datetime-picker.selectDateTime\":\"选择日期时间\",\"uni-datetime-picker.startDate\":\"开始日期\",\"uni-datetime-picker.endDate\":\"结束日期\",\"uni-datetime-picker.startTime\":\"开始时间\",\"uni-datetime-picker.endTime\":\"结束时间\",\"uni-datetime-picker.ok\":\"确定\",\"uni-datetime-picker.clear\":\"清除\",\"uni-datetime-picker.cancel\":\"取消\",\"uni-datetime-picker.year\":\"年\",\"uni-datetime-picker.month\":\"月\",\"uni-calender.SUN\":\"日\",\"uni-calender.MON\":\"一\",\"uni-calender.TUE\":\"二\",\"uni-calender.WED\":\"三\",\"uni-calender.THU\":\"四\",\"uni-calender.FRI\":\"五\",\"uni-calender.SAT\":\"六\",\"uni-calender.confirm\":\"确认\"}");
- /***/ }),
- /* 976 */
- /*!************************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hant.json ***!
- \************************************************************************************************************/
- /*! exports provided: uni-datetime-picker.selectDate, uni-datetime-picker.selectTime, uni-datetime-picker.selectDateTime, uni-datetime-picker.startDate, uni-datetime-picker.endDate, uni-datetime-picker.startTime, uni-datetime-picker.endTime, uni-datetime-picker.ok, uni-datetime-picker.clear, uni-datetime-picker.cancel, uni-datetime-picker.year, uni-datetime-picker.month, uni-calender.SUN, uni-calender.MON, uni-calender.TUE, uni-calender.WED, uni-calender.THU, uni-calender.FRI, uni-calender.SAT, uni-calender.confirm, default */
- /***/ (function(module) {
- module.exports = JSON.parse("{\"uni-datetime-picker.selectDate\":\"選擇日期\",\"uni-datetime-picker.selectTime\":\"選擇時間\",\"uni-datetime-picker.selectDateTime\":\"選擇日期時間\",\"uni-datetime-picker.startDate\":\"開始日期\",\"uni-datetime-picker.endDate\":\"結束日期\",\"uni-datetime-picker.startTime\":\"開始时间\",\"uni-datetime-picker.endTime\":\"結束时间\",\"uni-datetime-picker.ok\":\"確定\",\"uni-datetime-picker.clear\":\"清除\",\"uni-datetime-picker.cancel\":\"取消\",\"uni-datetime-picker.year\":\"年\",\"uni-datetime-picker.month\":\"月\",\"uni-calender.SUN\":\"日\",\"uni-calender.MON\":\"一\",\"uni-calender.TUE\":\"二\",\"uni-calender.WED\":\"三\",\"uni-calender.THU\":\"四\",\"uni-calender.FRI\":\"五\",\"uni-calender.SAT\":\"六\",\"uni-calender.confirm\":\"確認\"}");
- /***/ }),
- /* 977 */
- /*!**************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/uni_modules/uni-datetime-picker/components/uni-datetime-picker/util.js ***!
- \**************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.Calendar = void 0;
- exports.addZero = addZero;
- exports.checkDate = checkDate;
- exports.dateCompare = dateCompare;
- exports.fixIosDateFormat = fixIosDateFormat;
- exports.getDate = getDate;
- exports.getDateTime = getDateTime;
- exports.getDefaultSecond = getDefaultSecond;
- exports.getTime = getTime;
- var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ 18));
- var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23));
- var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ 24));
- var Calendar = /*#__PURE__*/function () {
- function Calendar() {
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- selected = _ref.selected,
- startDate = _ref.startDate,
- endDate = _ref.endDate,
- range = _ref.range;
- (0, _classCallCheck2.default)(this, Calendar);
- // 当前日期
- this.date = this.getDateObj(new Date()); // 当前初入日期
- // 打点信息
- this.selected = selected || [];
- // 起始时间
- this.startDate = startDate;
- // 终止时间
- this.endDate = endDate;
- // 是否范围选择
- this.range = range;
- // 多选状态
- this.cleanMultipleStatus();
- // 每周日期
- this.weeks = {};
- this.lastHover = false;
- }
- /**
- * 设置日期
- * @param {Object} date
- */
- (0, _createClass2.default)(Calendar, [{
- key: "setDate",
- value: function setDate(date) {
- var selectDate = this.getDateObj(date);
- this.getWeeks(selectDate.fullDate);
- }
- /**
- * 清理多选状态
- */
- }, {
- key: "cleanMultipleStatus",
- value: function cleanMultipleStatus() {
- this.multipleStatus = {
- before: '',
- after: '',
- data: []
- };
- }
- }, {
- key: "setStartDate",
- value: function setStartDate(startDate) {
- this.startDate = startDate;
- }
- }, {
- key: "setEndDate",
- value: function setEndDate(endDate) {
- this.endDate = endDate;
- }
- }, {
- key: "getPreMonthObj",
- value: function getPreMonthObj(date) {
- date = fixIosDateFormat(date);
- date = new Date(date);
- var oldMonth = date.getMonth();
- date.setMonth(oldMonth - 1);
- var newMonth = date.getMonth();
- if (oldMonth !== 0 && newMonth - oldMonth === 0) {
- date.setMonth(newMonth - 1);
- }
- return this.getDateObj(date);
- }
- }, {
- key: "getNextMonthObj",
- value: function getNextMonthObj(date) {
- date = fixIosDateFormat(date);
- date = new Date(date);
- var oldMonth = date.getMonth();
- date.setMonth(oldMonth + 1);
- var newMonth = date.getMonth();
- if (newMonth - oldMonth > 1) {
- date.setMonth(newMonth - 1);
- }
- return this.getDateObj(date);
- }
- /**
- * 获取指定格式Date对象
- */
- }, {
- key: "getDateObj",
- value: function getDateObj(date) {
- date = fixIosDateFormat(date);
- date = new Date(date);
- return {
- fullDate: getDate(date),
- year: date.getFullYear(),
- month: addZero(date.getMonth() + 1),
- date: addZero(date.getDate()),
- day: date.getDay()
- };
- }
- /**
- * 获取上一个月日期集合
- */
- }, {
- key: "getPreMonthDays",
- value: function getPreMonthDays(amount, dateObj) {
- var result = [];
- for (var i = amount - 1; i >= 0; i--) {
- var month = dateObj.month - 1;
- result.push({
- date: new Date(dateObj.year, month, -i).getDate(),
- month: month,
- disable: true
- });
- }
- return result;
- }
- /**
- * 获取本月日期集合
- */
- }, {
- key: "getCurrentMonthDays",
- value: function getCurrentMonthDays(amount, dateObj) {
- var _this = this;
- var result = [];
- var fullDate = this.date.fullDate;
- var _loop = function _loop(i) {
- var currentDate = "".concat(dateObj.year, "-").concat(dateObj.month, "-").concat(addZero(i));
- var isToday = fullDate === currentDate;
- // 获取打点信息
- var info = _this.selected && _this.selected.find(function (item) {
- if (_this.dateEqual(currentDate, item.date)) {
- return item;
- }
- });
- // 日期禁用
- var disableBefore = true;
- var disableAfter = true;
- if (_this.startDate) {
- disableBefore = dateCompare(_this.startDate, currentDate);
- }
- if (_this.endDate) {
- disableAfter = dateCompare(currentDate, _this.endDate);
- }
- var multiples = _this.multipleStatus.data;
- var multiplesStatus = -1;
- if (_this.range && multiples) {
- multiplesStatus = multiples.findIndex(function (item) {
- return _this.dateEqual(item, currentDate);
- });
- }
- var checked = multiplesStatus !== -1;
- result.push({
- fullDate: currentDate,
- year: dateObj.year,
- date: i,
- multiple: _this.range ? checked : false,
- beforeMultiple: _this.isLogicBefore(currentDate, _this.multipleStatus.before, _this.multipleStatus.after),
- afterMultiple: _this.isLogicAfter(currentDate, _this.multipleStatus.before, _this.multipleStatus.after),
- month: dateObj.month,
- disable: _this.startDate && !dateCompare(_this.startDate, currentDate) || _this.endDate && !dateCompare(currentDate, _this.endDate),
- isToday: isToday,
- userChecked: false,
- extraInfo: info
- });
- };
- for (var i = 1; i <= amount; i++) {
- _loop(i);
- }
- return result;
- }
- /**
- * 获取下一个月日期集合
- */
- }, {
- key: "_getNextMonthDays",
- value: function _getNextMonthDays(amount, dateObj) {
- var result = [];
- var month = dateObj.month + 1;
- for (var i = 1; i <= amount; i++) {
- result.push({
- date: i,
- month: month,
- disable: true
- });
- }
- return result;
- }
- /**
- * 获取当前日期详情
- * @param {Object} date
- */
- }, {
- key: "getInfo",
- value: function getInfo(date) {
- var _this2 = this;
- if (!date) {
- date = new Date();
- }
- var res = this.calendar.find(function (item) {
- return item.fullDate === _this2.getDateObj(date).fullDate;
- });
- return res ? res : this.getDateObj(date);
- }
- /**
- * 比较时间是否相等
- */
- }, {
- key: "dateEqual",
- value: function dateEqual(before, after) {
- before = new Date(fixIosDateFormat(before));
- after = new Date(fixIosDateFormat(after));
- return before.valueOf() === after.valueOf();
- }
- /**
- * 比较真实起始日期
- */
- }, {
- key: "isLogicBefore",
- value: function isLogicBefore(currentDate, before, after) {
- var logicBefore = before;
- if (before && after) {
- logicBefore = dateCompare(before, after) ? before : after;
- }
- return this.dateEqual(logicBefore, currentDate);
- }
- }, {
- key: "isLogicAfter",
- value: function isLogicAfter(currentDate, before, after) {
- var logicAfter = after;
- if (before && after) {
- logicAfter = dateCompare(before, after) ? after : before;
- }
- return this.dateEqual(logicAfter, currentDate);
- }
- /**
- * 获取日期范围内所有日期
- * @param {Object} begin
- * @param {Object} end
- */
- }, {
- key: "geDateAll",
- value: function geDateAll(begin, end) {
- var arr = [];
- var ab = begin.split('-');
- var ae = end.split('-');
- var db = new Date();
- db.setFullYear(ab[0], ab[1] - 1, ab[2]);
- var de = new Date();
- de.setFullYear(ae[0], ae[1] - 1, ae[2]);
- var unixDb = db.getTime() - 24 * 60 * 60 * 1000;
- var unixDe = de.getTime() - 24 * 60 * 60 * 1000;
- for (var k = unixDb; k <= unixDe;) {
- k = k + 24 * 60 * 60 * 1000;
- arr.push(this.getDateObj(new Date(parseInt(k))).fullDate);
- }
- return arr;
- }
- /**
- * 获取多选状态
- */
- }, {
- key: "setMultiple",
- value: function setMultiple(fullDate) {
- if (!this.range) return;
- var _this$multipleStatus = this.multipleStatus,
- before = _this$multipleStatus.before,
- after = _this$multipleStatus.after;
- if (before && after) {
- if (!this.lastHover) {
- this.lastHover = true;
- return;
- }
- this.multipleStatus.before = fullDate;
- this.multipleStatus.after = '';
- this.multipleStatus.data = [];
- this.multipleStatus.fulldate = '';
- this.lastHover = false;
- } else {
- if (!before) {
- this.multipleStatus.before = fullDate;
- this.multipleStatus.after = undefined;
- this.lastHover = false;
- } else {
- this.multipleStatus.after = fullDate;
- if (dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
- this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after);
- } else {
- this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before);
- }
- this.lastHover = true;
- }
- }
- this.getWeeks(fullDate);
- }
- /**
- * 鼠标 hover 更新多选状态
- */
- }, {
- key: "setHoverMultiple",
- value: function setHoverMultiple(fullDate) {
- //抖音小程序点击会触发hover事件,需要避免一下
- if (!this.range || this.lastHover) return;
- var before = this.multipleStatus.before;
- if (!before) {
- this.multipleStatus.before = fullDate;
- } else {
- this.multipleStatus.after = fullDate;
- if (dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
- this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after);
- } else {
- this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before);
- }
- }
- this.getWeeks(fullDate);
- }
- /**
- * 更新默认值多选状态
- */
- }, {
- key: "setDefaultMultiple",
- value: function setDefaultMultiple(before, after) {
- this.multipleStatus.before = before;
- this.multipleStatus.after = after;
- if (before && after) {
- if (dateCompare(before, after)) {
- this.multipleStatus.data = this.geDateAll(before, after);
- this.getWeeks(after);
- } else {
- this.multipleStatus.data = this.geDateAll(after, before);
- this.getWeeks(before);
- }
- }
- }
- /**
- * 获取每周数据
- * @param {Object} dateData
- */
- }, {
- key: "getWeeks",
- value: function getWeeks(dateData) {
- var _this$getDateObj = this.getDateObj(dateData),
- year = _this$getDateObj.year,
- month = _this$getDateObj.month;
- var preMonthDayAmount = new Date(year, month - 1, 1).getDay();
- var preMonthDays = this.getPreMonthDays(preMonthDayAmount, this.getDateObj(dateData));
- var currentMonthDayAmount = new Date(year, month, 0).getDate();
- var currentMonthDays = this.getCurrentMonthDays(currentMonthDayAmount, this.getDateObj(dateData));
- var nextMonthDayAmount = 42 - preMonthDayAmount - currentMonthDayAmount;
- var nextMonthDays = this._getNextMonthDays(nextMonthDayAmount, this.getDateObj(dateData));
- var calendarDays = [].concat((0, _toConsumableArray2.default)(preMonthDays), (0, _toConsumableArray2.default)(currentMonthDays), (0, _toConsumableArray2.default)(nextMonthDays));
- var weeks = new Array(6);
- for (var i = 0; i < calendarDays.length; i++) {
- var index = Math.floor(i / 7);
- if (!weeks[index]) {
- weeks[index] = new Array(7);
- }
- weeks[index][i % 7] = calendarDays[i];
- }
- this.calendar = calendarDays;
- this.weeks = weeks;
- }
- }]);
- return Calendar;
- }();
- exports.Calendar = Calendar;
- function getDateTime(date, hideSecond) {
- return "".concat(getDate(date), " ").concat(getTime(date, hideSecond));
- }
- function getDate(date) {
- date = fixIosDateFormat(date);
- date = new Date(date);
- var year = date.getFullYear();
- var month = date.getMonth() + 1;
- var day = date.getDate();
- return "".concat(year, "-").concat(addZero(month), "-").concat(addZero(day));
- }
- function getTime(date, hideSecond) {
- date = fixIosDateFormat(date);
- date = new Date(date);
- var hour = date.getHours();
- var minute = date.getMinutes();
- var second = date.getSeconds();
- return hideSecond ? "".concat(addZero(hour), ":").concat(addZero(minute)) : "".concat(addZero(hour), ":").concat(addZero(minute), ":").concat(addZero(second));
- }
- function addZero(num) {
- if (num < 10) {
- num = "0".concat(num);
- }
- return num;
- }
- function getDefaultSecond(hideSecond) {
- return hideSecond ? '00:00' : '00:00:00';
- }
- function dateCompare(startDate, endDate) {
- startDate = new Date(fixIosDateFormat(startDate));
- endDate = new Date(fixIosDateFormat(endDate));
- return startDate <= endDate;
- }
- function checkDate(date) {
- var dateReg = /((19|20)\d{2})(-|\/)\d{1,2}(-|\/)\d{1,2}/g;
- return date.match(dateReg);
- }
- //ios低版本15及以下,无法匹配 没有 ’秒‘ 时的情况,所以需要在末尾 秒 加上 问号
- var dateTimeReg = /^\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])( [0-5]?[0-9]:[0-5]?[0-9](:[0-5]?[0-9])?)?$/;
- function fixIosDateFormat(value) {
- if (typeof value === 'string' && dateTimeReg.test(value)) {
- value = value.replace(/-/g, '/');
- }
- return value;
- }
- /***/ }),
- /* 978 */,
- /* 979 */,
- /* 980 */,
- /* 981 */,
- /* 982 */,
- /* 983 */,
- /* 984 */,
- /* 985 */
- /*!*********************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-picker.js ***!
- \*********************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(uniCloud) {
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
- var _default2 = {
- props: {
- localdata: {
- type: [Array, Object],
- default: function _default() {
- return [];
- }
- },
- spaceInfo: {
- type: Object,
- default: function _default() {
- return {};
- }
- },
- collection: {
- type: String,
- default: ''
- },
- action: {
- type: String,
- default: ''
- },
- field: {
- type: String,
- default: ''
- },
- orderby: {
- type: String,
- default: ''
- },
- where: {
- type: [String, Object],
- default: ''
- },
- pageData: {
- type: String,
- default: 'add'
- },
- pageCurrent: {
- type: Number,
- default: 1
- },
- pageSize: {
- type: Number,
- default: 20
- },
- getcount: {
- type: [Boolean, String],
- default: false
- },
- getone: {
- type: [Boolean, String],
- default: false
- },
- gettree: {
- type: [Boolean, String],
- default: false
- },
- manual: {
- type: Boolean,
- default: false
- },
- value: {
- type: [Array, String, Number],
- default: function _default() {
- return [];
- }
- },
- modelValue: {
- type: [Array, String, Number],
- default: function _default() {
- return [];
- }
- },
- preload: {
- type: Boolean,
- default: false
- },
- stepSearh: {
- type: Boolean,
- default: true
- },
- selfField: {
- type: String,
- default: ''
- },
- parentField: {
- type: String,
- default: ''
- },
- multiple: {
- type: Boolean,
- default: false
- },
- map: {
- type: Object,
- default: function _default() {
- return {
- text: "text",
- value: "value"
- };
- }
- }
- },
- data: function data() {
- return {
- loading: false,
- errorMessage: '',
- loadMore: {
- contentdown: '',
- contentrefresh: '',
- contentnomore: ''
- },
- dataList: [],
- selected: [],
- selectedIndex: 0,
- page: {
- current: this.pageCurrent,
- size: this.pageSize,
- count: 0
- }
- };
- },
- computed: {
- isLocaldata: function isLocaldata() {
- return !this.collection.length;
- },
- postField: function postField() {
- var fields = [this.field];
- if (this.parentField) {
- fields.push("".concat(this.parentField, " as parent_value"));
- }
- return fields.join(',');
- },
- dataValue: function dataValue() {
- var isModelValue = Array.isArray(this.modelValue) ? this.modelValue.length > 0 : this.modelValue !== null || this.modelValue !== undefined;
- return isModelValue ? this.modelValue : this.value;
- },
- hasValue: function hasValue() {
- if (typeof this.dataValue === 'number') {
- return true;
- }
- return this.dataValue != null && this.dataValue.length > 0;
- }
- },
- created: function created() {
- var _this = this;
- this.$watch(function () {
- var al = [];
- ['pageCurrent', 'pageSize', 'spaceInfo', 'value', 'modelValue', 'localdata', 'collection', 'action', 'field', 'orderby', 'where', 'getont', 'getcount', 'gettree'].forEach(function (key) {
- al.push(_this[key]);
- });
- return al;
- }, function (newValue, oldValue) {
- var needReset = false;
- for (var i = 2; i < newValue.length; i++) {
- if (newValue[i] != oldValue[i]) {
- needReset = true;
- break;
- }
- }
- if (newValue[0] != oldValue[0]) {
- _this.page.current = _this.pageCurrent;
- }
- _this.page.size = _this.pageSize;
- _this.onPropsChange();
- });
- this._treeData = [];
- },
- methods: {
- onPropsChange: function onPropsChange() {
- this._treeData = [];
- },
- getCommand: function getCommand() {
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- /* eslint-disable no-undef */
- var db = uniCloud.database(this.spaceInfo);
- var action = options.action || this.action;
- if (action) {
- db = db.action(action);
- }
- var collection = options.collection || this.collection;
- db = db.collection(collection);
- var where = options.where || this.where;
- if (!(!where || !Object.keys(where).length)) {
- db = db.where(where);
- }
- var field = options.field || this.field;
- if (field) {
- db = db.field(field);
- }
- var orderby = options.orderby || this.orderby;
- if (orderby) {
- db = db.orderBy(orderby);
- }
- var current = options.pageCurrent !== undefined ? options.pageCurrent : this.page.current;
- var size = options.pageSize !== undefined ? options.pageSize : this.page.size;
- var getCount = options.getcount !== undefined ? options.getcount : this.getcount;
- var getTree = options.gettree !== undefined ? options.gettree : this.gettree;
- var getOptions = {
- getCount: getCount,
- getTree: getTree
- };
- if (options.getTreePath) {
- getOptions.getTreePath = options.getTreePath;
- }
- db = db.skip(size * (current - 1)).limit(size).get(getOptions);
- return db;
- },
- getNodeData: function getNodeData(callback) {
- var _this2 = this;
- if (this.loading) {
- return;
- }
- this.loading = true;
- this.getCommand({
- field: this.postField,
- where: this._pathWhere()
- }).then(function (res) {
- _this2.loading = false;
- _this2.selected = res.result.data;
- callback && callback();
- }).catch(function (err) {
- _this2.loading = false;
- _this2.errorMessage = err;
- });
- },
- getTreePath: function getTreePath(callback) {
- var _this3 = this;
- if (this.loading) {
- return;
- }
- this.loading = true;
- this.getCommand({
- field: this.postField,
- getTreePath: {
- startWith: "".concat(this.selfField, "=='").concat(this.dataValue, "'")
- }
- }).then(function (res) {
- _this3.loading = false;
- var treePath = [];
- _this3._extractTreePath(res.result.data, treePath);
- _this3.selected = treePath;
- callback && callback();
- }).catch(function (err) {
- _this3.loading = false;
- _this3.errorMessage = err;
- });
- },
- loadData: function loadData() {
- var _this4 = this;
- if (this.isLocaldata) {
- this._processLocalData();
- return;
- }
- if (this.dataValue != null) {
- this._loadNodeData(function (data) {
- _this4._treeData = data;
- _this4._updateBindData();
- _this4._updateSelected();
- });
- return;
- }
- if (this.stepSearh) {
- this._loadNodeData(function (data) {
- _this4._treeData = data;
- _this4._updateBindData();
- });
- } else {
- this._loadAllData(function (data) {
- _this4._treeData = [];
- _this4._extractTree(data, _this4._treeData, null);
- _this4._updateBindData();
- });
- }
- },
- _loadAllData: function _loadAllData(callback) {
- var _this5 = this;
- if (this.loading) {
- return;
- }
- this.loading = true;
- this.getCommand({
- field: this.postField,
- gettree: true,
- startwith: "".concat(this.selfField, "=='").concat(this.dataValue, "'")
- }).then(function (res) {
- _this5.loading = false;
- callback(res.result.data);
- _this5.onDataChange();
- }).catch(function (err) {
- _this5.loading = false;
- _this5.errorMessage = err;
- });
- },
- _loadNodeData: function _loadNodeData(callback, pw) {
- var _this6 = this;
- if (this.loading) {
- return;
- }
- this.loading = true;
- this.getCommand({
- field: this.postField,
- where: pw || this._postWhere(),
- pageSize: 500
- }).then(function (res) {
- _this6.loading = false;
- callback(res.result.data);
- _this6.onDataChange();
- }).catch(function (err) {
- _this6.loading = false;
- _this6.errorMessage = err;
- });
- },
- _pathWhere: function _pathWhere() {
- var result = [];
- var where_field = this._getParentNameByField();
- if (where_field) {
- result.push("".concat(where_field, " == '").concat(this.dataValue, "'"));
- }
- if (this.where) {
- return "(".concat(this.where, ") && (").concat(result.join(' || '), ")");
- }
- return result.join(' || ');
- },
- _postWhere: function _postWhere() {
- var result = [];
- var selected = this.selected;
- var parentField = this.parentField;
- if (parentField) {
- result.push("".concat(parentField, " == null || ").concat(parentField, " == \"\""));
- }
- if (selected.length) {
- for (var i = 0; i < selected.length - 1; i++) {
- result.push("".concat(parentField, " == '").concat(selected[i].value, "'"));
- }
- }
- var where = [];
- if (this.where) {
- where.push("(".concat(this.where, ")"));
- }
- if (result.length) {
- where.push("(".concat(result.join(' || '), ")"));
- }
- return where.join(' && ');
- },
- _nodeWhere: function _nodeWhere() {
- var result = [];
- var selected = this.selected;
- if (selected.length) {
- result.push("".concat(this.parentField, " == '").concat(selected[selected.length - 1].value, "'"));
- }
- if (this.where) {
- return "(".concat(this.where, ") && (").concat(result.join(' || '), ")");
- }
- return result.join(' || ');
- },
- _getParentNameByField: function _getParentNameByField() {
- var fields = this.field.split(',');
- var where_field = null;
- for (var i = 0; i < fields.length; i++) {
- var items = fields[i].split('as');
- if (items.length < 2) {
- continue;
- }
- if (items[1].trim() === 'value') {
- where_field = items[0].trim();
- break;
- }
- }
- return where_field;
- },
- _isTreeView: function _isTreeView() {
- return this.parentField && this.selfField;
- },
- _updateSelected: function _updateSelected() {
- var dl = this.dataList;
- var sl = this.selected;
- var textField = this.map.text;
- var valueField = this.map.value;
- for (var i = 0; i < sl.length; i++) {
- var value = sl[i].value;
- var dl2 = dl[i];
- for (var j = 0; j < dl2.length; j++) {
- var item2 = dl2[j];
- if (item2[valueField] === value) {
- sl[i].text = item2[textField];
- break;
- }
- }
- }
- },
- _updateBindData: function _updateBindData(node) {
- var _this$_filterData = this._filterData(this._treeData, this.selected),
- dataList = _this$_filterData.dataList,
- hasNodes = _this$_filterData.hasNodes;
- var isleaf = this._stepSearh === false && !hasNodes;
- if (node) {
- node.isleaf = isleaf;
- }
- this.dataList = dataList;
- this.selectedIndex = dataList.length - 1;
- if (!isleaf && this.selected.length < dataList.length) {
- this.selected.push({
- value: null,
- text: "请选择"
- });
- }
- return {
- isleaf: isleaf,
- hasNodes: hasNodes
- };
- },
- _filterData: function _filterData(data, paths) {
- var dataList = [];
- var hasNodes = true;
- dataList.push(data.filter(function (item) {
- return item.parent_value === null || item.parent_value === undefined || item.parent_value === '';
- }));
- for (var i = 0; i < paths.length; i++) {
- var value = paths[i].value;
- var nodes = data.filter(function (item) {
- return item.parent_value === value;
- });
- if (nodes.length) {
- dataList.push(nodes);
- } else {
- hasNodes = false;
- }
- }
- return {
- dataList: dataList,
- hasNodes: hasNodes
- };
- },
- _extractTree: function _extractTree(nodes, result, parent_value) {
- var list = result || [];
- var valueField = this.map.value;
- for (var i = 0; i < nodes.length; i++) {
- var node = nodes[i];
- var child = {};
- for (var key in node) {
- if (key !== 'children') {
- child[key] = node[key];
- }
- }
- if (parent_value !== null && parent_value !== undefined && parent_value !== '') {
- child.parent_value = parent_value;
- }
- result.push(child);
- var children = node.children;
- if (children) {
- this._extractTree(children, result, node[valueField]);
- }
- }
- },
- _extractTreePath: function _extractTreePath(nodes, result) {
- var list = result || [];
- for (var i = 0; i < nodes.length; i++) {
- var node = nodes[i];
- var child = {};
- for (var key in node) {
- if (key !== 'children') {
- child[key] = node[key];
- }
- }
- result.push(child);
- var children = node.children;
- if (children) {
- this._extractTreePath(children, result);
- }
- }
- },
- _findNodePath: function _findNodePath(key, nodes) {
- var path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
- var textField = this.map.text;
- var valueField = this.map.value;
- for (var i = 0; i < nodes.length; i++) {
- var node = nodes[i];
- var children = node.children;
- var text = node[textField];
- var value = node[valueField];
- path.push({
- value: value,
- text: text
- });
- if (value === key) {
- return path;
- }
- if (children) {
- var p = this._findNodePath(key, children, path);
- if (p.length) {
- return p;
- }
- }
- path.pop();
- }
- return [];
- },
- _processLocalData: function _processLocalData() {
- this._treeData = [];
- this._extractTree(this.localdata, this._treeData);
- var inputValue = this.dataValue;
- if (inputValue === undefined) {
- return;
- }
- if (Array.isArray(inputValue)) {
- inputValue = inputValue[inputValue.length - 1];
- if ((0, _typeof2.default)(inputValue) === 'object' && inputValue[this.map.value]) {
- inputValue = inputValue[this.map.value];
- }
- }
- this.selected = this._findNodePath(inputValue, this.localdata);
- }
- }
- };
- exports.default = _default2;
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/uni-cloud/dist/index.js */ 986)["uniCloud"]))
- /***/ }),
- /* 986 */
- /*!************************************************************************************!*\
- !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/uni-cloud/dist/index.js ***!
- \************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(global, uni, wx) {
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.uniCloud = exports.default = exports.UniCloudError = void 0;
- var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ 50));
- var _assertThisInitialized2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ 987));
- var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 5));
- var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
- var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ 18));
- var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 52));
- var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
- var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ 988));
- var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ 989));
- var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ 990));
- var _wrapNativeSuper2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/wrapNativeSuper */ 991));
- var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23));
- var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ 24));
- var _pages = _interopRequireDefault(__webpack_require__(/*! @/pages.json */ 993));
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e34) { throw _e34; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e35) { didErr = true; err = _e35; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
- "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self && self;
- function t(e) {
- return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
- }
- function n(e, t, n) {
- return e(n = {
- path: t,
- exports: {},
- require: function require(e, t) {
- return function () {
- throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs");
- }(null == t && n.path);
- }
- }, n.exports), n.exports;
- }
- var s = n(function (e, t) {
- var n;
- e.exports = (n = n || function (e, t) {
- var n = Object.create || function () {
- function e() {}
- return function (t) {
- var n;
- return e.prototype = t, n = new e(), e.prototype = null, n;
- };
- }(),
- s = {},
- r = s.lib = {},
- i = r.Base = {
- extend: function extend(e) {
- var t = n(this);
- return e && t.mixIn(e), t.hasOwnProperty("init") && this.init !== t.init || (t.init = function () {
- t.$super.init.apply(this, arguments);
- }), t.init.prototype = t, t.$super = this, t;
- },
- create: function create() {
- var e = this.extend();
- return e.init.apply(e, arguments), e;
- },
- init: function init() {},
- mixIn: function mixIn(e) {
- for (var t in e) {
- e.hasOwnProperty(t) && (this[t] = e[t]);
- }
- e.hasOwnProperty("toString") && (this.toString = e.toString);
- },
- clone: function clone() {
- return this.init.prototype.extend(this);
- }
- },
- o = r.WordArray = i.extend({
- init: function init(e, n) {
- e = this.words = e || [], this.sigBytes = n != t ? n : 4 * e.length;
- },
- toString: function toString(e) {
- return (e || c).stringify(this);
- },
- concat: function concat(e) {
- var t = this.words,
- n = e.words,
- s = this.sigBytes,
- r = e.sigBytes;
- if (this.clamp(), s % 4) for (var i = 0; i < r; i++) {
- var o = n[i >>> 2] >>> 24 - i % 4 * 8 & 255;
- t[s + i >>> 2] |= o << 24 - (s + i) % 4 * 8;
- } else for (i = 0; i < r; i += 4) {
- t[s + i >>> 2] = n[i >>> 2];
- }
- return this.sigBytes += r, this;
- },
- clamp: function clamp() {
- var t = this.words,
- n = this.sigBytes;
- t[n >>> 2] &= 4294967295 << 32 - n % 4 * 8, t.length = e.ceil(n / 4);
- },
- clone: function clone() {
- var e = i.clone.call(this);
- return e.words = this.words.slice(0), e;
- },
- random: function random(t) {
- for (var n, s = [], r = function r(t) {
- var n = 987654321,
- s = 4294967295;
- return function () {
- var r = ((n = 36969 * (65535 & n) + (n >> 16) & s) << 16) + (t = 18e3 * (65535 & t) + (t >> 16) & s) & s;
- return r /= 4294967296, (r += .5) * (e.random() > .5 ? 1 : -1);
- };
- }, i = 0; i < t; i += 4) {
- var a = r(4294967296 * (n || e.random()));
- n = 987654071 * a(), s.push(4294967296 * a() | 0);
- }
- return new o.init(s, t);
- }
- }),
- a = s.enc = {},
- c = a.Hex = {
- stringify: function stringify(e) {
- for (var t = e.words, n = e.sigBytes, s = [], r = 0; r < n; r++) {
- var i = t[r >>> 2] >>> 24 - r % 4 * 8 & 255;
- s.push((i >>> 4).toString(16)), s.push((15 & i).toString(16));
- }
- return s.join("");
- },
- parse: function parse(e) {
- for (var t = e.length, n = [], s = 0; s < t; s += 2) {
- n[s >>> 3] |= parseInt(e.substr(s, 2), 16) << 24 - s % 8 * 4;
- }
- return new o.init(n, t / 2);
- }
- },
- u = a.Latin1 = {
- stringify: function stringify(e) {
- for (var t = e.words, n = e.sigBytes, s = [], r = 0; r < n; r++) {
- var i = t[r >>> 2] >>> 24 - r % 4 * 8 & 255;
- s.push(String.fromCharCode(i));
- }
- return s.join("");
- },
- parse: function parse(e) {
- for (var t = e.length, n = [], s = 0; s < t; s++) {
- n[s >>> 2] |= (255 & e.charCodeAt(s)) << 24 - s % 4 * 8;
- }
- return new o.init(n, t);
- }
- },
- h = a.Utf8 = {
- stringify: function stringify(e) {
- try {
- return decodeURIComponent(escape(u.stringify(e)));
- } catch (e) {
- throw new Error("Malformed UTF-8 data");
- }
- },
- parse: function parse(e) {
- return u.parse(unescape(encodeURIComponent(e)));
- }
- },
- l = r.BufferedBlockAlgorithm = i.extend({
- reset: function reset() {
- this._data = new o.init(), this._nDataBytes = 0;
- },
- _append: function _append(e) {
- "string" == typeof e && (e = h.parse(e)), this._data.concat(e), this._nDataBytes += e.sigBytes;
- },
- _process: function _process(t) {
- var n = this._data,
- s = n.words,
- r = n.sigBytes,
- i = this.blockSize,
- a = r / (4 * i),
- c = (a = t ? e.ceil(a) : e.max((0 | a) - this._minBufferSize, 0)) * i,
- u = e.min(4 * c, r);
- if (c) {
- for (var h = 0; h < c; h += i) {
- this._doProcessBlock(s, h);
- }
- var l = s.splice(0, c);
- n.sigBytes -= u;
- }
- return new o.init(l, u);
- },
- clone: function clone() {
- var e = i.clone.call(this);
- return e._data = this._data.clone(), e;
- },
- _minBufferSize: 0
- });
- r.Hasher = l.extend({
- cfg: i.extend(),
- init: function init(e) {
- this.cfg = this.cfg.extend(e), this.reset();
- },
- reset: function reset() {
- l.reset.call(this), this._doReset();
- },
- update: function update(e) {
- return this._append(e), this._process(), this;
- },
- finalize: function finalize(e) {
- return e && this._append(e), this._doFinalize();
- },
- blockSize: 16,
- _createHelper: function _createHelper(e) {
- return function (t, n) {
- return new e.init(n).finalize(t);
- };
- },
- _createHmacHelper: function _createHmacHelper(e) {
- return function (t, n) {
- return new d.HMAC.init(e, n).finalize(t);
- };
- }
- });
- var d = s.algo = {};
- return s;
- }(Math), n);
- }),
- r = s,
- i = (n(function (e, t) {
- var n;
- e.exports = (n = r, function (e) {
- var t = n,
- s = t.lib,
- r = s.WordArray,
- i = s.Hasher,
- o = t.algo,
- a = [];
- !function () {
- for (var t = 0; t < 64; t++) {
- a[t] = 4294967296 * e.abs(e.sin(t + 1)) | 0;
- }
- }();
- var c = o.MD5 = i.extend({
- _doReset: function _doReset() {
- this._hash = new r.init([1732584193, 4023233417, 2562383102, 271733878]);
- },
- _doProcessBlock: function _doProcessBlock(e, t) {
- for (var n = 0; n < 16; n++) {
- var s = t + n,
- r = e[s];
- e[s] = 16711935 & (r << 8 | r >>> 24) | 4278255360 & (r << 24 | r >>> 8);
- }
- var i = this._hash.words,
- o = e[t + 0],
- c = e[t + 1],
- p = e[t + 2],
- f = e[t + 3],
- g = e[t + 4],
- m = e[t + 5],
- y = e[t + 6],
- _ = e[t + 7],
- w = e[t + 8],
- v = e[t + 9],
- I = e[t + 10],
- S = e[t + 11],
- T = e[t + 12],
- b = e[t + 13],
- E = e[t + 14],
- k = e[t + 15],
- P = i[0],
- C = i[1],
- A = i[2],
- O = i[3];
- P = u(P, C, A, O, o, 7, a[0]), O = u(O, P, C, A, c, 12, a[1]), A = u(A, O, P, C, p, 17, a[2]), C = u(C, A, O, P, f, 22, a[3]), P = u(P, C, A, O, g, 7, a[4]), O = u(O, P, C, A, m, 12, a[5]), A = u(A, O, P, C, y, 17, a[6]), C = u(C, A, O, P, _, 22, a[7]), P = u(P, C, A, O, w, 7, a[8]), O = u(O, P, C, A, v, 12, a[9]), A = u(A, O, P, C, I, 17, a[10]), C = u(C, A, O, P, S, 22, a[11]), P = u(P, C, A, O, T, 7, a[12]), O = u(O, P, C, A, b, 12, a[13]), A = u(A, O, P, C, E, 17, a[14]), P = h(P, C = u(C, A, O, P, k, 22, a[15]), A, O, c, 5, a[16]), O = h(O, P, C, A, y, 9, a[17]), A = h(A, O, P, C, S, 14, a[18]), C = h(C, A, O, P, o, 20, a[19]), P = h(P, C, A, O, m, 5, a[20]), O = h(O, P, C, A, I, 9, a[21]), A = h(A, O, P, C, k, 14, a[22]), C = h(C, A, O, P, g, 20, a[23]), P = h(P, C, A, O, v, 5, a[24]), O = h(O, P, C, A, E, 9, a[25]), A = h(A, O, P, C, f, 14, a[26]), C = h(C, A, O, P, w, 20, a[27]), P = h(P, C, A, O, b, 5, a[28]), O = h(O, P, C, A, p, 9, a[29]), A = h(A, O, P, C, _, 14, a[30]), P = l(P, C = h(C, A, O, P, T, 20, a[31]), A, O, m, 4, a[32]), O = l(O, P, C, A, w, 11, a[33]), A = l(A, O, P, C, S, 16, a[34]), C = l(C, A, O, P, E, 23, a[35]), P = l(P, C, A, O, c, 4, a[36]), O = l(O, P, C, A, g, 11, a[37]), A = l(A, O, P, C, _, 16, a[38]), C = l(C, A, O, P, I, 23, a[39]), P = l(P, C, A, O, b, 4, a[40]), O = l(O, P, C, A, o, 11, a[41]), A = l(A, O, P, C, f, 16, a[42]), C = l(C, A, O, P, y, 23, a[43]), P = l(P, C, A, O, v, 4, a[44]), O = l(O, P, C, A, T, 11, a[45]), A = l(A, O, P, C, k, 16, a[46]), P = d(P, C = l(C, A, O, P, p, 23, a[47]), A, O, o, 6, a[48]), O = d(O, P, C, A, _, 10, a[49]), A = d(A, O, P, C, E, 15, a[50]), C = d(C, A, O, P, m, 21, a[51]), P = d(P, C, A, O, T, 6, a[52]), O = d(O, P, C, A, f, 10, a[53]), A = d(A, O, P, C, I, 15, a[54]), C = d(C, A, O, P, c, 21, a[55]), P = d(P, C, A, O, w, 6, a[56]), O = d(O, P, C, A, k, 10, a[57]), A = d(A, O, P, C, y, 15, a[58]), C = d(C, A, O, P, b, 21, a[59]), P = d(P, C, A, O, g, 6, a[60]), O = d(O, P, C, A, S, 10, a[61]), A = d(A, O, P, C, p, 15, a[62]), C = d(C, A, O, P, v, 21, a[63]), i[0] = i[0] + P | 0, i[1] = i[1] + C | 0, i[2] = i[2] + A | 0, i[3] = i[3] + O | 0;
- },
- _doFinalize: function _doFinalize() {
- var t = this._data,
- n = t.words,
- s = 8 * this._nDataBytes,
- r = 8 * t.sigBytes;
- n[r >>> 5] |= 128 << 24 - r % 32;
- var i = e.floor(s / 4294967296),
- o = s;
- n[15 + (r + 64 >>> 9 << 4)] = 16711935 & (i << 8 | i >>> 24) | 4278255360 & (i << 24 | i >>> 8), n[14 + (r + 64 >>> 9 << 4)] = 16711935 & (o << 8 | o >>> 24) | 4278255360 & (o << 24 | o >>> 8), t.sigBytes = 4 * (n.length + 1), this._process();
- for (var a = this._hash, c = a.words, u = 0; u < 4; u++) {
- var h = c[u];
- c[u] = 16711935 & (h << 8 | h >>> 24) | 4278255360 & (h << 24 | h >>> 8);
- }
- return a;
- },
- clone: function clone() {
- var e = i.clone.call(this);
- return e._hash = this._hash.clone(), e;
- }
- });
- function u(e, t, n, s, r, i, o) {
- var a = e + (t & n | ~t & s) + r + o;
- return (a << i | a >>> 32 - i) + t;
- }
- function h(e, t, n, s, r, i, o) {
- var a = e + (t & s | n & ~s) + r + o;
- return (a << i | a >>> 32 - i) + t;
- }
- function l(e, t, n, s, r, i, o) {
- var a = e + (t ^ n ^ s) + r + o;
- return (a << i | a >>> 32 - i) + t;
- }
- function d(e, t, n, s, r, i, o) {
- var a = e + (n ^ (t | ~s)) + r + o;
- return (a << i | a >>> 32 - i) + t;
- }
- t.MD5 = i._createHelper(c), t.HmacMD5 = i._createHmacHelper(c);
- }(Math), n.MD5);
- }), n(function (e, t) {
- var n;
- e.exports = (n = r, void function () {
- var e = n,
- t = e.lib.Base,
- s = e.enc.Utf8;
- e.algo.HMAC = t.extend({
- init: function init(e, t) {
- e = this._hasher = new e.init(), "string" == typeof t && (t = s.parse(t));
- var n = e.blockSize,
- r = 4 * n;
- t.sigBytes > r && (t = e.finalize(t)), t.clamp();
- for (var i = this._oKey = t.clone(), o = this._iKey = t.clone(), a = i.words, c = o.words, u = 0; u < n; u++) {
- a[u] ^= 1549556828, c[u] ^= 909522486;
- }
- i.sigBytes = o.sigBytes = r, this.reset();
- },
- reset: function reset() {
- var e = this._hasher;
- e.reset(), e.update(this._iKey);
- },
- update: function update(e) {
- return this._hasher.update(e), this;
- },
- finalize: function finalize(e) {
- var t = this._hasher,
- n = t.finalize(e);
- return t.reset(), t.finalize(this._oKey.clone().concat(n));
- }
- });
- }());
- }), n(function (e, t) {
- e.exports = r.HmacMD5;
- })),
- o = n(function (e, t) {
- e.exports = r.enc.Utf8;
- }),
- a = n(function (e, t) {
- var n;
- e.exports = (n = r, function () {
- var e = n,
- t = e.lib.WordArray;
- function s(e, n, s) {
- for (var r = [], i = 0, o = 0; o < n; o++) {
- if (o % 4) {
- var a = s[e.charCodeAt(o - 1)] << o % 4 * 2,
- c = s[e.charCodeAt(o)] >>> 6 - o % 4 * 2;
- r[i >>> 2] |= (a | c) << 24 - i % 4 * 8, i++;
- }
- }
- return t.create(r, i);
- }
- e.enc.Base64 = {
- stringify: function stringify(e) {
- var t = e.words,
- n = e.sigBytes,
- s = this._map;
- e.clamp();
- for (var r = [], i = 0; i < n; i += 3) {
- for (var o = (t[i >>> 2] >>> 24 - i % 4 * 8 & 255) << 16 | (t[i + 1 >>> 2] >>> 24 - (i + 1) % 4 * 8 & 255) << 8 | t[i + 2 >>> 2] >>> 24 - (i + 2) % 4 * 8 & 255, a = 0; a < 4 && i + .75 * a < n; a++) {
- r.push(s.charAt(o >>> 6 * (3 - a) & 63));
- }
- }
- var c = s.charAt(64);
- if (c) for (; r.length % 4;) {
- r.push(c);
- }
- return r.join("");
- },
- parse: function parse(e) {
- var t = e.length,
- n = this._map,
- r = this._reverseMap;
- if (!r) {
- r = this._reverseMap = [];
- for (var i = 0; i < n.length; i++) {
- r[n.charCodeAt(i)] = i;
- }
- }
- var o = n.charAt(64);
- if (o) {
- var a = e.indexOf(o);
- -1 !== a && (t = a);
- }
- return s(e, t, r);
- },
- _map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
- };
- }(), n.enc.Base64);
- });
- var c = "uni_id_token",
- u = "uni_id_token_expired",
- h = "uniIdToken",
- l = {
- DEFAULT: "FUNCTION",
- FUNCTION: "FUNCTION",
- OBJECT: "OBJECT",
- CLIENT_DB: "CLIENT_DB"
- },
- d = "pending",
- p = "fulfilled",
- f = "rejected";
- function g(e) {
- return Object.prototype.toString.call(e).slice(8, -1).toLowerCase();
- }
- function m(e) {
- return "object" === g(e);
- }
- function y(e) {
- return "function" == typeof e;
- }
- function _(e) {
- return function () {
- try {
- return e.apply(e, arguments);
- } catch (e) {
- console.error(e);
- }
- };
- }
- var w = "REJECTED",
- v = "NOT_PENDING";
- var I = /*#__PURE__*/function () {
- function I() {
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- e = _ref.createPromise,
- _ref$retryRule = _ref.retryRule,
- t = _ref$retryRule === void 0 ? w : _ref$retryRule;
- (0, _classCallCheck2.default)(this, I);
- this.createPromise = e, this.status = null, this.promise = null, this.retryRule = t;
- }
- (0, _createClass2.default)(I, [{
- key: "needRetry",
- get: function get() {
- if (!this.status) return !0;
- switch (this.retryRule) {
- case w:
- return this.status === f;
- case v:
- return this.status !== d;
- }
- }
- }, {
- key: "exec",
- value: function exec() {
- var _this = this;
- return this.needRetry ? (this.status = d, this.promise = this.createPromise().then(function (e) {
- return _this.status = p, Promise.resolve(e);
- }, function (e) {
- return _this.status = f, Promise.reject(e);
- }), this.promise) : this.promise;
- }
- }]);
- return I;
- }();
- var S = /*#__PURE__*/function () {
- function S() {
- (0, _classCallCheck2.default)(this, S);
- this._callback = {};
- }
- (0, _createClass2.default)(S, [{
- key: "addListener",
- value: function addListener(e, t) {
- this._callback[e] || (this._callback[e] = []), this._callback[e].push(t);
- }
- }, {
- key: "on",
- value: function on(e, t) {
- return this.addListener(e, t);
- }
- }, {
- key: "removeListener",
- value: function removeListener(e, t) {
- if (!t) throw new Error('The "listener" argument must be of type function. Received undefined');
- var n = this._callback[e];
- if (!n) return;
- var s = function (e, t) {
- for (var _n2 = e.length - 1; _n2 >= 0; _n2--) {
- if (e[_n2] === t) return _n2;
- }
- return -1;
- }(n, t);
- n.splice(s, 1);
- }
- }, {
- key: "off",
- value: function off(e, t) {
- return this.removeListener(e, t);
- }
- }, {
- key: "removeAllListener",
- value: function removeAllListener(e) {
- delete this._callback[e];
- }
- }, {
- key: "emit",
- value: function emit(e) {
- var n = this._callback[e];
- for (var _len = arguments.length, t = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- t[_key - 1] = arguments[_key];
- }
- if (n) for (var _e2 = 0; _e2 < n.length; _e2++) {
- n[_e2].apply(n, t);
- }
- }
- }]);
- return S;
- }();
- function T(e) {
- return e && "string" == typeof e ? JSON.parse(e) : e;
- }
- var b = "development" === "development",
- E = "mp-weixin",
- k = "true" === undefined || !0 === undefined,
- P = T([]),
- C = "h5" === E ? "web" : "app-plus" === E || "app-harmony" === E ? "app" : E,
- A = T(undefined),
- O = T([]) || [],
- x = true;
- var N = "";
- try {
- N = (__webpack_require__(/*! uni-stat-config */ 994).default || __webpack_require__(/*! uni-stat-config */ 994)).appid;
- } catch (e) {}
- var R,
- L = {};
- function U(e) {
- var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var n, s;
- return n = L, s = e, Object.prototype.hasOwnProperty.call(n, s) || (L[e] = t), L[e];
- }
- function D() {
- return R || (R = function () {
- if ("undefined" != typeof globalThis) return globalThis;
- if ("undefined" != typeof self) return self;
- if ("undefined" != typeof window) return window;
- function e() {
- return this;
- }
- return void 0 !== e() ? e() : new Function("return this")();
- }(), R);
- }
- "app" === C && (L = uni._globalUniCloudObj ? uni._globalUniCloudObj : uni._globalUniCloudObj = {});
- var M = ["invoke", "success", "fail", "complete"],
- q = U("_globalUniCloudInterceptor");
- function F(e, t) {
- q[e] || (q[e] = {}), m(t) && Object.keys(t).forEach(function (n) {
- M.indexOf(n) > -1 && function (e, t, n) {
- var s = q[e][t];
- s || (s = q[e][t] = []), -1 === s.indexOf(n) && y(n) && s.push(n);
- }(e, n, t[n]);
- });
- }
- function K(e, t) {
- q[e] || (q[e] = {}), m(t) ? Object.keys(t).forEach(function (n) {
- M.indexOf(n) > -1 && function (e, t, n) {
- var s = q[e][t];
- if (!s) return;
- var r = s.indexOf(n);
- r > -1 && s.splice(r, 1);
- }(e, n, t[n]);
- }) : delete q[e];
- }
- function j(e, t) {
- return e && 0 !== e.length ? e.reduce(function (e, n) {
- return e.then(function () {
- return n(t);
- });
- }, Promise.resolve()) : Promise.resolve();
- }
- function $(e, t) {
- return q[e] && q[e][t] || [];
- }
- function B(e) {
- F("callObject", e);
- }
- var W = U("_globalUniCloudListener"),
- H = {
- RESPONSE: "response",
- NEED_LOGIN: "needLogin",
- REFRESH_TOKEN: "refreshToken"
- },
- J = {
- CLIENT_DB: "clientdb",
- CLOUD_FUNCTION: "cloudfunction",
- CLOUD_OBJECT: "cloudobject"
- };
- function z(e) {
- return W[e] || (W[e] = []), W[e];
- }
- function V(e, t) {
- var n = z(e);
- n.includes(t) || n.push(t);
- }
- function G(e, t) {
- var n = z(e),
- s = n.indexOf(t);
- -1 !== s && n.splice(s, 1);
- }
- function Y(e, t) {
- var n = z(e);
- for (var _e3 = 0; _e3 < n.length; _e3++) {
- (0, n[_e3])(t);
- }
- }
- var Q,
- X = !1;
- function Z() {
- return Q || (Q = new Promise(function (e) {
- X && e(), function t() {
- if ("function" == typeof getCurrentPages) {
- var _t2 = getCurrentPages();
- _t2 && _t2[0] && (X = !0, e());
- }
- X || setTimeout(function () {
- t();
- }, 30);
- }();
- }), Q);
- }
- function ee(e) {
- var t = {};
- for (var _n3 in e) {
- var _s2 = e[_n3];
- y(_s2) && (t[_n3] = _(_s2));
- }
- return t;
- }
- var te = /*#__PURE__*/function (_Error) {
- (0, _inherits2.default)(te, _Error);
- var _super = _createSuper(te);
- function te(e) {
- var _this2;
- (0, _classCallCheck2.default)(this, te);
- _this2 = _super.call(this, e.message), _this2.errMsg = e.message || e.errMsg || "unknown system error", _this2.code = _this2.errCode = e.code || e.errCode || "SYSTEM_ERROR", _this2.errSubject = _this2.subject = e.subject || e.errSubject, _this2.cause = e.cause, _this2.requestId = e.requestId;
- return _this2;
- }
- (0, _createClass2.default)(te, [{
- key: "toJson",
- value: function toJson() {
- var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
- if (!(e >= 10)) return e++, {
- errCode: this.errCode,
- errMsg: this.errMsg,
- errSubject: this.errSubject,
- cause: this.cause && this.cause.toJson ? this.cause.toJson(e) : this.cause
- };
- }
- }]);
- return te;
- }( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
- exports.UniCloudError = te;
- var ne = {
- request: function request(e) {
- return uni.request(e);
- },
- uploadFile: function uploadFile(e) {
- return uni.uploadFile(e);
- },
- setStorageSync: function setStorageSync(e, t) {
- return uni.setStorageSync(e, t);
- },
- getStorageSync: function getStorageSync(e) {
- return uni.getStorageSync(e);
- },
- removeStorageSync: function removeStorageSync(e) {
- return uni.removeStorageSync(e);
- },
- clearStorageSync: function clearStorageSync() {
- return uni.clearStorageSync();
- },
- connectSocket: function connectSocket(e) {
- return uni.connectSocket(e);
- }
- };
- function se() {
- return {
- token: ne.getStorageSync(c) || ne.getStorageSync(h),
- tokenExpired: ne.getStorageSync(u)
- };
- }
- function re() {
- var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- e = _ref2.token,
- t = _ref2.tokenExpired;
- e && ne.setStorageSync(c, e), t && ne.setStorageSync(u, t);
- }
- var ie, oe;
- function ae() {
- return ie || (ie = uni.getSystemInfoSync()), ie;
- }
- function ce() {
- var e, t;
- try {
- if (uni.getLaunchOptionsSync) {
- if (uni.getLaunchOptionsSync.toString().indexOf("not yet implemented") > -1) return;
- var _uni$getLaunchOptions = uni.getLaunchOptionsSync(),
- _n4 = _uni$getLaunchOptions.scene,
- _s3 = _uni$getLaunchOptions.channel;
- e = _s3, t = _n4;
- }
- } catch (e) {}
- return {
- channel: e,
- scene: t
- };
- }
- var ue = {};
- function he() {
- var e = uni.getLocale && uni.getLocale() || "en";
- if (oe) return _objectSpread(_objectSpread(_objectSpread({}, ue), oe), {}, {
- locale: e,
- LOCALE: e
- });
- var t = ae(),
- n = t.deviceId,
- s = t.osName,
- r = t.uniPlatform,
- i = t.appId,
- o = ["appId", "appLanguage", "appName", "appVersion", "appVersionCode", "appWgtVersion", "browserName", "browserVersion", "deviceBrand", "deviceId", "deviceModel", "deviceType", "osName", "osVersion", "romName", "romVersion", "ua", "hostName", "hostVersion", "uniPlatform", "uniRuntimeVersion", "uniRuntimeVersionCode", "uniCompilerVersion", "uniCompilerVersionCode"];
- for (var _e4 in t) {
- Object.hasOwnProperty.call(t, _e4) && -1 === o.indexOf(_e4) && delete t[_e4];
- }
- return oe = _objectSpread(_objectSpread({
- PLATFORM: r,
- OS: s,
- APPID: i,
- DEVICEID: n
- }, ce()), t), _objectSpread(_objectSpread(_objectSpread({}, ue), oe), {}, {
- locale: e,
- LOCALE: e
- });
- }
- var le = {
- sign: function sign(e, t) {
- var n = "";
- return Object.keys(e).sort().forEach(function (t) {
- e[t] && (n = n + "&" + t + "=" + e[t]);
- }), n = n.slice(1), i(n, t).toString();
- },
- wrappedRequest: function wrappedRequest(e, t) {
- return new Promise(function (n, s) {
- t(Object.assign(e, {
- complete: function complete(e) {
- e || (e = {}), b && "web" === C && e.errMsg && 0 === e.errMsg.indexOf("request:fail") && console.warn("发布H5,需要在uniCloud后台操作,绑定安全域名,否则会因为跨域问题而无法访问。教程参考:https://uniapp.dcloud.io/uniCloud/quickstart?id=useinh5");
- var t = e.data && e.data.header && e.data.header["x-serverless-request-id"] || e.header && e.header["request-id"];
- if (!e.statusCode || e.statusCode >= 400) {
- var _n5 = e.data && e.data.error && e.data.error.code || "SYS_ERR",
- _r = e.data && e.data.error && e.data.error.message || e.errMsg || "request:fail";
- return s(new te({
- code: _n5,
- message: _r,
- requestId: t
- }));
- }
- var r = e.data;
- if (r.error) return s(new te({
- code: r.error.code,
- message: r.error.message,
- requestId: t
- }));
- r.result = r.data, r.requestId = t, delete r.data, n(r);
- }
- }));
- });
- },
- toBase64: function toBase64(e) {
- return a.stringify(o.parse(e));
- }
- };
- var de = /*#__PURE__*/function () {
- function de(e) {
- var _this3 = this;
- (0, _classCallCheck2.default)(this, de);
- ["spaceId", "clientSecret"].forEach(function (t) {
- if (!Object.prototype.hasOwnProperty.call(e, t)) throw new Error("".concat(t, " required"));
- }), this.config = Object.assign({}, {
- endpoint: 0 === e.spaceId.indexOf("mp-") ? "https://api.next.bspapp.com" : "https://api.bspapp.com"
- }, e), this.config.provider = "aliyun", this.config.requestUrl = this.config.endpoint + "/client", this.config.envType = this.config.envType || "public", this.config.accessTokenKey = "access_token_" + this.config.spaceId, this.adapter = ne, this._getAccessTokenPromiseHub = new I({
- createPromise: function createPromise() {
- return _this3.requestAuth(_this3.setupRequest({
- method: "serverless.auth.user.anonymousAuthorize",
- params: "{}"
- }, "auth")).then(function (e) {
- if (!e.result || !e.result.accessToken) throw new te({
- code: "AUTH_FAILED",
- message: "获取accessToken失败"
- });
- _this3.setAccessToken(e.result.accessToken);
- });
- },
- retryRule: v
- });
- }
- (0, _createClass2.default)(de, [{
- key: "hasAccessToken",
- get: function get() {
- return !!this.accessToken;
- }
- }, {
- key: "setAccessToken",
- value: function setAccessToken(e) {
- this.accessToken = e;
- }
- }, {
- key: "requestWrapped",
- value: function requestWrapped(e) {
- return le.wrappedRequest(e, this.adapter.request);
- }
- }, {
- key: "requestAuth",
- value: function requestAuth(e) {
- return this.requestWrapped(e);
- }
- }, {
- key: "request",
- value: function request(e, t) {
- var _this4 = this;
- return Promise.resolve().then(function () {
- return _this4.hasAccessToken ? t ? _this4.requestWrapped(e) : _this4.requestWrapped(e).catch(function (t) {
- return new Promise(function (e, n) {
- !t || "GATEWAY_INVALID_TOKEN" !== t.code && "InvalidParameter.InvalidToken" !== t.code ? n(t) : e();
- }).then(function () {
- return _this4.getAccessToken();
- }).then(function () {
- var t = _this4.rebuildRequest(e);
- return _this4.request(t, !0);
- });
- }) : _this4.getAccessToken().then(function () {
- var t = _this4.rebuildRequest(e);
- return _this4.request(t, !0);
- });
- });
- }
- }, {
- key: "rebuildRequest",
- value: function rebuildRequest(e) {
- var t = Object.assign({}, e);
- return t.data.token = this.accessToken, t.header["x-basement-token"] = this.accessToken, t.header["x-serverless-sign"] = le.sign(t.data, this.config.clientSecret), t;
- }
- }, {
- key: "setupRequest",
- value: function setupRequest(e, t) {
- var n = Object.assign({}, e, {
- spaceId: this.config.spaceId,
- timestamp: Date.now()
- }),
- s = {
- "Content-Type": "application/json"
- };
- return "auth" !== t && (n.token = this.accessToken, s["x-basement-token"] = this.accessToken), s["x-serverless-sign"] = le.sign(n, this.config.clientSecret), {
- url: this.config.requestUrl,
- method: "POST",
- data: n,
- dataType: "json",
- header: s
- };
- }
- }, {
- key: "getAccessToken",
- value: function getAccessToken() {
- return this._getAccessTokenPromiseHub.exec();
- }
- }, {
- key: "authorize",
- value: function () {
- var _authorize = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- _context.next = 2;
- return this.getAccessToken();
- case 2:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function authorize() {
- return _authorize.apply(this, arguments);
- }
- return authorize;
- }()
- }, {
- key: "callFunction",
- value: function callFunction(e) {
- var t = {
- method: "serverless.function.runtime.invoke",
- params: JSON.stringify({
- functionTarget: e.name,
- functionArgs: e.data || {}
- })
- };
- return this.request(_objectSpread(_objectSpread({}, this.setupRequest(t)), {}, {
- timeout: e.timeout
- }));
- }
- }, {
- key: "getOSSUploadOptionsFromPath",
- value: function getOSSUploadOptionsFromPath(e) {
- var t = {
- method: "serverless.file.resource.generateProximalSign",
- params: JSON.stringify(e)
- };
- return this.request(this.setupRequest(t));
- }
- }, {
- key: "uploadFileToOSS",
- value: function uploadFileToOSS(_ref3) {
- var _this5 = this;
- var e = _ref3.url,
- t = _ref3.formData,
- n = _ref3.name,
- s = _ref3.filePath,
- r = _ref3.fileType,
- i = _ref3.onUploadProgress;
- return new Promise(function (o, a) {
- var c = _this5.adapter.uploadFile({
- url: e,
- formData: t,
- name: n,
- filePath: s,
- fileType: r,
- header: {
- "X-OSS-server-side-encrpytion": "AES256"
- },
- success: function success(e) {
- e && e.statusCode < 400 ? o(e) : a(new te({
- code: "UPLOAD_FAILED",
- message: "文件上传失败"
- }));
- },
- fail: function fail(e) {
- a(new te({
- code: e.code || "UPLOAD_FAILED",
- message: e.message || e.errMsg || "文件上传失败"
- }));
- }
- });
- "function" == typeof i && c && "function" == typeof c.onProgressUpdate && c.onProgressUpdate(function (e) {
- i({
- loaded: e.totalBytesSent,
- total: e.totalBytesExpectedToSend
- });
- });
- });
- }
- }, {
- key: "reportOSSUpload",
- value: function reportOSSUpload(e) {
- var t = {
- method: "serverless.file.resource.report",
- params: JSON.stringify(e)
- };
- return this.request(this.setupRequest(t));
- }
- }, {
- key: "uploadFile",
- value: function () {
- var _uploadFile = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(_ref4) {
- var e, t, _ref4$fileType, n, _ref4$cloudPathAsReal, s, r, i, o, a, c, u, h, l, d, p, f, m, y, _, _e5, w;
- return _regenerator.default.wrap(function _callee2$(_context2) {
- while (1) {
- switch (_context2.prev = _context2.next) {
- case 0:
- e = _ref4.filePath, t = _ref4.cloudPath, _ref4$fileType = _ref4.fileType, n = _ref4$fileType === void 0 ? "image" : _ref4$fileType, _ref4$cloudPathAsReal = _ref4.cloudPathAsRealPath, s = _ref4$cloudPathAsReal === void 0 ? !1 : _ref4$cloudPathAsReal, r = _ref4.onUploadProgress, i = _ref4.config;
- if (!("string" !== g(t))) {
- _context2.next = 3;
- break;
- }
- throw new te({
- code: "INVALID_PARAM",
- message: "cloudPath必须为字符串类型"
- });
- case 3:
- if (t = t.trim()) {
- _context2.next = 5;
- break;
- }
- throw new te({
- code: "INVALID_PARAM",
- message: "cloudPath不可为空"
- });
- case 5:
- if (!/:\/\//.test(t)) {
- _context2.next = 7;
- break;
- }
- throw new te({
- code: "INVALID_PARAM",
- message: "cloudPath不合法"
- });
- case 7:
- o = i && i.envType || this.config.envType;
- if (!(s && ("/" !== t[0] && (t = "/" + t), t.indexOf("\\") > -1))) {
- _context2.next = 10;
- break;
- }
- throw new te({
- code: "INVALID_PARAM",
- message: "使用cloudPath作为路径时,cloudPath不可包含“\\”"
- });
- case 10:
- _context2.next = 12;
- return this.getOSSUploadOptionsFromPath({
- env: o,
- filename: s ? t.split("/").pop() : t,
- fileId: s ? t : void 0
- });
- case 12:
- a = _context2.sent.result;
- c = "https://" + a.cdnDomain + "/" + a.ossPath;
- u = a.securityToken;
- h = a.accessKeyId;
- l = a.signature;
- d = a.host;
- p = a.ossPath;
- f = a.id;
- m = a.policy;
- y = a.ossCallbackUrl;
- _ = {
- "Cache-Control": "max-age=2592000",
- "Content-Disposition": "attachment",
- OSSAccessKeyId: h,
- Signature: l,
- host: d,
- id: f,
- key: p,
- policy: m,
- success_action_status: 200
- };
- if (u && (_["x-oss-security-token"] = u), y) {
- _e5 = JSON.stringify({
- callbackUrl: y,
- callbackBody: JSON.stringify({
- fileId: f,
- spaceId: this.config.spaceId
- }),
- callbackBodyType: "application/json"
- });
- _.callback = le.toBase64(_e5);
- }
- w = {
- url: "https://" + a.host,
- formData: _,
- fileName: "file",
- name: "file",
- filePath: e,
- fileType: n
- };
- _context2.next = 27;
- return this.uploadFileToOSS(Object.assign({}, w, {
- onUploadProgress: r
- }));
- case 27:
- if (!y) {
- _context2.next = 29;
- break;
- }
- return _context2.abrupt("return", {
- success: !0,
- filePath: e,
- fileID: c
- });
- case 29:
- _context2.next = 31;
- return this.reportOSSUpload({
- id: f
- });
- case 31:
- if (!_context2.sent.success) {
- _context2.next = 33;
- break;
- }
- return _context2.abrupt("return", {
- success: !0,
- filePath: e,
- fileID: c
- });
- case 33:
- throw new te({
- code: "UPLOAD_FAILED",
- message: "文件上传失败"
- });
- case 34:
- case "end":
- return _context2.stop();
- }
- }
- }, _callee2, this);
- }));
- function uploadFile(_x) {
- return _uploadFile.apply(this, arguments);
- }
- return uploadFile;
- }()
- }, {
- key: "getTempFileURL",
- value: function getTempFileURL() {
- var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- e = _ref5.fileList;
- return new Promise(function (t, n) {
- Array.isArray(e) && 0 !== e.length || n(new te({
- code: "INVALID_PARAM",
- message: "fileList的元素必须是非空的字符串"
- })), t({
- fileList: e.map(function (e) {
- return {
- fileID: e,
- tempFileURL: e
- };
- })
- });
- });
- }
- }, {
- key: "getFileInfo",
- value: function () {
- var _getFileInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
- var _ref6,
- e,
- t,
- _args3 = arguments;
- return _regenerator.default.wrap(function _callee3$(_context3) {
- while (1) {
- switch (_context3.prev = _context3.next) {
- case 0:
- _ref6 = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {}, e = _ref6.fileList;
- if (!(!Array.isArray(e) || 0 === e.length)) {
- _context3.next = 3;
- break;
- }
- throw new te({
- code: "INVALID_PARAM",
- message: "fileList的元素必须是非空的字符串"
- });
- case 3:
- t = {
- method: "serverless.file.resource.info",
- params: JSON.stringify({
- id: e.map(function (e) {
- return e.split("?")[0];
- }).join(",")
- })
- };
- _context3.next = 6;
- return this.request(this.setupRequest(t));
- case 6:
- _context3.t0 = _context3.sent.result;
- return _context3.abrupt("return", {
- fileList: _context3.t0
- });
- case 8:
- case "end":
- return _context3.stop();
- }
- }
- }, _callee3, this);
- }));
- function getFileInfo() {
- return _getFileInfo.apply(this, arguments);
- }
- return getFileInfo;
- }()
- }]);
- return de;
- }();
- var pe = {
- init: function init(e) {
- var t = new de(e),
- n = {
- signInAnonymously: function signInAnonymously() {
- return t.authorize();
- },
- getLoginState: function getLoginState() {
- return Promise.resolve(!1);
- }
- };
- return t.auth = function () {
- return n;
- }, t.customAuth = t.auth, t;
- }
- };
- var fe = "undefined" != typeof location && "http:" === location.protocol ? "http:" : "https:";
- var ge;
- !function (e) {
- e.local = "local", e.none = "none", e.session = "session";
- }(ge || (ge = {}));
- var me = function me() {},
- ye = n(function (e, t) {
- var n;
- e.exports = (n = r, function (e) {
- var t = n,
- s = t.lib,
- r = s.WordArray,
- i = s.Hasher,
- o = t.algo,
- a = [],
- c = [];
- !function () {
- function t(t) {
- for (var n = e.sqrt(t), s = 2; s <= n; s++) {
- if (!(t % s)) return !1;
- }
- return !0;
- }
- function n(e) {
- return 4294967296 * (e - (0 | e)) | 0;
- }
- for (var s = 2, r = 0; r < 64;) {
- t(s) && (r < 8 && (a[r] = n(e.pow(s, .5))), c[r] = n(e.pow(s, 1 / 3)), r++), s++;
- }
- }();
- var u = [],
- h = o.SHA256 = i.extend({
- _doReset: function _doReset() {
- this._hash = new r.init(a.slice(0));
- },
- _doProcessBlock: function _doProcessBlock(e, t) {
- for (var n = this._hash.words, s = n[0], r = n[1], i = n[2], o = n[3], a = n[4], h = n[5], l = n[6], d = n[7], p = 0; p < 64; p++) {
- if (p < 16) u[p] = 0 | e[t + p];else {
- var f = u[p - 15],
- g = (f << 25 | f >>> 7) ^ (f << 14 | f >>> 18) ^ f >>> 3,
- m = u[p - 2],
- y = (m << 15 | m >>> 17) ^ (m << 13 | m >>> 19) ^ m >>> 10;
- u[p] = g + u[p - 7] + y + u[p - 16];
- }
- var _ = s & r ^ s & i ^ r & i,
- w = (s << 30 | s >>> 2) ^ (s << 19 | s >>> 13) ^ (s << 10 | s >>> 22),
- v = d + ((a << 26 | a >>> 6) ^ (a << 21 | a >>> 11) ^ (a << 7 | a >>> 25)) + (a & h ^ ~a & l) + c[p] + u[p];
- d = l, l = h, h = a, a = o + v | 0, o = i, i = r, r = s, s = v + (w + _) | 0;
- }
- n[0] = n[0] + s | 0, n[1] = n[1] + r | 0, n[2] = n[2] + i | 0, n[3] = n[3] + o | 0, n[4] = n[4] + a | 0, n[5] = n[5] + h | 0, n[6] = n[6] + l | 0, n[7] = n[7] + d | 0;
- },
- _doFinalize: function _doFinalize() {
- var t = this._data,
- n = t.words,
- s = 8 * this._nDataBytes,
- r = 8 * t.sigBytes;
- return n[r >>> 5] |= 128 << 24 - r % 32, n[14 + (r + 64 >>> 9 << 4)] = e.floor(s / 4294967296), n[15 + (r + 64 >>> 9 << 4)] = s, t.sigBytes = 4 * n.length, this._process(), this._hash;
- },
- clone: function clone() {
- var e = i.clone.call(this);
- return e._hash = this._hash.clone(), e;
- }
- });
- t.SHA256 = i._createHelper(h), t.HmacSHA256 = i._createHmacHelper(h);
- }(Math), n.SHA256);
- }),
- _e = ye,
- we = n(function (e, t) {
- e.exports = r.HmacSHA256;
- });
- var ve = function ve() {
- var e;
- if (!Promise) {
- e = function e() {}, e.promise = {};
- var _t3 = function _t3() {
- throw new te({
- message: 'Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.'
- });
- };
- return Object.defineProperty(e.promise, "then", {
- get: _t3
- }), Object.defineProperty(e.promise, "catch", {
- get: _t3
- }), e;
- }
- var t = new Promise(function (t, n) {
- e = function e(_e6, s) {
- return _e6 ? n(_e6) : t(s);
- };
- });
- return e.promise = t, e;
- };
- function Ie(e) {
- return void 0 === e;
- }
- function Se(e) {
- return "[object Null]" === Object.prototype.toString.call(e);
- }
- function Te() {
- var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
- return e.replace(/([\s\S]+)\s+(请前往云开发AI小助手查看问题:.*)/, "$1");
- }
- function be() {
- var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 32;
- var t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
- var n = "";
- for (var _s4 = 0; _s4 < e; _s4++) {
- n += t.charAt(Math.floor(62 * Math.random()));
- }
- return n;
- }
- var Ee;
- function ke(e) {
- var t = (n = e, "[object Array]" === Object.prototype.toString.call(n) ? e : [e]);
- var n;
- var _iterator = _createForOfIteratorHelper(t),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var _e7 = _step.value;
- var _t4 = _e7.isMatch,
- _n6 = _e7.genAdapter,
- _s5 = _e7.runtime;
- if (_t4()) return {
- adapter: _n6(),
- runtime: _s5
- };
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- }
- !function (e) {
- e.WEB = "web", e.WX_MP = "wx_mp";
- }(Ee || (Ee = {}));
- var Pe = {
- adapter: null,
- runtime: void 0
- },
- Ce = ["anonymousUuidKey"];
- var Ae = /*#__PURE__*/function (_me) {
- (0, _inherits2.default)(Ae, _me);
- var _super2 = _createSuper(Ae);
- function Ae() {
- var _this6;
- (0, _classCallCheck2.default)(this, Ae);
- _this6 = _super2.call(this), Pe.adapter.root.tcbObject || (Pe.adapter.root.tcbObject = {});
- return _this6;
- }
- (0, _createClass2.default)(Ae, [{
- key: "setItem",
- value: function setItem(e, t) {
- Pe.adapter.root.tcbObject[e] = t;
- }
- }, {
- key: "getItem",
- value: function getItem(e) {
- return Pe.adapter.root.tcbObject[e];
- }
- }, {
- key: "removeItem",
- value: function removeItem(e) {
- delete Pe.adapter.root.tcbObject[e];
- }
- }, {
- key: "clear",
- value: function clear() {
- delete Pe.adapter.root.tcbObject;
- }
- }]);
- return Ae;
- }(me);
- function Oe(e, t) {
- switch (e) {
- case "local":
- return t.localStorage || new Ae();
- case "none":
- return new Ae();
- default:
- return t.sessionStorage || new Ae();
- }
- }
- var xe = /*#__PURE__*/function () {
- function xe(e) {
- (0, _classCallCheck2.default)(this, xe);
- if (!this._storage) {
- this._persistence = Pe.adapter.primaryStorage || e.persistence, this._storage = Oe(this._persistence, Pe.adapter);
- var _t5 = "access_token_".concat(e.env),
- _n7 = "access_token_expire_".concat(e.env),
- _s6 = "refresh_token_".concat(e.env),
- _r2 = "anonymous_uuid_".concat(e.env),
- _i = "login_type_".concat(e.env),
- _o = "device_id",
- _a = "token_type_".concat(e.env),
- _c = "user_info_".concat(e.env);
- this.keys = {
- accessTokenKey: _t5,
- accessTokenExpireKey: _n7,
- refreshTokenKey: _s6,
- anonymousUuidKey: _r2,
- loginTypeKey: _i,
- userInfoKey: _c,
- deviceIdKey: _o,
- tokenTypeKey: _a
- };
- }
- }
- (0, _createClass2.default)(xe, [{
- key: "updatePersistence",
- value: function updatePersistence(e) {
- if (e === this._persistence) return;
- var t = "local" === this._persistence;
- this._persistence = e;
- var n = Oe(e, Pe.adapter);
- for (var _e8 in this.keys) {
- var _s7 = this.keys[_e8];
- if (t && Ce.includes(_e8)) continue;
- var _r3 = this._storage.getItem(_s7);
- Ie(_r3) || Se(_r3) || (n.setItem(_s7, _r3), this._storage.removeItem(_s7));
- }
- this._storage = n;
- }
- }, {
- key: "setStore",
- value: function setStore(e, t, n) {
- if (!this._storage) return;
- var s = {
- version: n || "localCachev1",
- content: t
- },
- r = JSON.stringify(s);
- try {
- this._storage.setItem(e, r);
- } catch (e) {
- throw e;
- }
- }
- }, {
- key: "getStore",
- value: function getStore(e, t) {
- try {
- if (!this._storage) return;
- } catch (e) {
- return "";
- }
- t = t || "localCachev1";
- var n = this._storage.getItem(e);
- if (!n) return "";
- if (n.indexOf(t) >= 0) {
- return JSON.parse(n).content;
- }
- return "";
- }
- }, {
- key: "removeStore",
- value: function removeStore(e) {
- this._storage.removeItem(e);
- }
- }]);
- return xe;
- }();
- var Ne = {},
- Re = {};
- function Le(e) {
- return Ne[e];
- }
- var Ue = /*#__PURE__*/(0, _createClass2.default)(function Ue(e, t) {
- (0, _classCallCheck2.default)(this, Ue);
- this.data = t || null, this.name = e;
- });
- var De = /*#__PURE__*/function (_Ue) {
- (0, _inherits2.default)(De, _Ue);
- var _super3 = _createSuper(De);
- function De(e, t) {
- var _this7;
- (0, _classCallCheck2.default)(this, De);
- _this7 = _super3.call(this, "error", {
- error: e,
- data: t
- }), _this7.error = e;
- return _this7;
- }
- return (0, _createClass2.default)(De);
- }(Ue);
- var Me = new ( /*#__PURE__*/function () {
- function _class() {
- (0, _classCallCheck2.default)(this, _class);
- this._listeners = {};
- }
- (0, _createClass2.default)(_class, [{
- key: "on",
- value: function on(e, t) {
- return function (e, t, n) {
- n[e] = n[e] || [], n[e].push(t);
- }(e, t, this._listeners), this;
- }
- }, {
- key: "off",
- value: function off(e, t) {
- return function (e, t, n) {
- if (n && n[e]) {
- var _s8 = n[e].indexOf(t);
- -1 !== _s8 && n[e].splice(_s8, 1);
- }
- }(e, t, this._listeners), this;
- }
- }, {
- key: "fire",
- value: function fire(e, t) {
- if (e instanceof De) return console.error(e.error), this;
- var n = "string" == typeof e ? new Ue(e, t || {}) : e;
- var s = n.name;
- if (this._listens(s)) {
- n.target = this;
- var _e9 = this._listeners[s] ? (0, _toConsumableArray2.default)(this._listeners[s]) : [];
- var _iterator2 = _createForOfIteratorHelper(_e9),
- _step2;
- try {
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
- var _t6 = _step2.value;
- _t6.call(this, n);
- }
- } catch (err) {
- _iterator2.e(err);
- } finally {
- _iterator2.f();
- }
- }
- return this;
- }
- }, {
- key: "_listens",
- value: function _listens(e) {
- return this._listeners[e] && this._listeners[e].length > 0;
- }
- }]);
- return _class;
- }())();
- function qe(e, t) {
- Me.on(e, t);
- }
- function Fe(e) {
- var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- Me.fire(e, t);
- }
- function Ke(e, t) {
- Me.off(e, t);
- }
- var je = "loginStateChanged",
- $e = "loginStateExpire",
- Be = "loginTypeChanged",
- We = "anonymousConverted",
- He = "refreshAccessToken";
- var Je;
- !function (e) {
- e.ANONYMOUS = "ANONYMOUS", e.WECHAT = "WECHAT", e.WECHAT_PUBLIC = "WECHAT-PUBLIC", e.WECHAT_OPEN = "WECHAT-OPEN", e.CUSTOM = "CUSTOM", e.EMAIL = "EMAIL", e.USERNAME = "USERNAME", e.NULL = "NULL";
- }(Je || (Je = {}));
- var ze = /*#__PURE__*/function () {
- function ze() {
- (0, _classCallCheck2.default)(this, ze);
- this._fnPromiseMap = new Map();
- }
- (0, _createClass2.default)(ze, [{
- key: "run",
- value: function () {
- var _run = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(e, t) {
- var _this8 = this;
- var n;
- return _regenerator.default.wrap(function _callee5$(_context5) {
- while (1) {
- switch (_context5.prev = _context5.next) {
- case 0:
- n = this._fnPromiseMap.get(e);
- return _context5.abrupt("return", (n || (n = new Promise( /*#__PURE__*/function () {
- var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(n, s) {
- var _e10;
- return _regenerator.default.wrap(function _callee4$(_context4) {
- while (1) {
- switch (_context4.prev = _context4.next) {
- case 0:
- _context4.prev = 0;
- _context4.next = 3;
- return _this8._runIdlePromise();
- case 3:
- _e10 = t();
- _context4.t0 = n;
- _context4.next = 7;
- return _e10;
- case 7:
- _context4.t1 = _context4.sent;
- (0, _context4.t0)(_context4.t1);
- _context4.next = 14;
- break;
- case 11:
- _context4.prev = 11;
- _context4.t2 = _context4["catch"](0);
- s(_context4.t2);
- case 14:
- _context4.prev = 14;
- _this8._fnPromiseMap.delete(e);
- return _context4.finish(14);
- case 17:
- case "end":
- return _context4.stop();
- }
- }
- }, _callee4, null, [[0, 11, 14, 17]]);
- }));
- return function (_x4, _x5) {
- return _ref7.apply(this, arguments);
- };
- }()), this._fnPromiseMap.set(e, n)), n));
- case 2:
- case "end":
- return _context5.stop();
- }
- }
- }, _callee5, this);
- }));
- function run(_x2, _x3) {
- return _run.apply(this, arguments);
- }
- return run;
- }()
- }, {
- key: "_runIdlePromise",
- value: function _runIdlePromise() {
- return Promise.resolve();
- }
- }]);
- return ze;
- }();
- var Ve = /*#__PURE__*/function () {
- function Ve(e) {
- (0, _classCallCheck2.default)(this, Ve);
- this._singlePromise = new ze(), this._cache = Le(e.env), this._baseURL = "https://".concat(e.env, ".ap-shanghai.tcb-api.tencentcloudapi.com"), this._reqClass = new Pe.adapter.reqClass({
- timeout: e.timeout,
- timeoutMsg: "\u8BF7\u6C42\u5728".concat(e.timeout / 1e3, "s\u5185\u672A\u5B8C\u6210\uFF0C\u5DF2\u4E2D\u65AD"),
- restrictedMethods: ["post"]
- });
- }
- (0, _createClass2.default)(Ve, [{
- key: "_getDeviceId",
- value: function _getDeviceId() {
- if (this._deviceID) return this._deviceID;
- var e = this._cache.keys.deviceIdKey;
- var t = this._cache.getStore(e);
- return "string" == typeof t && t.length >= 16 && t.length <= 48 || (t = be(), this._cache.setStore(e, t)), this._deviceID = t, t;
- }
- }, {
- key: "_request",
- value: function () {
- var _request2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(e, t) {
- var n,
- s,
- _e11,
- _t7,
- _n8,
- _args6 = arguments;
- return _regenerator.default.wrap(function _callee6$(_context6) {
- while (1) {
- switch (_context6.prev = _context6.next) {
- case 0:
- n = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : {};
- s = {
- "x-request-id": be(),
- "x-device-id": this._getDeviceId()
- };
- if (!n.withAccessToken) {
- _context6.next = 9;
- break;
- }
- _e11 = this._cache.keys.tokenTypeKey;
- _context6.next = 6;
- return this.getAccessToken();
- case 6:
- _t7 = _context6.sent;
- _n8 = this._cache.getStore(_e11);
- s.authorization = "".concat(_n8, " ").concat(_t7);
- case 9:
- return _context6.abrupt("return", this._reqClass["get" === n.method ? "get" : "post"]({
- url: "".concat(this._baseURL).concat(e),
- data: t,
- headers: s
- }));
- case 10:
- case "end":
- return _context6.stop();
- }
- }
- }, _callee6, this);
- }));
- function _request(_x6, _x7) {
- return _request2.apply(this, arguments);
- }
- return _request;
- }()
- }, {
- key: "_fetchAccessToken",
- value: function () {
- var _fetchAccessToken2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
- var _this9 = this;
- var _this$_cache$keys, e, t, n, s, r, i, o, a, c;
- return _regenerator.default.wrap(function _callee8$(_context8) {
- while (1) {
- switch (_context8.prev = _context8.next) {
- case 0:
- _this$_cache$keys = this._cache.keys, e = _this$_cache$keys.loginTypeKey, t = _this$_cache$keys.accessTokenKey, n = _this$_cache$keys.accessTokenExpireKey, s = _this$_cache$keys.tokenTypeKey, r = this._cache.getStore(e);
- if (!(r && r !== Je.ANONYMOUS)) {
- _context8.next = 3;
- break;
- }
- throw new te({
- code: "INVALID_OPERATION",
- message: "非匿名登录不支持刷新 access token"
- });
- case 3:
- _context8.next = 5;
- return this._singlePromise.run("fetchAccessToken", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
- return _regenerator.default.wrap(function _callee7$(_context7) {
- while (1) {
- switch (_context7.prev = _context7.next) {
- case 0:
- _context7.next = 2;
- return _this9._request("/auth/v1/signin/anonymously", {}, {
- method: "post"
- });
- case 2:
- return _context7.abrupt("return", _context7.sent.data);
- case 3:
- case "end":
- return _context7.stop();
- }
- }
- }, _callee7);
- })));
- case 5:
- i = _context8.sent;
- o = i.access_token;
- a = i.expires_in;
- c = i.token_type;
- return _context8.abrupt("return", (this._cache.setStore(s, c), this._cache.setStore(t, o), this._cache.setStore(n, Date.now() + 1e3 * a), o));
- case 10:
- case "end":
- return _context8.stop();
- }
- }
- }, _callee8, this);
- }));
- function _fetchAccessToken() {
- return _fetchAccessToken2.apply(this, arguments);
- }
- return _fetchAccessToken;
- }()
- }, {
- key: "isAccessTokenExpired",
- value: function isAccessTokenExpired(e, t) {
- var n = !0;
- return e && t && (n = t < Date.now()), n;
- }
- }, {
- key: "getAccessToken",
- value: function () {
- var _getAccessToken = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
- var _this$_cache$keys2, e, t, n, s;
- return _regenerator.default.wrap(function _callee9$(_context9) {
- while (1) {
- switch (_context9.prev = _context9.next) {
- case 0:
- _this$_cache$keys2 = this._cache.keys, e = _this$_cache$keys2.accessTokenKey, t = _this$_cache$keys2.accessTokenExpireKey, n = this._cache.getStore(e), s = this._cache.getStore(t);
- return _context9.abrupt("return", this.isAccessTokenExpired(n, s) ? this._fetchAccessToken() : n);
- case 2:
- case "end":
- return _context9.stop();
- }
- }
- }, _callee9, this);
- }));
- function getAccessToken() {
- return _getAccessToken.apply(this, arguments);
- }
- return getAccessToken;
- }()
- }, {
- key: "refreshAccessToken",
- value: function () {
- var _refreshAccessToken = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
- var _this$_cache$keys3, e, t, n;
- return _regenerator.default.wrap(function _callee10$(_context10) {
- while (1) {
- switch (_context10.prev = _context10.next) {
- case 0:
- _this$_cache$keys3 = this._cache.keys, e = _this$_cache$keys3.accessTokenKey, t = _this$_cache$keys3.accessTokenExpireKey, n = _this$_cache$keys3.loginTypeKey;
- return _context10.abrupt("return", (this._cache.removeStore(e), this._cache.removeStore(t), this._cache.setStore(n, Je.ANONYMOUS), this.getAccessToken()));
- case 2:
- case "end":
- return _context10.stop();
- }
- }
- }, _callee10, this);
- }));
- function refreshAccessToken() {
- return _refreshAccessToken.apply(this, arguments);
- }
- return refreshAccessToken;
- }()
- }, {
- key: "getUserInfo",
- value: function () {
- var _getUserInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
- var _this10 = this;
- return _regenerator.default.wrap(function _callee12$(_context12) {
- while (1) {
- switch (_context12.prev = _context12.next) {
- case 0:
- return _context12.abrupt("return", this._singlePromise.run("getUserInfo", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
- return _regenerator.default.wrap(function _callee11$(_context11) {
- while (1) {
- switch (_context11.prev = _context11.next) {
- case 0:
- _context11.next = 2;
- return _this10._request("/auth/v1/user/me", {}, {
- withAccessToken: !0,
- method: "get"
- });
- case 2:
- return _context11.abrupt("return", _context11.sent.data);
- case 3:
- case "end":
- return _context11.stop();
- }
- }
- }, _callee11);
- }))));
- case 1:
- case "end":
- return _context12.stop();
- }
- }
- }, _callee12, this);
- }));
- function getUserInfo() {
- return _getUserInfo.apply(this, arguments);
- }
- return getUserInfo;
- }()
- }]);
- return Ve;
- }();
- var Ge = ["auth.getJwt", "auth.logout", "auth.signInWithTicket", "auth.signInAnonymously", "auth.signIn", "auth.fetchAccessTokenWithRefreshToken", "auth.signUpWithEmailAndPassword", "auth.activateEndUserMail", "auth.sendPasswordResetEmail", "auth.resetPasswordWithToken", "auth.isUsernameRegistered"],
- Ye = {
- "X-SDK-Version": "1.3.5"
- };
- function Qe(e, t, n) {
- var s = e[t];
- e[t] = function (t) {
- var r = {},
- i = {};
- n.forEach(function (n) {
- var _n$call = n.call(e, t),
- s = _n$call.data,
- o = _n$call.headers;
- Object.assign(r, s), Object.assign(i, o);
- });
- var o = t.data;
- return o && function () {
- var e;
- if (e = o, "[object FormData]" !== Object.prototype.toString.call(e)) t.data = _objectSpread(_objectSpread({}, o), r);else for (var _e12 in r) {
- o.append(_e12, r[_e12]);
- }
- }(), t.headers = _objectSpread(_objectSpread({}, t.headers || {}), i), s.call(e, t);
- };
- }
- function Xe() {
- var e = Math.random().toString(16).slice(2);
- return {
- data: {
- seqId: e
- },
- headers: _objectSpread(_objectSpread({}, Ye), {}, {
- "x-seqid": e
- })
- };
- }
- var Ze = /*#__PURE__*/function () {
- function Ze() {
- var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- (0, _classCallCheck2.default)(this, Ze);
- var t;
- this.config = e, this._reqClass = new Pe.adapter.reqClass({
- timeout: this.config.timeout,
- timeoutMsg: "\u8BF7\u6C42\u5728".concat(this.config.timeout / 1e3, "s\u5185\u672A\u5B8C\u6210\uFF0C\u5DF2\u4E2D\u65AD"),
- restrictedMethods: ["post"]
- }), this._cache = Le(this.config.env), this._localCache = (t = this.config.env, Re[t]), this.oauth = new Ve(this.config), Qe(this._reqClass, "post", [Xe]), Qe(this._reqClass, "upload", [Xe]), Qe(this._reqClass, "download", [Xe]);
- }
- (0, _createClass2.default)(Ze, [{
- key: "post",
- value: function () {
- var _post = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(e) {
- return _regenerator.default.wrap(function _callee13$(_context13) {
- while (1) {
- switch (_context13.prev = _context13.next) {
- case 0:
- _context13.next = 2;
- return this._reqClass.post(e);
- case 2:
- return _context13.abrupt("return", _context13.sent);
- case 3:
- case "end":
- return _context13.stop();
- }
- }
- }, _callee13, this);
- }));
- function post(_x8) {
- return _post.apply(this, arguments);
- }
- return post;
- }()
- }, {
- key: "upload",
- value: function () {
- var _upload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(e) {
- return _regenerator.default.wrap(function _callee14$(_context14) {
- while (1) {
- switch (_context14.prev = _context14.next) {
- case 0:
- _context14.next = 2;
- return this._reqClass.upload(e);
- case 2:
- return _context14.abrupt("return", _context14.sent);
- case 3:
- case "end":
- return _context14.stop();
- }
- }
- }, _callee14, this);
- }));
- function upload(_x9) {
- return _upload.apply(this, arguments);
- }
- return upload;
- }()
- }, {
- key: "download",
- value: function () {
- var _download = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(e) {
- return _regenerator.default.wrap(function _callee15$(_context15) {
- while (1) {
- switch (_context15.prev = _context15.next) {
- case 0:
- _context15.next = 2;
- return this._reqClass.download(e);
- case 2:
- return _context15.abrupt("return", _context15.sent);
- case 3:
- case "end":
- return _context15.stop();
- }
- }
- }, _callee15, this);
- }));
- function download(_x10) {
- return _download.apply(this, arguments);
- }
- return download;
- }()
- }, {
- key: "refreshAccessToken",
- value: function () {
- var _refreshAccessToken2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
- var e, t;
- return _regenerator.default.wrap(function _callee16$(_context16) {
- while (1) {
- switch (_context16.prev = _context16.next) {
- case 0:
- this._refreshAccessTokenPromise || (this._refreshAccessTokenPromise = this._refreshAccessToken());
- _context16.prev = 1;
- _context16.next = 4;
- return this._refreshAccessTokenPromise;
- case 4:
- e = _context16.sent;
- _context16.next = 10;
- break;
- case 7:
- _context16.prev = 7;
- _context16.t0 = _context16["catch"](1);
- t = _context16.t0;
- case 10:
- if (!(this._refreshAccessTokenPromise = null, this._shouldRefreshAccessTokenHook = null, t)) {
- _context16.next = 12;
- break;
- }
- throw t;
- case 12:
- return _context16.abrupt("return", e);
- case 13:
- case "end":
- return _context16.stop();
- }
- }
- }, _callee16, this, [[1, 7]]);
- }));
- function refreshAccessToken() {
- return _refreshAccessToken2.apply(this, arguments);
- }
- return refreshAccessToken;
- }()
- }, {
- key: "_refreshAccessToken",
- value: function () {
- var _refreshAccessToken3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17() {
- var _this$_cache$keys4, e, t, n, s, r, i, o, a, _e13, _e14, _t8, _s9;
- return _regenerator.default.wrap(function _callee17$(_context17) {
- while (1) {
- switch (_context17.prev = _context17.next) {
- case 0:
- _this$_cache$keys4 = this._cache.keys, e = _this$_cache$keys4.accessTokenKey, t = _this$_cache$keys4.accessTokenExpireKey, n = _this$_cache$keys4.refreshTokenKey, s = _this$_cache$keys4.loginTypeKey, r = _this$_cache$keys4.anonymousUuidKey;
- this._cache.removeStore(e), this._cache.removeStore(t);
- i = this._cache.getStore(n);
- if (i) {
- _context17.next = 5;
- break;
- }
- throw new te({
- message: "未登录CloudBase"
- });
- case 5:
- o = {
- refresh_token: i
- };
- _context17.next = 8;
- return this.request("auth.fetchAccessTokenWithRefreshToken", o);
- case 8:
- a = _context17.sent;
- if (!a.data.code) {
- _context17.next = 21;
- break;
- }
- _e13 = a.data.code;
- if (!("SIGN_PARAM_INVALID" === _e13 || "REFRESH_TOKEN_EXPIRED" === _e13 || "INVALID_REFRESH_TOKEN" === _e13)) {
- _context17.next = 20;
- break;
- }
- if (!(this._cache.getStore(s) === Je.ANONYMOUS && "INVALID_REFRESH_TOKEN" === _e13)) {
- _context17.next = 19;
- break;
- }
- _e14 = this._cache.getStore(r);
- _t8 = this._cache.getStore(n);
- _context17.next = 17;
- return this.send("auth.signInAnonymously", {
- anonymous_uuid: _e14,
- refresh_token: _t8
- });
- case 17:
- _s9 = _context17.sent;
- return _context17.abrupt("return", (this.setRefreshToken(_s9.refresh_token), this._refreshAccessToken()));
- case 19:
- Fe($e), this._cache.removeStore(n);
- case 20:
- throw new te({
- code: a.data.code,
- message: "\u5237\u65B0access token\u5931\u8D25\uFF1A".concat(a.data.code)
- });
- case 21:
- if (!a.data.access_token) {
- _context17.next = 23;
- break;
- }
- return _context17.abrupt("return", (Fe(He), this._cache.setStore(e, a.data.access_token), this._cache.setStore(t, a.data.access_token_expire + Date.now()), {
- accessToken: a.data.access_token,
- accessTokenExpire: a.data.access_token_expire
- }));
- case 23:
- a.data.refresh_token && (this._cache.removeStore(n), this._cache.setStore(n, a.data.refresh_token), this._refreshAccessToken());
- case 24:
- case "end":
- return _context17.stop();
- }
- }
- }, _callee17, this);
- }));
- function _refreshAccessToken() {
- return _refreshAccessToken3.apply(this, arguments);
- }
- return _refreshAccessToken;
- }()
- }, {
- key: "getAccessToken",
- value: function () {
- var _getAccessToken2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18() {
- var _this$_cache$keys5, e, t, n, s, r, i;
- return _regenerator.default.wrap(function _callee18$(_context18) {
- while (1) {
- switch (_context18.prev = _context18.next) {
- case 0:
- _this$_cache$keys5 = this._cache.keys, e = _this$_cache$keys5.accessTokenKey, t = _this$_cache$keys5.accessTokenExpireKey, n = _this$_cache$keys5.refreshTokenKey;
- if (this._cache.getStore(n)) {
- _context18.next = 3;
- break;
- }
- throw new te({
- message: "refresh token不存在,登录状态异常"
- });
- case 3:
- s = this._cache.getStore(e), r = this._cache.getStore(t), i = !0;
- _context18.t0 = this._shouldRefreshAccessTokenHook;
- if (!_context18.t0) {
- _context18.next = 9;
- break;
- }
- _context18.next = 8;
- return this._shouldRefreshAccessTokenHook(s, r);
- case 8:
- _context18.t0 = !_context18.sent;
- case 9:
- _context18.t1 = _context18.t0;
- if (!_context18.t1) {
- _context18.next = 12;
- break;
- }
- i = !1;
- case 12:
- return _context18.abrupt("return", (!s || !r || r < Date.now()) && i ? this.refreshAccessToken() : {
- accessToken: s,
- accessTokenExpire: r
- });
- case 13:
- case "end":
- return _context18.stop();
- }
- }
- }, _callee18, this);
- }));
- function getAccessToken() {
- return _getAccessToken2.apply(this, arguments);
- }
- return getAccessToken;
- }()
- }, {
- key: "request",
- value: function () {
- var _request3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(e, t, n) {
- var s, r, i, o, _e15, _e16, a, c, u, h, l, d, p, f, g;
- return _regenerator.default.wrap(function _callee19$(_context19) {
- while (1) {
- switch (_context19.prev = _context19.next) {
- case 0:
- s = "x-tcb-trace_".concat(this.config.env);
- r = "application/x-www-form-urlencoded";
- i = _objectSpread({
- action: e,
- env: this.config.env,
- dataVersion: "2019-08-16"
- }, t);
- _context19.t0 = -1 === Ge.indexOf(e);
- if (!_context19.t0) {
- _context19.next = 9;
- break;
- }
- this._cache.keys;
- _context19.next = 8;
- return this.oauth.getAccessToken();
- case 8:
- i.access_token = _context19.sent;
- case 9:
- if (!("storage.uploadFile" === e)) {
- _context19.next = 15;
- break;
- }
- o = new FormData();
- for (_e15 in o) {
- o.hasOwnProperty(_e15) && void 0 !== o[_e15] && o.append(_e15, i[_e15]);
- }
- r = "multipart/form-data";
- _context19.next = 17;
- break;
- case 15:
- r = "application/json", o = {};
- for (_e16 in i) {
- void 0 !== i[_e16] && (o[_e16] = i[_e16]);
- }
- case 17:
- a = {
- headers: {
- "content-type": r
- }
- };
- n && n.timeout && (a.timeout = n.timeout), n && n.onUploadProgress && (a.onUploadProgress = n.onUploadProgress);
- c = this._localCache.getStore(s);
- c && (a.headers["X-TCB-Trace"] = c);
- u = t.parse, h = t.inQuery, l = t.search;
- d = {
- env: this.config.env
- };
- u && (d.parse = !0), h && (d = _objectSpread(_objectSpread({}, h), d));
- p = function (e, t) {
- var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- var s = /\?/.test(t);
- var r = "";
- for (var _e17 in n) {
- "" === r ? !s && (t += "?") : r += "&", r += "".concat(_e17, "=").concat(encodeURIComponent(n[_e17]));
- }
- return /^http(s)?\:\/\//.test(t += r) ? t : "".concat(e).concat(t);
- }(fe, "//tcb-api.tencentcloudapi.com/web", d);
- l && (p += l);
- _context19.next = 28;
- return this.post(_objectSpread({
- url: p,
- data: o
- }, a));
- case 28:
- f = _context19.sent;
- g = f.header && f.header["x-tcb-trace"];
- if (!(g && this._localCache.setStore(s, g), 200 !== Number(f.status) && 200 !== Number(f.statusCode) || !f.data)) {
- _context19.next = 32;
- break;
- }
- throw new te({
- code: "NETWORK_ERROR",
- message: "network request error"
- });
- case 32:
- return _context19.abrupt("return", f);
- case 33:
- case "end":
- return _context19.stop();
- }
- }
- }, _callee19, this);
- }));
- function request(_x11, _x12, _x13) {
- return _request3.apply(this, arguments);
- }
- return request;
- }()
- }, {
- key: "send",
- value: function () {
- var _send = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(e) {
- var t,
- n,
- s,
- _s10,
- _args20 = arguments;
- return _regenerator.default.wrap(function _callee20$(_context20) {
- while (1) {
- switch (_context20.prev = _context20.next) {
- case 0:
- t = _args20.length > 1 && _args20[1] !== undefined ? _args20[1] : {};
- n = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : {};
- _context20.next = 4;
- return this.request(e, t, _objectSpread(_objectSpread({}, n), {}, {
- onUploadProgress: t.onUploadProgress
- }));
- case 4:
- s = _context20.sent;
- if (!(("ACCESS_TOKEN_DISABLED" === s.data.code || "ACCESS_TOKEN_EXPIRED" === s.data.code) && -1 === Ge.indexOf(e))) {
- _context20.next = 14;
- break;
- }
- _context20.next = 8;
- return this.oauth.refreshAccessToken();
- case 8:
- _context20.next = 10;
- return this.request(e, t, _objectSpread(_objectSpread({}, n), {}, {
- onUploadProgress: t.onUploadProgress
- }));
- case 10:
- _s10 = _context20.sent;
- if (!_s10.data.code) {
- _context20.next = 13;
- break;
- }
- throw new te({
- code: _s10.data.code,
- message: Te(_s10.data.message)
- });
- case 13:
- return _context20.abrupt("return", _s10.data);
- case 14:
- if (!s.data.code) {
- _context20.next = 16;
- break;
- }
- throw new te({
- code: s.data.code,
- message: Te(s.data.message)
- });
- case 16:
- return _context20.abrupt("return", s.data);
- case 17:
- case "end":
- return _context20.stop();
- }
- }
- }, _callee20, this);
- }));
- function send(_x14) {
- return _send.apply(this, arguments);
- }
- return send;
- }()
- }, {
- key: "setRefreshToken",
- value: function setRefreshToken(e) {
- var _this$_cache$keys6 = this._cache.keys,
- t = _this$_cache$keys6.accessTokenKey,
- n = _this$_cache$keys6.accessTokenExpireKey,
- s = _this$_cache$keys6.refreshTokenKey;
- this._cache.removeStore(t), this._cache.removeStore(n), this._cache.setStore(s, e);
- }
- }]);
- return Ze;
- }();
- var et = {};
- function tt(e) {
- return et[e];
- }
- var nt = /*#__PURE__*/function () {
- function nt(e) {
- (0, _classCallCheck2.default)(this, nt);
- this.config = e, this._cache = Le(e.env), this._request = tt(e.env);
- }
- (0, _createClass2.default)(nt, [{
- key: "setRefreshToken",
- value: function setRefreshToken(e) {
- var _this$_cache$keys7 = this._cache.keys,
- t = _this$_cache$keys7.accessTokenKey,
- n = _this$_cache$keys7.accessTokenExpireKey,
- s = _this$_cache$keys7.refreshTokenKey;
- this._cache.removeStore(t), this._cache.removeStore(n), this._cache.setStore(s, e);
- }
- }, {
- key: "setAccessToken",
- value: function setAccessToken(e, t) {
- var _this$_cache$keys8 = this._cache.keys,
- n = _this$_cache$keys8.accessTokenKey,
- s = _this$_cache$keys8.accessTokenExpireKey;
- this._cache.setStore(n, e), this._cache.setStore(s, t);
- }
- }, {
- key: "refreshUserInfo",
- value: function () {
- var _refreshUserInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21() {
- var _yield$this$_request$, e;
- return _regenerator.default.wrap(function _callee21$(_context21) {
- while (1) {
- switch (_context21.prev = _context21.next) {
- case 0:
- _context21.next = 2;
- return this._request.send("auth.getUserInfo", {});
- case 2:
- _yield$this$_request$ = _context21.sent;
- e = _yield$this$_request$.data;
- return _context21.abrupt("return", (this.setLocalUserInfo(e), e));
- case 5:
- case "end":
- return _context21.stop();
- }
- }
- }, _callee21, this);
- }));
- function refreshUserInfo() {
- return _refreshUserInfo.apply(this, arguments);
- }
- return refreshUserInfo;
- }()
- }, {
- key: "setLocalUserInfo",
- value: function setLocalUserInfo(e) {
- var t = this._cache.keys.userInfoKey;
- this._cache.setStore(t, e);
- }
- }]);
- return nt;
- }();
- var st = /*#__PURE__*/function () {
- function st(e) {
- (0, _classCallCheck2.default)(this, st);
- if (!e) throw new te({
- code: "PARAM_ERROR",
- message: "envId is not defined"
- });
- this._envId = e, this._cache = Le(this._envId), this._request = tt(this._envId), this.setUserInfo();
- }
- (0, _createClass2.default)(st, [{
- key: "linkWithTicket",
- value: function linkWithTicket(e) {
- if ("string" != typeof e) throw new te({
- code: "PARAM_ERROR",
- message: "ticket must be string"
- });
- return this._request.send("auth.linkWithTicket", {
- ticket: e
- });
- }
- }, {
- key: "linkWithRedirect",
- value: function linkWithRedirect(e) {
- e.signInWithRedirect();
- }
- }, {
- key: "updatePassword",
- value: function updatePassword(e, t) {
- return this._request.send("auth.updatePassword", {
- oldPassword: t,
- newPassword: e
- });
- }
- }, {
- key: "updateEmail",
- value: function updateEmail(e) {
- return this._request.send("auth.updateEmail", {
- newEmail: e
- });
- }
- }, {
- key: "updateUsername",
- value: function updateUsername(e) {
- if ("string" != typeof e) throw new te({
- code: "PARAM_ERROR",
- message: "username must be a string"
- });
- return this._request.send("auth.updateUsername", {
- username: e
- });
- }
- }, {
- key: "getLinkedUidList",
- value: function () {
- var _getLinkedUidList = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22() {
- var _yield$this$_request$2, e, t, n;
- return _regenerator.default.wrap(function _callee22$(_context22) {
- while (1) {
- switch (_context22.prev = _context22.next) {
- case 0:
- _context22.next = 2;
- return this._request.send("auth.getLinkedUidList", {});
- case 2:
- _yield$this$_request$2 = _context22.sent;
- e = _yield$this$_request$2.data;
- t = !1;
- n = e.users;
- return _context22.abrupt("return", (n.forEach(function (e) {
- e.wxOpenId && e.wxPublicId && (t = !0);
- }), {
- users: n,
- hasPrimaryUid: t
- }));
- case 7:
- case "end":
- return _context22.stop();
- }
- }
- }, _callee22, this);
- }));
- function getLinkedUidList() {
- return _getLinkedUidList.apply(this, arguments);
- }
- return getLinkedUidList;
- }()
- }, {
- key: "setPrimaryUid",
- value: function setPrimaryUid(e) {
- return this._request.send("auth.setPrimaryUid", {
- uid: e
- });
- }
- }, {
- key: "unlink",
- value: function unlink(e) {
- return this._request.send("auth.unlink", {
- platform: e
- });
- }
- }, {
- key: "update",
- value: function () {
- var _update = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23(e) {
- var t, n, s, r, i, o, _yield$this$_request$3, a;
- return _regenerator.default.wrap(function _callee23$(_context23) {
- while (1) {
- switch (_context23.prev = _context23.next) {
- case 0:
- t = e.nickName;
- n = e.gender;
- s = e.avatarUrl;
- r = e.province;
- i = e.country;
- o = e.city;
- _context23.next = 8;
- return this._request.send("auth.updateUserInfo", {
- nickName: t,
- gender: n,
- avatarUrl: s,
- province: r,
- country: i,
- city: o
- });
- case 8:
- _yield$this$_request$3 = _context23.sent;
- a = _yield$this$_request$3.data;
- this.setLocalUserInfo(a);
- case 11:
- case "end":
- return _context23.stop();
- }
- }
- }, _callee23, this);
- }));
- function update(_x15) {
- return _update.apply(this, arguments);
- }
- return update;
- }()
- }, {
- key: "refresh",
- value: function () {
- var _refresh = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee24() {
- var e;
- return _regenerator.default.wrap(function _callee24$(_context24) {
- while (1) {
- switch (_context24.prev = _context24.next) {
- case 0:
- _context24.next = 2;
- return this._request.oauth.getUserInfo();
- case 2:
- e = _context24.sent;
- return _context24.abrupt("return", (this.setLocalUserInfo(e), e));
- case 4:
- case "end":
- return _context24.stop();
- }
- }
- }, _callee24, this);
- }));
- function refresh() {
- return _refresh.apply(this, arguments);
- }
- return refresh;
- }()
- }, {
- key: "setUserInfo",
- value: function setUserInfo() {
- var _this11 = this;
- var e = this._cache.keys.userInfoKey,
- t = this._cache.getStore(e);
- ["uid", "loginType", "openid", "wxOpenId", "wxPublicId", "unionId", "qqMiniOpenId", "email", "hasPassword", "customUserId", "nickName", "gender", "avatarUrl"].forEach(function (e) {
- _this11[e] = t[e];
- }), this.location = {
- country: t.country,
- province: t.province,
- city: t.city
- };
- }
- }, {
- key: "setLocalUserInfo",
- value: function setLocalUserInfo(e) {
- var t = this._cache.keys.userInfoKey;
- this._cache.setStore(t, e), this.setUserInfo();
- }
- }]);
- return st;
- }();
- var rt = /*#__PURE__*/function () {
- function rt(e) {
- (0, _classCallCheck2.default)(this, rt);
- if (!e) throw new te({
- code: "PARAM_ERROR",
- message: "envId is not defined"
- });
- this._cache = Le(e);
- var _this$_cache$keys9 = this._cache.keys,
- t = _this$_cache$keys9.refreshTokenKey,
- n = _this$_cache$keys9.accessTokenKey,
- s = _this$_cache$keys9.accessTokenExpireKey,
- r = this._cache.getStore(t),
- i = this._cache.getStore(n),
- o = this._cache.getStore(s);
- this.credential = {
- refreshToken: r,
- accessToken: i,
- accessTokenExpire: o
- }, this.user = new st(e);
- }
- (0, _createClass2.default)(rt, [{
- key: "isAnonymousAuth",
- get: function get() {
- return this.loginType === Je.ANONYMOUS;
- }
- }, {
- key: "isCustomAuth",
- get: function get() {
- return this.loginType === Je.CUSTOM;
- }
- }, {
- key: "isWeixinAuth",
- get: function get() {
- return this.loginType === Je.WECHAT || this.loginType === Je.WECHAT_OPEN || this.loginType === Je.WECHAT_PUBLIC;
- }
- }, {
- key: "loginType",
- get: function get() {
- return this._cache.getStore(this._cache.keys.loginTypeKey);
- }
- }]);
- return rt;
- }();
- var it = /*#__PURE__*/function (_nt) {
- (0, _inherits2.default)(it, _nt);
- var _super4 = _createSuper(it);
- function it() {
- (0, _classCallCheck2.default)(this, it);
- return _super4.apply(this, arguments);
- }
- (0, _createClass2.default)(it, [{
- key: "signIn",
- value: function () {
- var _signIn = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee25() {
- var e;
- return _regenerator.default.wrap(function _callee25$(_context25) {
- while (1) {
- switch (_context25.prev = _context25.next) {
- case 0:
- this._cache.updatePersistence("local");
- _context25.next = 3;
- return this._request.oauth.getAccessToken();
- case 3:
- Fe(je);
- Fe(Be, {
- env: this.config.env,
- loginType: Je.ANONYMOUS,
- persistence: "local"
- });
- e = new rt(this.config.env);
- _context25.next = 8;
- return e.user.refresh();
- case 8:
- return _context25.abrupt("return", e);
- case 9:
- case "end":
- return _context25.stop();
- }
- }
- }, _callee25, this);
- }));
- function signIn() {
- return _signIn.apply(this, arguments);
- }
- return signIn;
- }()
- }, {
- key: "linkAndRetrieveDataWithTicket",
- value: function () {
- var _linkAndRetrieveDataWithTicket = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee26(e) {
- var _this$_cache$keys10, t, n, s, r, i;
- return _regenerator.default.wrap(function _callee26$(_context26) {
- while (1) {
- switch (_context26.prev = _context26.next) {
- case 0:
- _this$_cache$keys10 = this._cache.keys;
- t = _this$_cache$keys10.anonymousUuidKey;
- n = _this$_cache$keys10.refreshTokenKey;
- s = this._cache.getStore(t);
- r = this._cache.getStore(n);
- _context26.next = 7;
- return this._request.send("auth.linkAndRetrieveDataWithTicket", {
- anonymous_uuid: s,
- refresh_token: r,
- ticket: e
- });
- case 7:
- i = _context26.sent;
- if (!i.refresh_token) {
- _context26.next = 16;
- break;
- }
- this._clearAnonymousUUID();
- this.setRefreshToken(i.refresh_token);
- _context26.next = 13;
- return this._request.refreshAccessToken();
- case 13:
- Fe(We, {
- env: this.config.env
- });
- Fe(Be, {
- loginType: Je.CUSTOM,
- persistence: "local"
- });
- return _context26.abrupt("return", {
- credential: {
- refreshToken: i.refresh_token
- }
- });
- case 16:
- throw new te({
- message: "匿名转化失败"
- });
- case 17:
- case "end":
- return _context26.stop();
- }
- }
- }, _callee26, this);
- }));
- function linkAndRetrieveDataWithTicket(_x16) {
- return _linkAndRetrieveDataWithTicket.apply(this, arguments);
- }
- return linkAndRetrieveDataWithTicket;
- }()
- }, {
- key: "_setAnonymousUUID",
- value: function _setAnonymousUUID(e) {
- var _this$_cache$keys11 = this._cache.keys,
- t = _this$_cache$keys11.anonymousUuidKey,
- n = _this$_cache$keys11.loginTypeKey;
- this._cache.removeStore(t), this._cache.setStore(t, e), this._cache.setStore(n, Je.ANONYMOUS);
- }
- }, {
- key: "_clearAnonymousUUID",
- value: function _clearAnonymousUUID() {
- this._cache.removeStore(this._cache.keys.anonymousUuidKey);
- }
- }]);
- return it;
- }(nt);
- var ot = /*#__PURE__*/function (_nt2) {
- (0, _inherits2.default)(ot, _nt2);
- var _super5 = _createSuper(ot);
- function ot() {
- (0, _classCallCheck2.default)(this, ot);
- return _super5.apply(this, arguments);
- }
- (0, _createClass2.default)(ot, [{
- key: "signIn",
- value: function () {
- var _signIn2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee27(e) {
- var t, n;
- return _regenerator.default.wrap(function _callee27$(_context27) {
- while (1) {
- switch (_context27.prev = _context27.next) {
- case 0:
- if (!("string" != typeof e)) {
- _context27.next = 2;
- break;
- }
- throw new te({
- code: "PARAM_ERROR",
- message: "ticket must be a string"
- });
- case 2:
- t = this._cache.keys.refreshTokenKey;
- _context27.next = 5;
- return this._request.send("auth.signInWithTicket", {
- ticket: e,
- refresh_token: this._cache.getStore(t) || ""
- });
- case 5:
- n = _context27.sent;
- if (!n.refresh_token) {
- _context27.next = 15;
- break;
- }
- this.setRefreshToken(n.refresh_token);
- _context27.next = 10;
- return this._request.refreshAccessToken();
- case 10:
- Fe(je);
- Fe(Be, {
- env: this.config.env,
- loginType: Je.CUSTOM,
- persistence: this.config.persistence
- });
- _context27.next = 14;
- return this.refreshUserInfo();
- case 14:
- return _context27.abrupt("return", new rt(this.config.env));
- case 15:
- throw new te({
- message: "自定义登录失败"
- });
- case 16:
- case "end":
- return _context27.stop();
- }
- }
- }, _callee27, this);
- }));
- function signIn(_x17) {
- return _signIn2.apply(this, arguments);
- }
- return signIn;
- }()
- }]);
- return ot;
- }(nt);
- var at = /*#__PURE__*/function (_nt3) {
- (0, _inherits2.default)(at, _nt3);
- var _super6 = _createSuper(at);
- function at() {
- (0, _classCallCheck2.default)(this, at);
- return _super6.apply(this, arguments);
- }
- (0, _createClass2.default)(at, [{
- key: "signIn",
- value: function () {
- var _signIn3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee28(e, t) {
- var n, s, r, i, o;
- return _regenerator.default.wrap(function _callee28$(_context28) {
- while (1) {
- switch (_context28.prev = _context28.next) {
- case 0:
- if (!("string" != typeof e)) {
- _context28.next = 2;
- break;
- }
- throw new te({
- code: "PARAM_ERROR",
- message: "email must be a string"
- });
- case 2:
- n = this._cache.keys.refreshTokenKey;
- _context28.next = 5;
- return this._request.send("auth.signIn", {
- loginType: "EMAIL",
- email: e,
- password: t,
- refresh_token: this._cache.getStore(n) || ""
- });
- case 5:
- s = _context28.sent;
- r = s.refresh_token;
- i = s.access_token;
- o = s.access_token_expire;
- if (!r) {
- _context28.next = 22;
- break;
- }
- this.setRefreshToken(r);
- if (!(i && o)) {
- _context28.next = 15;
- break;
- }
- this.setAccessToken(i, o);
- _context28.next = 17;
- break;
- case 15:
- _context28.next = 17;
- return this._request.refreshAccessToken();
- case 17:
- _context28.next = 19;
- return this.refreshUserInfo();
- case 19:
- Fe(je);
- Fe(Be, {
- env: this.config.env,
- loginType: Je.EMAIL,
- persistence: this.config.persistence
- });
- return _context28.abrupt("return", new rt(this.config.env));
- case 22:
- throw s.code ? new te({
- code: s.code,
- message: "\u90AE\u7BB1\u767B\u5F55\u5931\u8D25: ".concat(s.message)
- }) : new te({
- message: "邮箱登录失败"
- });
- case 23:
- case "end":
- return _context28.stop();
- }
- }
- }, _callee28, this);
- }));
- function signIn(_x18, _x19) {
- return _signIn3.apply(this, arguments);
- }
- return signIn;
- }()
- }, {
- key: "activate",
- value: function () {
- var _activate = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee29(e) {
- return _regenerator.default.wrap(function _callee29$(_context29) {
- while (1) {
- switch (_context29.prev = _context29.next) {
- case 0:
- return _context29.abrupt("return", this._request.send("auth.activateEndUserMail", {
- token: e
- }));
- case 1:
- case "end":
- return _context29.stop();
- }
- }
- }, _callee29, this);
- }));
- function activate(_x20) {
- return _activate.apply(this, arguments);
- }
- return activate;
- }()
- }, {
- key: "resetPasswordWithToken",
- value: function () {
- var _resetPasswordWithToken = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee30(e, t) {
- return _regenerator.default.wrap(function _callee30$(_context30) {
- while (1) {
- switch (_context30.prev = _context30.next) {
- case 0:
- return _context30.abrupt("return", this._request.send("auth.resetPasswordWithToken", {
- token: e,
- newPassword: t
- }));
- case 1:
- case "end":
- return _context30.stop();
- }
- }
- }, _callee30, this);
- }));
- function resetPasswordWithToken(_x21, _x22) {
- return _resetPasswordWithToken.apply(this, arguments);
- }
- return resetPasswordWithToken;
- }()
- }]);
- return at;
- }(nt);
- var ct = /*#__PURE__*/function (_nt4) {
- (0, _inherits2.default)(ct, _nt4);
- var _super7 = _createSuper(ct);
- function ct() {
- (0, _classCallCheck2.default)(this, ct);
- return _super7.apply(this, arguments);
- }
- (0, _createClass2.default)(ct, [{
- key: "signIn",
- value: function () {
- var _signIn4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee31(e, t) {
- var n, s, r, i, o;
- return _regenerator.default.wrap(function _callee31$(_context31) {
- while (1) {
- switch (_context31.prev = _context31.next) {
- case 0:
- if (!("string" != typeof e)) {
- _context31.next = 2;
- break;
- }
- throw new te({
- code: "PARAM_ERROR",
- message: "username must be a string"
- });
- case 2:
- "string" != typeof t && (t = "", console.warn("password is empty"));
- n = this._cache.keys.refreshTokenKey;
- _context31.next = 6;
- return this._request.send("auth.signIn", {
- loginType: Je.USERNAME,
- username: e,
- password: t,
- refresh_token: this._cache.getStore(n) || ""
- });
- case 6:
- s = _context31.sent;
- r = s.refresh_token;
- i = s.access_token_expire;
- o = s.access_token;
- if (!r) {
- _context31.next = 23;
- break;
- }
- this.setRefreshToken(r);
- if (!(o && i)) {
- _context31.next = 16;
- break;
- }
- this.setAccessToken(o, i);
- _context31.next = 18;
- break;
- case 16:
- _context31.next = 18;
- return this._request.refreshAccessToken();
- case 18:
- _context31.next = 20;
- return this.refreshUserInfo();
- case 20:
- Fe(je);
- Fe(Be, {
- env: this.config.env,
- loginType: Je.USERNAME,
- persistence: this.config.persistence
- });
- return _context31.abrupt("return", new rt(this.config.env));
- case 23:
- throw s.code ? new te({
- code: s.code,
- message: "\u7528\u6237\u540D\u5BC6\u7801\u767B\u5F55\u5931\u8D25: ".concat(s.message)
- }) : new te({
- message: "用户名密码登录失败"
- });
- case 24:
- case "end":
- return _context31.stop();
- }
- }
- }, _callee31, this);
- }));
- function signIn(_x23, _x24) {
- return _signIn4.apply(this, arguments);
- }
- return signIn;
- }()
- }]);
- return ct;
- }(nt);
- var ut = /*#__PURE__*/function () {
- function ut(e) {
- (0, _classCallCheck2.default)(this, ut);
- this.config = e, this._cache = Le(e.env), this._request = tt(e.env), this._onAnonymousConverted = this._onAnonymousConverted.bind(this), this._onLoginTypeChanged = this._onLoginTypeChanged.bind(this), qe(Be, this._onLoginTypeChanged);
- }
- (0, _createClass2.default)(ut, [{
- key: "currentUser",
- get: function get() {
- var e = this.hasLoginState();
- return e && e.user || null;
- }
- }, {
- key: "loginType",
- get: function get() {
- return this._cache.getStore(this._cache.keys.loginTypeKey);
- }
- }, {
- key: "anonymousAuthProvider",
- value: function anonymousAuthProvider() {
- return new it(this.config);
- }
- }, {
- key: "customAuthProvider",
- value: function customAuthProvider() {
- return new ot(this.config);
- }
- }, {
- key: "emailAuthProvider",
- value: function emailAuthProvider() {
- return new at(this.config);
- }
- }, {
- key: "usernameAuthProvider",
- value: function usernameAuthProvider() {
- return new ct(this.config);
- }
- }, {
- key: "signInAnonymously",
- value: function () {
- var _signInAnonymously = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee32() {
- return _regenerator.default.wrap(function _callee32$(_context32) {
- while (1) {
- switch (_context32.prev = _context32.next) {
- case 0:
- return _context32.abrupt("return", new it(this.config).signIn());
- case 1:
- case "end":
- return _context32.stop();
- }
- }
- }, _callee32, this);
- }));
- function signInAnonymously() {
- return _signInAnonymously.apply(this, arguments);
- }
- return signInAnonymously;
- }()
- }, {
- key: "signInWithEmailAndPassword",
- value: function () {
- var _signInWithEmailAndPassword = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee33(e, t) {
- return _regenerator.default.wrap(function _callee33$(_context33) {
- while (1) {
- switch (_context33.prev = _context33.next) {
- case 0:
- return _context33.abrupt("return", new at(this.config).signIn(e, t));
- case 1:
- case "end":
- return _context33.stop();
- }
- }
- }, _callee33, this);
- }));
- function signInWithEmailAndPassword(_x25, _x26) {
- return _signInWithEmailAndPassword.apply(this, arguments);
- }
- return signInWithEmailAndPassword;
- }()
- }, {
- key: "signInWithUsernameAndPassword",
- value: function signInWithUsernameAndPassword(e, t) {
- return new ct(this.config).signIn(e, t);
- }
- }, {
- key: "linkAndRetrieveDataWithTicket",
- value: function () {
- var _linkAndRetrieveDataWithTicket2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee34(e) {
- return _regenerator.default.wrap(function _callee34$(_context34) {
- while (1) {
- switch (_context34.prev = _context34.next) {
- case 0:
- this._anonymousAuthProvider || (this._anonymousAuthProvider = new it(this.config)), qe(We, this._onAnonymousConverted);
- _context34.next = 3;
- return this._anonymousAuthProvider.linkAndRetrieveDataWithTicket(e);
- case 3:
- return _context34.abrupt("return", _context34.sent);
- case 4:
- case "end":
- return _context34.stop();
- }
- }
- }, _callee34, this);
- }));
- function linkAndRetrieveDataWithTicket(_x27) {
- return _linkAndRetrieveDataWithTicket2.apply(this, arguments);
- }
- return linkAndRetrieveDataWithTicket;
- }()
- }, {
- key: "signOut",
- value: function () {
- var _signOut = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee35() {
- var _this$_cache$keys12, e, t, n, s, r;
- return _regenerator.default.wrap(function _callee35$(_context35) {
- while (1) {
- switch (_context35.prev = _context35.next) {
- case 0:
- if (!(this.loginType === Je.ANONYMOUS)) {
- _context35.next = 2;
- break;
- }
- throw new te({
- message: "匿名用户不支持登出操作"
- });
- case 2:
- _this$_cache$keys12 = this._cache.keys, e = _this$_cache$keys12.refreshTokenKey, t = _this$_cache$keys12.accessTokenKey, n = _this$_cache$keys12.accessTokenExpireKey, s = this._cache.getStore(e);
- if (s) {
- _context35.next = 5;
- break;
- }
- return _context35.abrupt("return");
- case 5:
- _context35.next = 7;
- return this._request.send("auth.logout", {
- refresh_token: s
- });
- case 7:
- r = _context35.sent;
- return _context35.abrupt("return", (this._cache.removeStore(e), this._cache.removeStore(t), this._cache.removeStore(n), Fe(je), Fe(Be, {
- env: this.config.env,
- loginType: Je.NULL,
- persistence: this.config.persistence
- }), r));
- case 9:
- case "end":
- return _context35.stop();
- }
- }
- }, _callee35, this);
- }));
- function signOut() {
- return _signOut.apply(this, arguments);
- }
- return signOut;
- }()
- }, {
- key: "signUpWithEmailAndPassword",
- value: function () {
- var _signUpWithEmailAndPassword = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee36(e, t) {
- return _regenerator.default.wrap(function _callee36$(_context36) {
- while (1) {
- switch (_context36.prev = _context36.next) {
- case 0:
- return _context36.abrupt("return", this._request.send("auth.signUpWithEmailAndPassword", {
- email: e,
- password: t
- }));
- case 1:
- case "end":
- return _context36.stop();
- }
- }
- }, _callee36, this);
- }));
- function signUpWithEmailAndPassword(_x28, _x29) {
- return _signUpWithEmailAndPassword.apply(this, arguments);
- }
- return signUpWithEmailAndPassword;
- }()
- }, {
- key: "sendPasswordResetEmail",
- value: function () {
- var _sendPasswordResetEmail = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee37(e) {
- return _regenerator.default.wrap(function _callee37$(_context37) {
- while (1) {
- switch (_context37.prev = _context37.next) {
- case 0:
- return _context37.abrupt("return", this._request.send("auth.sendPasswordResetEmail", {
- email: e
- }));
- case 1:
- case "end":
- return _context37.stop();
- }
- }
- }, _callee37, this);
- }));
- function sendPasswordResetEmail(_x30) {
- return _sendPasswordResetEmail.apply(this, arguments);
- }
- return sendPasswordResetEmail;
- }()
- }, {
- key: "onLoginStateChanged",
- value: function onLoginStateChanged(e) {
- var _this12 = this;
- qe(je, function () {
- var t = _this12.hasLoginState();
- e.call(_this12, t);
- });
- var t = this.hasLoginState();
- e.call(this, t);
- }
- }, {
- key: "onLoginStateExpired",
- value: function onLoginStateExpired(e) {
- qe($e, e.bind(this));
- }
- }, {
- key: "onAccessTokenRefreshed",
- value: function onAccessTokenRefreshed(e) {
- qe(He, e.bind(this));
- }
- }, {
- key: "onAnonymousConverted",
- value: function onAnonymousConverted(e) {
- qe(We, e.bind(this));
- }
- }, {
- key: "onLoginTypeChanged",
- value: function onLoginTypeChanged(e) {
- var _this13 = this;
- qe(Be, function () {
- var t = _this13.hasLoginState();
- e.call(_this13, t);
- });
- }
- }, {
- key: "getAccessToken",
- value: function () {
- var _getAccessToken3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee38() {
- return _regenerator.default.wrap(function _callee38$(_context38) {
- while (1) {
- switch (_context38.prev = _context38.next) {
- case 0:
- _context38.next = 2;
- return this._request.getAccessToken();
- case 2:
- _context38.t0 = _context38.sent.accessToken;
- _context38.t1 = this.config.env;
- return _context38.abrupt("return", {
- accessToken: _context38.t0,
- env: _context38.t1
- });
- case 5:
- case "end":
- return _context38.stop();
- }
- }
- }, _callee38, this);
- }));
- function getAccessToken() {
- return _getAccessToken3.apply(this, arguments);
- }
- return getAccessToken;
- }()
- }, {
- key: "hasLoginState",
- value: function hasLoginState() {
- var _this$_cache$keys13 = this._cache.keys,
- e = _this$_cache$keys13.accessTokenKey,
- t = _this$_cache$keys13.accessTokenExpireKey,
- n = this._cache.getStore(e),
- s = this._cache.getStore(t);
- return this._request.oauth.isAccessTokenExpired(n, s) ? null : new rt(this.config.env);
- }
- }, {
- key: "isUsernameRegistered",
- value: function () {
- var _isUsernameRegistered = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee39(e) {
- var _yield$this$_request$4, t;
- return _regenerator.default.wrap(function _callee39$(_context39) {
- while (1) {
- switch (_context39.prev = _context39.next) {
- case 0:
- if (!("string" != typeof e)) {
- _context39.next = 2;
- break;
- }
- throw new te({
- code: "PARAM_ERROR",
- message: "username must be a string"
- });
- case 2:
- _context39.next = 4;
- return this._request.send("auth.isUsernameRegistered", {
- username: e
- });
- case 4:
- _yield$this$_request$4 = _context39.sent;
- t = _yield$this$_request$4.data;
- return _context39.abrupt("return", t && t.isRegistered);
- case 7:
- case "end":
- return _context39.stop();
- }
- }
- }, _callee39, this);
- }));
- function isUsernameRegistered(_x31) {
- return _isUsernameRegistered.apply(this, arguments);
- }
- return isUsernameRegistered;
- }()
- }, {
- key: "getLoginState",
- value: function getLoginState() {
- return Promise.resolve(this.hasLoginState());
- }
- }, {
- key: "signInWithTicket",
- value: function () {
- var _signInWithTicket = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee40(e) {
- return _regenerator.default.wrap(function _callee40$(_context40) {
- while (1) {
- switch (_context40.prev = _context40.next) {
- case 0:
- return _context40.abrupt("return", new ot(this.config).signIn(e));
- case 1:
- case "end":
- return _context40.stop();
- }
- }
- }, _callee40, this);
- }));
- function signInWithTicket(_x32) {
- return _signInWithTicket.apply(this, arguments);
- }
- return signInWithTicket;
- }()
- }, {
- key: "shouldRefreshAccessToken",
- value: function shouldRefreshAccessToken(e) {
- this._request._shouldRefreshAccessTokenHook = e.bind(this);
- }
- }, {
- key: "getUserInfo",
- value: function getUserInfo() {
- return this._request.send("auth.getUserInfo", {}).then(function (e) {
- return e.code ? e : _objectSpread(_objectSpread({}, e.data), {}, {
- requestId: e.seqId
- });
- });
- }
- }, {
- key: "getAuthHeader",
- value: function getAuthHeader() {
- var _this$_cache$keys14 = this._cache.keys,
- e = _this$_cache$keys14.refreshTokenKey,
- t = _this$_cache$keys14.accessTokenKey,
- n = this._cache.getStore(e);
- return {
- "x-cloudbase-credentials": this._cache.getStore(t) + "/@@/" + n
- };
- }
- }, {
- key: "_onAnonymousConverted",
- value: function _onAnonymousConverted(e) {
- var t = e.data.env;
- t === this.config.env && this._cache.updatePersistence(this.config.persistence);
- }
- }, {
- key: "_onLoginTypeChanged",
- value: function _onLoginTypeChanged(e) {
- var _e$data = e.data,
- t = _e$data.loginType,
- n = _e$data.persistence,
- s = _e$data.env;
- s === this.config.env && (this._cache.updatePersistence(n), this._cache.setStore(this._cache.keys.loginTypeKey, t));
- }
- }]);
- return ut;
- }();
- var ht = function ht(e, t) {
- t = t || ve();
- var n = tt(this.config.env),
- s = e.cloudPath,
- r = e.filePath,
- i = e.onUploadProgress,
- _e$fileType = e.fileType,
- o = _e$fileType === void 0 ? "image" : _e$fileType;
- return n.send("storage.getUploadMetadata", {
- path: s
- }).then(function (e) {
- var _e$data2 = e.data,
- a = _e$data2.url,
- c = _e$data2.authorization,
- u = _e$data2.token,
- h = _e$data2.fileId,
- l = _e$data2.cosFileId,
- d = e.requestId,
- p = {
- key: s,
- signature: c,
- "x-cos-meta-fileid": l,
- success_action_status: "201",
- "x-cos-security-token": u
- };
- n.upload({
- url: a,
- data: p,
- file: r,
- name: s,
- fileType: o,
- onUploadProgress: i
- }).then(function (e) {
- 201 === e.statusCode ? t(null, {
- fileID: h,
- requestId: d
- }) : t(new te({
- code: "STORAGE_REQUEST_FAIL",
- message: "STORAGE_REQUEST_FAIL: ".concat(e.data)
- }));
- }).catch(function (e) {
- t(e);
- });
- }).catch(function (e) {
- t(e);
- }), t.promise;
- },
- lt = function lt(e, t) {
- t = t || ve();
- var n = tt(this.config.env),
- s = e.cloudPath;
- return n.send("storage.getUploadMetadata", {
- path: s
- }).then(function (e) {
- t(null, e);
- }).catch(function (e) {
- t(e);
- }), t.promise;
- },
- dt = function dt(_ref10, t) {
- var e = _ref10.fileList;
- if (t = t || ve(), !e || !Array.isArray(e)) return {
- code: "INVALID_PARAM",
- message: "fileList必须是非空的数组"
- };
- var _iterator3 = _createForOfIteratorHelper(e),
- _step3;
- try {
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
- var _t9 = _step3.value;
- if (!_t9 || "string" != typeof _t9) return {
- code: "INVALID_PARAM",
- message: "fileList的元素必须是非空的字符串"
- };
- }
- } catch (err) {
- _iterator3.e(err);
- } finally {
- _iterator3.f();
- }
- var n = {
- fileid_list: e
- };
- return tt(this.config.env).send("storage.batchDeleteFile", n).then(function (e) {
- e.code ? t(null, e) : t(null, {
- fileList: e.data.delete_list,
- requestId: e.requestId
- });
- }).catch(function (e) {
- t(e);
- }), t.promise;
- },
- pt = function pt(_ref11, t) {
- var e = _ref11.fileList;
- t = t || ve(), e && Array.isArray(e) || t(null, {
- code: "INVALID_PARAM",
- message: "fileList必须是非空的数组"
- });
- var n = [];
- var _iterator4 = _createForOfIteratorHelper(e),
- _step4;
- try {
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
- var _s11 = _step4.value;
- "object" == (0, _typeof2.default)(_s11) ? (_s11.hasOwnProperty("fileID") && _s11.hasOwnProperty("maxAge") || t(null, {
- code: "INVALID_PARAM",
- message: "fileList的元素必须是包含fileID和maxAge的对象"
- }), n.push({
- fileid: _s11.fileID,
- max_age: _s11.maxAge
- })) : "string" == typeof _s11 ? n.push({
- fileid: _s11
- }) : t(null, {
- code: "INVALID_PARAM",
- message: "fileList的元素必须是字符串"
- });
- }
- } catch (err) {
- _iterator4.e(err);
- } finally {
- _iterator4.f();
- }
- var s = {
- file_list: n
- };
- return tt(this.config.env).send("storage.batchGetDownloadUrl", s).then(function (e) {
- e.code ? t(null, e) : t(null, {
- fileList: e.data.download_list,
- requestId: e.requestId
- });
- }).catch(function (e) {
- t(e);
- }), t.promise;
- },
- ft = /*#__PURE__*/function () {
- var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee41(_ref12, t) {
- var e, n, s, r;
- return _regenerator.default.wrap(function _callee41$(_context41) {
- while (1) {
- switch (_context41.prev = _context41.next) {
- case 0:
- e = _ref12.fileID;
- _context41.next = 3;
- return pt.call(this, {
- fileList: [{
- fileID: e,
- maxAge: 600
- }]
- });
- case 3:
- n = _context41.sent.fileList[0];
- if (!("SUCCESS" !== n.code)) {
- _context41.next = 6;
- break;
- }
- return _context41.abrupt("return", t ? t(n) : new Promise(function (e) {
- e(n);
- }));
- case 6:
- s = tt(this.config.env);
- r = n.download_url;
- if (!(r = encodeURI(r), !t)) {
- _context41.next = 10;
- break;
- }
- return _context41.abrupt("return", s.download({
- url: r
- }));
- case 10:
- _context41.t0 = t;
- _context41.next = 13;
- return s.download({
- url: r
- });
- case 13:
- _context41.t1 = _context41.sent;
- (0, _context41.t0)(_context41.t1);
- case 15:
- case "end":
- return _context41.stop();
- }
- }
- }, _callee41, this);
- }));
- return function ft(_x33, _x34) {
- return _ref13.apply(this, arguments);
- };
- }(),
- gt = function gt(_ref14, o) {
- var e = _ref14.name,
- t = _ref14.data,
- n = _ref14.query,
- s = _ref14.parse,
- r = _ref14.search,
- i = _ref14.timeout;
- var a = o || ve();
- var c;
- try {
- c = t ? JSON.stringify(t) : "";
- } catch (e) {
- return Promise.reject(e);
- }
- if (!e) return Promise.reject(new te({
- code: "PARAM_ERROR",
- message: "函数名不能为空"
- }));
- var u = {
- inQuery: n,
- parse: s,
- search: r,
- function_name: e,
- request_data: c
- };
- return tt(this.config.env).send("functions.invokeFunction", u, {
- timeout: i
- }).then(function (e) {
- if (e.code) a(null, e);else {
- var _t10 = e.data.response_data;
- if (s) a(null, {
- result: _t10,
- requestId: e.requestId
- });else try {
- _t10 = JSON.parse(e.data.response_data), a(null, {
- result: _t10,
- requestId: e.requestId
- });
- } catch (e) {
- a(new te({
- message: "response data must be json"
- }));
- }
- }
- return a.promise;
- }).catch(function (e) {
- a(e);
- }), a.promise;
- },
- mt = {
- timeout: 15e3,
- persistence: "session"
- },
- yt = 6e5,
- _t = {};
- var wt = /*#__PURE__*/function () {
- function wt(e) {
- (0, _classCallCheck2.default)(this, wt);
- this.config = e || this.config, this.authObj = void 0;
- }
- (0, _createClass2.default)(wt, [{
- key: "init",
- value: function init(e) {
- switch (Pe.adapter || (this.requestClient = new Pe.adapter.reqClass({
- timeout: e.timeout || 5e3,
- timeoutMsg: "\u8BF7\u6C42\u5728".concat((e.timeout || 5e3) / 1e3, "s\u5185\u672A\u5B8C\u6210\uFF0C\u5DF2\u4E2D\u65AD")
- })), this.config = _objectSpread(_objectSpread({}, mt), e), !0) {
- case this.config.timeout > yt:
- console.warn("timeout大于可配置上限[10分钟],已重置为上限数值"), this.config.timeout = yt;
- break;
- case this.config.timeout < 100:
- console.warn("timeout小于可配置下限[100ms],已重置为下限数值"), this.config.timeout = 100;
- }
- return new wt(this.config);
- }
- }, {
- key: "auth",
- value: function auth() {
- var _ref15 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- e = _ref15.persistence;
- if (this.authObj) return this.authObj;
- var t = e || Pe.adapter.primaryStorage || mt.persistence;
- var n;
- return t !== this.config.persistence && (this.config.persistence = t), function (e) {
- var t = e.env;
- Ne[t] = new xe(e), Re[t] = new xe(_objectSpread(_objectSpread({}, e), {}, {
- persistence: "local"
- }));
- }(this.config), n = this.config, et[n.env] = new Ze(n), this.authObj = new ut(this.config), this.authObj;
- }
- }, {
- key: "on",
- value: function on(e, t) {
- return qe.apply(this, [e, t]);
- }
- }, {
- key: "off",
- value: function off(e, t) {
- return Ke.apply(this, [e, t]);
- }
- }, {
- key: "callFunction",
- value: function callFunction(e, t) {
- return gt.apply(this, [e, t]);
- }
- }, {
- key: "deleteFile",
- value: function deleteFile(e, t) {
- return dt.apply(this, [e, t]);
- }
- }, {
- key: "getTempFileURL",
- value: function getTempFileURL(e, t) {
- return pt.apply(this, [e, t]);
- }
- }, {
- key: "downloadFile",
- value: function downloadFile(e, t) {
- return ft.apply(this, [e, t]);
- }
- }, {
- key: "uploadFile",
- value: function uploadFile(e, t) {
- return ht.apply(this, [e, t]);
- }
- }, {
- key: "getUploadMetadata",
- value: function getUploadMetadata(e, t) {
- return lt.apply(this, [e, t]);
- }
- }, {
- key: "registerExtension",
- value: function registerExtension(e) {
- _t[e.name] = e;
- }
- }, {
- key: "invokeExtension",
- value: function () {
- var _invokeExtension = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee42(e, t) {
- var n;
- return _regenerator.default.wrap(function _callee42$(_context42) {
- while (1) {
- switch (_context42.prev = _context42.next) {
- case 0:
- n = _t[e];
- if (n) {
- _context42.next = 3;
- break;
- }
- throw new te({
- message: "\u6269\u5C55".concat(e, " \u5FC5\u987B\u5148\u6CE8\u518C")
- });
- case 3:
- _context42.next = 5;
- return n.invoke(t, this);
- case 5:
- return _context42.abrupt("return", _context42.sent);
- case 6:
- case "end":
- return _context42.stop();
- }
- }
- }, _callee42, this);
- }));
- function invokeExtension(_x35, _x36) {
- return _invokeExtension.apply(this, arguments);
- }
- return invokeExtension;
- }()
- }, {
- key: "useAdapters",
- value: function useAdapters(e) {
- var _ref16 = ke(e) || {},
- t = _ref16.adapter,
- n = _ref16.runtime;
- t && (Pe.adapter = t), n && (Pe.runtime = n);
- }
- }]);
- return wt;
- }();
- var vt = new wt();
- function It(e, t, n) {
- void 0 === n && (n = {});
- var s = /\?/.test(t),
- r = "";
- for (var i in n) {
- "" === r ? !s && (t += "?") : r += "&", r += i + "=" + encodeURIComponent(n[i]);
- }
- return /^http(s)?:\/\//.test(t += r) ? t : "" + e + t;
- }
- var St = /*#__PURE__*/function () {
- function St() {
- (0, _classCallCheck2.default)(this, St);
- }
- (0, _createClass2.default)(St, [{
- key: "get",
- value: function get(e) {
- var t = e.url,
- n = e.data,
- s = e.headers,
- r = e.timeout;
- return new Promise(function (e, i) {
- ne.request({
- url: It("https:", t),
- data: n,
- method: "GET",
- header: s,
- timeout: r,
- success: function success(t) {
- e(t);
- },
- fail: function fail(e) {
- i(e);
- }
- });
- });
- }
- }, {
- key: "post",
- value: function post(e) {
- var t = e.url,
- n = e.data,
- s = e.headers,
- r = e.timeout;
- return new Promise(function (e, i) {
- ne.request({
- url: It("https:", t),
- data: n,
- method: "POST",
- header: s,
- timeout: r,
- success: function success(t) {
- e(t);
- },
- fail: function fail(e) {
- i(e);
- }
- });
- });
- }
- }, {
- key: "upload",
- value: function upload(e) {
- return new Promise(function (t, n) {
- var s = e.url,
- r = e.file,
- i = e.data,
- o = e.headers,
- a = e.fileType,
- c = ne.uploadFile({
- url: It("https:", s),
- name: "file",
- formData: Object.assign({}, i),
- filePath: r,
- fileType: a,
- header: o,
- success: function success(e) {
- var n = {
- statusCode: e.statusCode,
- data: e.data || {}
- };
- 200 === e.statusCode && i.success_action_status && (n.statusCode = parseInt(i.success_action_status, 10)), t(n);
- },
- fail: function fail(e) {
- n(new Error(e.errMsg || "uploadFile:fail"));
- }
- });
- "function" == typeof e.onUploadProgress && c && "function" == typeof c.onProgressUpdate && c.onProgressUpdate(function (t) {
- e.onUploadProgress({
- loaded: t.totalBytesSent,
- total: t.totalBytesExpectedToSend
- });
- });
- });
- }
- }]);
- return St;
- }();
- var Tt = {
- setItem: function setItem(e, t) {
- ne.setStorageSync(e, t);
- },
- getItem: function getItem(e) {
- return ne.getStorageSync(e);
- },
- removeItem: function removeItem(e) {
- ne.removeStorageSync(e);
- },
- clear: function clear() {
- ne.clearStorageSync();
- }
- };
- var bt = {
- genAdapter: function genAdapter() {
- return {
- root: {},
- reqClass: St,
- localStorage: Tt,
- primaryStorage: "local"
- };
- },
- isMatch: function isMatch() {
- return !0;
- },
- runtime: "uni_app"
- };
- vt.useAdapters(bt);
- var Et = vt,
- kt = Et.init;
- Et.init = function (e) {
- e.env = e.spaceId;
- var t = kt.call(this, e);
- t.config.provider = "tencent", t.config.spaceId = e.spaceId;
- var n = t.auth;
- return t.auth = function (e) {
- var t = n.call(this, e);
- return ["linkAndRetrieveDataWithTicket", "signInAnonymously", "signOut", "getAccessToken", "getLoginState", "signInWithTicket", "getUserInfo"].forEach(function (e) {
- var n;
- t[e] = (n = t[e], function (e) {
- e = e || {};
- var _ee = ee(e),
- t = _ee.success,
- s = _ee.fail,
- r = _ee.complete;
- if (!(t || s || r)) return n.call(this, e);
- n.call(this, e).then(function (e) {
- t && t(e), r && r(e);
- }, function (e) {
- s && s(e), r && r(e);
- });
- }).bind(t);
- }), t;
- }, t.customAuth = t.auth, t;
- };
- var Pt = Et;
- function Ct(_x37, _x38) {
- return _Ct.apply(this, arguments);
- }
- function _Ct() {
- _Ct = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee68(e, t) {
- var n, _e31, s;
- return _regenerator.default.wrap(function _callee68$(_context68) {
- while (1) {
- switch (_context68.prev = _context68.next) {
- case 0:
- n = "http://".concat(e, ":").concat(t, "/system/ping");
- _context68.prev = 1;
- _context68.next = 4;
- return s = {
- url: n,
- timeout: 500
- }, new Promise(function (e, t) {
- ne.request(_objectSpread(_objectSpread({}, s), {}, {
- success: function success(t) {
- e(t);
- },
- fail: function fail(e) {
- t(e);
- }
- }));
- });
- case 4:
- _e31 = _context68.sent;
- return _context68.abrupt("return", !(!_e31.data || 0 !== _e31.data.code));
- case 8:
- _context68.prev = 8;
- _context68.t0 = _context68["catch"](1);
- return _context68.abrupt("return", !1);
- case 11:
- case "end":
- return _context68.stop();
- }
- }
- }, _callee68, null, [[1, 8]]);
- }));
- return _Ct.apply(this, arguments);
- }
- function At(_x39, _x40) {
- return _At.apply(this, arguments);
- }
- function _At() {
- _At = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee69(e, t) {
- var n, s, _r10;
- return _regenerator.default.wrap(function _callee69$(_context69) {
- while (1) {
- switch (_context69.prev = _context69.next) {
- case 0:
- s = 0;
- case 1:
- if (!(s < e.length)) {
- _context69.next = 11;
- break;
- }
- _r10 = e[s];
- _context69.next = 5;
- return Ct(_r10, t);
- case 5:
- if (!_context69.sent) {
- _context69.next = 8;
- break;
- }
- n = _r10;
- return _context69.abrupt("break", 11);
- case 8:
- s++;
- _context69.next = 1;
- break;
- case 11:
- return _context69.abrupt("return", {
- address: n,
- port: t
- });
- case 12:
- case "end":
- return _context69.stop();
- }
- }
- }, _callee69);
- }));
- return _At.apply(this, arguments);
- }
- var Ot = {
- "serverless.file.resource.generateProximalSign": "storage/generate-proximal-sign",
- "serverless.file.resource.report": "storage/report",
- "serverless.file.resource.delete": "storage/delete",
- "serverless.file.resource.getTempFileURL": "storage/get-temp-file-url"
- };
- var xt = /*#__PURE__*/function () {
- function xt(e) {
- (0, _classCallCheck2.default)(this, xt);
- if (["spaceId", "clientSecret"].forEach(function (t) {
- if (!Object.prototype.hasOwnProperty.call(e, t)) throw new Error("".concat(t, " required"));
- }), !e.endpoint) throw new Error("集群空间未配置ApiEndpoint,配置后需要重新关联服务空间后生效");
- this.config = Object.assign({}, e), this.config.provider = "dcloud", this.config.requestUrl = this.config.endpoint + "/client", this.config.envType = this.config.envType || "public", this.adapter = ne;
- }
- (0, _createClass2.default)(xt, [{
- key: "request",
- value: function () {
- var _request4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee43(e) {
- var _this14 = this;
- var t,
- n,
- _args43 = arguments;
- return _regenerator.default.wrap(function _callee43$(_context43) {
- while (1) {
- switch (_context43.prev = _context43.next) {
- case 0:
- t = _args43.length > 1 && _args43[1] !== undefined ? _args43[1] : !0;
- n = b && t;
- if (!n) {
- _context43.next = 8;
- break;
- }
- _context43.next = 5;
- return this.setupLocalRequest(e);
- case 5:
- _context43.t0 = _context43.sent;
- _context43.next = 9;
- break;
- case 8:
- _context43.t0 = this.setupRequest(e);
- case 9:
- e = _context43.t0;
- return _context43.abrupt("return", Promise.resolve().then(function () {
- return n ? _this14.requestLocal(e) : le.wrappedRequest(e, _this14.adapter.request);
- }));
- case 11:
- case "end":
- return _context43.stop();
- }
- }
- }, _callee43, this);
- }));
- function request(_x41) {
- return _request4.apply(this, arguments);
- }
- return request;
- }()
- }, {
- key: "requestLocal",
- value: function requestLocal(e) {
- var _this15 = this;
- return new Promise(function (t, n) {
- _this15.adapter.request(Object.assign(e, {
- complete: function complete(e) {
- if (e || (e = {}), !e.statusCode || e.statusCode >= 400) {
- var _t11 = e.data && e.data.code || "SYS_ERR",
- _s12 = e.data && e.data.message || "request:fail";
- return n(new te({
- code: _t11,
- message: _s12
- }));
- }
- t({
- success: !0,
- result: e.data
- });
- }
- }));
- });
- }
- }, {
- key: "setupRequest",
- value: function setupRequest(e) {
- var t = Object.assign({}, e, {
- spaceId: this.config.spaceId,
- timestamp: Date.now()
- }),
- n = {
- "Content-Type": "application/json"
- };
- n["x-serverless-sign"] = le.sign(t, this.config.clientSecret);
- var s = he();
- n["x-client-info"] = encodeURIComponent(JSON.stringify(s));
- var _se = se(),
- r = _se.token;
- return n["x-client-token"] = r, {
- url: this.config.requestUrl,
- method: "POST",
- data: t,
- dataType: "json",
- header: JSON.parse(JSON.stringify(n))
- };
- }
- }, {
- key: "setupLocalRequest",
- value: function () {
- var _setupLocalRequest = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee44(e) {
- var t, _se2, n, s, _ref17, r, i, _yield$At, o;
- return _regenerator.default.wrap(function _callee44$(_context44) {
- while (1) {
- switch (_context44.prev = _context44.next) {
- case 0:
- t = he();
- _se2 = se();
- n = _se2.token;
- s = Object.assign({}, e, {
- spaceId: this.config.spaceId,
- timestamp: Date.now(),
- clientInfo: t,
- token: n
- });
- _ref17 = this.__dev__ && this.__dev__.debugInfo || {};
- r = _ref17.address;
- i = _ref17.servePort;
- _context44.next = 9;
- return At(r, i);
- case 9:
- _yield$At = _context44.sent;
- o = _yield$At.address;
- return _context44.abrupt("return", {
- url: "http://".concat(o, ":").concat(i, "/").concat(Ot[e.method]),
- method: "POST",
- data: s,
- dataType: "json",
- header: JSON.parse(JSON.stringify({
- "Content-Type": "application/json"
- }))
- });
- case 12:
- case "end":
- return _context44.stop();
- }
- }
- }, _callee44, this);
- }));
- function setupLocalRequest(_x42) {
- return _setupLocalRequest.apply(this, arguments);
- }
- return setupLocalRequest;
- }()
- }, {
- key: "callFunction",
- value: function callFunction(e) {
- var t = {
- method: "serverless.function.runtime.invoke",
- params: JSON.stringify({
- functionTarget: e.name,
- functionArgs: e.data || {}
- })
- };
- return this.request(t, !1);
- }
- }, {
- key: "getUploadFileOptions",
- value: function getUploadFileOptions(e) {
- var t = {
- method: "serverless.file.resource.generateProximalSign",
- params: JSON.stringify(e)
- };
- return this.request(t);
- }
- }, {
- key: "reportUploadFile",
- value: function reportUploadFile(e) {
- var t = {
- method: "serverless.file.resource.report",
- params: JSON.stringify(e)
- };
- return this.request(t);
- }
- }, {
- key: "uploadFile",
- value: function uploadFile(_ref18) {
- var _this16 = this;
- var e = _ref18.filePath,
- t = _ref18.cloudPath,
- _ref18$fileType = _ref18.fileType,
- n = _ref18$fileType === void 0 ? "image" : _ref18$fileType,
- s = _ref18.onUploadProgress;
- if (!t) throw new te({
- code: "CLOUDPATH_REQUIRED",
- message: "cloudPath不可为空"
- });
- var r;
- return this.getUploadFileOptions({
- cloudPath: t
- }).then(function (t) {
- var _t$result = t.result,
- i = _t$result.url,
- o = _t$result.formData,
- a = _t$result.name;
- return r = t.result.fileUrl, new Promise(function (t, r) {
- var c = _this16.adapter.uploadFile({
- url: i,
- formData: o,
- name: a,
- filePath: e,
- fileType: n,
- success: function success(e) {
- e && e.statusCode < 400 ? t(e) : r(new te({
- code: "UPLOAD_FAILED",
- message: "文件上传失败"
- }));
- },
- fail: function fail(e) {
- r(new te({
- code: e.code || "UPLOAD_FAILED",
- message: e.message || e.errMsg || "文件上传失败"
- }));
- }
- });
- "function" == typeof s && c && "function" == typeof c.onProgressUpdate && c.onProgressUpdate(function (e) {
- s({
- loaded: e.totalBytesSent,
- total: e.totalBytesExpectedToSend
- });
- });
- });
- }).then(function () {
- return _this16.reportUploadFile({
- cloudPath: t
- });
- }).then(function (t) {
- return new Promise(function (n, s) {
- t.success ? n({
- success: !0,
- filePath: e,
- fileID: r
- }) : s(new te({
- code: "UPLOAD_FAILED",
- message: "文件上传失败"
- }));
- });
- });
- }
- }, {
- key: "deleteFile",
- value: function deleteFile(_ref19) {
- var e = _ref19.fileList;
- var t = {
- method: "serverless.file.resource.delete",
- params: JSON.stringify({
- fileList: e
- })
- };
- return this.request(t).then(function (e) {
- if (e.success) return e.result;
- throw new te({
- code: "DELETE_FILE_FAILED",
- message: "删除文件失败"
- });
- });
- }
- }, {
- key: "getTempFileURL",
- value: function getTempFileURL() {
- var _ref20 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- e = _ref20.fileList,
- t = _ref20.maxAge;
- if (!Array.isArray(e) || 0 === e.length) throw new te({
- code: "INVALID_PARAM",
- message: "fileList的元素必须是非空的字符串"
- });
- var n = {
- method: "serverless.file.resource.getTempFileURL",
- params: JSON.stringify({
- fileList: e,
- maxAge: t
- })
- };
- return this.request(n).then(function (e) {
- if (e.success) return {
- fileList: e.result.fileList.map(function (e) {
- return {
- fileID: e.fileID,
- tempFileURL: e.tempFileURL
- };
- })
- };
- throw new te({
- code: "GET_TEMP_FILE_URL_FAILED",
- message: "获取临时文件链接失败"
- });
- });
- }
- }]);
- return xt;
- }();
- var Nt = {
- init: function init(e) {
- var t = new xt(e),
- n = {
- signInAnonymously: function signInAnonymously() {
- return Promise.resolve();
- },
- getLoginState: function getLoginState() {
- return Promise.resolve(!1);
- }
- };
- return t.auth = function () {
- return n;
- }, t.customAuth = t.auth, t;
- }
- },
- Rt = n(function (e, t) {
- e.exports = r.enc.Hex;
- });
- function Lt() {
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (e) {
- var t = 16 * Math.random() | 0;
- return ("x" === e ? t : 3 & t | 8).toString(16);
- });
- }
- function Ut() {
- var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
- var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var n = t.data,
- s = t.functionName,
- r = t.method,
- i = t.headers,
- _t$signHeaderKeys = t.signHeaderKeys,
- o = _t$signHeaderKeys === void 0 ? [] : _t$signHeaderKeys,
- a = t.config,
- c = String(Date.now()),
- u = Lt(),
- h = Object.assign({}, i, {
- "x-from-app-id": a.spaceAppId,
- "x-from-env-id": a.spaceId,
- "x-to-env-id": a.spaceId,
- "x-from-instance-id": c,
- "x-from-function-name": s,
- "x-client-timestamp": c,
- "x-alipay-source": "client",
- "x-request-id": u,
- "x-alipay-callid": u,
- "x-trace-id": u
- }),
- l = ["x-from-app-id", "x-from-env-id", "x-to-env-id", "x-from-instance-id", "x-from-function-name", "x-client-timestamp"].concat(o),
- _ref21 = e.split("?") || [],
- _ref22 = (0, _slicedToArray2.default)(_ref21, 2),
- _ref22$ = _ref22[0],
- d = _ref22$ === void 0 ? "" : _ref22$,
- _ref22$2 = _ref22[1],
- p = _ref22$2 === void 0 ? "" : _ref22$2,
- f = function (e) {
- var t = "HMAC-SHA256",
- n = e.signedHeaders.join(";"),
- s = e.signedHeaders.map(function (t) {
- return "".concat(t.toLowerCase(), ":").concat(e.headers[t], "\n");
- }).join(""),
- r = _e(e.body).toString(Rt),
- i = "".concat(e.method.toUpperCase(), "\n").concat(e.path, "\n").concat(e.query, "\n").concat(s, "\n").concat(n, "\n").concat(r, "\n"),
- o = _e(i).toString(Rt),
- a = "".concat(t, "\n").concat(e.timestamp, "\n").concat(o, "\n"),
- c = we(a, e.secretKey).toString(Rt);
- return "".concat(t, " Credential=").concat(e.secretId, ", SignedHeaders=").concat(n, ", Signature=").concat(c);
- }({
- path: d,
- query: p,
- method: r,
- headers: h,
- timestamp: c,
- body: JSON.stringify(n),
- secretId: a.accessKey,
- secretKey: a.secretKey,
- signedHeaders: l.sort()
- });
- return {
- url: "".concat(a.endpoint).concat(e),
- headers: Object.assign({}, h, {
- Authorization: f
- })
- };
- }
- function Dt(_ref23) {
- var e = _ref23.url,
- t = _ref23.data,
- _ref23$method = _ref23.method,
- n = _ref23$method === void 0 ? "POST" : _ref23$method,
- _ref23$headers = _ref23.headers,
- s = _ref23$headers === void 0 ? {} : _ref23$headers,
- r = _ref23.timeout;
- return new Promise(function (i, o) {
- ne.request({
- url: e,
- method: n,
- data: "object" == (0, _typeof2.default)(t) ? JSON.stringify(t) : t,
- header: s,
- dataType: "json",
- timeout: r,
- complete: function complete() {
- var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- var t = s["x-trace-id"] || "";
- if (!e.statusCode || e.statusCode >= 400) {
- var _ref24 = e.data || {},
- _n9 = _ref24.message,
- _s13 = _ref24.errMsg,
- _r4 = _ref24.trace_id;
- return o(new te({
- code: "SYS_ERR",
- message: _n9 || _s13 || "request:fail",
- requestId: _r4 || t
- }));
- }
- i({
- status: e.statusCode,
- data: e.data,
- headers: e.header,
- requestId: t
- });
- }
- });
- });
- }
- function Mt(e, t) {
- var n = e.path,
- s = e.data,
- _e$method = e.method,
- r = _e$method === void 0 ? "GET" : _e$method,
- _Ut = Ut(n, {
- functionName: "",
- data: s,
- method: r,
- headers: {
- "x-alipay-cloud-mode": "oss",
- "x-data-api-type": "oss",
- "x-expire-timestamp": Date.now() + 6e4
- },
- signHeaderKeys: ["x-data-api-type", "x-expire-timestamp"],
- config: t
- }),
- i = _Ut.url,
- o = _Ut.headers;
- return Dt({
- url: i,
- data: s,
- method: r,
- headers: o
- }).then(function (e) {
- var t = e.data || {};
- if (!t.success) throw new te({
- code: e.errCode,
- message: e.errMsg,
- requestId: e.requestId
- });
- return t.data || {};
- }).catch(function (e) {
- throw new te({
- code: e.errCode,
- message: e.errMsg,
- requestId: e.requestId
- });
- });
- }
- function qt() {
- var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
- var t = e.trim().replace(/^cloud:\/\//, ""),
- n = t.indexOf("/");
- if (n <= 0) throw new te({
- code: "INVALID_PARAM",
- message: "fileID不合法"
- });
- var s = t.substring(0, n),
- r = t.substring(n + 1);
- return s !== this.config.spaceId && console.warn("file ".concat(e, " does not belong to env ").concat(this.config.spaceId)), r;
- }
- function Ft() {
- var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
- return "cloud://".concat(this.config.spaceId, "/").concat(e.replace(/^\/+/, ""));
- }
- var Kt = /*#__PURE__*/function () {
- function Kt(e) {
- (0, _classCallCheck2.default)(this, Kt);
- this.config = e;
- }
- (0, _createClass2.default)(Kt, [{
- key: "signedURL",
- value: function signedURL(e) {
- var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var n = "/ws/function/".concat(e),
- s = this.config.wsEndpoint.replace(/^ws(s)?:\/\//, ""),
- r = Object.assign({}, t, {
- accessKeyId: this.config.accessKey,
- signatureNonce: Lt(),
- timestamp: "" + Date.now()
- }),
- i = [n, ["accessKeyId", "authorization", "signatureNonce", "timestamp"].sort().map(function (e) {
- return r[e] ? "".concat(e, "=").concat(r[e]) : null;
- }).filter(Boolean).join("&"), "host:".concat(s)].join("\n"),
- o = ["HMAC-SHA256", _e(i).toString(Rt)].join("\n"),
- a = we(o, this.config.secretKey).toString(Rt),
- c = Object.keys(r).map(function (e) {
- return "".concat(e, "=").concat(encodeURIComponent(r[e]));
- }).join("&");
- return "".concat(this.config.wsEndpoint).concat(n, "?").concat(c, "&signature=").concat(a);
- }
- }]);
- return Kt;
- }();
- var jt = /*#__PURE__*/function () {
- function jt(e) {
- (0, _classCallCheck2.default)(this, jt);
- if (["spaceId", "spaceAppId", "accessKey", "secretKey"].forEach(function (t) {
- if (!Object.prototype.hasOwnProperty.call(e, t)) throw new Error("".concat(t, " required"));
- }), e.endpoint) {
- if ("string" != typeof e.endpoint) throw new Error("endpoint must be string");
- if (!/^https:\/\//.test(e.endpoint)) throw new Error("endpoint must start with https://");
- e.endpoint = e.endpoint.replace(/\/$/, "");
- }
- this.config = Object.assign({}, e, {
- endpoint: e.endpoint || "https://".concat(e.spaceId, ".api-hz.cloudbasefunction.cn"),
- wsEndpoint: e.wsEndpoint || "wss://".concat(e.spaceId, ".api-hz.cloudbasefunction.cn")
- }), this._websocket = new Kt(this.config);
- }
- (0, _createClass2.default)(jt, [{
- key: "callFunction",
- value: function callFunction(e) {
- return function (e, t) {
- var n = e.name,
- s = e.data,
- _e$async = e.async,
- r = _e$async === void 0 ? !1 : _e$async,
- i = e.timeout,
- o = "POST",
- a = {
- "x-to-function-name": n
- };
- r && (a["x-function-invoke-type"] = "async");
- var _Ut2 = Ut("/functions/invokeFunction", {
- functionName: n,
- data: s,
- method: o,
- headers: a,
- signHeaderKeys: ["x-to-function-name"],
- config: t
- }),
- c = _Ut2.url,
- u = _Ut2.headers;
- return Dt({
- url: c,
- data: s,
- method: o,
- headers: u,
- timeout: i
- }).then(function (e) {
- var t = 0;
- if (r) {
- var _n10 = e.data || {};
- t = "200" === _n10.errCode ? 0 : _n10.errCode, e.data = _n10.data || {}, e.errMsg = _n10.errMsg;
- }
- if (0 !== t) throw new te({
- code: t,
- message: e.errMsg,
- requestId: e.requestId
- });
- return {
- errCode: t,
- success: 0 === t,
- requestId: e.requestId,
- result: e.data
- };
- }).catch(function (e) {
- throw new te({
- code: e.errCode,
- message: e.errMsg,
- requestId: e.requestId
- });
- });
- }(e, this.config);
- }
- }, {
- key: "uploadFileToOSS",
- value: function uploadFileToOSS(_ref25) {
- var e = _ref25.url,
- t = _ref25.filePath,
- n = _ref25.fileType,
- s = _ref25.formData,
- r = _ref25.onUploadProgress;
- return new Promise(function (i, o) {
- var a = ne.uploadFile({
- url: e,
- filePath: t,
- fileType: n,
- formData: s,
- name: "file",
- success: function success(e) {
- e && e.statusCode < 400 ? i(e) : o(new te({
- code: "UPLOAD_FAILED",
- message: "文件上传失败"
- }));
- },
- fail: function fail(e) {
- o(new te({
- code: e.code || "UPLOAD_FAILED",
- message: e.message || e.errMsg || "文件上传失败"
- }));
- }
- });
- "function" == typeof r && a && "function" == typeof a.onProgressUpdate && a.onProgressUpdate(function (e) {
- r({
- loaded: e.totalBytesSent,
- total: e.totalBytesExpectedToSend
- });
- });
- });
- }
- }, {
- key: "uploadFile",
- value: function () {
- var _uploadFile2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee45(_ref26) {
- var e, _ref26$cloudPath, t, _ref26$fileType, n, s, r, i, o, a, c;
- return _regenerator.default.wrap(function _callee45$(_context45) {
- while (1) {
- switch (_context45.prev = _context45.next) {
- case 0:
- e = _ref26.filePath, _ref26$cloudPath = _ref26.cloudPath, t = _ref26$cloudPath === void 0 ? "" : _ref26$cloudPath, _ref26$fileType = _ref26.fileType, n = _ref26$fileType === void 0 ? "image" : _ref26$fileType, s = _ref26.onUploadProgress;
- if (!("string" !== g(t))) {
- _context45.next = 3;
- break;
- }
- throw new te({
- code: "INVALID_PARAM",
- message: "cloudPath必须为字符串类型"
- });
- case 3:
- if (t = t.trim()) {
- _context45.next = 5;
- break;
- }
- throw new te({
- code: "INVALID_PARAM",
- message: "cloudPath不可为空"
- });
- case 5:
- if (!/:\/\//.test(t)) {
- _context45.next = 7;
- break;
- }
- throw new te({
- code: "INVALID_PARAM",
- message: "cloudPath不合法"
- });
- case 7:
- _context45.next = 9;
- return Mt({
- path: "/".concat(t.replace(/^\//, ""), "?post_url")
- }, this.config);
- case 9:
- r = _context45.sent;
- i = r.file_id;
- o = r.upload_url;
- a = r.form_data;
- c = a && a.reduce(function (e, t) {
- return e[t.key] = t.value, e;
- }, {});
- return _context45.abrupt("return", this.uploadFileToOSS({
- url: o,
- filePath: e,
- fileType: n,
- formData: c,
- onUploadProgress: s
- }).then(function () {
- return {
- fileID: i
- };
- }));
- case 15:
- case "end":
- return _context45.stop();
- }
- }
- }, _callee45, this);
- }));
- function uploadFile(_x43) {
- return _uploadFile2.apply(this, arguments);
- }
- return uploadFile;
- }()
- }, {
- key: "getTempFileURL",
- value: function () {
- var _getTempFileURL = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee46(_ref27) {
- var _this17 = this;
- var e;
- return _regenerator.default.wrap(function _callee46$(_context46) {
- while (1) {
- switch (_context46.prev = _context46.next) {
- case 0:
- e = _ref27.fileList;
- return _context46.abrupt("return", new Promise(function (t, n) {
- (!e || e.length < 0) && t({
- code: "INVALID_PARAM",
- message: "fileList不能为空数组"
- }), e.length > 50 && t({
- code: "INVALID_PARAM",
- message: "fileList数组长度不能超过50"
- });
- var s = [];
- var _iterator5 = _createForOfIteratorHelper(e),
- _step5;
- try {
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
- var _n11 = _step5.value;
- var _e18 = void 0;
- "string" !== g(_n11) && t({
- code: "INVALID_PARAM",
- message: "fileList的元素必须是非空的字符串"
- });
- try {
- _e18 = qt.call(_this17, _n11);
- } catch (t) {
- console.warn(t.errCode, t.errMsg), _e18 = _n11;
- }
- s.push({
- file_id: _e18,
- expire: 600
- });
- }
- } catch (err) {
- _iterator5.e(err);
- } finally {
- _iterator5.f();
- }
- Mt({
- path: "/?download_url",
- data: {
- file_list: s
- },
- method: "POST"
- }, _this17.config).then(function (e) {
- var _e$file_list = e.file_list,
- n = _e$file_list === void 0 ? [] : _e$file_list;
- t({
- fileList: n.map(function (e) {
- return {
- fileID: Ft.call(_this17, e.file_id),
- tempFileURL: e.download_url
- };
- })
- });
- }).catch(function (e) {
- return n(e);
- });
- }));
- case 2:
- case "end":
- return _context46.stop();
- }
- }
- }, _callee46);
- }));
- function getTempFileURL(_x44) {
- return _getTempFileURL.apply(this, arguments);
- }
- return getTempFileURL;
- }()
- }, {
- key: "connectWebSocket",
- value: function () {
- var _connectWebSocket = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee47(e) {
- var t, n;
- return _regenerator.default.wrap(function _callee47$(_context47) {
- while (1) {
- switch (_context47.prev = _context47.next) {
- case 0:
- t = e.name, n = e.query;
- return _context47.abrupt("return", ne.connectSocket({
- url: this._websocket.signedURL(t, n),
- complete: function complete() {}
- }));
- case 2:
- case "end":
- return _context47.stop();
- }
- }
- }, _callee47, this);
- }));
- function connectWebSocket(_x45) {
- return _connectWebSocket.apply(this, arguments);
- }
- return connectWebSocket;
- }()
- }]);
- return jt;
- }();
- var $t = {
- init: function init(e) {
- e.provider = "alipay";
- var t = new jt(e);
- return t.auth = function () {
- return {
- signInAnonymously: function signInAnonymously() {
- return Promise.resolve();
- },
- getLoginState: function getLoginState() {
- return Promise.resolve(!0);
- }
- };
- }, t;
- }
- };
- function Bt(_ref28) {
- var e = _ref28.data;
- var t;
- t = he();
- var n = JSON.parse(JSON.stringify(e || {}));
- if (Object.assign(n, {
- clientInfo: t
- }), !n.uniIdToken) {
- var _se3 = se(),
- _e19 = _se3.token;
- _e19 && (n.uniIdToken = _e19);
- }
- return n;
- }
- function Wt() {
- return _Wt.apply(this, arguments);
- }
- function _Wt() {
- _Wt = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee70() {
- var _this30 = this;
- var e,
- _this$__dev__,
- t,
- n,
- s,
- r,
- i,
- o,
- _args9 = arguments;
- return _regenerator.default.wrap(function _callee70$(_context70) {
- while (1) {
- switch (_context70.prev = _context70.next) {
- case 0:
- e = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : {};
- _context70.next = 3;
- return this.__dev__.initLocalNetwork();
- case 3:
- _this$__dev__ = this.__dev__, t = _this$__dev__.localAddress, n = _this$__dev__.localPort, s = {
- aliyun: "aliyun",
- tencent: "tcb",
- alipay: "alipay",
- dcloud: "dcloud"
- }[this.config.provider], r = this.config.spaceId, i = "http://".concat(t, ":").concat(n, "/system/check-function"), o = "http://".concat(t, ":").concat(n, "/cloudfunctions/").concat(e.name);
- return _context70.abrupt("return", new Promise(function (t, n) {
- ne.request({
- method: "POST",
- url: i,
- data: {
- name: e.name,
- platform: C,
- provider: s,
- spaceId: r
- },
- timeout: 3e3,
- success: function success(e) {
- t(e);
- },
- fail: function fail() {
- t({
- data: {
- code: "NETWORK_ERROR",
- message: "连接本地调试服务失败,请检查客户端是否和主机在同一局域网下,自动切换为已部署的云函数。"
- }
- });
- }
- });
- }).then(function () {
- var _ref66 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- e = _ref66.data;
- var _ref67 = e || {},
- t = _ref67.code,
- n = _ref67.message;
- return {
- code: 0 === t ? 0 : t || "SYS_ERR",
- message: n || "SYS_ERR"
- };
- }).then(function (_ref68) {
- var t = _ref68.code,
- n = _ref68.message;
- if (0 !== t) {
- switch (t) {
- case "MODULE_ENCRYPTED":
- console.error("\u6B64\u4E91\u51FD\u6570\uFF08".concat(e.name, "\uFF09\u4F9D\u8D56\u52A0\u5BC6\u516C\u5171\u6A21\u5757\u4E0D\u53EF\u672C\u5730\u8C03\u8BD5\uFF0C\u81EA\u52A8\u5207\u6362\u4E3A\u4E91\u7AEF\u5DF2\u90E8\u7F72\u7684\u4E91\u51FD\u6570"));
- break;
- case "FUNCTION_ENCRYPTED":
- console.error("\u6B64\u4E91\u51FD\u6570\uFF08".concat(e.name, "\uFF09\u5DF2\u52A0\u5BC6\u4E0D\u53EF\u672C\u5730\u8C03\u8BD5\uFF0C\u81EA\u52A8\u5207\u6362\u4E3A\u4E91\u7AEF\u5DF2\u90E8\u7F72\u7684\u4E91\u51FD\u6570"));
- break;
- case "ACTION_ENCRYPTED":
- console.error(n || "需要访问加密的uni-clientDB-action,自动切换为云端环境");
- break;
- case "NETWORK_ERROR":
- console.error(n || "连接本地调试服务失败,请检查客户端是否和主机在同一局域网下");
- break;
- case "SWITCH_TO_CLOUD":
- break;
- default:
- {
- var _e32 = "\u68C0\u6D4B\u672C\u5730\u8C03\u8BD5\u670D\u52A1\u51FA\u73B0\u9519\u8BEF\uFF1A".concat(n, "\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u73AF\u5883\u6216\u91CD\u542F\u5BA2\u6237\u7AEF\u518D\u8BD5");
- throw console.error(_e32), new Error(_e32);
- }
- }
- return _this30._callCloudFunction(e);
- }
- return new Promise(function (t, n) {
- var r = Bt.call(_this30, {
- data: e.data
- });
- ne.request({
- method: "POST",
- url: o,
- data: {
- provider: s,
- platform: C,
- param: r
- },
- timeout: e.timeout,
- success: function success() {
- var _ref69 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- e = _ref69.statusCode,
- s = _ref69.data;
- return !e || e >= 400 ? n(new te({
- code: s.code || "SYS_ERR",
- message: s.message || "request:fail"
- })) : t({
- result: s
- });
- },
- fail: function fail(e) {
- n(new te({
- code: e.code || e.errCode || "SYS_ERR",
- message: e.message || e.errMsg || "request:fail"
- }));
- }
- });
- });
- }));
- case 5:
- case "end":
- return _context70.stop();
- }
- }
- }, _callee70, this);
- }));
- return _Wt.apply(this, arguments);
- }
- var Ht = [{
- rule: /fc_function_not_found|FUNCTION_NOT_FOUND/,
- content: ",云函数[{functionName}]在云端不存在,请检查此云函数名称是否正确以及该云函数是否已上传到服务空间",
- mode: "append"
- }];
- var Jt = /[\\^$.*+?()[\]{}|]/g,
- zt = RegExp(Jt.source);
- function Vt(e, t, n) {
- return e.replace(new RegExp((s = t) && zt.test(s) ? s.replace(Jt, "\\$&") : s, "g"), n);
- var s;
- }
- var Gt = {
- NONE: "none",
- REQUEST: "request",
- RESPONSE: "response",
- BOTH: "both"
- },
- Yt = "_globalUniCloudStatus",
- Qt = "_globalUniCloudSecureNetworkCache__{spaceId}";
- var Xt = /*#__PURE__*/function () {
- function Xt() {
- var _ref29 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- e = _ref29.secretType,
- t = _ref29.uniCloudIns;
- (0, _classCallCheck2.default)(this, Xt);
- this.clientType = "", this.secretType = e || Gt.NONE, this.uniCloudIns = t;
- var _this$uniCloudIns$con = this.uniCloudIns.config,
- n = _this$uniCloudIns$con.provider,
- s = _this$uniCloudIns$con.spaceId;
- var r;
- this.provider = n, this.spaceId = s, this.scopedGlobalCache = (r = this.uniCloudIns, U(Qt.replace("{spaceId}", r.config.spaceId)));
- }
- (0, _createClass2.default)(Xt, [{
- key: "getSystemInfo",
- value: function getSystemInfo() {
- return this._systemInfo || (this._systemInfo = ae()), this._systemInfo;
- }
- }, {
- key: "appId",
- get: function get() {
- return this.getSystemInfo().appId;
- }
- }, {
- key: "deviceId",
- get: function get() {
- return this.getSystemInfo().deviceId;
- }
- }, {
- key: "encryptData",
- value: function () {
- var _encryptData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee48(e) {
- return _regenerator.default.wrap(function _callee48$(_context48) {
- while (1) {
- switch (_context48.prev = _context48.next) {
- case 0:
- return _context48.abrupt("return", this.secretType === Gt.NONE ? e : this.platformEncryptData(e));
- case 1:
- case "end":
- return _context48.stop();
- }
- }
- }, _callee48, this);
- }));
- function encryptData(_x46) {
- return _encryptData.apply(this, arguments);
- }
- return encryptData;
- }()
- }, {
- key: "decryptResult",
- value: function () {
- var _decryptResult = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee49(e) {
- var _ref30, t, n;
- return _regenerator.default.wrap(function _callee49$(_context49) {
- while (1) {
- switch (_context49.prev = _context49.next) {
- case 0:
- if (!(this.secretType === Gt.NONE)) {
- _context49.next = 2;
- break;
- }
- return _context49.abrupt("return", e);
- case 2:
- _ref30 = e || {}, t = _ref30.errCode, n = _ref30.content;
- return _context49.abrupt("return", t || !n ? e : this.secretType === Gt.REQUEST ? n : this.platformDecryptResult(e));
- case 4:
- case "end":
- return _context49.stop();
- }
- }
- }, _callee49, this);
- }));
- function decryptResult(_x47) {
- return _decryptResult.apply(this, arguments);
- }
- return decryptResult;
- }()
- }, {
- key: "wrapVerifyClientCallFunction",
- value: function wrapVerifyClientCallFunction(e) {
- var t = this;
- return /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee50() {
- var _ref32,
- n,
- _ref32$data,
- s,
- r,
- _args50 = arguments;
- return _regenerator.default.wrap(function _callee50$(_context50) {
- while (1) {
- switch (_context50.prev = _context50.next) {
- case 0:
- _ref32 = _args50.length > 0 && _args50[0] !== undefined ? _args50[0] : {}, n = _ref32.name, _ref32$data = _ref32.data, s = _ref32$data === void 0 ? {} : _ref32$data;
- _context50.next = 3;
- return t.prepare();
- case 3:
- _context50.next = 5;
- return t.platformGetSignOption();
- case 5:
- (s = JSON.parse(JSON.stringify(s)))._uniCloudOptions = _context50.sent;
- _context50.next = 8;
- return e({
- name: n,
- data: s
- });
- case 8:
- r = _context50.sent;
- _context50.t0 = t.isClientKeyNotFound(r);
- if (!_context50.t0) {
- _context50.next = 19;
- break;
- }
- _context50.next = 13;
- return t.prepare({
- forceUpdate: !0
- });
- case 13:
- _context50.next = 15;
- return t.platformGetSignOption();
- case 15:
- s._uniCloudOptions = _context50.sent;
- _context50.next = 18;
- return e({
- name: n,
- data: s
- });
- case 18:
- r = _context50.sent;
- case 19:
- return _context50.abrupt("return", r);
- case 20:
- case "end":
- return _context50.stop();
- }
- }
- }, _callee50);
- }));
- }
- }, {
- key: "wrapEncryptDataCallFunction",
- value: function wrapEncryptDataCallFunction(e) {
- var t = this;
- return /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee51() {
- var _ref34,
- n,
- _ref34$data,
- s,
- r,
- i,
- _r5,
- _args51 = arguments;
- return _regenerator.default.wrap(function _callee51$(_context51) {
- while (1) {
- switch (_context51.prev = _context51.next) {
- case 0:
- _ref34 = _args51.length > 0 && _args51[0] !== undefined ? _args51[0] : {}, n = _ref34.name, _ref34$data = _ref34.data, s = _ref34$data === void 0 ? {} : _ref34$data;
- _context51.next = 3;
- return t.prepare();
- case 3:
- _context51.next = 5;
- return t.encryptData(s);
- case 5:
- r = _context51.sent;
- _context51.next = 8;
- return e({
- name: n,
- data: r
- });
- case 8:
- i = _context51.sent;
- if (!t.isClientKeyNotFound(i)) {
- _context51.next = 21;
- break;
- }
- _context51.next = 12;
- return t.prepare({
- forceUpdate: !0
- });
- case 12:
- _context51.next = 14;
- return t.encryptData(s);
- case 14:
- _r5 = _context51.sent;
- _context51.next = 17;
- return t.platformGetSignOption();
- case 17:
- s._uniCloudOptions = _context51.sent;
- _context51.next = 20;
- return e({
- name: n,
- data: _r5
- });
- case 20:
- i = _context51.sent;
- case 21:
- _context51.next = 23;
- return t.decryptResult(i.result);
- case 23:
- i.result = _context51.sent;
- return _context51.abrupt("return", i);
- case 25:
- case "end":
- return _context51.stop();
- }
- }
- }, _callee51);
- }));
- }
- }]);
- return Xt;
- }();
- /*! MIT License. Copyright 2015-2018 Richard Moore <me@ricmoo.com>. See LICENSE.txt. */
- function Zt(e) {
- return parseInt(e) === e;
- }
- function en(e) {
- if (!Zt(e.length)) return !1;
- for (var t = 0; t < e.length; t++) {
- if (!Zt(e[t]) || e[t] < 0 || e[t] > 255) return !1;
- }
- return !0;
- }
- function tn(e, t) {
- if (e.buffer && "Uint8Array" === e.name) return t && (e = e.slice ? e.slice() : Array.prototype.slice.call(e)), e;
- if (Array.isArray(e)) {
- if (!en(e)) throw new Error("Array contains invalid value: " + e);
- return new Uint8Array(e);
- }
- if (Zt(e.length) && en(e)) return new Uint8Array(e);
- throw new Error("unsupported array-like object");
- }
- function nn(e) {
- return new Uint8Array(e);
- }
- function sn(e, t, n, s, r) {
- null == s && null == r || (e = e.slice ? e.slice(s, r) : Array.prototype.slice.call(e, s, r)), t.set(e, n);
- }
- var rn,
- on = {
- toBytes: function toBytes(e) {
- var t = [],
- n = 0;
- for (e = encodeURI(e); n < e.length;) {
- var s = e.charCodeAt(n++);
- 37 === s ? (t.push(parseInt(e.substr(n, 2), 16)), n += 2) : t.push(s);
- }
- return tn(t);
- },
- fromBytes: function fromBytes(e) {
- for (var t = [], n = 0; n < e.length;) {
- var s = e[n];
- s < 128 ? (t.push(String.fromCharCode(s)), n++) : s > 191 && s < 224 ? (t.push(String.fromCharCode((31 & s) << 6 | 63 & e[n + 1])), n += 2) : (t.push(String.fromCharCode((15 & s) << 12 | (63 & e[n + 1]) << 6 | 63 & e[n + 2])), n += 3);
- }
- return t.join("");
- }
- },
- an = (rn = "0123456789abcdef", {
- toBytes: function toBytes(e) {
- for (var t = [], n = 0; n < e.length; n += 2) {
- t.push(parseInt(e.substr(n, 2), 16));
- }
- return t;
- },
- fromBytes: function fromBytes(e) {
- for (var t = [], n = 0; n < e.length; n++) {
- var s = e[n];
- t.push(rn[(240 & s) >> 4] + rn[15 & s]);
- }
- return t.join("");
- }
- }),
- cn = {
- 16: 10,
- 24: 12,
- 32: 14
- },
- un = [1, 2, 4, 8, 16, 32, 64, 128, 27, 54, 108, 216, 171, 77, 154, 47, 94, 188, 99, 198, 151, 53, 106, 212, 179, 125, 250, 239, 197, 145],
- hn = [99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117, 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132, 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207, 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168, 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 255, 243, 210, 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115, 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, 224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8, 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, 112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223, 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22],
- ln = [82, 9, 106, 213, 48, 54, 165, 56, 191, 64, 163, 158, 129, 243, 215, 251, 124, 227, 57, 130, 155, 47, 255, 135, 52, 142, 67, 68, 196, 222, 233, 203, 84, 123, 148, 50, 166, 194, 35, 61, 238, 76, 149, 11, 66, 250, 195, 78, 8, 46, 161, 102, 40, 217, 36, 178, 118, 91, 162, 73, 109, 139, 209, 37, 114, 248, 246, 100, 134, 104, 152, 22, 212, 164, 92, 204, 93, 101, 182, 146, 108, 112, 72, 80, 253, 237, 185, 218, 94, 21, 70, 87, 167, 141, 157, 132, 144, 216, 171, 0, 140, 188, 211, 10, 247, 228, 88, 5, 184, 179, 69, 6, 208, 44, 30, 143, 202, 63, 15, 2, 193, 175, 189, 3, 1, 19, 138, 107, 58, 145, 17, 65, 79, 103, 220, 234, 151, 242, 207, 206, 240, 180, 230, 115, 150, 172, 116, 34, 231, 173, 53, 133, 226, 249, 55, 232, 28, 117, 223, 110, 71, 241, 26, 113, 29, 41, 197, 137, 111, 183, 98, 14, 170, 24, 190, 27, 252, 86, 62, 75, 198, 210, 121, 32, 154, 219, 192, 254, 120, 205, 90, 244, 31, 221, 168, 51, 136, 7, 199, 49, 177, 18, 16, 89, 39, 128, 236, 95, 96, 81, 127, 169, 25, 181, 74, 13, 45, 229, 122, 159, 147, 201, 156, 239, 160, 224, 59, 77, 174, 42, 245, 176, 200, 235, 187, 60, 131, 83, 153, 97, 23, 43, 4, 126, 186, 119, 214, 38, 225, 105, 20, 99, 85, 33, 12, 125],
- dn = [3328402341, 4168907908, 4000806809, 4135287693, 4294111757, 3597364157, 3731845041, 2445657428, 1613770832, 33620227, 3462883241, 1445669757, 3892248089, 3050821474, 1303096294, 3967186586, 2412431941, 528646813, 2311702848, 4202528135, 4026202645, 2992200171, 2387036105, 4226871307, 1101901292, 3017069671, 1604494077, 1169141738, 597466303, 1403299063, 3832705686, 2613100635, 1974974402, 3791519004, 1033081774, 1277568618, 1815492186, 2118074177, 4126668546, 2211236943, 1748251740, 1369810420, 3521504564, 4193382664, 3799085459, 2883115123, 1647391059, 706024767, 134480908, 2512897874, 1176707941, 2646852446, 806885416, 932615841, 168101135, 798661301, 235341577, 605164086, 461406363, 3756188221, 3454790438, 1311188841, 2142417613, 3933566367, 302582043, 495158174, 1479289972, 874125870, 907746093, 3698224818, 3025820398, 1537253627, 2756858614, 1983593293, 3084310113, 2108928974, 1378429307, 3722699582, 1580150641, 327451799, 2790478837, 3117535592, 0, 3253595436, 1075847264, 3825007647, 2041688520, 3059440621, 3563743934, 2378943302, 1740553945, 1916352843, 2487896798, 2555137236, 2958579944, 2244988746, 3151024235, 3320835882, 1336584933, 3992714006, 2252555205, 2588757463, 1714631509, 293963156, 2319795663, 3925473552, 67240454, 4269768577, 2689618160, 2017213508, 631218106, 1269344483, 2723238387, 1571005438, 2151694528, 93294474, 1066570413, 563977660, 1882732616, 4059428100, 1673313503, 2008463041, 2950355573, 1109467491, 537923632, 3858759450, 4260623118, 3218264685, 2177748300, 403442708, 638784309, 3287084079, 3193921505, 899127202, 2286175436, 773265209, 2479146071, 1437050866, 4236148354, 2050833735, 3362022572, 3126681063, 840505643, 3866325909, 3227541664, 427917720, 2655997905, 2749160575, 1143087718, 1412049534, 999329963, 193497219, 2353415882, 3354324521, 1807268051, 672404540, 2816401017, 3160301282, 369822493, 2916866934, 3688947771, 1681011286, 1949973070, 336202270, 2454276571, 201721354, 1210328172, 3093060836, 2680341085, 3184776046, 1135389935, 3294782118, 965841320, 831886756, 3554993207, 4068047243, 3588745010, 2345191491, 1849112409, 3664604599, 26054028, 2983581028, 2622377682, 1235855840, 3630984372, 2891339514, 4092916743, 3488279077, 3395642799, 4101667470, 1202630377, 268961816, 1874508501, 4034427016, 1243948399, 1546530418, 941366308, 1470539505, 1941222599, 2546386513, 3421038627, 2715671932, 3899946140, 1042226977, 2521517021, 1639824860, 227249030, 260737669, 3765465232, 2084453954, 1907733956, 3429263018, 2420656344, 100860677, 4160157185, 470683154, 3261161891, 1781871967, 2924959737, 1773779408, 394692241, 2579611992, 974986535, 664706745, 3655459128, 3958962195, 731420851, 571543859, 3530123707, 2849626480, 126783113, 865375399, 765172662, 1008606754, 361203602, 3387549984, 2278477385, 2857719295, 1344809080, 2782912378, 59542671, 1503764984, 160008576, 437062935, 1707065306, 3622233649, 2218934982, 3496503480, 2185314755, 697932208, 1512910199, 504303377, 2075177163, 2824099068, 1841019862, 739644986],
- pn = [2781242211, 2230877308, 2582542199, 2381740923, 234877682, 3184946027, 2984144751, 1418839493, 1348481072, 50462977, 2848876391, 2102799147, 434634494, 1656084439, 3863849899, 2599188086, 1167051466, 2636087938, 1082771913, 2281340285, 368048890, 3954334041, 3381544775, 201060592, 3963727277, 1739838676, 4250903202, 3930435503, 3206782108, 4149453988, 2531553906, 1536934080, 3262494647, 484572669, 2923271059, 1783375398, 1517041206, 1098792767, 49674231, 1334037708, 1550332980, 4098991525, 886171109, 150598129, 2481090929, 1940642008, 1398944049, 1059722517, 201851908, 1385547719, 1699095331, 1587397571, 674240536, 2704774806, 252314885, 3039795866, 151914247, 908333586, 2602270848, 1038082786, 651029483, 1766729511, 3447698098, 2682942837, 454166793, 2652734339, 1951935532, 775166490, 758520603, 3000790638, 4004797018, 4217086112, 4137964114, 1299594043, 1639438038, 3464344499, 2068982057, 1054729187, 1901997871, 2534638724, 4121318227, 1757008337, 0, 750906861, 1614815264, 535035132, 3363418545, 3988151131, 3201591914, 1183697867, 3647454910, 1265776953, 3734260298, 3566750796, 3903871064, 1250283471, 1807470800, 717615087, 3847203498, 384695291, 3313910595, 3617213773, 1432761139, 2484176261, 3481945413, 283769337, 100925954, 2180939647, 4037038160, 1148730428, 3123027871, 3813386408, 4087501137, 4267549603, 3229630528, 2315620239, 2906624658, 3156319645, 1215313976, 82966005, 3747855548, 3245848246, 1974459098, 1665278241, 807407632, 451280895, 251524083, 1841287890, 1283575245, 337120268, 891687699, 801369324, 3787349855, 2721421207, 3431482436, 959321879, 1469301956, 4065699751, 2197585534, 1199193405, 2898814052, 3887750493, 724703513, 2514908019, 2696962144, 2551808385, 3516813135, 2141445340, 1715741218, 2119445034, 2872807568, 2198571144, 3398190662, 700968686, 3547052216, 1009259540, 2041044702, 3803995742, 487983883, 1991105499, 1004265696, 1449407026, 1316239930, 504629770, 3683797321, 168560134, 1816667172, 3837287516, 1570751170, 1857934291, 4014189740, 2797888098, 2822345105, 2754712981, 936633572, 2347923833, 852879335, 1133234376, 1500395319, 3084545389, 2348912013, 1689376213, 3533459022, 3762923945, 3034082412, 4205598294, 133428468, 634383082, 2949277029, 2398386810, 3913789102, 403703816, 3580869306, 2297460856, 1867130149, 1918643758, 607656988, 4049053350, 3346248884, 1368901318, 600565992, 2090982877, 2632479860, 557719327, 3717614411, 3697393085, 2249034635, 2232388234, 2430627952, 1115438654, 3295786421, 2865522278, 3633334344, 84280067, 33027830, 303828494, 2747425121, 1600795957, 4188952407, 3496589753, 2434238086, 1486471617, 658119965, 3106381470, 953803233, 334231800, 3005978776, 857870609, 3151128937, 1890179545, 2298973838, 2805175444, 3056442267, 574365214, 2450884487, 550103529, 1233637070, 4289353045, 2018519080, 2057691103, 2399374476, 4166623649, 2148108681, 387583245, 3664101311, 836232934, 3330556482, 3100665960, 3280093505, 2955516313, 2002398509, 287182607, 3413881008, 4238890068, 3597515707, 975967766],
- fn = [1671808611, 2089089148, 2006576759, 2072901243, 4061003762, 1807603307, 1873927791, 3310653893, 810573872, 16974337, 1739181671, 729634347, 4263110654, 3613570519, 2883997099, 1989864566, 3393556426, 2191335298, 3376449993, 2106063485, 4195741690, 1508618841, 1204391495, 4027317232, 2917941677, 3563566036, 2734514082, 2951366063, 2629772188, 2767672228, 1922491506, 3227229120, 3082974647, 4246528509, 2477669779, 644500518, 911895606, 1061256767, 4144166391, 3427763148, 878471220, 2784252325, 3845444069, 4043897329, 1905517169, 3631459288, 827548209, 356461077, 67897348, 3344078279, 593839651, 3277757891, 405286936, 2527147926, 84871685, 2595565466, 118033927, 305538066, 2157648768, 3795705826, 3945188843, 661212711, 2999812018, 1973414517, 152769033, 2208177539, 745822252, 439235610, 455947803, 1857215598, 1525593178, 2700827552, 1391895634, 994932283, 3596728278, 3016654259, 695947817, 3812548067, 795958831, 2224493444, 1408607827, 3513301457, 0, 3979133421, 543178784, 4229948412, 2982705585, 1542305371, 1790891114, 3410398667, 3201918910, 961245753, 1256100938, 1289001036, 1491644504, 3477767631, 3496721360, 4012557807, 2867154858, 4212583931, 1137018435, 1305975373, 861234739, 2241073541, 1171229253, 4178635257, 33948674, 2139225727, 1357946960, 1011120188, 2679776671, 2833468328, 1374921297, 2751356323, 1086357568, 2408187279, 2460827538, 2646352285, 944271416, 4110742005, 3168756668, 3066132406, 3665145818, 560153121, 271589392, 4279952895, 4077846003, 3530407890, 3444343245, 202643468, 322250259, 3962553324, 1608629855, 2543990167, 1154254916, 389623319, 3294073796, 2817676711, 2122513534, 1028094525, 1689045092, 1575467613, 422261273, 1939203699, 1621147744, 2174228865, 1339137615, 3699352540, 577127458, 712922154, 2427141008, 2290289544, 1187679302, 3995715566, 3100863416, 339486740, 3732514782, 1591917662, 186455563, 3681988059, 3762019296, 844522546, 978220090, 169743370, 1239126601, 101321734, 611076132, 1558493276, 3260915650, 3547250131, 2901361580, 1655096418, 2443721105, 2510565781, 3828863972, 2039214713, 3878868455, 3359869896, 928607799, 1840765549, 2374762893, 3580146133, 1322425422, 2850048425, 1823791212, 1459268694, 4094161908, 3928346602, 1706019429, 2056189050, 2934523822, 135794696, 3134549946, 2022240376, 628050469, 779246638, 472135708, 2800834470, 3032970164, 3327236038, 3894660072, 3715932637, 1956440180, 522272287, 1272813131, 3185336765, 2340818315, 2323976074, 1888542832, 1044544574, 3049550261, 1722469478, 1222152264, 50660867, 4127324150, 236067854, 1638122081, 895445557, 1475980887, 3117443513, 2257655686, 3243809217, 489110045, 2662934430, 3778599393, 4162055160, 2561878936, 288563729, 1773916777, 3648039385, 2391345038, 2493985684, 2612407707, 505560094, 2274497927, 3911240169, 3460925390, 1442818645, 678973480, 3749357023, 2358182796, 2717407649, 2306869641, 219617805, 3218761151, 3862026214, 1120306242, 1756942440, 1103331905, 2578459033, 762796589, 252780047, 2966125488, 1425844308, 3151392187, 372911126],
- gn = [1667474886, 2088535288, 2004326894, 2071694838, 4075949567, 1802223062, 1869591006, 3318043793, 808472672, 16843522, 1734846926, 724270422, 4278065639, 3621216949, 2880169549, 1987484396, 3402253711, 2189597983, 3385409673, 2105378810, 4210693615, 1499065266, 1195886990, 4042263547, 2913856577, 3570689971, 2728590687, 2947541573, 2627518243, 2762274643, 1920112356, 3233831835, 3082273397, 4261223649, 2475929149, 640051788, 909531756, 1061110142, 4160160501, 3435941763, 875846760, 2779116625, 3857003729, 4059105529, 1903268834, 3638064043, 825316194, 353713962, 67374088, 3351728789, 589522246, 3284360861, 404236336, 2526454071, 84217610, 2593830191, 117901582, 303183396, 2155911963, 3806477791, 3958056653, 656894286, 2998062463, 1970642922, 151591698, 2206440989, 741110872, 437923380, 454765878, 1852748508, 1515908788, 2694904667, 1381168804, 993742198, 3604373943, 3014905469, 690584402, 3823320797, 791638366, 2223281939, 1398011302, 3520161977, 0, 3991743681, 538992704, 4244381667, 2981218425, 1532751286, 1785380564, 3419096717, 3200178535, 960056178, 1246420628, 1280103576, 1482221744, 3486468741, 3503319995, 4025428677, 2863326543, 4227536621, 1128514950, 1296947098, 859002214, 2240123921, 1162203018, 4193849577, 33687044, 2139062782, 1347481760, 1010582648, 2678045221, 2829640523, 1364325282, 2745433693, 1077985408, 2408548869, 2459086143, 2644360225, 943212656, 4126475505, 3166494563, 3065430391, 3671750063, 555836226, 269496352, 4294908645, 4092792573, 3537006015, 3452783745, 202118168, 320025894, 3974901699, 1600119230, 2543297077, 1145359496, 387397934, 3301201811, 2812801621, 2122220284, 1027426170, 1684319432, 1566435258, 421079858, 1936954854, 1616945344, 2172753945, 1330631070, 3705438115, 572679748, 707427924, 2425400123, 2290647819, 1179044492, 4008585671, 3099120491, 336870440, 3739122087, 1583276732, 185277718, 3688593069, 3772791771, 842159716, 976899700, 168435220, 1229577106, 101059084, 606366792, 1549591736, 3267517855, 3553849021, 2897014595, 1650632388, 2442242105, 2509612081, 3840161747, 2038008818, 3890688725, 3368567691, 926374254, 1835907034, 2374863873, 3587531953, 1313788572, 2846482505, 1819063512, 1448540844, 4109633523, 3941213647, 1701162954, 2054852340, 2930698567, 134748176, 3132806511, 2021165296, 623210314, 774795868, 471606328, 2795958615, 3031746419, 3334885783, 3907527627, 3722280097, 1953799400, 522133822, 1263263126, 3183336545, 2341176845, 2324333839, 1886425312, 1044267644, 3048588401, 1718004428, 1212733584, 50529542, 4143317495, 235803164, 1633788866, 892690282, 1465383342, 3115962473, 2256965911, 3250673817, 488449850, 2661202215, 3789633753, 4177007595, 2560144171, 286339874, 1768537042, 3654906025, 2391705863, 2492770099, 2610673197, 505291324, 2273808917, 3924369609, 3469625735, 1431699370, 673740880, 3755965093, 2358021891, 2711746649, 2307489801, 218961690, 3217021541, 3873845719, 1111672452, 1751693520, 1094828930, 2576986153, 757954394, 252645662, 2964376443, 1414855848, 3149649517, 370555436],
- mn = [1374988112, 2118214995, 437757123, 975658646, 1001089995, 530400753, 2902087851, 1273168787, 540080725, 2910219766, 2295101073, 4110568485, 1340463100, 3307916247, 641025152, 3043140495, 3736164937, 632953703, 1172967064, 1576976609, 3274667266, 2169303058, 2370213795, 1809054150, 59727847, 361929877, 3211623147, 2505202138, 3569255213, 1484005843, 1239443753, 2395588676, 1975683434, 4102977912, 2572697195, 666464733, 3202437046, 4035489047, 3374361702, 2110667444, 1675577880, 3843699074, 2538681184, 1649639237, 2976151520, 3144396420, 4269907996, 4178062228, 1883793496, 2403728665, 2497604743, 1383856311, 2876494627, 1917518562, 3810496343, 1716890410, 3001755655, 800440835, 2261089178, 3543599269, 807962610, 599762354, 33778362, 3977675356, 2328828971, 2809771154, 4077384432, 1315562145, 1708848333, 101039829, 3509871135, 3299278474, 875451293, 2733856160, 92987698, 2767645557, 193195065, 1080094634, 1584504582, 3178106961, 1042385657, 2531067453, 3711829422, 1306967366, 2438237621, 1908694277, 67556463, 1615861247, 429456164, 3602770327, 2302690252, 1742315127, 2968011453, 126454664, 3877198648, 2043211483, 2709260871, 2084704233, 4169408201, 0, 159417987, 841739592, 504459436, 1817866830, 4245618683, 260388950, 1034867998, 908933415, 168810852, 1750902305, 2606453969, 607530554, 202008497, 2472011535, 3035535058, 463180190, 2160117071, 1641816226, 1517767529, 470948374, 3801332234, 3231722213, 1008918595, 303765277, 235474187, 4069246893, 766945465, 337553864, 1475418501, 2943682380, 4003061179, 2743034109, 4144047775, 1551037884, 1147550661, 1543208500, 2336434550, 3408119516, 3069049960, 3102011747, 3610369226, 1113818384, 328671808, 2227573024, 2236228733, 3535486456, 2935566865, 3341394285, 496906059, 3702665459, 226906860, 2009195472, 733156972, 2842737049, 294930682, 1206477858, 2835123396, 2700099354, 1451044056, 573804783, 2269728455, 3644379585, 2362090238, 2564033334, 2801107407, 2776292904, 3669462566, 1068351396, 742039012, 1350078989, 1784663195, 1417561698, 4136440770, 2430122216, 775550814, 2193862645, 2673705150, 1775276924, 1876241833, 3475313331, 3366754619, 270040487, 3902563182, 3678124923, 3441850377, 1851332852, 3969562369, 2203032232, 3868552805, 2868897406, 566021896, 4011190502, 3135740889, 1248802510, 3936291284, 699432150, 832877231, 708780849, 3332740144, 899835584, 1951317047, 4236429990, 3767586992, 866637845, 4043610186, 1106041591, 2144161806, 395441711, 1984812685, 1139781709, 3433712980, 3835036895, 2664543715, 1282050075, 3240894392, 1181045119, 2640243204, 25965917, 4203181171, 4211818798, 3009879386, 2463879762, 3910161971, 1842759443, 2597806476, 933301370, 1509430414, 3943906441, 3467192302, 3076639029, 3776767469, 2051518780, 2631065433, 1441952575, 404016761, 1942435775, 1408749034, 1610459739, 3745345300, 2017778566, 3400528769, 3110650942, 941896748, 3265478751, 371049330, 3168937228, 675039627, 4279080257, 967311729, 135050206, 3635733660, 1683407248, 2076935265, 3576870512, 1215061108, 3501741890],
- yn = [1347548327, 1400783205, 3273267108, 2520393566, 3409685355, 4045380933, 2880240216, 2471224067, 1428173050, 4138563181, 2441661558, 636813900, 4233094615, 3620022987, 2149987652, 2411029155, 1239331162, 1730525723, 2554718734, 3781033664, 46346101, 310463728, 2743944855, 3328955385, 3875770207, 2501218972, 3955191162, 3667219033, 768917123, 3545789473, 692707433, 1150208456, 1786102409, 2029293177, 1805211710, 3710368113, 3065962831, 401639597, 1724457132, 3028143674, 409198410, 2196052529, 1620529459, 1164071807, 3769721975, 2226875310, 486441376, 2499348523, 1483753576, 428819965, 2274680428, 3075636216, 598438867, 3799141122, 1474502543, 711349675, 129166120, 53458370, 2592523643, 2782082824, 4063242375, 2988687269, 3120694122, 1559041666, 730517276, 2460449204, 4042459122, 2706270690, 3446004468, 3573941694, 533804130, 2328143614, 2637442643, 2695033685, 839224033, 1973745387, 957055980, 2856345839, 106852767, 1371368976, 4181598602, 1033297158, 2933734917, 1179510461, 3046200461, 91341917, 1862534868, 4284502037, 605657339, 2547432937, 3431546947, 2003294622, 3182487618, 2282195339, 954669403, 3682191598, 1201765386, 3917234703, 3388507166, 0, 2198438022, 1211247597, 2887651696, 1315723890, 4227665663, 1443857720, 507358933, 657861945, 1678381017, 560487590, 3516619604, 975451694, 2970356327, 261314535, 3535072918, 2652609425, 1333838021, 2724322336, 1767536459, 370938394, 182621114, 3854606378, 1128014560, 487725847, 185469197, 2918353863, 3106780840, 3356761769, 2237133081, 1286567175, 3152976349, 4255350624, 2683765030, 3160175349, 3309594171, 878443390, 1988838185, 3704300486, 1756818940, 1673061617, 3403100636, 272786309, 1075025698, 545572369, 2105887268, 4174560061, 296679730, 1841768865, 1260232239, 4091327024, 3960309330, 3497509347, 1814803222, 2578018489, 4195456072, 575138148, 3299409036, 446754879, 3629546796, 4011996048, 3347532110, 3252238545, 4270639778, 915985419, 3483825537, 681933534, 651868046, 2755636671, 3828103837, 223377554, 2607439820, 1649704518, 3270937875, 3901806776, 1580087799, 4118987695, 3198115200, 2087309459, 2842678573, 3016697106, 1003007129, 2802849917, 1860738147, 2077965243, 164439672, 4100872472, 32283319, 2827177882, 1709610350, 2125135846, 136428751, 3874428392, 3652904859, 3460984630, 3572145929, 3593056380, 2939266226, 824852259, 818324884, 3224740454, 930369212, 2801566410, 2967507152, 355706840, 1257309336, 4148292826, 243256656, 790073846, 2373340630, 1296297904, 1422699085, 3756299780, 3818836405, 457992840, 3099667487, 2135319889, 77422314, 1560382517, 1945798516, 788204353, 1521706781, 1385356242, 870912086, 325965383, 2358957921, 2050466060, 2388260884, 2313884476, 4006521127, 901210569, 3990953189, 1014646705, 1503449823, 1062597235, 2031621326, 3212035895, 3931371469, 1533017514, 350174575, 2256028891, 2177544179, 1052338372, 741876788, 1606591296, 1914052035, 213705253, 2334669897, 1107234197, 1899603969, 3725069491, 2631447780, 2422494913, 1635502980, 1893020342, 1950903388, 1120974935],
- _n = [2807058932, 1699970625, 2764249623, 1586903591, 1808481195, 1173430173, 1487645946, 59984867, 4199882800, 1844882806, 1989249228, 1277555970, 3623636965, 3419915562, 1149249077, 2744104290, 1514790577, 459744698, 244860394, 3235995134, 1963115311, 4027744588, 2544078150, 4190530515, 1608975247, 2627016082, 2062270317, 1507497298, 2200818878, 567498868, 1764313568, 3359936201, 2305455554, 2037970062, 1047239e3, 1910319033, 1337376481, 2904027272, 2892417312, 984907214, 1243112415, 830661914, 861968209, 2135253587, 2011214180, 2927934315, 2686254721, 731183368, 1750626376, 4246310725, 1820824798, 4172763771, 3542330227, 48394827, 2404901663, 2871682645, 671593195, 3254988725, 2073724613, 145085239, 2280796200, 2779915199, 1790575107, 2187128086, 472615631, 3029510009, 4075877127, 3802222185, 4107101658, 3201631749, 1646252340, 4270507174, 1402811438, 1436590835, 3778151818, 3950355702, 3963161475, 4020912224, 2667994737, 273792366, 2331590177, 104699613, 95345982, 3175501286, 2377486676, 1560637892, 3564045318, 369057872, 4213447064, 3919042237, 1137477952, 2658625497, 1119727848, 2340947849, 1530455833, 4007360968, 172466556, 266959938, 516552836, 0, 2256734592, 3980931627, 1890328081, 1917742170, 4294704398, 945164165, 3575528878, 958871085, 3647212047, 2787207260, 1423022939, 775562294, 1739656202, 3876557655, 2530391278, 2443058075, 3310321856, 547512796, 1265195639, 437656594, 3121275539, 719700128, 3762502690, 387781147, 218828297, 3350065803, 2830708150, 2848461854, 428169201, 122466165, 3720081049, 1627235199, 648017665, 4122762354, 1002783846, 2117360635, 695634755, 3336358691, 4234721005, 4049844452, 3704280881, 2232435299, 574624663, 287343814, 612205898, 1039717051, 840019705, 2708326185, 793451934, 821288114, 1391201670, 3822090177, 376187827, 3113855344, 1224348052, 1679968233, 2361698556, 1058709744, 752375421, 2431590963, 1321699145, 3519142200, 2734591178, 188127444, 2177869557, 3727205754, 2384911031, 3215212461, 2648976442, 2450346104, 3432737375, 1180849278, 331544205, 3102249176, 4150144569, 2952102595, 2159976285, 2474404304, 766078933, 313773861, 2570832044, 2108100632, 1668212892, 3145456443, 2013908262, 418672217, 3070356634, 2594734927, 1852171925, 3867060991, 3473416636, 3907448597, 2614737639, 919489135, 164948639, 2094410160, 2997825956, 590424639, 2486224549, 1723872674, 3157750862, 3399941250, 3501252752, 3625268135, 2555048196, 3673637356, 1343127501, 4130281361, 3599595085, 2957853679, 1297403050, 81781910, 3051593425, 2283490410, 532201772, 1367295589, 3926170974, 895287692, 1953757831, 1093597963, 492483431, 3528626907, 1446242576, 1192455638, 1636604631, 209336225, 344873464, 1015671571, 669961897, 3375740769, 3857572124, 2973530695, 3747192018, 1933530610, 3464042516, 935293895, 3454686199, 2858115069, 1863638845, 3683022916, 4085369519, 3292445032, 875313188, 1080017571, 3279033885, 621591778, 1233856572, 2504130317, 24197544, 3017672716, 3835484340, 3247465558, 2220981195, 3060847922, 1551124588, 1463996600],
- wn = [4104605777, 1097159550, 396673818, 660510266, 2875968315, 2638606623, 4200115116, 3808662347, 821712160, 1986918061, 3430322568, 38544885, 3856137295, 718002117, 893681702, 1654886325, 2975484382, 3122358053, 3926825029, 4274053469, 796197571, 1290801793, 1184342925, 3556361835, 2405426947, 2459735317, 1836772287, 1381620373, 3196267988, 1948373848, 3764988233, 3385345166, 3263785589, 2390325492, 1480485785, 3111247143, 3780097726, 2293045232, 548169417, 3459953789, 3746175075, 439452389, 1362321559, 1400849762, 1685577905, 1806599355, 2174754046, 137073913, 1214797936, 1174215055, 3731654548, 2079897426, 1943217067, 1258480242, 529487843, 1437280870, 3945269170, 3049390895, 3313212038, 923313619, 679998e3, 3215307299, 57326082, 377642221, 3474729866, 2041877159, 133361907, 1776460110, 3673476453, 96392454, 878845905, 2801699524, 777231668, 4082475170, 2330014213, 4142626212, 2213296395, 1626319424, 1906247262, 1846563261, 562755902, 3708173718, 1040559837, 3871163981, 1418573201, 3294430577, 114585348, 1343618912, 2566595609, 3186202582, 1078185097, 3651041127, 3896688048, 2307622919, 425408743, 3371096953, 2081048481, 1108339068, 2216610296, 0, 2156299017, 736970802, 292596766, 1517440620, 251657213, 2235061775, 2933202493, 758720310, 265905162, 1554391400, 1532285339, 908999204, 174567692, 1474760595, 4002861748, 2610011675, 3234156416, 3693126241, 2001430874, 303699484, 2478443234, 2687165888, 585122620, 454499602, 151849742, 2345119218, 3064510765, 514443284, 4044981591, 1963412655, 2581445614, 2137062819, 19308535, 1928707164, 1715193156, 4219352155, 1126790795, 600235211, 3992742070, 3841024952, 836553431, 1669664834, 2535604243, 3323011204, 1243905413, 3141400786, 4180808110, 698445255, 2653899549, 2989552604, 2253581325, 3252932727, 3004591147, 1891211689, 2487810577, 3915653703, 4237083816, 4030667424, 2100090966, 865136418, 1229899655, 953270745, 3399679628, 3557504664, 4118925222, 2061379749, 3079546586, 2915017791, 983426092, 2022837584, 1607244650, 2118541908, 2366882550, 3635996816, 972512814, 3283088770, 1568718495, 3499326569, 3576539503, 621982671, 2895723464, 410887952, 2623762152, 1002142683, 645401037, 1494807662, 2595684844, 1335535747, 2507040230, 4293295786, 3167684641, 367585007, 3885750714, 1865862730, 2668221674, 2960971305, 2763173681, 1059270954, 2777952454, 2724642869, 1320957812, 2194319100, 2429595872, 2815956275, 77089521, 3973773121, 3444575871, 2448830231, 1305906550, 4021308739, 2857194700, 2516901860, 3518358430, 1787304780, 740276417, 1699839814, 1592394909, 2352307457, 2272556026, 188821243, 1729977011, 3687994002, 274084841, 3594982253, 3613494426, 2701949495, 4162096729, 322734571, 2837966542, 1640576439, 484830689, 1202797690, 3537852828, 4067639125, 349075736, 3342319475, 4157467219, 4255800159, 1030690015, 1155237496, 2951971274, 1757691577, 607398968, 2738905026, 499347990, 3794078908, 1011452712, 227885567, 2818666809, 213114376, 3034881240, 1455525988, 3414450555, 850817237, 1817998408, 3092726480],
- vn = [0, 235474187, 470948374, 303765277, 941896748, 908933415, 607530554, 708780849, 1883793496, 2118214995, 1817866830, 1649639237, 1215061108, 1181045119, 1417561698, 1517767529, 3767586992, 4003061179, 4236429990, 4069246893, 3635733660, 3602770327, 3299278474, 3400528769, 2430122216, 2664543715, 2362090238, 2193862645, 2835123396, 2801107407, 3035535058, 3135740889, 3678124923, 3576870512, 3341394285, 3374361702, 3810496343, 3977675356, 4279080257, 4043610186, 2876494627, 2776292904, 3076639029, 3110650942, 2472011535, 2640243204, 2403728665, 2169303058, 1001089995, 899835584, 666464733, 699432150, 59727847, 226906860, 530400753, 294930682, 1273168787, 1172967064, 1475418501, 1509430414, 1942435775, 2110667444, 1876241833, 1641816226, 2910219766, 2743034109, 2976151520, 3211623147, 2505202138, 2606453969, 2302690252, 2269728455, 3711829422, 3543599269, 3240894392, 3475313331, 3843699074, 3943906441, 4178062228, 4144047775, 1306967366, 1139781709, 1374988112, 1610459739, 1975683434, 2076935265, 1775276924, 1742315127, 1034867998, 866637845, 566021896, 800440835, 92987698, 193195065, 429456164, 395441711, 1984812685, 2017778566, 1784663195, 1683407248, 1315562145, 1080094634, 1383856311, 1551037884, 101039829, 135050206, 437757123, 337553864, 1042385657, 807962610, 573804783, 742039012, 2531067453, 2564033334, 2328828971, 2227573024, 2935566865, 2700099354, 3001755655, 3168937228, 3868552805, 3902563182, 4203181171, 4102977912, 3736164937, 3501741890, 3265478751, 3433712980, 1106041591, 1340463100, 1576976609, 1408749034, 2043211483, 2009195472, 1708848333, 1809054150, 832877231, 1068351396, 766945465, 599762354, 159417987, 126454664, 361929877, 463180190, 2709260871, 2943682380, 3178106961, 3009879386, 2572697195, 2538681184, 2236228733, 2336434550, 3509871135, 3745345300, 3441850377, 3274667266, 3910161971, 3877198648, 4110568485, 4211818798, 2597806476, 2497604743, 2261089178, 2295101073, 2733856160, 2902087851, 3202437046, 2968011453, 3936291284, 3835036895, 4136440770, 4169408201, 3535486456, 3702665459, 3467192302, 3231722213, 2051518780, 1951317047, 1716890410, 1750902305, 1113818384, 1282050075, 1584504582, 1350078989, 168810852, 67556463, 371049330, 404016761, 841739592, 1008918595, 775550814, 540080725, 3969562369, 3801332234, 4035489047, 4269907996, 3569255213, 3669462566, 3366754619, 3332740144, 2631065433, 2463879762, 2160117071, 2395588676, 2767645557, 2868897406, 3102011747, 3069049960, 202008497, 33778362, 270040487, 504459436, 875451293, 975658646, 675039627, 641025152, 2084704233, 1917518562, 1615861247, 1851332852, 1147550661, 1248802510, 1484005843, 1451044056, 933301370, 967311729, 733156972, 632953703, 260388950, 25965917, 328671808, 496906059, 1206477858, 1239443753, 1543208500, 1441952575, 2144161806, 1908694277, 1675577880, 1842759443, 3610369226, 3644379585, 3408119516, 3307916247, 4011190502, 3776767469, 4077384432, 4245618683, 2809771154, 2842737049, 3144396420, 3043140495, 2673705150, 2438237621, 2203032232, 2370213795],
- In = [0, 185469197, 370938394, 487725847, 741876788, 657861945, 975451694, 824852259, 1483753576, 1400783205, 1315723890, 1164071807, 1950903388, 2135319889, 1649704518, 1767536459, 2967507152, 3152976349, 2801566410, 2918353863, 2631447780, 2547432937, 2328143614, 2177544179, 3901806776, 3818836405, 4270639778, 4118987695, 3299409036, 3483825537, 3535072918, 3652904859, 2077965243, 1893020342, 1841768865, 1724457132, 1474502543, 1559041666, 1107234197, 1257309336, 598438867, 681933534, 901210569, 1052338372, 261314535, 77422314, 428819965, 310463728, 3409685355, 3224740454, 3710368113, 3593056380, 3875770207, 3960309330, 4045380933, 4195456072, 2471224067, 2554718734, 2237133081, 2388260884, 3212035895, 3028143674, 2842678573, 2724322336, 4138563181, 4255350624, 3769721975, 3955191162, 3667219033, 3516619604, 3431546947, 3347532110, 2933734917, 2782082824, 3099667487, 3016697106, 2196052529, 2313884476, 2499348523, 2683765030, 1179510461, 1296297904, 1347548327, 1533017514, 1786102409, 1635502980, 2087309459, 2003294622, 507358933, 355706840, 136428751, 53458370, 839224033, 957055980, 605657339, 790073846, 2373340630, 2256028891, 2607439820, 2422494913, 2706270690, 2856345839, 3075636216, 3160175349, 3573941694, 3725069491, 3273267108, 3356761769, 4181598602, 4063242375, 4011996048, 3828103837, 1033297158, 915985419, 730517276, 545572369, 296679730, 446754879, 129166120, 213705253, 1709610350, 1860738147, 1945798516, 2029293177, 1239331162, 1120974935, 1606591296, 1422699085, 4148292826, 4233094615, 3781033664, 3931371469, 3682191598, 3497509347, 3446004468, 3328955385, 2939266226, 2755636671, 3106780840, 2988687269, 2198438022, 2282195339, 2501218972, 2652609425, 1201765386, 1286567175, 1371368976, 1521706781, 1805211710, 1620529459, 2105887268, 1988838185, 533804130, 350174575, 164439672, 46346101, 870912086, 954669403, 636813900, 788204353, 2358957921, 2274680428, 2592523643, 2441661558, 2695033685, 2880240216, 3065962831, 3182487618, 3572145929, 3756299780, 3270937875, 3388507166, 4174560061, 4091327024, 4006521127, 3854606378, 1014646705, 930369212, 711349675, 560487590, 272786309, 457992840, 106852767, 223377554, 1678381017, 1862534868, 1914052035, 2031621326, 1211247597, 1128014560, 1580087799, 1428173050, 32283319, 182621114, 401639597, 486441376, 768917123, 651868046, 1003007129, 818324884, 1503449823, 1385356242, 1333838021, 1150208456, 1973745387, 2125135846, 1673061617, 1756818940, 2970356327, 3120694122, 2802849917, 2887651696, 2637442643, 2520393566, 2334669897, 2149987652, 3917234703, 3799141122, 4284502037, 4100872472, 3309594171, 3460984630, 3545789473, 3629546796, 2050466060, 1899603969, 1814803222, 1730525723, 1443857720, 1560382517, 1075025698, 1260232239, 575138148, 692707433, 878443390, 1062597235, 243256656, 91341917, 409198410, 325965383, 3403100636, 3252238545, 3704300486, 3620022987, 3874428392, 3990953189, 4042459122, 4227665663, 2460449204, 2578018489, 2226875310, 2411029155, 3198115200, 3046200461, 2827177882, 2743944855],
- Sn = [0, 218828297, 437656594, 387781147, 875313188, 958871085, 775562294, 590424639, 1750626376, 1699970625, 1917742170, 2135253587, 1551124588, 1367295589, 1180849278, 1265195639, 3501252752, 3720081049, 3399941250, 3350065803, 3835484340, 3919042237, 4270507174, 4085369519, 3102249176, 3051593425, 2734591178, 2952102595, 2361698556, 2177869557, 2530391278, 2614737639, 3145456443, 3060847922, 2708326185, 2892417312, 2404901663, 2187128086, 2504130317, 2555048196, 3542330227, 3727205754, 3375740769, 3292445032, 3876557655, 3926170974, 4246310725, 4027744588, 1808481195, 1723872674, 1910319033, 2094410160, 1608975247, 1391201670, 1173430173, 1224348052, 59984867, 244860394, 428169201, 344873464, 935293895, 984907214, 766078933, 547512796, 1844882806, 1627235199, 2011214180, 2062270317, 1507497298, 1423022939, 1137477952, 1321699145, 95345982, 145085239, 532201772, 313773861, 830661914, 1015671571, 731183368, 648017665, 3175501286, 2957853679, 2807058932, 2858115069, 2305455554, 2220981195, 2474404304, 2658625497, 3575528878, 3625268135, 3473416636, 3254988725, 3778151818, 3963161475, 4213447064, 4130281361, 3599595085, 3683022916, 3432737375, 3247465558, 3802222185, 4020912224, 4172763771, 4122762354, 3201631749, 3017672716, 2764249623, 2848461854, 2331590177, 2280796200, 2431590963, 2648976442, 104699613, 188127444, 472615631, 287343814, 840019705, 1058709744, 671593195, 621591778, 1852171925, 1668212892, 1953757831, 2037970062, 1514790577, 1463996600, 1080017571, 1297403050, 3673637356, 3623636965, 3235995134, 3454686199, 4007360968, 3822090177, 4107101658, 4190530515, 2997825956, 3215212461, 2830708150, 2779915199, 2256734592, 2340947849, 2627016082, 2443058075, 172466556, 122466165, 273792366, 492483431, 1047239e3, 861968209, 612205898, 695634755, 1646252340, 1863638845, 2013908262, 1963115311, 1446242576, 1530455833, 1277555970, 1093597963, 1636604631, 1820824798, 2073724613, 1989249228, 1436590835, 1487645946, 1337376481, 1119727848, 164948639, 81781910, 331544205, 516552836, 1039717051, 821288114, 669961897, 719700128, 2973530695, 3157750862, 2871682645, 2787207260, 2232435299, 2283490410, 2667994737, 2450346104, 3647212047, 3564045318, 3279033885, 3464042516, 3980931627, 3762502690, 4150144569, 4199882800, 3070356634, 3121275539, 2904027272, 2686254721, 2200818878, 2384911031, 2570832044, 2486224549, 3747192018, 3528626907, 3310321856, 3359936201, 3950355702, 3867060991, 4049844452, 4234721005, 1739656202, 1790575107, 2108100632, 1890328081, 1402811438, 1586903591, 1233856572, 1149249077, 266959938, 48394827, 369057872, 418672217, 1002783846, 919489135, 567498868, 752375421, 209336225, 24197544, 376187827, 459744698, 945164165, 895287692, 574624663, 793451934, 1679968233, 1764313568, 2117360635, 1933530610, 1343127501, 1560637892, 1243112415, 1192455638, 3704280881, 3519142200, 3336358691, 3419915562, 3907448597, 3857572124, 4075877127, 4294704398, 3029510009, 3113855344, 2927934315, 2744104290, 2159976285, 2377486676, 2594734927, 2544078150],
- Tn = [0, 151849742, 303699484, 454499602, 607398968, 758720310, 908999204, 1059270954, 1214797936, 1097159550, 1517440620, 1400849762, 1817998408, 1699839814, 2118541908, 2001430874, 2429595872, 2581445614, 2194319100, 2345119218, 3034881240, 3186202582, 2801699524, 2951971274, 3635996816, 3518358430, 3399679628, 3283088770, 4237083816, 4118925222, 4002861748, 3885750714, 1002142683, 850817237, 698445255, 548169417, 529487843, 377642221, 227885567, 77089521, 1943217067, 2061379749, 1640576439, 1757691577, 1474760595, 1592394909, 1174215055, 1290801793, 2875968315, 2724642869, 3111247143, 2960971305, 2405426947, 2253581325, 2638606623, 2487810577, 3808662347, 3926825029, 4044981591, 4162096729, 3342319475, 3459953789, 3576539503, 3693126241, 1986918061, 2137062819, 1685577905, 1836772287, 1381620373, 1532285339, 1078185097, 1229899655, 1040559837, 923313619, 740276417, 621982671, 439452389, 322734571, 137073913, 19308535, 3871163981, 4021308739, 4104605777, 4255800159, 3263785589, 3414450555, 3499326569, 3651041127, 2933202493, 2815956275, 3167684641, 3049390895, 2330014213, 2213296395, 2566595609, 2448830231, 1305906550, 1155237496, 1607244650, 1455525988, 1776460110, 1626319424, 2079897426, 1928707164, 96392454, 213114376, 396673818, 514443284, 562755902, 679998e3, 865136418, 983426092, 3708173718, 3557504664, 3474729866, 3323011204, 4180808110, 4030667424, 3945269170, 3794078908, 2507040230, 2623762152, 2272556026, 2390325492, 2975484382, 3092726480, 2738905026, 2857194700, 3973773121, 3856137295, 4274053469, 4157467219, 3371096953, 3252932727, 3673476453, 3556361835, 2763173681, 2915017791, 3064510765, 3215307299, 2156299017, 2307622919, 2459735317, 2610011675, 2081048481, 1963412655, 1846563261, 1729977011, 1480485785, 1362321559, 1243905413, 1126790795, 878845905, 1030690015, 645401037, 796197571, 274084841, 425408743, 38544885, 188821243, 3613494426, 3731654548, 3313212038, 3430322568, 4082475170, 4200115116, 3780097726, 3896688048, 2668221674, 2516901860, 2366882550, 2216610296, 3141400786, 2989552604, 2837966542, 2687165888, 1202797690, 1320957812, 1437280870, 1554391400, 1669664834, 1787304780, 1906247262, 2022837584, 265905162, 114585348, 499347990, 349075736, 736970802, 585122620, 972512814, 821712160, 2595684844, 2478443234, 2293045232, 2174754046, 3196267988, 3079546586, 2895723464, 2777952454, 3537852828, 3687994002, 3234156416, 3385345166, 4142626212, 4293295786, 3841024952, 3992742070, 174567692, 57326082, 410887952, 292596766, 777231668, 660510266, 1011452712, 893681702, 1108339068, 1258480242, 1343618912, 1494807662, 1715193156, 1865862730, 1948373848, 2100090966, 2701949495, 2818666809, 3004591147, 3122358053, 2235061775, 2352307457, 2535604243, 2653899549, 3915653703, 3764988233, 4219352155, 4067639125, 3444575871, 3294430577, 3746175075, 3594982253, 836553431, 953270745, 600235211, 718002117, 367585007, 484830689, 133361907, 251657213, 2041877159, 1891211689, 1806599355, 1654886325, 1568718495, 1418573201, 1335535747, 1184342925];
- function bn(e) {
- for (var t = [], n = 0; n < e.length; n += 4) {
- t.push(e[n] << 24 | e[n + 1] << 16 | e[n + 2] << 8 | e[n + 3]);
- }
- return t;
- }
- var En = /*#__PURE__*/function () {
- function En(e) {
- (0, _classCallCheck2.default)(this, En);
- if (!(this instanceof En)) throw Error("AES must be instanitated with `new`");
- Object.defineProperty(this, "key", {
- value: tn(e, !0)
- }), this._prepare();
- }
- (0, _createClass2.default)(En, [{
- key: "_prepare",
- value: function _prepare() {
- var e = cn[this.key.length];
- if (null == e) throw new Error("invalid key size (must be 16, 24 or 32 bytes)");
- this._Ke = [], this._Kd = [];
- for (var t = 0; t <= e; t++) {
- this._Ke.push([0, 0, 0, 0]), this._Kd.push([0, 0, 0, 0]);
- }
- var n,
- s = 4 * (e + 1),
- r = this.key.length / 4,
- i = bn(this.key);
- for (t = 0; t < r; t++) {
- n = t >> 2, this._Ke[n][t % 4] = i[t], this._Kd[e - n][t % 4] = i[t];
- }
- for (var o, a = 0, c = r; c < s;) {
- if (o = i[r - 1], i[0] ^= hn[o >> 16 & 255] << 24 ^ hn[o >> 8 & 255] << 16 ^ hn[255 & o] << 8 ^ hn[o >> 24 & 255] ^ un[a] << 24, a += 1, 8 != r) for (t = 1; t < r; t++) {
- i[t] ^= i[t - 1];
- } else {
- for (t = 1; t < r / 2; t++) {
- i[t] ^= i[t - 1];
- }
- o = i[r / 2 - 1], i[r / 2] ^= hn[255 & o] ^ hn[o >> 8 & 255] << 8 ^ hn[o >> 16 & 255] << 16 ^ hn[o >> 24 & 255] << 24;
- for (t = r / 2 + 1; t < r; t++) {
- i[t] ^= i[t - 1];
- }
- }
- for (t = 0; t < r && c < s;) {
- u = c >> 2, h = c % 4, this._Ke[u][h] = i[t], this._Kd[e - u][h] = i[t++], c++;
- }
- }
- for (var u = 1; u < e; u++) {
- for (var h = 0; h < 4; h++) {
- o = this._Kd[u][h], this._Kd[u][h] = vn[o >> 24 & 255] ^ In[o >> 16 & 255] ^ Sn[o >> 8 & 255] ^ Tn[255 & o];
- }
- }
- }
- }, {
- key: "encrypt",
- value: function encrypt(e) {
- if (16 != e.length) throw new Error("invalid plaintext size (must be 16 bytes)");
- for (var t = this._Ke.length - 1, n = [0, 0, 0, 0], s = bn(e), r = 0; r < 4; r++) {
- s[r] ^= this._Ke[0][r];
- }
- for (var i = 1; i < t; i++) {
- for (r = 0; r < 4; r++) {
- n[r] = dn[s[r] >> 24 & 255] ^ pn[s[(r + 1) % 4] >> 16 & 255] ^ fn[s[(r + 2) % 4] >> 8 & 255] ^ gn[255 & s[(r + 3) % 4]] ^ this._Ke[i][r];
- }
- s = n.slice();
- }
- var o,
- a = nn(16);
- for (r = 0; r < 4; r++) {
- o = this._Ke[t][r], a[4 * r] = 255 & (hn[s[r] >> 24 & 255] ^ o >> 24), a[4 * r + 1] = 255 & (hn[s[(r + 1) % 4] >> 16 & 255] ^ o >> 16), a[4 * r + 2] = 255 & (hn[s[(r + 2) % 4] >> 8 & 255] ^ o >> 8), a[4 * r + 3] = 255 & (hn[255 & s[(r + 3) % 4]] ^ o);
- }
- return a;
- }
- }, {
- key: "decrypt",
- value: function decrypt(e) {
- if (16 != e.length) throw new Error("invalid ciphertext size (must be 16 bytes)");
- for (var t = this._Kd.length - 1, n = [0, 0, 0, 0], s = bn(e), r = 0; r < 4; r++) {
- s[r] ^= this._Kd[0][r];
- }
- for (var i = 1; i < t; i++) {
- for (r = 0; r < 4; r++) {
- n[r] = mn[s[r] >> 24 & 255] ^ yn[s[(r + 3) % 4] >> 16 & 255] ^ _n[s[(r + 2) % 4] >> 8 & 255] ^ wn[255 & s[(r + 1) % 4]] ^ this._Kd[i][r];
- }
- s = n.slice();
- }
- var o,
- a = nn(16);
- for (r = 0; r < 4; r++) {
- o = this._Kd[t][r], a[4 * r] = 255 & (ln[s[r] >> 24 & 255] ^ o >> 24), a[4 * r + 1] = 255 & (ln[s[(r + 3) % 4] >> 16 & 255] ^ o >> 16), a[4 * r + 2] = 255 & (ln[s[(r + 2) % 4] >> 8 & 255] ^ o >> 8), a[4 * r + 3] = 255 & (ln[255 & s[(r + 1) % 4]] ^ o);
- }
- return a;
- }
- }]);
- return En;
- }();
- var kn = /*#__PURE__*/function () {
- function kn(e) {
- (0, _classCallCheck2.default)(this, kn);
- if (!(this instanceof kn)) throw Error("AES must be instanitated with `new`");
- this.description = "Electronic Code Block", this.name = "ecb", this._aes = new En(e);
- }
- (0, _createClass2.default)(kn, [{
- key: "encrypt",
- value: function encrypt(e) {
- if ((e = tn(e)).length % 16 != 0) throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
- for (var t = nn(e.length), n = nn(16), s = 0; s < e.length; s += 16) {
- sn(e, n, 0, s, s + 16), sn(n = this._aes.encrypt(n), t, s);
- }
- return t;
- }
- }, {
- key: "decrypt",
- value: function decrypt(e) {
- if ((e = tn(e)).length % 16 != 0) throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
- for (var t = nn(e.length), n = nn(16), s = 0; s < e.length; s += 16) {
- sn(e, n, 0, s, s + 16), sn(n = this._aes.decrypt(n), t, s);
- }
- return t;
- }
- }]);
- return kn;
- }();
- var Pn = /*#__PURE__*/function () {
- function Pn(e, t) {
- (0, _classCallCheck2.default)(this, Pn);
- if (!(this instanceof Pn)) throw Error("AES must be instanitated with `new`");
- if (this.description = "Cipher Block Chaining", this.name = "cbc", t) {
- if (16 != t.length) throw new Error("invalid initialation vector size (must be 16 bytes)");
- } else t = nn(16);
- this._lastCipherblock = tn(t, !0), this._aes = new En(e);
- }
- (0, _createClass2.default)(Pn, [{
- key: "encrypt",
- value: function encrypt(e) {
- if ((e = tn(e)).length % 16 != 0) throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
- for (var t = nn(e.length), n = nn(16), s = 0; s < e.length; s += 16) {
- sn(e, n, 0, s, s + 16);
- for (var r = 0; r < 16; r++) {
- n[r] ^= this._lastCipherblock[r];
- }
- this._lastCipherblock = this._aes.encrypt(n), sn(this._lastCipherblock, t, s);
- }
- return t;
- }
- }, {
- key: "decrypt",
- value: function decrypt(e) {
- if ((e = tn(e)).length % 16 != 0) throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
- for (var t = nn(e.length), n = nn(16), s = 0; s < e.length; s += 16) {
- sn(e, n, 0, s, s + 16), n = this._aes.decrypt(n);
- for (var r = 0; r < 16; r++) {
- t[s + r] = n[r] ^ this._lastCipherblock[r];
- }
- sn(e, this._lastCipherblock, 0, s, s + 16);
- }
- return t;
- }
- }]);
- return Pn;
- }();
- var Cn = /*#__PURE__*/function () {
- function Cn(e, t, n) {
- (0, _classCallCheck2.default)(this, Cn);
- if (!(this instanceof Cn)) throw Error("AES must be instanitated with `new`");
- if (this.description = "Cipher Feedback", this.name = "cfb", t) {
- if (16 != t.length) throw new Error("invalid initialation vector size (must be 16 size)");
- } else t = nn(16);
- n || (n = 1), this.segmentSize = n, this._shiftRegister = tn(t, !0), this._aes = new En(e);
- }
- (0, _createClass2.default)(Cn, [{
- key: "encrypt",
- value: function encrypt(e) {
- if (e.length % this.segmentSize != 0) throw new Error("invalid plaintext size (must be segmentSize bytes)");
- for (var t, n = tn(e, !0), s = 0; s < n.length; s += this.segmentSize) {
- t = this._aes.encrypt(this._shiftRegister);
- for (var r = 0; r < this.segmentSize; r++) {
- n[s + r] ^= t[r];
- }
- sn(this._shiftRegister, this._shiftRegister, 0, this.segmentSize), sn(n, this._shiftRegister, 16 - this.segmentSize, s, s + this.segmentSize);
- }
- return n;
- }
- }, {
- key: "decrypt",
- value: function decrypt(e) {
- if (e.length % this.segmentSize != 0) throw new Error("invalid ciphertext size (must be segmentSize bytes)");
- for (var t, n = tn(e, !0), s = 0; s < n.length; s += this.segmentSize) {
- t = this._aes.encrypt(this._shiftRegister);
- for (var r = 0; r < this.segmentSize; r++) {
- n[s + r] ^= t[r];
- }
- sn(this._shiftRegister, this._shiftRegister, 0, this.segmentSize), sn(e, this._shiftRegister, 16 - this.segmentSize, s, s + this.segmentSize);
- }
- return n;
- }
- }]);
- return Cn;
- }();
- var An = /*#__PURE__*/function () {
- function An(e, t) {
- (0, _classCallCheck2.default)(this, An);
- if (!(this instanceof An)) throw Error("AES must be instanitated with `new`");
- if (this.description = "Output Feedback", this.name = "ofb", t) {
- if (16 != t.length) throw new Error("invalid initialation vector size (must be 16 bytes)");
- } else t = nn(16);
- this._lastPrecipher = tn(t, !0), this._lastPrecipherIndex = 16, this._aes = new En(e);
- }
- (0, _createClass2.default)(An, [{
- key: "encrypt",
- value: function encrypt(e) {
- for (var t = tn(e, !0), n = 0; n < t.length; n++) {
- 16 === this._lastPrecipherIndex && (this._lastPrecipher = this._aes.encrypt(this._lastPrecipher), this._lastPrecipherIndex = 0), t[n] ^= this._lastPrecipher[this._lastPrecipherIndex++];
- }
- return t;
- }
- }, {
- key: "decrypt",
- value: function decrypt(e) {
- return this.encrypt(e);
- }
- }]);
- return An;
- }();
- var On = /*#__PURE__*/function () {
- function On(e) {
- (0, _classCallCheck2.default)(this, On);
- if (!(this instanceof On)) throw Error("Counter must be instanitated with `new`");
- 0 === e || e || (e = 1), "number" == typeof e ? (this._counter = nn(16), this.setValue(e)) : this.setBytes(e);
- }
- (0, _createClass2.default)(On, [{
- key: "setValue",
- value: function setValue(e) {
- if ("number" != typeof e || parseInt(e) != e) throw new Error("invalid counter value (must be an integer)");
- if (e > Number.MAX_SAFE_INTEGER) throw new Error("integer value out of safe range");
- for (var t = 15; t >= 0; --t) {
- this._counter[t] = e % 256, e = parseInt(e / 256);
- }
- }
- }, {
- key: "setBytes",
- value: function setBytes(e) {
- if (16 != (e = tn(e, !0)).length) throw new Error("invalid counter bytes size (must be 16 bytes)");
- this._counter = e;
- }
- }, {
- key: "increment",
- value: function increment() {
- for (var e = 15; e >= 0; e--) {
- if (255 !== this._counter[e]) {
- this._counter[e]++;
- break;
- }
- this._counter[e] = 0;
- }
- }
- }]);
- return On;
- }();
- var xn = /*#__PURE__*/function () {
- function xn(e, t) {
- (0, _classCallCheck2.default)(this, xn);
- if (!(this instanceof xn)) throw Error("AES must be instanitated with `new`");
- this.description = "Counter", this.name = "ctr", t instanceof On || (t = new On(t)), this._counter = t, this._remainingCounter = null, this._remainingCounterIndex = 16, this._aes = new En(e);
- }
- (0, _createClass2.default)(xn, [{
- key: "encrypt",
- value: function encrypt(e) {
- for (var t = tn(e, !0), n = 0; n < t.length; n++) {
- 16 === this._remainingCounterIndex && (this._remainingCounter = this._aes.encrypt(this._counter._counter), this._remainingCounterIndex = 0, this._counter.increment()), t[n] ^= this._remainingCounter[this._remainingCounterIndex++];
- }
- return t;
- }
- }, {
- key: "decrypt",
- value: function decrypt(e) {
- return this.encrypt(e);
- }
- }]);
- return xn;
- }();
- var Nn = {
- AES: En,
- Counter: On,
- ModeOfOperation: {
- ecb: kn,
- cbc: Pn,
- cfb: Cn,
- ofb: An,
- ctr: xn
- },
- utils: {
- hex: an,
- utf8: on
- },
- padding: {
- pkcs7: {
- pad: function pad(e) {
- var t = 16 - (e = tn(e, !0)).length % 16,
- n = nn(e.length + t);
- sn(e, n);
- for (var s = e.length; s < n.length; s++) {
- n[s] = t;
- }
- return n;
- },
- strip: function strip(e) {
- if ((e = tn(e, !0)).length < 16) throw new Error("PKCS#7 invalid length");
- var t = e[e.length - 1];
- if (t > 16) throw new Error("PKCS#7 padding byte out of range");
- for (var n = e.length - t, s = 0; s < t; s++) {
- if (e[n + s] !== t) throw new Error("PKCS#7 invalid padding byte");
- }
- var r = nn(n);
- return sn(e, r, 0, 0, n), r;
- }
- }
- },
- _arrayTest: {
- coerceArray: tn,
- createArray: nn,
- copyArray: sn
- }
- };
- function Rn(e, t, n) {
- var s = new Uint8Array(uni.base64ToArrayBuffer(t)),
- r = Nn.utils.utf8.toBytes(n),
- i = Nn.utils.utf8.toBytes(e),
- o = new Nn.ModeOfOperation.cbc(s, r),
- a = Nn.padding.pkcs7.pad(i),
- c = o.encrypt(a);
- return uni.arrayBufferToBase64(c);
- }
- var Ln = "uni-secure-network",
- Un = {
- SYSTEM_ERROR: {
- code: 2e4,
- message: "System error"
- },
- APP_INFO_INVALID: {
- code: 20101,
- message: "Invalid client"
- },
- GET_ENCRYPT_KEY_FAILED: {
- code: 20102,
- message: "Get encrypt key failed"
- }
- },
- Dn = {
- 10001: "Secure network is not supported on current playground or unimpsdk",
- 10003: "Config missing in current app. If the problem pesist, please contact DCloud.",
- 10009: "Encrypt payload failed",
- 10010: "Decrypt response failed"
- };
- function Mn(e) {
- var _ref35 = e || {},
- t = _ref35.errSubject,
- n = _ref35.subject,
- s = _ref35.errCode,
- r = _ref35.errMsg,
- i = _ref35.code,
- o = _ref35.message,
- a = _ref35.cause;
- return new te({
- subject: t || n || Ln,
- code: s || i || Un.SYSTEM_ERROR.code,
- message: r || o,
- cause: a
- });
- }
- var qn,
- Fn,
- Kn = null;
- var jn = /*#__PURE__*/function (_Xt) {
- (0, _inherits2.default)(jn, _Xt);
- var _super8 = _createSuper(jn);
- function jn(e) {
- var _this18;
- (0, _classCallCheck2.default)(this, jn);
- _this18 = _super8.call(this, e), _this18.clientType = "mp-weixin", _this18.userEncryptKey = null;
- return _this18;
- }
- (0, _createClass2.default)(jn, [{
- key: "isLogin",
- value: function isLogin() {
- return !!this.scopedGlobalCache.mpWeixinCode || !!this.scopedGlobalCache.mpWeixinOpenid;
- }
- }, {
- key: "prepare",
- value: function () {
- var _prepare2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee52() {
- return _regenerator.default.wrap(function _callee52$(_context52) {
- while (1) {
- switch (_context52.prev = _context52.next) {
- case 0:
- if (this.isLogin()) {
- _context52.next = 7;
- break;
- }
- if (this.scopedGlobalCache.initPromise) {
- _context52.next = 3;
- break;
- }
- throw new Error("`uniCloud.initSecureNetworkByWeixin` has not yet been called");
- case 3:
- _context52.next = 5;
- return this.scopedGlobalCache.initPromise;
- case 5:
- if (this.isLogin()) {
- _context52.next = 7;
- break;
- }
- throw new Error("uniCloud.initSecureNetworkByWeixin` has not yet been called or successfully excuted");
- case 7:
- case "end":
- return _context52.stop();
- }
- }
- }, _callee52, this);
- }));
- function prepare() {
- return _prepare2.apply(this, arguments);
- }
- return prepare;
- }()
- }, {
- key: "getUserEncryptKey",
- value: function () {
- var _getUserEncryptKey = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee53() {
- var _this19 = this;
- var e;
- return _regenerator.default.wrap(function _callee53$(_context53) {
- while (1) {
- switch (_context53.prev = _context53.next) {
- case 0:
- if (!this.userEncryptKey) {
- _context53.next = 2;
- break;
- }
- return _context53.abrupt("return", this.userEncryptKey);
- case 2:
- if (!(Kn && Kn.expireTime)) {
- _context53.next = 6;
- break;
- }
- e = Date.now();
- if (!(Kn.expireTime - e > 0)) {
- _context53.next = 6;
- break;
- }
- return _context53.abrupt("return", (this.userEncryptKey = Kn, this.userEncryptKey));
- case 6:
- return _context53.abrupt("return", new Promise(function (e, t) {
- uni.getUserCryptoManager().getLatestUserKey({
- success: function success(t) {
- Kn = t, _this19.userEncryptKey = t, e(_this19.userEncryptKey);
- },
- fail: function fail(e) {
- t(Mn(_objectSpread(_objectSpread({}, Un.GET_ENCRYPT_KEY_FAILED), {}, {
- cause: e
- })));
- }
- });
- }));
- case 7:
- case "end":
- return _context53.stop();
- }
- }
- }, _callee53, this);
- }));
- function getUserEncryptKey() {
- return _getUserEncryptKey.apply(this, arguments);
- }
- return getUserEncryptKey;
- }()
- }, {
- key: "getWxAppId",
- value: function getWxAppId() {
- return wx.getAccountInfoSync().miniProgram.appId;
- }
- }, {
- key: "platformGetSignOption",
- value: function () {
- var _platformGetSignOption = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee54() {
- var _yield$this$getUserEn, e, t, n;
- return _regenerator.default.wrap(function _callee54$(_context54) {
- while (1) {
- switch (_context54.prev = _context54.next) {
- case 0:
- _context54.next = 2;
- return this.getUserEncryptKey();
- case 2:
- _yield$this$getUserEn = _context54.sent;
- e = _yield$this$getUserEn.encryptKey;
- t = _yield$this$getUserEn.iv;
- n = _yield$this$getUserEn.version;
- return _context54.abrupt("return", {
- verifyClientSign: Rn(JSON.stringify({
- data: JSON.stringify({}),
- appId: this.appId,
- deviceId: this.deviceId,
- wxAppId: this.getWxAppId(),
- simulator: "devtools" === ae().platform,
- timestamp: Date.now()
- }), e, t),
- encryptKeyId: n,
- mpWeixinCode: this.scopedGlobalCache.mpWeixinCode,
- mpWeixinOpenid: this.scopedGlobalCache.mpWeixinOpenid
- });
- case 7:
- case "end":
- return _context54.stop();
- }
- }
- }, _callee54, this);
- }));
- function platformGetSignOption() {
- return _platformGetSignOption.apply(this, arguments);
- }
- return platformGetSignOption;
- }()
- }, {
- key: "platformEncryptData",
- value: function () {
- var _platformEncryptData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee55(e) {
- var _yield$this$getUserEn2, t, n, s, r;
- return _regenerator.default.wrap(function _callee55$(_context55) {
- while (1) {
- switch (_context55.prev = _context55.next) {
- case 0:
- _context55.next = 2;
- return this.getUserEncryptKey();
- case 2:
- _yield$this$getUserEn2 = _context55.sent;
- t = _yield$this$getUserEn2.encryptKey;
- n = _yield$this$getUserEn2.iv;
- s = _yield$this$getUserEn2.version;
- r = {
- secretType: this.secretType,
- encryptKeyId: s,
- mpWeixinCode: this.scopedGlobalCache.mpWeixinCode,
- mpWeixinOpenid: this.scopedGlobalCache.mpWeixinOpenid
- };
- return _context55.abrupt("return", this.secretType === Gt.RESPONSE ? {
- content: e,
- _uniCloudOptions: r
- } : {
- content: Rn(JSON.stringify({
- data: JSON.stringify(e),
- appId: this.appId,
- deviceId: this.deviceId,
- wxAppId: this.getWxAppId(),
- simulator: "devtools" === ae().platform,
- timestamp: Date.now()
- }), t, n),
- _uniCloudOptions: r
- });
- case 8:
- case "end":
- return _context55.stop();
- }
- }
- }, _callee55, this);
- }));
- function platformEncryptData(_x48) {
- return _platformEncryptData.apply(this, arguments);
- }
- return platformEncryptData;
- }()
- }, {
- key: "platformDecryptResult",
- value: function () {
- var _platformDecryptResult = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee56(e) {
- var t, _yield$this$getUserEn3, n, s;
- return _regenerator.default.wrap(function _callee56$(_context56) {
- while (1) {
- switch (_context56.prev = _context56.next) {
- case 0:
- t = e.content;
- _context56.next = 3;
- return this.getUserEncryptKey();
- case 3:
- _yield$this$getUserEn3 = _context56.sent;
- n = _yield$this$getUserEn3.encryptKey;
- s = _yield$this$getUserEn3.iv;
- return _context56.abrupt("return", JSON.parse(function (e, t, n) {
- var s = new Uint8Array(uni.base64ToArrayBuffer(e)),
- r = new Uint8Array(uni.base64ToArrayBuffer(t)),
- i = Nn.utils.utf8.toBytes(n),
- o = new Nn.ModeOfOperation.cbc(r, i),
- a = Nn.padding.pkcs7.strip(o.decrypt(s));
- return Nn.utils.utf8.fromBytes(a);
- }(t, n, s)));
- case 7:
- case "end":
- return _context56.stop();
- }
- }
- }, _callee56, this);
- }));
- function platformDecryptResult(_x49) {
- return _platformDecryptResult.apply(this, arguments);
- }
- return platformDecryptResult;
- }()
- }, {
- key: "isClientKeyNotFound",
- value: function isClientKeyNotFound() {
- return !1;
- }
- }]);
- return jn;
- }(Xt);
- function $n(e) {
- var t = ["hasClientKey", "encryptGetClientKeyPayload", "setClientKey", "encrypt", "decrypt"],
- n = {};
- var _loop = function _loop(_s14) {
- var r = t[_s14];
- n[r] = function () {
- for (var _len2 = arguments.length, t = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
- t[_key2] = arguments[_key2];
- }
- return new Promise(function (n, s) {
- "function" == typeof e[r] ? e[r].apply(e, t.concat([function () {
- var _ref36 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- e = _ref36.type,
- t = _ref36.data,
- r = _ref36.errCode,
- i = _ref36.errMsg,
- o = _ref36.errSubject,
- a = _ref36.message;
- "success" === e ? n(t) : s(Mn({
- errCode: r,
- errMsg: Dn[r] || i || a,
- errSubject: o
- }));
- }])) : s(Mn({
- message: "请检查manifest.json内是否开启安全网络模块,另外注意标准基座不支持安全网络模块"
- }));
- });
- };
- };
- for (var _s14 = 0; _s14 < t.length; _s14++) {
- _loop(_s14);
- }
- return n;
- }
- var Bn = /*#__PURE__*/function (_Xt2) {
- (0, _inherits2.default)(Bn, _Xt2);
- var _super9 = _createSuper(Bn);
- function Bn(e) {
- var _this20;
- (0, _classCallCheck2.default)(this, Bn);
- _this20 = _super9.call(this, e), _this20.clientType = "app", _this20.appUtils = _objectSpread({}, $n(uni.requireNativePlugin("plus"))), _this20.systemInfo = qn || (qn = ae());
- return _this20;
- }
- (0, _createClass2.default)(Bn, [{
- key: "hasClientKey",
- value: function () {
- var _hasClientKey = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee57() {
- return _regenerator.default.wrap(function _callee57$(_context57) {
- while (1) {
- switch (_context57.prev = _context57.next) {
- case 0:
- _context57.next = 2;
- return this.appUtils.hasClientKey({
- provider: this.provider,
- spaceId: this.spaceId
- });
- case 2:
- this._hasClientKey = _context57.sent;
- return _context57.abrupt("return", this._hasClientKey);
- case 4:
- case "end":
- return _context57.stop();
- }
- }
- }, _callee57, this);
- }));
- function hasClientKey() {
- return _hasClientKey.apply(this, arguments);
- }
- return hasClientKey;
- }()
- }, {
- key: "getAppClientKey",
- value: function () {
- var _getAppClientKey = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee58() {
- var _yield$this$appUtils$, e, t, n, s, r;
- return _regenerator.default.wrap(function _callee58$(_context58) {
- while (1) {
- switch (_context58.prev = _context58.next) {
- case 0:
- _context58.next = 2;
- return this.appUtils.encryptGetClientKeyPayload({
- data: JSON.stringify({})
- });
- case 2:
- _yield$this$appUtils$ = _context58.sent;
- e = _yield$this$appUtils$.data;
- t = _yield$this$appUtils$.key;
- _context58.next = 7;
- return this.uniCloudIns.callFunction({
- name: "DCloud-clientDB",
- data: {
- redirectTo: "encryption",
- action: "getAppClientKey",
- data: e,
- key: t
- }
- });
- case 7:
- _context58.t0 = _context58.sent.result;
- if (_context58.t0) {
- _context58.next = 10;
- break;
- }
- _context58.t0 = {};
- case 10:
- n = _context58.t0;
- if (!(0 !== n.errCode)) {
- _context58.next = 13;
- break;
- }
- throw function (e) {
- return new te({
- subject: e.errSubject || Ln,
- code: e.errCode || e.code || Un.SYSTEM_ERROR.code,
- message: e.errMsg || e.message
- });
- }(n);
- case 13:
- s = n.clientKey, r = n.key;
- _context58.next = 16;
- return this.appUtils.setClientKey({
- provider: this.provider,
- spaceId: this.spaceId,
- clientKey: s,
- key: r
- });
- case 16:
- case "end":
- return _context58.stop();
- }
- }
- }, _callee58, this);
- }));
- function getAppClientKey() {
- return _getAppClientKey.apply(this, arguments);
- }
- return getAppClientKey;
- }()
- }, {
- key: "ensureClientKey",
- value: function () {
- var _ensureClientKey = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee59() {
- var _this21 = this;
- var _ref37,
- _ref37$forceUpdate,
- e,
- _args59 = arguments;
- return _regenerator.default.wrap(function _callee59$(_context59) {
- while (1) {
- switch (_context59.prev = _context59.next) {
- case 0:
- _ref37 = _args59.length > 0 && _args59[0] !== undefined ? _args59[0] : {}, _ref37$forceUpdate = _ref37.forceUpdate, e = _ref37$forceUpdate === void 0 ? !1 : _ref37$forceUpdate;
- _context59.t1 = !0;
- _context59.next = 4;
- return this.hasClientKey();
- case 4:
- _context59.t2 = _context59.sent;
- _context59.t0 = _context59.t1 !== _context59.t2;
- if (_context59.t0) {
- _context59.next = 8;
- break;
- }
- _context59.t0 = e;
- case 8:
- if (!_context59.t0) {
- _context59.next = 10;
- break;
- }
- return _context59.abrupt("return", (e && this.scopedGlobalCache.initPromise && this.scopedGlobalCache.initStatus === d || !e && this.scopedGlobalCache.initPromise && this.scopedGlobalCache.initStatus !== f || (this.scopedGlobalCache.initPromise = this.getAppClientKey(), this.scopedGlobalCache.initPromise.then(function (e) {
- _this21.scopedGlobalCache.initStatus = p;
- }).catch(function (e) {
- throw _this21.scopedGlobalCache.initStatus = f, e;
- }), this.scopedGlobalCache.initStatus = d), this.scopedGlobalCache.initPromise));
- case 10:
- case "end":
- return _context59.stop();
- }
- }
- }, _callee59, this);
- }));
- function ensureClientKey() {
- return _ensureClientKey.apply(this, arguments);
- }
- return ensureClientKey;
- }()
- }, {
- key: "prepare",
- value: function () {
- var _prepare3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee60() {
- var _ref38,
- _ref38$forceUpdate,
- e,
- _args60 = arguments;
- return _regenerator.default.wrap(function _callee60$(_context60) {
- while (1) {
- switch (_context60.prev = _context60.next) {
- case 0:
- _ref38 = _args60.length > 0 && _args60[0] !== undefined ? _args60[0] : {}, _ref38$forceUpdate = _ref38.forceUpdate, e = _ref38$forceUpdate === void 0 ? !1 : _ref38$forceUpdate;
- _context60.next = 3;
- return this.ensureClientKey({
- forceUpdate: e
- });
- case 3:
- case "end":
- return _context60.stop();
- }
- }
- }, _callee60, this);
- }));
- function prepare() {
- return _prepare3.apply(this, arguments);
- }
- return prepare;
- }()
- }, {
- key: "platformGetSignOption",
- value: function () {
- var _platformGetSignOption2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee61() {
- var _yield$this$appUtils$2, e, t;
- return _regenerator.default.wrap(function _callee61$(_context61) {
- while (1) {
- switch (_context61.prev = _context61.next) {
- case 0:
- _context61.next = 2;
- return this.appUtils.encrypt({
- provider: this.provider,
- spaceId: this.spaceId,
- data: JSON.stringify({})
- });
- case 2:
- _yield$this$appUtils$2 = _context61.sent;
- e = _yield$this$appUtils$2.data;
- t = _yield$this$appUtils$2.key;
- return _context61.abrupt("return", {
- verifyClientSign: e,
- encryptKeyId: t
- });
- case 6:
- case "end":
- return _context61.stop();
- }
- }
- }, _callee61, this);
- }));
- function platformGetSignOption() {
- return _platformGetSignOption2.apply(this, arguments);
- }
- return platformGetSignOption;
- }()
- }, {
- key: "platformEncryptData",
- value: function () {
- var _platformEncryptData2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee62(e) {
- var _yield$this$appUtils$3, t, n, s;
- return _regenerator.default.wrap(function _callee62$(_context62) {
- while (1) {
- switch (_context62.prev = _context62.next) {
- case 0:
- _context62.next = 2;
- return this.appUtils.encrypt({
- provider: this.provider,
- spaceId: this.spaceId,
- data: JSON.stringify(e)
- });
- case 2:
- _yield$this$appUtils$3 = _context62.sent;
- t = _yield$this$appUtils$3.data;
- n = _yield$this$appUtils$3.key;
- s = {
- secretType: this.secretType,
- encryptKeyId: n
- };
- return _context62.abrupt("return", this.secretType === Gt.RESPONSE ? {
- content: e,
- _uniCloudOptions: s
- } : {
- content: t,
- _uniCloudOptions: s
- });
- case 7:
- case "end":
- return _context62.stop();
- }
- }
- }, _callee62, this);
- }));
- function platformEncryptData(_x50) {
- return _platformEncryptData2.apply(this, arguments);
- }
- return platformEncryptData;
- }()
- }, {
- key: "platformDecryptResult",
- value: function () {
- var _platformDecryptResult2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee63(e) {
- var t, _e$_uniCloudOptions, n, s, r;
- return _regenerator.default.wrap(function _callee63$(_context63) {
- while (1) {
- switch (_context63.prev = _context63.next) {
- case 0:
- t = e.content;
- _e$_uniCloudOptions = e._uniCloudOptions;
- n = _e$_uniCloudOptions === void 0 ? {} : _e$_uniCloudOptions;
- s = n.encryptKeyId;
- _context63.next = 6;
- return this.appUtils.decrypt({
- provider: this.provider,
- spaceId: this.spaceId,
- data: t,
- key: s
- });
- case 6:
- r = _context63.sent;
- return _context63.abrupt("return", JSON.parse(r.data));
- case 8:
- case "end":
- return _context63.stop();
- }
- }
- }, _callee63, this);
- }));
- function platformDecryptResult(_x51) {
- return _platformDecryptResult2.apply(this, arguments);
- }
- return platformDecryptResult;
- }()
- }, {
- key: "isClientKeyNotFound",
- value: function isClientKeyNotFound() {
- var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- var t = e.result || {};
- return 70009 === t.errCode && t.errSubject === Ln;
- }
- }]);
- return Bn;
- }(Xt);
- function Wn() {
- var _ref39 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- e = _ref39.secretType;
- return e === Gt.REQUEST || e === Gt.RESPONSE || e === Gt.BOTH;
- }
- function Hn() {
- var _ref40 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- e = _ref40.name,
- _ref40$data = _ref40.data,
- t = _ref40$data === void 0 ? {} : _ref40$data;
- return "app" === C && "DCloud-clientDB" === e && "encryption" === t.redirectTo && "getAppClientKey" === t.action;
- }
- function Jn() {
- var _ref41 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- e = _ref41.provider,
- t = _ref41.spaceId,
- n = _ref41.functionName;
- var _ae = ae(),
- s = _ae.appId,
- r = _ae.uniPlatform,
- i = _ae.osName;
- var o = r;
- "app" === r && (o = i);
- var a = function () {
- var _ref42 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- e = _ref42.provider,
- t = _ref42.spaceId;
- var n = P;
- if (!n) return {};
- e = function (e) {
- return "tencent" === e ? "tcb" : e;
- }(e);
- var s = n.find(function (n) {
- return n.provider === e && n.spaceId === t;
- });
- return s && s.config;
- }({
- provider: e,
- spaceId: t
- });
- if (!a || !a.accessControl || !a.accessControl.enable) return !1;
- var c = a.accessControl.function || {},
- u = Object.keys(c);
- if (0 === u.length) return !0;
- var h = function (e, t) {
- var n, s, r;
- for (var _i2 = 0; _i2 < e.length; _i2++) {
- var _o2 = e[_i2];
- _o2 !== t ? "*" !== _o2 ? _o2.split(",").map(function (e) {
- return e.trim();
- }).indexOf(t) > -1 && (s = _o2) : r = _o2 : n = _o2;
- }
- return n || s || r;
- }(u, n);
- if (!h) return !1;
- if ((c[h] || []).find(function () {
- var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- return e.appId === s && (e.platform || "").toLowerCase() === o.toLowerCase();
- })) return !0;
- throw console.error("\u6B64\u5E94\u7528[appId: ".concat(s, ", platform: ").concat(o, "]\u4E0D\u5728\u4E91\u7AEF\u914D\u7F6E\u7684\u5141\u8BB8\u8BBF\u95EE\u7684\u5E94\u7528\u5217\u8868\u5185\uFF0C\u53C2\u8003\uFF1Ahttps://uniapp.dcloud.net.cn/uniCloud/secure-network.html#verify-client")), Mn(Un.APP_INFO_INVALID);
- }
- function zn(_ref43) {
- var e = _ref43.functionName,
- t = _ref43.result,
- n = _ref43.logPvd;
- if (b && this.__dev__.debugLog && t && t.requestId) {
- var _s15 = JSON.stringify({
- spaceId: this.config.spaceId,
- functionName: e,
- requestId: t.requestId
- });
- console.log("[".concat(n, "-request]").concat(_s15, "[/").concat(n, "-request]"));
- }
- }
- function Vn(e) {
- var t = e.callFunction,
- n = function n(_n12) {
- var _this22 = this;
- var s = _n12.name;
- _n12.data = Bt.call(e, {
- data: _n12.data
- });
- var r = {
- aliyun: "aliyun",
- tencent: "tcb",
- tcb: "tcb",
- alipay: "alipay",
- dcloud: "dcloud"
- }[this.config.provider],
- i = Wn(_n12),
- o = Hn(_n12),
- a = i || o;
- return t.call(this, _n12).then(function (e) {
- return e.errCode = 0, !a && zn.call(_this22, {
- functionName: s,
- result: e,
- logPvd: r
- }), Promise.resolve(e);
- }, function (e) {
- return !a && zn.call(_this22, {
- functionName: s,
- result: e,
- logPvd: r
- }), e && e.message && (e.message = function () {
- var _ref44 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- _ref44$message = _ref44.message,
- e = _ref44$message === void 0 ? "" : _ref44$message,
- _ref44$extraInfo = _ref44.extraInfo,
- t = _ref44$extraInfo === void 0 ? {} : _ref44$extraInfo,
- _ref44$formatter = _ref44.formatter,
- n = _ref44$formatter === void 0 ? [] : _ref44$formatter;
- for (var _s16 = 0; _s16 < n.length; _s16++) {
- var _n$_s = n[_s16],
- _r6 = _n$_s.rule,
- _i3 = _n$_s.content,
- _o3 = _n$_s.mode,
- _a2 = e.match(_r6);
- if (!_a2) continue;
- var _c2 = _i3;
- for (var _e20 = 1; _e20 < _a2.length; _e20++) {
- _c2 = Vt(_c2, "{$".concat(_e20, "}"), _a2[_e20]);
- }
- for (var _e21 in t) {
- _c2 = Vt(_c2, "{".concat(_e21, "}"), t[_e21]);
- }
- return "replace" === _o3 ? _c2 : e + _c2;
- }
- return e;
- }({
- message: "[".concat(_n12.name, "]: ").concat(e.message),
- formatter: Ht,
- extraInfo: {
- functionName: s
- }
- })), Promise.reject(e);
- });
- };
- e.callFunction = function (t) {
- var _e$config = e.config,
- s = _e$config.provider,
- r = _e$config.spaceId,
- i = t.name;
- var o, a;
- if (t.data = t.data || {}, b && e.__dev__.debugInfo && !e.__dev__.debugInfo.forceRemote && O ? (e._callCloudFunction || (e._callCloudFunction = n, e._callLocalFunction = Wt), o = Wt) : o = n, o = o.bind(e), Hn(t)) a = n.call(e, t);else if (function (_ref45) {
- var e = _ref45.name,
- _ref45$data = _ref45.data,
- t = _ref45$data === void 0 ? {} : _ref45$data;
- return "mp-weixin" === C && "uni-id-co" === e && "secureNetworkHandshakeByWeixin" === t.method;
- }(t)) a = o.call(e, t);else if (Wn(t)) {
- a = new Fn({
- secretType: t.secretType,
- uniCloudIns: e
- }).wrapEncryptDataCallFunction(n.bind(e))(t);
- } else if (Jn({
- provider: s,
- spaceId: r,
- functionName: i
- })) {
- a = new Fn({
- secretType: t.secretType,
- uniCloudIns: e
- }).wrapVerifyClientCallFunction(n.bind(e))(t);
- } else a = o(t);
- return Object.defineProperty(a, "result", {
- get: function get() {
- return console.warn("当前返回结果为Promise类型,不可直接访问其result属性,详情请参考:https://uniapp.dcloud.net.cn/uniCloud/faq?id=promise"), {};
- }
- }), a.then(function (e) {
- return "undefined" != typeof UTSJSONObject && (e.result = new UTSJSONObject(e.result)), e;
- });
- };
- }
- Fn = "mp-weixin" !== C && "app" !== C ? /*#__PURE__*/function () {
- function _class2() {
- (0, _classCallCheck2.default)(this, _class2);
- throw Mn({
- message: "Platform ".concat(C, " is not supported by secure network")
- });
- }
- return (0, _createClass2.default)(_class2);
- }() : k ? "mp-weixin" === C ? jn : Bn : /*#__PURE__*/function () {
- function _class3() {
- (0, _classCallCheck2.default)(this, _class3);
- throw Mn({
- message: "Platform ".concat(C, " is not enabled, please check whether secure network module is enabled in your manifest.json")
- });
- }
- return (0, _createClass2.default)(_class3);
- }();
- var Gn = Symbol("CLIENT_DB_INTERNAL");
- function Yn(e, t) {
- return e.then = "DoNotReturnProxyWithAFunctionNamedThen", e._internalType = Gn, e.inspect = null, e.__ob__ = void 0, new Proxy(e, {
- get: function get(e, n, s) {
- if ("_uniClient" === n) return null;
- if ("symbol" == (0, _typeof2.default)(n)) return e[n];
- if (n in e || "string" != typeof n) {
- var _t12 = e[n];
- return "function" == typeof _t12 ? _t12.bind(e) : _t12;
- }
- return t.get(e, n, s);
- }
- });
- }
- function Qn(e) {
- return {
- on: function on(t, n) {
- e[t] = e[t] || [], e[t].indexOf(n) > -1 || e[t].push(n);
- },
- off: function off(t, n) {
- e[t] = e[t] || [];
- var s = e[t].indexOf(n);
- -1 !== s && e[t].splice(s, 1);
- }
- };
- }
- var Xn = ["db.Geo", "db.command", "command.aggregate"];
- function Zn(e, t) {
- return Xn.indexOf("".concat(e, ".").concat(t)) > -1;
- }
- function es(e) {
- switch (g(e)) {
- case "array":
- return e.map(function (e) {
- return es(e);
- });
- case "object":
- return e._internalType === Gn || Object.keys(e).forEach(function (t) {
- e[t] = es(e[t]);
- }), e;
- case "regexp":
- return {
- $regexp: {
- source: e.source,
- flags: e.flags
- }
- };
- case "date":
- return {
- $date: e.toISOString()
- };
- default:
- return e;
- }
- }
- function ts(e) {
- return e && e.content && e.content.$method;
- }
- var ns = /*#__PURE__*/function () {
- function ns(e, t, n) {
- (0, _classCallCheck2.default)(this, ns);
- this.content = e, this.prevStage = t || null, this.udb = null, this._database = n;
- }
- (0, _createClass2.default)(ns, [{
- key: "toJSON",
- value: function toJSON() {
- var e = this;
- var t = [e.content];
- for (; e.prevStage;) {
- e = e.prevStage, t.push(e.content);
- }
- return {
- $db: t.reverse().map(function (e) {
- return {
- $method: e.$method,
- $param: es(e.$param)
- };
- })
- };
- }
- }, {
- key: "toString",
- value: function toString() {
- return JSON.stringify(this.toJSON());
- }
- }, {
- key: "getAction",
- value: function getAction() {
- var e = this.toJSON().$db.find(function (e) {
- return "action" === e.$method;
- });
- return e && e.$param && e.$param[0];
- }
- }, {
- key: "getCommand",
- value: function getCommand() {
- return {
- $db: this.toJSON().$db.filter(function (e) {
- return "action" !== e.$method;
- })
- };
- }
- }, {
- key: "isAggregate",
- get: function get() {
- var e = this;
- for (; e;) {
- var t = ts(e),
- _n13 = ts(e.prevStage);
- if ("aggregate" === t && "collection" === _n13 || "pipeline" === t) return !0;
- e = e.prevStage;
- }
- return !1;
- }
- }, {
- key: "isCommand",
- get: function get() {
- var e = this;
- for (; e;) {
- if ("command" === ts(e)) return !0;
- e = e.prevStage;
- }
- return !1;
- }
- }, {
- key: "isAggregateCommand",
- get: function get() {
- var e = this;
- for (; e;) {
- var t = ts(e),
- _n14 = ts(e.prevStage);
- if ("aggregate" === t && "command" === _n14) return !0;
- e = e.prevStage;
- }
- return !1;
- }
- }, {
- key: "getNextStageFn",
- value: function getNextStageFn(e) {
- var t = this;
- return function () {
- return ss({
- $method: e,
- $param: es(Array.from(arguments))
- }, t, t._database);
- };
- }
- }, {
- key: "count",
- get: function get() {
- return this.isAggregate ? this.getNextStageFn("count") : function () {
- return this._send("count", Array.from(arguments));
- };
- }
- }, {
- key: "remove",
- get: function get() {
- return this.isCommand ? this.getNextStageFn("remove") : function () {
- return this._send("remove", Array.from(arguments));
- };
- }
- }, {
- key: "get",
- value: function get() {
- return this._send("get", Array.from(arguments));
- }
- }, {
- key: "add",
- get: function get() {
- return this.isCommand ? this.getNextStageFn("add") : function () {
- return this._send("add", Array.from(arguments));
- };
- }
- }, {
- key: "update",
- value: function update() {
- return this._send("update", Array.from(arguments));
- }
- }, {
- key: "end",
- value: function end() {
- return this._send("end", Array.from(arguments));
- }
- }, {
- key: "set",
- get: function get() {
- return this.isCommand ? this.getNextStageFn("set") : function () {
- throw new Error("JQL禁止使用set方法");
- };
- }
- }, {
- key: "_send",
- value: function _send(e, t) {
- var n = this.getAction(),
- s = this.getCommand();
- if (s.$db.push({
- $method: e,
- $param: es(t)
- }), b) {
- var _e22 = s.$db.find(function (e) {
- return "collection" === e.$method;
- }),
- _t13 = _e22 && _e22.$param;
- _t13 && 1 === _t13.length && "string" == typeof _e22.$param[0] && _e22.$param[0].indexOf(",") > -1 && console.warn("检测到使用JQL语法联表查询时,未使用getTemp先过滤主表数据,在主表数据量大的情况下可能会查询缓慢。\n- 如何优化请参考此文档:https://uniapp.dcloud.net.cn/uniCloud/jql?id=lookup-with-temp \n- 如果主表数据量很小请忽略此信息,项目发行时不会出现此提示。");
- }
- return this._database._callCloudFunction({
- action: n,
- command: s
- });
- }
- }]);
- return ns;
- }();
- function ss(e, t, n) {
- return Yn(new ns(e, t, n), {
- get: function get(e, t) {
- var s = "db";
- return e && e.content && (s = e.content.$method), Zn(s, t) ? ss({
- $method: t
- }, e, n) : function () {
- return ss({
- $method: t,
- $param: es(Array.from(arguments))
- }, e, n);
- };
- }
- });
- }
- function rs(_ref46) {
- var e = _ref46.path,
- t = _ref46.method;
- return /*#__PURE__*/function () {
- function _class4() {
- (0, _classCallCheck2.default)(this, _class4);
- this.param = Array.from(arguments);
- }
- (0, _createClass2.default)(_class4, [{
- key: "toJSON",
- value: function toJSON() {
- return {
- $newDb: [].concat((0, _toConsumableArray2.default)(e.map(function (e) {
- return {
- $method: e
- };
- })), [{
- $method: t,
- $param: this.param
- }])
- };
- }
- }, {
- key: "toString",
- value: function toString() {
- return JSON.stringify(this.toJSON());
- }
- }]);
- return _class4;
- }();
- }
- var is = /*#__PURE__*/function () {
- function is() {
- var _ref47 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- _ref47$uniClient = _ref47.uniClient,
- e = _ref47$uniClient === void 0 ? {} : _ref47$uniClient,
- _ref47$isJQL = _ref47.isJQL,
- t = _ref47$isJQL === void 0 ? !1 : _ref47$isJQL;
- (0, _classCallCheck2.default)(this, is);
- this._uniClient = e, this._authCallBacks = {}, this._dbCallBacks = {}, e._isDefault && (this._dbCallBacks = U("_globalUniCloudDatabaseCallback")), t || (this.auth = Qn(this._authCallBacks)), this._isJQL = t, Object.assign(this, Qn(this._dbCallBacks)), this.env = Yn({}, {
- get: function get(e, t) {
- return {
- $env: t
- };
- }
- }), this.Geo = Yn({}, {
- get: function get(e, t) {
- return rs({
- path: ["Geo"],
- method: t
- });
- }
- }), this.serverDate = rs({
- path: [],
- method: "serverDate"
- }), this.RegExp = rs({
- path: [],
- method: "RegExp"
- });
- }
- (0, _createClass2.default)(is, [{
- key: "getCloudEnv",
- value: function getCloudEnv(e) {
- if ("string" != typeof e || !e.trim()) throw new Error("getCloudEnv参数错误");
- return {
- $env: e.replace("$cloudEnv_", "")
- };
- }
- }, {
- key: "_callback",
- value: function _callback(e, t) {
- var n = this._dbCallBacks;
- n[e] && n[e].forEach(function (e) {
- e.apply(void 0, (0, _toConsumableArray2.default)(t));
- });
- }
- }, {
- key: "_callbackAuth",
- value: function _callbackAuth(e, t) {
- var n = this._authCallBacks;
- n[e] && n[e].forEach(function (e) {
- e.apply(void 0, (0, _toConsumableArray2.default)(t));
- });
- }
- }, {
- key: "multiSend",
- value: function multiSend() {
- var e = Array.from(arguments),
- t = e.map(function (e) {
- var t = e.getAction(),
- n = e.getCommand();
- if ("getTemp" !== n.$db[n.$db.length - 1].$method) throw new Error("multiSend只支持子命令内使用getTemp");
- return {
- action: t,
- command: n
- };
- });
- return this._callCloudFunction({
- multiCommand: t,
- queryList: e
- });
- }
- }]);
- return is;
- }();
- function os(e) {
- var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- return Yn(new e(t), {
- get: function get(e, t) {
- return Zn("db", t) ? ss({
- $method: t
- }, null, e) : function () {
- return ss({
- $method: t,
- $param: es(Array.from(arguments))
- }, null, e);
- };
- }
- });
- }
- var as = /*#__PURE__*/function (_is) {
- (0, _inherits2.default)(as, _is);
- var _super10 = _createSuper(as);
- function as() {
- (0, _classCallCheck2.default)(this, as);
- return _super10.apply(this, arguments);
- }
- (0, _createClass2.default)(as, [{
- key: "_parseResult",
- value: function _parseResult(e) {
- return this._isJQL ? e.result : e;
- }
- }, {
- key: "_callCloudFunction",
- value: function _callCloudFunction(_ref48) {
- var _this23 = this;
- var e = _ref48.action,
- t = _ref48.command,
- n = _ref48.multiCommand,
- s = _ref48.queryList;
- function r(e, t) {
- if (n && s) for (var _n15 = 0; _n15 < s.length; _n15++) {
- var _r7 = s[_n15];
- _r7.udb && "function" == typeof _r7.udb.setResult && (t ? _r7.udb.setResult(t) : _r7.udb.setResult(e.result.dataList[_n15]));
- }
- }
- var i = this,
- o = this._isJQL ? "databaseForJQL" : "database";
- function a(e) {
- return i._callback("error", [e]), j($(o, "fail"), e).then(function () {
- return j($(o, "complete"), e);
- }).then(function () {
- return r(null, e), Y(H.RESPONSE, {
- type: J.CLIENT_DB,
- content: e
- }), Promise.reject(e);
- });
- }
- var c = j($(o, "invoke")),
- u = this._uniClient;
- return c.then(function () {
- return u.callFunction({
- name: "DCloud-clientDB",
- type: l.CLIENT_DB,
- data: {
- action: e,
- command: t,
- multiCommand: n
- }
- });
- }).then(function (e) {
- var _e$result = e.result,
- t = _e$result.code,
- n = _e$result.message,
- s = _e$result.token,
- c = _e$result.tokenExpired,
- _e$result$systemInfo = _e$result.systemInfo,
- u = _e$result$systemInfo === void 0 ? [] : _e$result$systemInfo;
- if (u) for (var _e23 = 0; _e23 < u.length; _e23++) {
- var _u$_e = u[_e23],
- _t14 = _u$_e.level,
- _n16 = _u$_e.message,
- _s17 = _u$_e.detail;
- var _r8 = "[System Info]" + _n16;
- _s17 && (_r8 = "".concat(_r8, "\n\u8BE6\u7EC6\u4FE1\u606F\uFF1A").concat(_s17)), (console["app" === C && "warn" === _t14 ? "error" : _t14] || console.log)(_r8);
- }
- if (t) {
- return a(new te({
- code: t,
- message: n,
- requestId: e.requestId
- }));
- }
- e.result.errCode = e.result.errCode || e.result.code, e.result.errMsg = e.result.errMsg || e.result.message, s && c && (re({
- token: s,
- tokenExpired: c
- }), _this23._callbackAuth("refreshToken", [{
- token: s,
- tokenExpired: c
- }]), _this23._callback("refreshToken", [{
- token: s,
- tokenExpired: c
- }]), Y(H.REFRESH_TOKEN, {
- token: s,
- tokenExpired: c
- }));
- var h = [{
- prop: "affectedDocs",
- tips: "affectedDocs不再推荐使用,请使用inserted/deleted/updated/data.length替代"
- }, {
- prop: "code",
- tips: "code不再推荐使用,请使用errCode替代"
- }, {
- prop: "message",
- tips: "message不再推荐使用,请使用errMsg替代"
- }];
- var _loop2 = function _loop2(_t15) {
- var _h$_t = h[_t15],
- n = _h$_t.prop,
- s = _h$_t.tips;
- if (n in e.result) {
- var _t16 = e.result[n];
- Object.defineProperty(e.result, n, {
- get: function get() {
- return console.warn(s), _t16;
- }
- });
- }
- };
- for (var _t15 = 0; _t15 < h.length; _t15++) {
- _loop2(_t15);
- }
- return function (e) {
- return j($(o, "success"), e).then(function () {
- return j($(o, "complete"), e);
- }).then(function () {
- r(e, null);
- var t = i._parseResult(e);
- return Y(H.RESPONSE, {
- type: J.CLIENT_DB,
- content: t
- }), Promise.resolve(t);
- });
- }(e);
- }, function (e) {
- /fc_function_not_found|FUNCTION_NOT_FOUND/g.test(e.message) && console.warn("clientDB未初始化,请在web控制台保存一次schema以开启clientDB");
- return a(new te({
- code: e.code || "SYSTEM_ERROR",
- message: e.message,
- requestId: e.requestId
- }));
- });
- }
- }]);
- return as;
- }(is);
- var cs = "token无效,跳转登录页面",
- us = "token过期,跳转登录页面",
- hs = {
- TOKEN_INVALID_TOKEN_EXPIRED: us,
- TOKEN_INVALID_INVALID_CLIENTID: cs,
- TOKEN_INVALID: cs,
- TOKEN_INVALID_WRONG_TOKEN: cs,
- TOKEN_INVALID_ANONYMOUS_USER: cs
- },
- ls = {
- "uni-id-token-expired": us,
- "uni-id-check-token-failed": cs,
- "uni-id-token-not-exist": cs,
- "uni-id-check-device-feature-failed": cs
- };
- function ds(e, t) {
- var n = "";
- return n = e ? "".concat(e, "/").concat(t) : t, n.replace(/^\//, "");
- }
- function ps() {
- var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
- var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
- var n = [],
- s = [];
- return e.forEach(function (e) {
- !0 === e.needLogin ? n.push(ds(t, e.path)) : !1 === e.needLogin && s.push(ds(t, e.path));
- }), {
- needLoginPage: n,
- notNeedLoginPage: s
- };
- }
- function fs(e) {
- return e.split("?")[0].replace(/^\//, "");
- }
- function gs() {
- return function (e) {
- var t = e && e.$page && e.$page.fullPath || "";
- return t ? ("/" !== t.charAt(0) && (t = "/" + t), t) : t;
- }(function () {
- var e = getCurrentPages();
- return e[e.length - 1];
- }());
- }
- function ms() {
- return fs(gs());
- }
- function ys() {
- var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
- var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- if (!e) return !1;
- if (!(t && t.list && t.list.length)) return !1;
- var n = t.list,
- s = fs(e);
- return n.some(function (e) {
- return e.pagePath === s;
- });
- }
- var _s = !!_pages.default.uniIdRouter;
- var _ref49 = function () {
- var _ref8 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _pages.default,
- _ref8$pages = _ref8.pages,
- t = _ref8$pages === void 0 ? [] : _ref8$pages,
- _ref8$subPackages = _ref8.subPackages,
- n = _ref8$subPackages === void 0 ? [] : _ref8$subPackages,
- _ref8$uniIdRouter = _ref8.uniIdRouter,
- s = _ref8$uniIdRouter === void 0 ? {} : _ref8$uniIdRouter,
- _ref8$tabBar = _ref8.tabBar,
- r = _ref8$tabBar === void 0 ? {} : _ref8$tabBar;
- var i = s.loginPage,
- _s$needLogin = s.needLogin,
- o = _s$needLogin === void 0 ? [] : _s$needLogin,
- _s$resToLogin = s.resToLogin,
- a = _s$resToLogin === void 0 ? !0 : _s$resToLogin,
- _ps = ps(t),
- c = _ps.needLoginPage,
- u = _ps.notNeedLoginPage,
- _ref9 = function () {
- var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
- var t = [],
- n = [];
- return e.forEach(function (e) {
- var s = e.root,
- _e$pages = e.pages,
- r = _e$pages === void 0 ? [] : _e$pages,
- _ps2 = ps(r, s),
- i = _ps2.needLoginPage,
- o = _ps2.notNeedLoginPage;
- t.push.apply(t, (0, _toConsumableArray2.default)(i)), n.push.apply(n, (0, _toConsumableArray2.default)(o));
- }), {
- needLoginPage: t,
- notNeedLoginPage: n
- };
- }(n),
- h = _ref9.needLoginPage,
- l = _ref9.notNeedLoginPage;
- return {
- loginPage: i,
- routerNeedLogin: o,
- resToLogin: a,
- needLoginPage: [].concat((0, _toConsumableArray2.default)(c), (0, _toConsumableArray2.default)(h)),
- notNeedLoginPage: [].concat((0, _toConsumableArray2.default)(u), (0, _toConsumableArray2.default)(l)),
- loginPageInTabBar: ys(i, r)
- };
- }(),
- ws = _ref49.loginPage,
- vs = _ref49.routerNeedLogin,
- Is = _ref49.resToLogin,
- Ss = _ref49.needLoginPage,
- Ts = _ref49.notNeedLoginPage,
- bs = _ref49.loginPageInTabBar;
- if (Ss.indexOf(ws) > -1) throw new Error("Login page [".concat(ws, "] should not be \"needLogin\", please check your pages.json"));
- function Es(e) {
- var t = ms();
- if ("/" === e.charAt(0)) return e;
- var _e$split = e.split("?"),
- _e$split2 = (0, _slicedToArray2.default)(_e$split, 2),
- n = _e$split2[0],
- s = _e$split2[1],
- r = n.replace(/^\//, "").split("/"),
- i = t.split("/");
- i.pop();
- for (var _e24 = 0; _e24 < r.length; _e24++) {
- var _t17 = r[_e24];
- ".." === _t17 ? i.pop() : "." !== _t17 && i.push(_t17);
- }
- return "" === i[0] && i.shift(), "/" + i.join("/") + (s ? "?" + s : "");
- }
- function ks(e) {
- var t = fs(Es(e));
- return !(Ts.indexOf(t) > -1) && (Ss.indexOf(t) > -1 || vs.some(function (t) {
- return function (e, t) {
- return new RegExp(t).test(e);
- }(e, t);
- }));
- }
- function Ps(_ref31) {
- var e = _ref31.redirect;
- var t = fs(e),
- n = fs(ws);
- return ms() !== n && t !== n;
- }
- function Cs() {
- var _ref33 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- e = _ref33.api,
- t = _ref33.redirect;
- if (!t || !Ps({
- redirect: t
- })) return;
- var n = function (e, t) {
- return "/" !== e.charAt(0) && (e = "/" + e), t ? e.indexOf("?") > -1 ? e + "&uniIdRedirectUrl=".concat(encodeURIComponent(t)) : e + "?uniIdRedirectUrl=".concat(encodeURIComponent(t)) : e;
- }(ws, t);
- bs ? "navigateTo" !== e && "redirectTo" !== e || (e = "switchTab") : "switchTab" === e && (e = "navigateTo");
- var s = {
- navigateTo: uni.navigateTo,
- redirectTo: uni.redirectTo,
- switchTab: uni.switchTab,
- reLaunch: uni.reLaunch
- };
- setTimeout(function () {
- s[e]({
- url: n
- });
- }, 0);
- }
- function As() {
- var _ref50 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- e = _ref50.url;
- var t = {
- abortLoginPageJump: !1,
- autoToLoginPage: !1
- },
- n = function () {
- var _se4 = se(),
- e = _se4.token,
- t = _se4.tokenExpired;
- var n;
- if (e) {
- if (t < Date.now()) {
- var _e25 = "uni-id-token-expired";
- n = {
- errCode: _e25,
- errMsg: ls[_e25]
- };
- }
- } else {
- var _e26 = "uni-id-check-token-failed";
- n = {
- errCode: _e26,
- errMsg: ls[_e26]
- };
- }
- return n;
- }();
- if (ks(e) && n) {
- n.uniIdRedirectUrl = e;
- if (z(H.NEED_LOGIN).length > 0) return setTimeout(function () {
- Y(H.NEED_LOGIN, n);
- }, 0), t.abortLoginPageJump = !0, t;
- t.autoToLoginPage = !0;
- }
- return t;
- }
- function Os() {
- !function () {
- var e = gs(),
- _As = As({
- url: e
- }),
- t = _As.abortLoginPageJump,
- n = _As.autoToLoginPage;
- t || n && Cs({
- api: "redirectTo",
- redirect: e
- });
- }();
- var e = ["navigateTo", "redirectTo", "reLaunch", "switchTab"];
- var _loop3 = function _loop3(_t18) {
- var n = e[_t18];
- uni.addInterceptor(n, {
- invoke: function invoke(e) {
- var _As2 = As({
- url: e.url
- }),
- t = _As2.abortLoginPageJump,
- s = _As2.autoToLoginPage;
- return t ? e : s ? (Cs({
- api: n,
- redirect: Es(e.url)
- }), !1) : e;
- }
- });
- };
- for (var _t18 = 0; _t18 < e.length; _t18++) {
- _loop3(_t18);
- }
- }
- function xs() {
- this.onResponse(function (e) {
- var t = e.type,
- n = e.content;
- var s = !1;
- switch (t) {
- case "cloudobject":
- s = function (e) {
- if ("object" != (0, _typeof2.default)(e)) return !1;
- var _ref51 = e || {},
- t = _ref51.errCode;
- return t in ls;
- }(n);
- break;
- case "clientdb":
- s = function (e) {
- if ("object" != (0, _typeof2.default)(e)) return !1;
- var _ref52 = e || {},
- t = _ref52.errCode;
- return t in hs;
- }(n);
- }
- s && function () {
- var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- var t = z(H.NEED_LOGIN);
- Z().then(function () {
- var n = gs();
- if (n && Ps({
- redirect: n
- })) return t.length > 0 ? Y(H.NEED_LOGIN, Object.assign({
- uniIdRedirectUrl: n
- }, e)) : void (ws && Cs({
- api: "navigateTo",
- redirect: n
- }));
- });
- }(n);
- });
- }
- function Ns(e) {
- !function (e) {
- e.onResponse = function (e) {
- V(H.RESPONSE, e);
- }, e.offResponse = function (e) {
- G(H.RESPONSE, e);
- };
- }(e), function (e) {
- e.onNeedLogin = function (e) {
- V(H.NEED_LOGIN, e);
- }, e.offNeedLogin = function (e) {
- G(H.NEED_LOGIN, e);
- }, _s && (U(Yt).needLoginInit || (U(Yt).needLoginInit = !0, Z().then(function () {
- Os.call(e);
- }), Is && xs.call(e)));
- }(e), function (e) {
- e.onRefreshToken = function (e) {
- V(H.REFRESH_TOKEN, e);
- }, e.offRefreshToken = function (e) {
- G(H.REFRESH_TOKEN, e);
- };
- }(e);
- }
- var Rs;
- var Ls = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
- Us = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
- function Ds() {
- var e = se().token || "",
- t = e.split(".");
- if (!e || 3 !== t.length) return {
- uid: null,
- role: [],
- permission: [],
- tokenExpired: 0
- };
- var n;
- try {
- n = JSON.parse((s = t[1], decodeURIComponent(Rs(s).split("").map(function (e) {
- return "%" + ("00" + e.charCodeAt(0).toString(16)).slice(-2);
- }).join(""))));
- } catch (e) {
- throw new Error("获取当前用户信息出错,详细错误信息为:" + e.message);
- }
- var s;
- return n.tokenExpired = 1e3 * n.exp, delete n.exp, delete n.iat, n;
- }
- Rs = "function" != typeof atob ? function (e) {
- if (e = String(e).replace(/[\t\n\f\r ]+/g, ""), !Us.test(e)) throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
- var t;
- e += "==".slice(2 - (3 & e.length));
- for (var n, s, r = "", i = 0; i < e.length;) {
- t = Ls.indexOf(e.charAt(i++)) << 18 | Ls.indexOf(e.charAt(i++)) << 12 | (n = Ls.indexOf(e.charAt(i++))) << 6 | (s = Ls.indexOf(e.charAt(i++))), r += 64 === n ? String.fromCharCode(t >> 16 & 255) : 64 === s ? String.fromCharCode(t >> 16 & 255, t >> 8 & 255) : String.fromCharCode(t >> 16 & 255, t >> 8 & 255, 255 & t);
- }
- return r;
- } : atob;
- var Ms = n(function (e, t) {
- Object.defineProperty(t, "__esModule", {
- value: !0
- });
- var n = "chooseAndUploadFile:ok",
- s = "chooseAndUploadFile:fail";
- function r(e, t) {
- return e.tempFiles.forEach(function (e, n) {
- e.name || (e.name = e.path.substring(e.path.lastIndexOf("/") + 1)), t && (e.fileType = t), e.cloudPath = Date.now() + "_" + n + e.name.substring(e.name.lastIndexOf("."));
- }), e.tempFilePaths || (e.tempFilePaths = e.tempFiles.map(function (e) {
- return e.path;
- })), e;
- }
- function i(e, t, _ref53) {
- var s = _ref53.onChooseFile,
- r = _ref53.onUploadProgress;
- return t.then(function (e) {
- if (s) {
- var _t19 = s(e);
- if (void 0 !== _t19) return Promise.resolve(_t19).then(function (t) {
- return void 0 === t ? e : t;
- });
- }
- return e;
- }).then(function (t) {
- return !1 === t ? {
- errMsg: n,
- tempFilePaths: [],
- tempFiles: []
- } : function (e, t) {
- var s = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 5;
- var r = arguments.length > 3 ? arguments[3] : undefined;
- (t = Object.assign({}, t)).errMsg = n;
- var i = t.tempFiles,
- o = i.length;
- var a = 0;
- return new Promise(function (n) {
- for (; a < s;) {
- c();
- }
- function c() {
- var s = a++;
- if (s >= o) return void (!i.find(function (e) {
- return !e.url && !e.errMsg;
- }) && n(t));
- var u = i[s];
- e.uploadFile({
- provider: u.provider,
- filePath: u.path,
- cloudPath: u.cloudPath,
- fileType: u.fileType,
- cloudPathAsRealPath: u.cloudPathAsRealPath,
- onUploadProgress: function onUploadProgress(e) {
- e.index = s, e.tempFile = u, e.tempFilePath = u.path, r && r(e);
- }
- }).then(function (e) {
- u.url = e.fileID, s < o && c();
- }).catch(function (e) {
- u.errMsg = e.errMsg || e.message, s < o && c();
- });
- }
- });
- }(e, t, 5, r);
- });
- }
- t.initChooseAndUploadFile = function (e) {
- return function () {
- var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
- type: "all"
- };
- return "image" === t.type ? i(e, function (e) {
- var t = e.count,
- n = e.sizeType,
- _e$sourceType = e.sourceType,
- i = _e$sourceType === void 0 ? ["album", "camera"] : _e$sourceType,
- o = e.extension;
- return new Promise(function (e, a) {
- uni.chooseImage({
- count: t,
- sizeType: n,
- sourceType: i,
- extension: o,
- success: function success(t) {
- e(r(t, "image"));
- },
- fail: function fail(e) {
- a({
- errMsg: e.errMsg.replace("chooseImage:fail", s)
- });
- }
- });
- });
- }(t), t) : "video" === t.type ? i(e, function (e) {
- var t = e.camera,
- n = e.compressed,
- i = e.maxDuration,
- _e$sourceType2 = e.sourceType,
- o = _e$sourceType2 === void 0 ? ["album", "camera"] : _e$sourceType2,
- a = e.extension;
- return new Promise(function (e, c) {
- uni.chooseVideo({
- camera: t,
- compressed: n,
- maxDuration: i,
- sourceType: o,
- extension: a,
- success: function success(t) {
- var n = t.tempFilePath,
- s = t.duration,
- i = t.size,
- o = t.height,
- a = t.width;
- e(r({
- errMsg: "chooseVideo:ok",
- tempFilePaths: [n],
- tempFiles: [{
- name: t.tempFile && t.tempFile.name || "",
- path: n,
- size: i,
- type: t.tempFile && t.tempFile.type || "",
- width: a,
- height: o,
- duration: s,
- fileType: "video",
- cloudPath: ""
- }]
- }, "video"));
- },
- fail: function fail(e) {
- c({
- errMsg: e.errMsg.replace("chooseVideo:fail", s)
- });
- }
- });
- });
- }(t), t) : i(e, function (e) {
- var t = e.count,
- n = e.extension;
- return new Promise(function (e, i) {
- var o = uni.chooseFile;
- if ("undefined" != typeof wx && "function" == typeof wx.chooseMessageFile && (o = wx.chooseMessageFile), "function" != typeof o) return i({
- errMsg: s + " 请指定 type 类型,该平台仅支持选择 image 或 video。"
- });
- o({
- type: "all",
- count: t,
- extension: n,
- success: function success(t) {
- e(r(t));
- },
- fail: function fail(e) {
- i({
- errMsg: e.errMsg.replace("chooseFile:fail", s)
- });
- }
- });
- });
- }(t), t);
- };
- };
- }),
- qs = t(Ms);
- var Fs = {
- auto: "auto",
- onready: "onready",
- manual: "manual"
- };
- function Ks(e) {
- return {
- props: {
- localdata: {
- type: Array,
- default: function _default() {
- return [];
- }
- },
- options: {
- type: [Object, Array],
- default: function _default() {
- return {};
- }
- },
- spaceInfo: {
- type: Object,
- default: function _default() {
- return {};
- }
- },
- collection: {
- type: [String, Array],
- default: ""
- },
- action: {
- type: String,
- default: ""
- },
- field: {
- type: String,
- default: ""
- },
- orderby: {
- type: String,
- default: ""
- },
- where: {
- type: [String, Object],
- default: ""
- },
- pageData: {
- type: String,
- default: "add"
- },
- pageCurrent: {
- type: Number,
- default: 1
- },
- pageSize: {
- type: Number,
- default: 20
- },
- getcount: {
- type: [Boolean, String],
- default: !1
- },
- gettree: {
- type: [Boolean, String],
- default: !1
- },
- gettreepath: {
- type: [Boolean, String],
- default: !1
- },
- startwith: {
- type: String,
- default: ""
- },
- limitlevel: {
- type: Number,
- default: 10
- },
- groupby: {
- type: String,
- default: ""
- },
- groupField: {
- type: String,
- default: ""
- },
- distinct: {
- type: [Boolean, String],
- default: !1
- },
- foreignKey: {
- type: String,
- default: ""
- },
- loadtime: {
- type: String,
- default: "auto"
- },
- manual: {
- type: Boolean,
- default: !1
- }
- },
- data: function data() {
- return {
- mixinDatacomLoading: !1,
- mixinDatacomHasMore: !1,
- mixinDatacomResData: [],
- mixinDatacomErrorMessage: "",
- mixinDatacomPage: {},
- mixinDatacomError: null
- };
- },
- created: function created() {
- var _this24 = this;
- this.mixinDatacomPage = {
- current: this.pageCurrent,
- size: this.pageSize,
- count: 0
- }, this.$watch(function () {
- var e = [];
- return ["pageCurrent", "pageSize", "localdata", "collection", "action", "field", "orderby", "where", "getont", "getcount", "gettree", "groupby", "groupField", "distinct"].forEach(function (t) {
- e.push(_this24[t]);
- }), e;
- }, function (e, t) {
- if (_this24.loadtime === Fs.manual) return;
- var n = !1;
- var s = [];
- for (var _r9 = 2; _r9 < e.length; _r9++) {
- e[_r9] !== t[_r9] && (s.push(e[_r9]), n = !0);
- }
- e[0] !== t[0] && (_this24.mixinDatacomPage.current = _this24.pageCurrent), _this24.mixinDatacomPage.size = _this24.pageSize, _this24.onMixinDatacomPropsChange(n, s);
- });
- },
- methods: {
- onMixinDatacomPropsChange: function onMixinDatacomPropsChange(e, t) {},
- mixinDatacomEasyGet: function mixinDatacomEasyGet() {
- var _this25 = this;
- var _ref54 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- _ref54$getone = _ref54.getone,
- e = _ref54$getone === void 0 ? !1 : _ref54$getone,
- t = _ref54.success,
- n = _ref54.fail;
- this.mixinDatacomLoading || (this.mixinDatacomLoading = !0, this.mixinDatacomErrorMessage = "", this.mixinDatacomError = null, this.mixinDatacomGet().then(function (n) {
- _this25.mixinDatacomLoading = !1;
- var _n$result = n.result,
- s = _n$result.data,
- r = _n$result.count;
- _this25.getcount && (_this25.mixinDatacomPage.count = r), _this25.mixinDatacomHasMore = s.length < _this25.pageSize;
- var i = e ? s.length ? s[0] : void 0 : s;
- _this25.mixinDatacomResData = i, t && t(i);
- }).catch(function (e) {
- _this25.mixinDatacomLoading = !1, _this25.mixinDatacomErrorMessage = e, _this25.mixinDatacomError = e, n && n(e);
- }));
- },
- mixinDatacomGet: function mixinDatacomGet() {
- var _n17;
- var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- var n;
- t = t || {}, n = "undefined" != typeof __uniX && __uniX ? e.databaseForJQL(this.spaceInfo) : e.database(this.spaceInfo);
- var s = t.action || this.action;
- s && (n = n.action(s));
- var r = t.collection || this.collection;
- n = Array.isArray(r) ? (_n17 = n).collection.apply(_n17, (0, _toConsumableArray2.default)(r)) : n.collection(r);
- var i = t.where || this.where;
- i && Object.keys(i).length && (n = n.where(i));
- var o = t.field || this.field;
- o && (n = n.field(o));
- var a = t.foreignKey || this.foreignKey;
- a && (n = n.foreignKey(a));
- var c = t.groupby || this.groupby;
- c && (n = n.groupBy(c));
- var u = t.groupField || this.groupField;
- u && (n = n.groupField(u));
- !0 === (void 0 !== t.distinct ? t.distinct : this.distinct) && (n = n.distinct());
- var h = t.orderby || this.orderby;
- h && (n = n.orderBy(h));
- var l = void 0 !== t.pageCurrent ? t.pageCurrent : this.mixinDatacomPage.current,
- d = void 0 !== t.pageSize ? t.pageSize : this.mixinDatacomPage.size,
- p = void 0 !== t.getcount ? t.getcount : this.getcount,
- f = void 0 !== t.gettree ? t.gettree : this.gettree,
- g = void 0 !== t.gettreepath ? t.gettreepath : this.gettreepath,
- m = {
- getCount: p
- },
- y = {
- limitLevel: void 0 !== t.limitlevel ? t.limitlevel : this.limitlevel,
- startWith: void 0 !== t.startwith ? t.startwith : this.startwith
- };
- return f && (m.getTree = y), g && (m.getTreePath = y), n = n.skip(d * (l - 1)).limit(d).get(m), n;
- }
- }
- };
- }
- function js(e) {
- return function (t) {
- var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- n = function (e) {
- var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- return e.customUI = t.customUI || e.customUI, e.parseSystemError = t.parseSystemError || e.parseSystemError, Object.assign(e.loadingOptions, t.loadingOptions), Object.assign(e.errorOptions, t.errorOptions), "object" == (0, _typeof2.default)(t.secretMethods) && (e.secretMethods = t.secretMethods), e;
- }({
- customUI: !1,
- loadingOptions: {
- title: "加载中...",
- mask: !0
- },
- errorOptions: {
- type: "modal",
- retry: !1
- }
- }, n);
- var _n18 = n,
- s = _n18.customUI,
- r = _n18.loadingOptions,
- i = _n18.errorOptions,
- o = _n18.parseSystemError,
- a = !s;
- return new Proxy({}, {
- get: function get(s, c) {
- switch (c) {
- case "toString":
- return "[object UniCloudObject]";
- case "toJSON":
- return {};
- }
- return function () {
- var _ref55 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- e = _ref55.fn,
- t = _ref55.interceptorName,
- n = _ref55.getCallbackArgs;
- return /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee64() {
- var _len3,
- s,
- _key3,
- r,
- i,
- o,
- _args = arguments;
- return _regenerator.default.wrap(function _callee64$(_context64) {
- while (1) {
- switch (_context64.prev = _context64.next) {
- case 0:
- for (_len3 = _args.length, s = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
- s[_key3] = _args[_key3];
- }
- r = n ? n({
- params: s
- }) : {};
- _context64.prev = 2;
- _context64.next = 5;
- return j($(t, "invoke"), _objectSpread({}, r));
- case 5:
- _context64.next = 7;
- return e.apply(void 0, s);
- case 7:
- i = _context64.sent;
- _context64.next = 10;
- return j($(t, "success"), _objectSpread(_objectSpread({}, r), {}, {
- result: i
- }));
- case 10:
- return _context64.abrupt("return", i);
- case 13:
- _context64.prev = 13;
- _context64.t0 = _context64["catch"](2);
- o = _context64.t0;
- _context64.next = 18;
- return j($(t, "fail"), _objectSpread(_objectSpread({}, r), {}, {
- error: o
- }));
- case 18:
- throw o;
- case 19:
- _context64.prev = 19;
- _context64.next = 22;
- return j($(t, "complete"), o ? _objectSpread(_objectSpread({}, r), {}, {
- error: o
- }) : _objectSpread(_objectSpread({}, r), {}, {
- result: i
- }));
- case 22:
- return _context64.finish(19);
- case 23:
- case "end":
- return _context64.stop();
- }
- }
- }, _callee64, null, [[2, 13, 19, 23]]);
- }));
- }({
- fn: function () {
- var _s18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee66() {
- var h,
- _len4,
- u,
- _key4,
- d,
- p,
- _ref57,
- f,
- g,
- m,
- y,
- _e27,
- _yield,
- _t20,
- _n19,
- _args4 = arguments;
- return _regenerator.default.wrap(function _callee66$(_context66) {
- while (1) {
- switch (_context66.prev = _context66.next) {
- case 0:
- a && uni.showLoading({
- title: r.title,
- mask: r.mask
- });
- for (_len4 = _args4.length, u = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
- u[_key4] = _args4[_key4];
- }
- d = {
- name: t,
- type: l.OBJECT,
- data: {
- method: c,
- params: u
- }
- };
- "object" == (0, _typeof2.default)(n.secretMethods) && function (e, t) {
- var n = t.data.method,
- s = e.secretMethods || {},
- r = s[n] || s["*"];
- r && (t.secretType = r);
- }(n, d);
- p = !1;
- _context66.prev = 5;
- _context66.next = 8;
- return e.callFunction(d);
- case 8:
- h = _context66.sent;
- _context66.next = 14;
- break;
- case 11:
- _context66.prev = 11;
- _context66.t0 = _context66["catch"](5);
- p = !0, h = {
- result: new te(_context66.t0)
- };
- case 14:
- _ref57 = h.result || {}, f = _ref57.errSubject, g = _ref57.errCode, m = _ref57.errMsg, y = _ref57.newToken;
- if (!(a && uni.hideLoading(), y && y.token && y.tokenExpired && (re(y), Y(H.REFRESH_TOKEN, _objectSpread({}, y))), g)) {
- _context66.next = 39;
- break;
- }
- _e27 = m;
- if (!(p && o)) {
- _context66.next = 24;
- break;
- }
- _context66.next = 20;
- return o({
- objectName: t,
- methodName: c,
- params: u,
- errSubject: f,
- errCode: g,
- errMsg: m
- });
- case 20:
- _context66.t1 = _context66.sent.errMsg;
- if (_context66.t1) {
- _context66.next = 23;
- break;
- }
- _context66.t1 = m;
- case 23:
- _e27 = _context66.t1;
- case 24:
- if (!a) {
- _context66.next = 37;
- break;
- }
- if (!("toast" === i.type)) {
- _context66.next = 29;
- break;
- }
- uni.showToast({
- title: _e27,
- icon: "none"
- });
- _context66.next = 37;
- break;
- case 29:
- if (!("modal" !== i.type)) {
- _context66.next = 31;
- break;
- }
- throw new Error("Invalid errorOptions.type: ".concat(i.type));
- case 31:
- _context66.next = 33;
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee65() {
- var _ref59,
- e,
- t,
- n,
- s,
- r,
- _args2 = arguments;
- return _regenerator.default.wrap(function _callee65$(_context65) {
- while (1) {
- switch (_context65.prev = _context65.next) {
- case 0:
- _ref59 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, e = _ref59.title, t = _ref59.content, n = _ref59.showCancel, s = _ref59.cancelText, r = _ref59.confirmText;
- return _context65.abrupt("return", new Promise(function (i, o) {
- uni.showModal({
- title: e,
- content: t,
- showCancel: n,
- cancelText: s,
- confirmText: r,
- success: function success(e) {
- i(e);
- },
- fail: function fail() {
- i({
- confirm: !1,
- cancel: !0
- });
- }
- });
- }));
- case 2:
- case "end":
- return _context65.stop();
- }
- }
- }, _callee65);
- }))({
- title: "提示",
- content: _e27,
- showCancel: i.retry,
- cancelText: "取消",
- confirmText: i.retry ? "重试" : "确定"
- });
- case 33:
- _yield = _context66.sent;
- _t20 = _yield.confirm;
- if (!(i.retry && _t20)) {
- _context66.next = 37;
- break;
- }
- return _context66.abrupt("return", s.apply(void 0, u));
- case 37:
- _n19 = new te({
- subject: f,
- code: g,
- message: m,
- requestId: h.requestId
- });
- throw _n19.detail = h.result, Y(H.RESPONSE, {
- type: J.CLOUD_OBJECT,
- content: _n19
- }), _n19;
- case 39:
- return _context66.abrupt("return", (Y(H.RESPONSE, {
- type: J.CLOUD_OBJECT,
- content: h.result
- }), h.result));
- case 40:
- case "end":
- return _context66.stop();
- }
- }
- }, _callee66, null, [[5, 11]]);
- }));
- function s() {
- return _s18.apply(this, arguments);
- }
- return s;
- }(),
- interceptorName: "callObject",
- getCallbackArgs: function getCallbackArgs() {
- var _ref60 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- e = _ref60.params;
- return {
- objectName: t,
- methodName: c,
- params: e
- };
- }
- });
- }
- });
- };
- }
- function $s(e) {
- return U(Qt.replace("{spaceId}", e.config.spaceId));
- }
- function Bs() {
- return _Bs.apply(this, arguments);
- }
- function _Bs() {
- _Bs = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee71() {
- var _ref70,
- e,
- _ref70$callLoginByWei,
- t,
- n,
- s,
- r,
- _args10 = arguments;
- return _regenerator.default.wrap(function _callee71$(_context71) {
- while (1) {
- switch (_context71.prev = _context71.next) {
- case 0:
- _ref70 = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : {}, e = _ref70.openid, _ref70$callLoginByWei = _ref70.callLoginByWeixin, t = _ref70$callLoginByWei === void 0 ? !1 : _ref70$callLoginByWei;
- n = $s(this);
- if (!("mp-weixin" !== C)) {
- _context71.next = 4;
- break;
- }
- throw new Error("[SecureNetwork] API `initSecureNetworkByWeixin` is not supported on platform `".concat(C, "`"));
- case 4:
- if (!(e && t)) {
- _context71.next = 6;
- break;
- }
- throw new Error("[SecureNetwork] openid and callLoginByWeixin cannot be passed at the same time");
- case 6:
- if (!e) {
- _context71.next = 8;
- break;
- }
- return _context71.abrupt("return", (n.mpWeixinOpenid = e, {}));
- case 8:
- _context71.next = 10;
- return new Promise(function (e, t) {
- uni.login({
- success: function success(t) {
- e(t.code);
- },
- fail: function fail(e) {
- t(new Error(e.errMsg));
- }
- });
- });
- case 10:
- s = _context71.sent;
- r = this.importObject("uni-id-co", {
- customUI: !0
- });
- _context71.next = 14;
- return r.secureNetworkHandshakeByWeixin({
- code: s,
- callLoginByWeixin: t
- });
- case 14:
- n.mpWeixinCode = s;
- return _context71.abrupt("return", {
- code: s
- });
- case 16:
- case "end":
- return _context71.stop();
- }
- }
- }, _callee71, this);
- }));
- return _Bs.apply(this, arguments);
- }
- function Ws(_x52) {
- return _Ws.apply(this, arguments);
- }
- function _Ws() {
- _Ws = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee72(e) {
- var t;
- return _regenerator.default.wrap(function _callee72$(_context72) {
- while (1) {
- switch (_context72.prev = _context72.next) {
- case 0:
- t = $s(this);
- return _context72.abrupt("return", (t.initPromise || (t.initPromise = Bs.call(this, e).then(function (e) {
- return e;
- }).catch(function (e) {
- throw delete t.initPromise, e;
- })), t.initPromise));
- case 2:
- case "end":
- return _context72.stop();
- }
- }
- }, _callee72, this);
- }));
- return _Ws.apply(this, arguments);
- }
- function Hs(e) {
- return function () {
- var _ref61 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- t = _ref61.openid,
- _ref61$callLoginByWei = _ref61.callLoginByWeixin,
- n = _ref61$callLoginByWei === void 0 ? !1 : _ref61$callLoginByWei;
- return Ws.call(e, {
- openid: t,
- callLoginByWeixin: n
- });
- };
- }
- function Js(e) {
- !function (e) {
- ue = e;
- }(e);
- }
- function zs(e) {
- var t = {
- getSystemInfo: uni.getSystemInfo,
- getPushClientId: uni.getPushClientId
- };
- return function (n) {
- return new Promise(function (s, r) {
- t[e](_objectSpread(_objectSpread({}, n), {}, {
- success: function success(e) {
- s(e);
- },
- fail: function fail(e) {
- r(e);
- }
- }));
- });
- };
- }
- var Vs = /*#__PURE__*/function (_S) {
- (0, _inherits2.default)(Vs, _S);
- var _super11 = _createSuper(Vs);
- function Vs() {
- var _this26;
- (0, _classCallCheck2.default)(this, Vs);
- _this26 = _super11.call(this), _this26._uniPushMessageCallback = _this26._receivePushMessage.bind((0, _assertThisInitialized2.default)(_this26)), _this26._currentMessageId = -1, _this26._payloadQueue = [];
- return _this26;
- }
- (0, _createClass2.default)(Vs, [{
- key: "init",
- value: function init() {
- var _this27 = this;
- return Promise.all([zs("getSystemInfo")(), zs("getPushClientId")()]).then(function () {
- var _ref62 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [],
- _ref63 = (0, _slicedToArray2.default)(_ref62, 2),
- _ref63$ = _ref63[0];
- _ref63$ = _ref63$ === void 0 ? {} : _ref63$;
- var e = _ref63$.appId,
- _ref63$2 = _ref63[1];
- _ref63$2 = _ref63$2 === void 0 ? {} : _ref63$2;
- var t = _ref63$2.cid;
- if (!e) throw new Error("Invalid appId, please check the manifest.json file");
- if (!t) throw new Error("Invalid push client id");
- _this27._appId = e, _this27._pushClientId = t, _this27._seqId = Date.now() + "-" + Math.floor(9e5 * Math.random() + 1e5), _this27.emit("open"), _this27._initMessageListener();
- }, function (e) {
- throw _this27.emit("error", e), _this27.close(), e;
- });
- }
- }, {
- key: "open",
- value: function () {
- var _open = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee67() {
- return _regenerator.default.wrap(function _callee67$(_context67) {
- while (1) {
- switch (_context67.prev = _context67.next) {
- case 0:
- return _context67.abrupt("return", this.init());
- case 1:
- case "end":
- return _context67.stop();
- }
- }
- }, _callee67, this);
- }));
- function open() {
- return _open.apply(this, arguments);
- }
- return open;
- }()
- }, {
- key: "_isUniCloudSSE",
- value: function _isUniCloudSSE(e) {
- if ("receive" !== e.type) return !1;
- var t = e && e.data && e.data.payload;
- return !(!t || "UNI_CLOUD_SSE" !== t.channel || t.seqId !== this._seqId);
- }
- }, {
- key: "_receivePushMessage",
- value: function _receivePushMessage(e) {
- if (!this._isUniCloudSSE(e)) return;
- var t = e && e.data && e.data.payload,
- n = t.action,
- s = t.messageId,
- r = t.message;
- this._payloadQueue.push({
- action: n,
- messageId: s,
- message: r
- }), this._consumMessage();
- }
- }, {
- key: "_consumMessage",
- value: function _consumMessage() {
- var _this28 = this;
- for (;;) {
- var _e28 = this._payloadQueue.find(function (e) {
- return e.messageId === _this28._currentMessageId + 1;
- });
- if (!_e28) break;
- this._currentMessageId++, this._parseMessagePayload(_e28);
- }
- }
- }, {
- key: "_parseMessagePayload",
- value: function _parseMessagePayload(e) {
- var t = e.action,
- n = e.messageId,
- s = e.message;
- "end" === t ? this._end({
- messageId: n,
- message: s
- }) : "message" === t && this._appendMessage({
- messageId: n,
- message: s
- });
- }
- }, {
- key: "_appendMessage",
- value: function _appendMessage() {
- var _ref64 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- e = _ref64.messageId,
- t = _ref64.message;
- this.emit("message", t);
- }
- }, {
- key: "_end",
- value: function _end() {
- var _ref65 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- e = _ref65.messageId,
- t = _ref65.message;
- this.emit("end", t), this.close();
- }
- }, {
- key: "_initMessageListener",
- value: function _initMessageListener() {
- uni.onPushMessage(this._uniPushMessageCallback);
- }
- }, {
- key: "_destroy",
- value: function _destroy() {
- uni.offPushMessage(this._uniPushMessageCallback);
- }
- }, {
- key: "toJSON",
- value: function toJSON() {
- return {
- appId: this._appId,
- pushClientId: this._pushClientId,
- seqId: this._seqId
- };
- }
- }, {
- key: "close",
- value: function close() {
- this._destroy(), this.emit("close");
- }
- }]);
- return Vs;
- }(S);
- function Gs(_x53) {
- return _Gs.apply(this, arguments);
- }
- function _Gs() {
- _Gs = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee73(e) {
- var _ae2, _e33, _t22, t, _t$debugInfo, n, s, _yield$At2, r, i, o;
- return _regenerator.default.wrap(function _callee73$(_context73) {
- while (1) {
- switch (_context73.prev = _context73.next) {
- case 0:
- if (b) {
- _context73.next = 2;
- break;
- }
- return _context73.abrupt("return", Promise.resolve());
- case 2:
- if ("app" === C) {
- _ae2 = ae(), _e33 = _ae2.osName, _t22 = _ae2.osVersion;
- "ios" === _e33 && function (e) {
- if (!e || "string" != typeof e) return 0;
- var t = e.match(/^(\d+)./);
- return t && t[1] ? parseInt(t[1]) : 0;
- }(_t22) >= 14 && console.warn("iOS 14及以上版本连接uniCloud本地调试服务需要允许客户端查找并连接到本地网络上的设备(仅开发期间需要,发行后不需要)");
- }
- t = e.__dev__;
- if (t.debugInfo) {
- _context73.next = 6;
- break;
- }
- return _context73.abrupt("return");
- case 6:
- _t$debugInfo = t.debugInfo;
- n = _t$debugInfo.address;
- s = _t$debugInfo.servePort;
- _context73.next = 11;
- return At(n, s);
- case 11:
- _yield$At2 = _context73.sent;
- r = _yield$At2.address;
- if (!r) {
- _context73.next = 15;
- break;
- }
- return _context73.abrupt("return", (t.localAddress = r, void (t.localPort = s)));
- case 15:
- i = console["app" === C ? "error" : "warn"];
- o = "";
- if (!("remote" === t.debugInfo.initialLaunchType ? (t.debugInfo.forceRemote = !0, o = "当前客户端和HBuilderX不在同一局域网下(或其他网络原因无法连接HBuilderX),uniCloud本地调试服务不对当前客户端生效。\n- 如果不使用uniCloud本地调试服务,请直接忽略此信息。\n- 如需使用uniCloud本地调试服务,请将客户端与主机连接到同一局域网下并重新运行到客户端。") : o = "无法连接uniCloud本地调试服务,请检查当前客户端是否与主机在同一局域网下。\n- 如需使用uniCloud本地调试服务,请将客户端与主机连接到同一局域网下并重新运行到客户端。", o += "\n- 如果在HBuilderX开启的状态下切换过网络环境,请重启HBuilderX后再试\n- 检查系统防火墙是否拦截了HBuilderX自带的nodejs\n- 检查是否错误的使用拦截器修改uni.request方法的参数", "web" === C && (o += "\n- 部分浏览器开启节流模式之后访问本地地址受限,请检查是否启用了节流模式"), 0 === C.indexOf("mp-") && (o += "\n- 小程序中如何使用uniCloud,请参考:https://uniapp.dcloud.net.cn/uniCloud/publish.html#useinmp"), !t.debugInfo.forceRemote)) {
- _context73.next = 19;
- break;
- }
- throw new Error(o);
- case 19:
- i(o);
- case 20:
- case "end":
- return _context73.stop();
- }
- }
- }, _callee73);
- }));
- return _Gs.apply(this, arguments);
- }
- function Ys(e) {
- e._initPromiseHub || (e._initPromiseHub = new I({
- createPromise: function createPromise() {
- var t = Promise.resolve();
- var n;
- n = 1, t = new Promise(function (e) {
- setTimeout(function () {
- e();
- }, n);
- });
- var s = e.auth();
- return t.then(function () {
- return s.getLoginState();
- }).then(function (e) {
- return e ? Promise.resolve() : s.signInAnonymously();
- });
- }
- }));
- }
- var Qs = {
- tcb: Pt,
- tencent: Pt,
- aliyun: pe,
- private: Nt,
- dcloud: Nt,
- alipay: $t
- };
- var Xs = new ( /*#__PURE__*/function () {
- function _class5() {
- (0, _classCallCheck2.default)(this, _class5);
- }
- (0, _createClass2.default)(_class5, [{
- key: "init",
- value: function init(e) {
- var t = {};
- var n = Qs[e.provider];
- if (!n) throw new Error("未提供正确的provider参数");
- t = n.init(e), b && function (e) {
- if (!b) return;
- var t = {};
- e.__dev__ = t, t.debugLog = b && ("web" === C && navigator.userAgent.indexOf("HBuilderX") > 0 || "app" === C || "mp-harmony" === C);
- var n = A;
- n && !n.code && (t.debugInfo = n);
- var s = new I({
- createPromise: function createPromise() {
- return Gs(e);
- }
- });
- t.initLocalNetwork = function () {
- return s.exec();
- };
- }(t), Ys(t), Vn(t), function (e) {
- var t = e.uploadFile;
- e.uploadFile = function (e) {
- return t.call(this, e);
- };
- }(t), function (e) {
- e.database = function (t) {
- if (t && Object.keys(t).length > 0) return e.init(t).database();
- if (this._database) return this._database;
- var n = os(as, {
- uniClient: e
- });
- return this._database = n, n;
- }, e.databaseForJQL = function (t) {
- if (t && Object.keys(t).length > 0) return e.init(t).databaseForJQL();
- if (this._databaseForJQL) return this._databaseForJQL;
- var n = os(as, {
- uniClient: e,
- isJQL: !0
- });
- return this._databaseForJQL = n, n;
- };
- }(t), function (e) {
- e.getCurrentUserInfo = Ds, e.chooseAndUploadFile = qs.initChooseAndUploadFile(e), Object.assign(e, {
- get mixinDatacom() {
- return Ks(e);
- }
- }), e.SSEChannel = Vs, e.initSecureNetworkByWeixin = Hs(e), e.setCustomClientInfo = Js, e.importObject = js(e);
- }(t);
- return ["callFunction", "uploadFile", "deleteFile", "getTempFileURL", "downloadFile", "chooseAndUploadFile"].forEach(function (e) {
- if (!t[e]) return;
- var n = t[e];
- t[e] = function () {
- return n.apply(t, Array.from(arguments));
- }, t[e] = function (e, t) {
- return function (n) {
- var _this29 = this;
- var s = !1;
- if ("callFunction" === t) {
- var _e29 = n && n.type || l.DEFAULT;
- s = _e29 !== l.DEFAULT;
- }
- var r = "callFunction" === t && !s,
- i = this._initPromiseHub.exec();
- n = n || {};
- var _ee2 = ee(n),
- o = _ee2.success,
- a = _ee2.fail,
- c = _ee2.complete,
- u = i.then(function () {
- return s ? Promise.resolve() : j($(t, "invoke"), n);
- }).then(function () {
- return e.call(_this29, n);
- }).then(function (e) {
- return s ? Promise.resolve(e) : j($(t, "success"), e).then(function () {
- return j($(t, "complete"), e);
- }).then(function () {
- return r && Y(H.RESPONSE, {
- type: J.CLOUD_FUNCTION,
- content: e
- }), Promise.resolve(e);
- });
- }, function (e) {
- return s ? Promise.reject(e) : j($(t, "fail"), e).then(function () {
- return j($(t, "complete"), e);
- }).then(function () {
- return Y(H.RESPONSE, {
- type: J.CLOUD_FUNCTION,
- content: e
- }), Promise.reject(e);
- });
- });
- if (!(o || a || c)) return u;
- u.then(function (e) {
- o && o(e), c && c(e), r && Y(H.RESPONSE, {
- type: J.CLOUD_FUNCTION,
- content: e
- });
- }, function (e) {
- a && a(e), c && c(e), r && Y(H.RESPONSE, {
- type: J.CLOUD_FUNCTION,
- content: e
- });
- });
- };
- }(t[e], e).bind(t);
- }), t.init = this.init, t;
- }
- }]);
- return _class5;
- }())();
- exports.uniCloud = Xs;
- (function () {
- var e = O;
- var t = {};
- if (e && 1 === e.length) t = e[0], exports.uniCloud = Xs = Xs.init(t), Xs._isDefault = !0;else {
- var _t21 = ["auth", "callFunction", "uploadFile", "deleteFile", "getTempFileURL", "downloadFile", "database", "getCurrentUSerInfo", "importObject"];
- var _n20;
- _n20 = e && e.length > 0 ? "应用有多个服务空间,请通过uniCloud.init方法指定要使用的服务空间" : x ? "应用未关联服务空间,请在uniCloud目录右键关联服务空间" : "uni-app cli项目内使用uniCloud需要使用HBuilderX的运行菜单运行项目,且需要在uniCloud目录关联服务空间", _t21.forEach(function (e) {
- Xs[e] = function () {
- return console.error(_n20), Promise.reject(new te({
- code: "SYS_ERR",
- message: _n20
- }));
- };
- });
- }
- if (Object.assign(Xs, {
- get mixinDatacom() {
- return Ks(Xs);
- }
- }), Ns(Xs), Xs.addInterceptor = F, Xs.removeInterceptor = K, Xs.interceptObject = B, b && "web" === C && (window.uniCloud = Xs), "app" === C && (uni.__uniCloud = Xs), "app" === C || "web" === C) {
- var _e30 = D();
- _e30.uniCloud = Xs, _e30.UniCloudError = te;
- }
- })();
- var Zs = Xs;
- exports.default = Zs;
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../webpack/buildin/global.js */ 3), __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"], __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"]))
- /***/ }),
- /* 987 */
- /*!**********************************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/assertThisInitialized.js ***!
- \**********************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- function _assertThisInitialized(self) {
- if (self === void 0) {
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- }
- return self;
- }
- module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 988 */
- /*!*********************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/inherits.js ***!
- \*********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf.js */ 16);
- function _inherits(subClass, superClass) {
- if (typeof superClass !== "function" && superClass !== null) {
- throw new TypeError("Super expression must either be null or a function");
- }
- subClass.prototype = Object.create(superClass && superClass.prototype, {
- constructor: {
- value: subClass,
- writable: true,
- configurable: true
- }
- });
- Object.defineProperty(subClass, "prototype", {
- writable: false
- });
- if (superClass) setPrototypeOf(subClass, superClass);
- }
- module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 989 */
- /*!**************************************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js ***!
- \**************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var _typeof = __webpack_require__(/*! ./typeof.js */ 13)["default"];
- var assertThisInitialized = __webpack_require__(/*! ./assertThisInitialized.js */ 987);
- function _possibleConstructorReturn(self, call) {
- if (call && (_typeof(call) === "object" || typeof call === "function")) {
- return call;
- } else if (call !== void 0) {
- throw new TypeError("Derived constructors may only return object or undefined");
- }
- return assertThisInitialized(self);
- }
- module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 990 */
- /*!***************************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/getPrototypeOf.js ***!
- \***************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- function _getPrototypeOf(o) {
- module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
- return o.__proto__ || Object.getPrototypeOf(o);
- }, module.exports.__esModule = true, module.exports["default"] = module.exports;
- return _getPrototypeOf(o);
- }
- module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 991 */
- /*!****************************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/wrapNativeSuper.js ***!
- \****************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- var getPrototypeOf = __webpack_require__(/*! ./getPrototypeOf.js */ 990);
- var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf.js */ 16);
- var isNativeFunction = __webpack_require__(/*! ./isNativeFunction.js */ 992);
- var construct = __webpack_require__(/*! ./construct.js */ 15);
- function _wrapNativeSuper(Class) {
- var _cache = typeof Map === "function" ? new Map() : undefined;
- module.exports = _wrapNativeSuper = function _wrapNativeSuper(Class) {
- if (Class === null || !isNativeFunction(Class)) return Class;
- if (typeof Class !== "function") {
- throw new TypeError("Super expression must either be null or a function");
- }
- if (typeof _cache !== "undefined") {
- if (_cache.has(Class)) return _cache.get(Class);
- _cache.set(Class, Wrapper);
- }
- function Wrapper() {
- return construct(Class, arguments, getPrototypeOf(this).constructor);
- }
- Wrapper.prototype = Object.create(Class.prototype, {
- constructor: {
- value: Wrapper,
- enumerable: false,
- writable: true,
- configurable: true
- }
- });
- return setPrototypeOf(Wrapper, Class);
- }, module.exports.__esModule = true, module.exports["default"] = module.exports;
- return _wrapNativeSuper(Class);
- }
- module.exports = _wrapNativeSuper, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 992 */
- /*!*****************************************************************!*\
- !*** ./node_modules/@babel/runtime/helpers/isNativeFunction.js ***!
- \*****************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- function _isNativeFunction(fn) {
- try {
- return Function.toString.call(fn).indexOf("[native code]") !== -1;
- } catch (e) {
- return typeof fn === "function";
- }
- }
- module.exports = _isNativeFunction, module.exports.__esModule = true, module.exports["default"] = module.exports;
- /***/ }),
- /* 993 */
- /*!*******************************************************************!*\
- !*** E:/git/2021项目/v3-H5/pages.json?{"type":"origin-pages-json"} ***!
- \*******************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _default = {
- "pages": [{
- "path": "pages/views/home/home",
- "style": {
- "navigationBarTitleText": "实验室安全智慧化管控系统",
- "navigationBarTextStyle": "white",
- "navigationBarBackgroundColor": "#0183FA"
- }
- }, {
- "path": "pages/views/teacherPage/laboratoryList",
- "style": {
- "navigationBarTitleText": "实验室安全智慧化管控系统",
- "navigationBarTextStyle": "white",
- "navigationBarBackgroundColor": "#0183FA"
- }
- }, {
- "path": "pages/views/information/information",
- "style": {
- "navigationBarTitleText": "消息"
- }
- }, {
- "path": "pages/views/information/informationInfo",
- "style": {
- "navigationBarTitleText": "消息详情"
- }
- }, {
- "path": "pages/views/mine/mine",
- "style": {
- "navigationBarTitleText": "我的",
- "navigationBarTextStyle": "white",
- "navigationBarBackgroundColor": "#0183FA"
- }
- }, {
- "path": "pages/views/login/login",
- "style": {
- "navigationBarTitleText": "",
- "navigationBarTextStyle": "white",
- "navigationStyle": "custom"
- }
- }, {
- "path": "pages/views/login/ssoLogin",
- "style": {
- "navigationBarTitleText": "统一身份认证",
- "navigationBarTextStyle": "white",
- "navigationBarBackgroundColor": "#0183FA"
- }
- }, {
- "path": "pages/views/login/ssoLoginH5",
- "style": {
- "navigationBarTitleText": "统一身份认证",
- "navigationBarTextStyle": "white",
- "navigationBarBackgroundColor": "#0183FA"
- }
- }, {
- "path": "pages/views/login/ssoCertification",
- "style": {
- "navigationBarTitleText": "身份认证",
- "navigationBarTextStyle": "white",
- "navigationBarBackgroundColor": "#0183FA"
- }
- }, {
- "path": "pages/views/scanCodePage",
- "style": {
- "navigationBarTitleText": "",
- "navigationBarTextStyle": "white",
- "navigationStyle": "custom"
- }
- }, {
- "path": "pages/views/saoCode/saoCode",
- "style": {
- "navigationBarTitleText": "",
- "navigationBarTextStyle": "white",
- "navigationBarBackgroundColor": "#0183FA"
- }
- }, {
- "path": "pages/views/saoCode/chemicalsInstructionsVideo",
- "style": {
- "navigationBarTitleText": "操作教程",
- "navigationBarTextStyle": "white",
- "navigationBarBackgroundColor": "#0183FA"
- }
- }, {
- "path": "pages/views/pages_patrolInspector/courseQRcode",
- "style": {
- "navigationBarTitleText": "课程详情",
- "navigationBarTextStyle": "white",
- "navigationBarBackgroundColor": "#0183FA"
- }
- }, {
- "path": "pages/views/pages_patrolInspector/chemicalCabinetQRcode",
- "style": {
- "navigationBarTitleText": "化学品柜详情",
- "navigationBarTextStyle": "white",
- "navigationBarBackgroundColor": "#0183FA"
- }
- }, {
- "path": "pages/views/pages_patrolInspector/chemicalDetail",
- "style": {
- "navigationBarTitleText": "化学品详情",
- "navigationBarTextStyle": "white",
- "navigationBarBackgroundColor": "#0183FA"
- }
- }, {
- "path": "pages/views/demo/index",
- "style": {
- "navigationBarTitleText": "测试页面",
- "navigationBarTextStyle": "white",
- "navigationBarBackgroundColor": "#0183FA"
- }
- }, {
- "path": "pages/views/demo/mqttDemo",
- "style": {
- "navigationBarTitleText": "mqtt测试",
- "navigationBarTextStyle": "white",
- "navigationBarBackgroundColor": "#0183FA"
- }
- }, {
- "path": "pages/views/videoPlayer",
- "style": {
- "navigationBarTitleText": "",
- "navigationBarTextStyle": "white",
- "navigationStyle": "custom"
- }
- }],
- "subPackages": [{
- "root": "devTools/page",
- "name": "devToolsPage",
- "pages": [{
- "path": "index",
- "style": {
- "navigationStyle": "custom"
- }
- }]
- }, {
- "root": "pages_basics",
- "name": "basics",
- "pages": [{
- "path": "views/forgotPassword/forgotPassword",
- "style": {
- "navigationBarTitleText": "忘记密码",
- "navigationBarTextStyle": "white",
- "navigationBarBackgroundColor": "#0183FA"
- }
- }, {
- "path": "views/editPassword/editPassword",
- "style": {
- "navigationBarTitleText": "修改密码",
- "navigationBarTextStyle": "white",
- "navigationBarBackgroundColor": "#0183FA"
- }
- }, {
- "path": "views/completeInformation/completeInformation",
- "style": {
- "navigationBarTitleText": "完善个人信息",
- "navigationBarTextStyle": "white",
- "navigationBarBackgroundColor": "#0183FA"
- }
- }, {
- "path": "views/avatar",
- "style": {
- "navigationBarTitleText": "身份验证"
- }
- }, {
- "path": "views/faceImage",
- "style": {
- "navigationBarTitleText": "身份验证"
- }
- }, {
- "path": "views/signature/signature",
- "style": {
- "navigationBarTitleText": "电子签名"
- }
- }, {
- "path": "views/signature/signatureImg",
- "style": {
- "navigationBarTitleText": "电子签名"
- }
- }, {
- "path": "views/photoInspection",
- "style": {
- "navigationBarTitleText": "离开检查"
- }
- }, {
- "path": "views/earlyWarningManage/earlyWarningDetail",
- "style": {
- "navigationBarTitleText": "预案预警信息"
- }
- }, {
- "path": "views/earlyWarningManage/earlyWarningList",
- "style": {
- "navigationBarTitleText": "预警记录"
- }
- }, {
- "path": "views/earlyWarningManage/videoMonitoring",
- "style": {
- "navigationBarTitleText": "监控信息"
- }
- }, {
- "path": "views/earlyWarningManage/warningVideo",
- "style": {
- "navigationBarTitleText": "报警抓拍"
- }
- }, {
- "path": "views/record/index",
- "style": {
- "navigationBarTitleText": "进出记录"
- }
- }, {
- "path": "views/record/infoPage",
- "style": {
- "navigationBarTitleText": "进出详情"
- }
- }, {
- "path": "views/gradingControl/gradingControl",
- "style": {
- "navigationBarTitleText": "管控工作"
- }
- }, {
- "path": "views/gradingControl/gradingControlFinish",
- "style": {
- "navigationBarTitleText": "分级管控"
- }
- }, {
- "path": "views/gradingControl/gradingControlAdd",
- "style": {
- "navigationBarTitleText": "分级管控"
- }
- }, {
- "path": "views/gradingControl/gradingControlDetail",
- "style": {
- "navigationBarTitleText": "分级管控"
- }
- }]
- }, {
- "root": "pages_student",
- "name": "student",
- "pages": [{
- "path": "views/accessApplication/accessApplication",
- "style": {
- "navigationBarTitleText": "安全准入"
- }
- }, {
- "path": "views/accessApplication/applicationDetails",
- "style": {
- "navigationBarTitleText": ""
- }
- }, {
- "path": "views/accessApplication/chooseALaboratory",
- "style": {
- "navigationBarTitleText": "安全准入"
- }
- }, {
- "path": "views/accessApplication/newApplication",
- "style": {
- "navigationBarTitleText": "准入申请"
- }
- }, {
- "path": "views/accessApplication/safeAccess",
- "style": {
- "navigationBarTitleText": "我的准入"
- }
- }, {
- "path": "views/myRecord/index",
- "style": {
- "navigationBarTitleText": "进出记录"
- }
- }, {
- "path": "views/myRecord/infoPage",
- "style": {
- "navigationBarTitleText": "进出详情"
- }
- }]
- }, {
- "root": "pages_manage",
- "name": "manage",
- "pages": [{
- "path": "views/accessControl/empowerOpen",
- "style": {
- "navigationBarTitleText": "授权开门"
- }
- }, {
- "path": "views/accessControl/remoteOpen",
- "style": {
- "navigationBarTitleText": "远程开门"
- }
- }, {
- "path": "views/accessControl/authorizationRecord",
- "style": {
- "navigationBarTitleText": "授权记录"
- }
- }, {
- "path": "views/accessControl/searchSub",
- "style": {
- "navigationBarTitleText": "实验室"
- }
- }, {
- "path": "views/accessQualification/accessQualification",
- "style": {
- "navigationBarTitleText": "准入审核"
- }
- }, {
- "path": "views/accessQualification/accessQualificationInfo",
- "style": {
- "navigationBarTitleText": ""
- }
- }, {
- "path": "views/accessQualification/approve",
- "style": {
- "navigationBarTitleText": "审核未通过"
- }
- }, {
- "path": "views/emergencyEvacuationSubList",
- "style": {
- "navigationBarTitleText": "应急处置"
- }
- }, {
- "path": "views/emergencyEvacuationBig",
- "style": {
- "navigationBarTitleText": "应急处置"
- }
- }, {
- "path": "views/emergencyEvacuationBigFullScreen",
- "style": {
- "navigationBarTitleText": "应急处置",
- "pageOrientation": "landscape"
- }
- }, {
- "path": "views/laboratory/safetyCardScan",
- "style": {
- "navigationBarTitleText": "实验室"
- }
- }, {
- "path": "views/laboratory/videoPlayer",
- "style": {
- "navigationBarTitleText": "视频监控",
- "enablePullDownRefresh": true
- }
- }]
- }, {
- "root": "pages_safetyCheck",
- "name": "safetyCheck",
- "pages": [{
- "path": "views/demo/index",
- "style": {
- "navigationBarTitleText": "安全检查分包",
- "navigationBarTextStyle": "white",
- "navigationBarBackgroundColor": "#0183FA"
- }
- }]
- }],
- "globalStyle": {
- "navigationBarTextStyle": "white",
- "navigationBarBackgroundColor": "#0183FA"
- }
- };
- exports.default = _default;
- /***/ }),
- /* 994 */
- /*!******************************************************!*\
- !*** E:/git/2021项目/v3-H5/pages.json?{"type":"stat"} ***!
- \******************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _default = {
- "appid": "__UNI__4A158B4"
- };
- exports.default = _default;
- /***/ }),
- /* 995 */,
- /* 996 */,
- /* 997 */,
- /* 998 */,
- /* 999 */,
- /* 1000 */,
- /* 1001 */,
- /* 1002 */,
- /* 1003 */,
- /* 1004 */,
- /* 1005 */,
- /* 1006 */,
- /* 1007 */,
- /* 1008 */,
- /* 1009 */,
- /* 1010 */,
- /* 1011 */,
- /* 1012 */,
- /* 1013 */,
- /* 1014 */,
- /* 1015 */,
- /* 1016 */,
- /* 1017 */,
- /* 1018 */,
- /* 1019 */,
- /* 1020 */,
- /* 1021 */,
- /* 1022 */,
- /* 1023 */,
- /* 1024 */,
- /* 1025 */,
- /* 1026 */,
- /* 1027 */,
- /* 1028 */,
- /* 1029 */,
- /* 1030 */
- /*!****************************************************!*\
- !*** E:/git/2021项目/v3-H5/component/system-info.js ***!
- \****************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(uni, wx) {
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.systemInfo = void 0;
- /**
- * 此js文件管理关于当前设备的机型系统信息
- */
- var systemInfo = function systemInfo() {
- /****************** 所有平台共有的系统信息 ********************/
- // 设备系统信息
- var systemInfomations = uni.getSystemInfoSync();
- // 机型适配比例系数
- var scaleFactor = 750 / systemInfomations.windowWidth;
- // 当前机型-屏幕高度
- var windowHeight = systemInfomations.windowHeight * scaleFactor; //rpx
- // 当前机型-屏幕宽度
- var windowWidth = systemInfomations.windowWidth * scaleFactor; //rpx
- // 状态栏高度
- var statusBarHeight = systemInfomations.statusBarHeight * scaleFactor; //rpx
- // 导航栏高度 注意:此导航栏高度只针对微信小程序有效 其他平台如自定义导航栏请使用:状态栏高度+自定义文本高度
- var navHeight = 0; //rpx
- // console.log(windowHeight,'哈哈哈哈哈');
- /****************** 微信小程序头部胶囊信息 ********************/
- var menuButtonInfo = wx.getMenuButtonBoundingClientRect();
- // 胶囊高度
- var menuButtonHeight = menuButtonInfo.height * scaleFactor; //rpx
- // 胶囊宽度
- var menuButtonWidth = menuButtonInfo.width * scaleFactor; //rpx
- // 胶囊上边界的坐标
- var menuButtonTop = menuButtonInfo.top * scaleFactor; //rpx
- // 胶囊右边界的坐标
- var menuButtonRight = menuButtonInfo.right * scaleFactor; //rpx
- // 胶囊下边界的坐标
- var menuButtonBottom = menuButtonInfo.bottom * scaleFactor; //rpx
- // 胶囊左边界的坐标
- var menuButtonLeft = menuButtonInfo.left * scaleFactor; //rpx
- // 微信小程序中导航栏高度 = 胶囊高度 + (顶部距离 - 状态栏高度) * 2
- navHeight = menuButtonHeight + (menuButtonTop - statusBarHeight) * 2;
- return {
- scaleFactor: scaleFactor,
- windowHeight: windowHeight,
- windowWidth: windowWidth,
- statusBarHeight: statusBarHeight,
- menuButtonHeight: menuButtonHeight,
- menuButtonWidth: menuButtonWidth,
- menuButtonTop: menuButtonTop,
- menuButtonRight: menuButtonRight,
- menuButtonBottom: menuButtonBottom,
- menuButtonLeft: menuButtonLeft,
- navHeight: navHeight
- };
- };
- exports.systemInfo = systemInfo;
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"], __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"]))
- /***/ }),
- /* 1031 */,
- /* 1032 */,
- /* 1033 */,
- /* 1034 */,
- /* 1035 */,
- /* 1036 */,
- /* 1037 */,
- /* 1038 */,
- /* 1039 */,
- /* 1040 */,
- /* 1041 */,
- /* 1042 */,
- /* 1043 */,
- /* 1044 */,
- /* 1045 */,
- /* 1046 */,
- /* 1047 */,
- /* 1048 */,
- /* 1049 */,
- /* 1050 */,
- /* 1051 */,
- /* 1052 */,
- /* 1053 */,
- /* 1054 */,
- /* 1055 */,
- /* 1056 */,
- /* 1057 */,
- /* 1058 */,
- /* 1059 */,
- /* 1060 */,
- /* 1061 */,
- /* 1062 */,
- /* 1063 */,
- /* 1064 */,
- /* 1065 */,
- /* 1066 */,
- /* 1067 */,
- /* 1068 */,
- /* 1069 */,
- /* 1070 */,
- /* 1071 */,
- /* 1072 */,
- /* 1073 */,
- /* 1074 */,
- /* 1075 */,
- /* 1076 */,
- /* 1077 */,
- /* 1078 */,
- /* 1079 */,
- /* 1080 */,
- /* 1081 */,
- /* 1082 */,
- /* 1083 */,
- /* 1084 */,
- /* 1085 */,
- /* 1086 */,
- /* 1087 */,
- /* 1088 */,
- /* 1089 */,
- /* 1090 */,
- /* 1091 */,
- /* 1092 */,
- /* 1093 */,
- /* 1094 */,
- /* 1095 */,
- /* 1096 */,
- /* 1097 */,
- /* 1098 */,
- /* 1099 */,
- /* 1100 */,
- /* 1101 */,
- /* 1102 */,
- /* 1103 */,
- /* 1104 */,
- /* 1105 */,
- /* 1106 */,
- /* 1107 */,
- /* 1108 */,
- /* 1109 */,
- /* 1110 */,
- /* 1111 */,
- /* 1112 */,
- /* 1113 */,
- /* 1114 */,
- /* 1115 */,
- /* 1116 */,
- /* 1117 */,
- /* 1118 */,
- /* 1119 */,
- /* 1120 */,
- /* 1121 */,
- /* 1122 */,
- /* 1123 */,
- /* 1124 */,
- /* 1125 */,
- /* 1126 */,
- /* 1127 */,
- /* 1128 */,
- /* 1129 */,
- /* 1130 */,
- /* 1131 */,
- /* 1132 */,
- /* 1133 */,
- /* 1134 */,
- /* 1135 */,
- /* 1136 */,
- /* 1137 */,
- /* 1138 */,
- /* 1139 */,
- /* 1140 */,
- /* 1141 */,
- /* 1142 */,
- /* 1143 */,
- /* 1144 */,
- /* 1145 */,
- /* 1146 */,
- /* 1147 */,
- /* 1148 */,
- /* 1149 */,
- /* 1150 */,
- /* 1151 */,
- /* 1152 */,
- /* 1153 */,
- /* 1154 */,
- /* 1155 */,
- /* 1156 */,
- /* 1157 */,
- /* 1158 */,
- /* 1159 */,
- /* 1160 */,
- /* 1161 */,
- /* 1162 */,
- /* 1163 */,
- /* 1164 */,
- /* 1165 */,
- /* 1166 */,
- /* 1167 */,
- /* 1168 */,
- /* 1169 */,
- /* 1170 */,
- /* 1171 */,
- /* 1172 */,
- /* 1173 */,
- /* 1174 */,
- /* 1175 */,
- /* 1176 */,
- /* 1177 */,
- /* 1178 */,
- /* 1179 */,
- /* 1180 */,
- /* 1181 */,
- /* 1182 */,
- /* 1183 */,
- /* 1184 */,
- /* 1185 */,
- /* 1186 */,
- /* 1187 */,
- /* 1188 */,
- /* 1189 */,
- /* 1190 */,
- /* 1191 */,
- /* 1192 */,
- /* 1193 */,
- /* 1194 */,
- /* 1195 */,
- /* 1196 */,
- /* 1197 */,
- /* 1198 */,
- /* 1199 */,
- /* 1200 */,
- /* 1201 */,
- /* 1202 */,
- /* 1203 */,
- /* 1204 */,
- /* 1205 */,
- /* 1206 */,
- /* 1207 */,
- /* 1208 */,
- /* 1209 */,
- /* 1210 */,
- /* 1211 */,
- /* 1212 */,
- /* 1213 */,
- /* 1214 */,
- /* 1215 */,
- /* 1216 */,
- /* 1217 */,
- /* 1218 */,
- /* 1219 */,
- /* 1220 */,
- /* 1221 */,
- /* 1222 */,
- /* 1223 */,
- /* 1224 */,
- /* 1225 */,
- /* 1226 */,
- /* 1227 */,
- /* 1228 */,
- /* 1229 */,
- /* 1230 */,
- /* 1231 */,
- /* 1232 */,
- /* 1233 */,
- /* 1234 */,
- /* 1235 */,
- /* 1236 */,
- /* 1237 */,
- /* 1238 */,
- /* 1239 */,
- /* 1240 */,
- /* 1241 */,
- /* 1242 */,
- /* 1243 */,
- /* 1244 */,
- /* 1245 */,
- /* 1246 */,
- /* 1247 */,
- /* 1248 */
- /*!********************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/uni_modules/uni-load-more/components/uni-load-more/i18n/index.js ***!
- \********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _en = _interopRequireDefault(__webpack_require__(/*! ./en.json */ 1249));
- var _zhHans = _interopRequireDefault(__webpack_require__(/*! ./zh-Hans.json */ 1250));
- var _zhHant = _interopRequireDefault(__webpack_require__(/*! ./zh-Hant.json */ 1251));
- var _default = {
- en: _en.default,
- 'zh-Hans': _zhHans.default,
- 'zh-Hant': _zhHant.default
- };
- exports.default = _default;
- /***/ }),
- /* 1249 */
- /*!*******************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/uni_modules/uni-load-more/components/uni-load-more/i18n/en.json ***!
- \*******************************************************************************************/
- /*! exports provided: uni-load-more.contentdown, uni-load-more.contentrefresh, uni-load-more.contentnomore, default */
- /***/ (function(module) {
- module.exports = JSON.parse("{\"uni-load-more.contentdown\":\"Pull up to show more\",\"uni-load-more.contentrefresh\":\"loading...\",\"uni-load-more.contentnomore\":\"No more data\"}");
- /***/ }),
- /* 1250 */
- /*!************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/uni_modules/uni-load-more/components/uni-load-more/i18n/zh-Hans.json ***!
- \************************************************************************************************/
- /*! exports provided: uni-load-more.contentdown, uni-load-more.contentrefresh, uni-load-more.contentnomore, default */
- /***/ (function(module) {
- module.exports = JSON.parse("{\"uni-load-more.contentdown\":\"上拉显示更多\",\"uni-load-more.contentrefresh\":\"正在加载...\",\"uni-load-more.contentnomore\":\"没有更多数据了\"}");
- /***/ }),
- /* 1251 */
- /*!************************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/uni_modules/uni-load-more/components/uni-load-more/i18n/zh-Hant.json ***!
- \************************************************************************************************/
- /*! exports provided: uni-load-more.contentdown, uni-load-more.contentrefresh, uni-load-more.contentnomore, default */
- /***/ (function(module) {
- module.exports = JSON.parse("{\"uni-load-more.contentdown\":\"上拉顯示更多\",\"uni-load-more.contentrefresh\":\"正在加載...\",\"uni-load-more.contentnomore\":\"沒有更多數據了\"}");
- /***/ }),
- /* 1252 */,
- /* 1253 */,
- /* 1254 */,
- /* 1255 */,
- /* 1256 */,
- /* 1257 */,
- /* 1258 */,
- /* 1259 */,
- /* 1260 */,
- /* 1261 */,
- /* 1262 */,
- /* 1263 */,
- /* 1264 */,
- /* 1265 */,
- /* 1266 */,
- /* 1267 */,
- /* 1268 */,
- /* 1269 */,
- /* 1270 */,
- /* 1271 */,
- /* 1272 */,
- /* 1273 */,
- /* 1274 */,
- /* 1275 */,
- /* 1276 */,
- /* 1277 */,
- /* 1278 */,
- /* 1279 */,
- /* 1280 */,
- /* 1281 */,
- /* 1282 */,
- /* 1283 */,
- /* 1284 */,
- /* 1285 */,
- /* 1286 */,
- /* 1287 */,
- /* 1288 */,
- /* 1289 */,
- /* 1290 */,
- /* 1291 */,
- /* 1292 */,
- /* 1293 */,
- /* 1294 */,
- /* 1295 */,
- /* 1296 */,
- /* 1297 */,
- /* 1298 */,
- /* 1299 */,
- /* 1300 */,
- /* 1301 */,
- /* 1302 */,
- /* 1303 */,
- /* 1304 */,
- /* 1305 */,
- /* 1306 */,
- /* 1307 */,
- /* 1308 */,
- /* 1309 */,
- /* 1310 */,
- /* 1311 */,
- /* 1312 */,
- /* 1313 */,
- /* 1314 */,
- /* 1315 */,
- /* 1316 */,
- /* 1317 */,
- /* 1318 */,
- /* 1319 */,
- /* 1320 */,
- /* 1321 */,
- /* 1322 */,
- /* 1323 */,
- /* 1324 */,
- /* 1325 */,
- /* 1326 */,
- /* 1327 */,
- /* 1328 */,
- /* 1329 */,
- /* 1330 */,
- /* 1331 */,
- /* 1332 */,
- /* 1333 */,
- /* 1334 */,
- /* 1335 */,
- /* 1336 */,
- /* 1337 */,
- /* 1338 */,
- /* 1339 */,
- /* 1340 */,
- /* 1341 */,
- /* 1342 */,
- /* 1343 */,
- /* 1344 */,
- /* 1345 */,
- /* 1346 */,
- /* 1347 */,
- /* 1348 */,
- /* 1349 */,
- /* 1350 */,
- /* 1351 */,
- /* 1352 */,
- /* 1353 */,
- /* 1354 */,
- /* 1355 */,
- /* 1356 */,
- /* 1357 */,
- /* 1358 */,
- /* 1359 */,
- /* 1360 */,
- /* 1361 */,
- /* 1362 */,
- /* 1363 */,
- /* 1364 */,
- /* 1365 */,
- /* 1366 */,
- /* 1367 */,
- /* 1368 */,
- /* 1369 */,
- /* 1370 */,
- /* 1371 */,
- /* 1372 */,
- /* 1373 */,
- /* 1374 */,
- /* 1375 */,
- /* 1376 */,
- /* 1377 */,
- /* 1378 */,
- /* 1379 */,
- /* 1380 */,
- /* 1381 */
- /*!************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/uni_modules/qiun-data-charts/js_sdk/u-charts/u-charts.js ***!
- \************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*
- * uCharts (R)
- * 高性能跨平台图表库,支持H5、APP、小程序(微信/支付宝/百度/头条/QQ/360/快手)、Vue、Taro等支持canvas的框架平台
- * Copyright (C) 2018-2022 QIUN (R) 秋云 https://www.ucharts.cn All rights reserved.
- * Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
- * 复制使用请保留本段注释,感谢支持开源!
- *
- * uCharts (R) 官方网站
- * https://www.uCharts.cn
- *
- * 开源地址:
- * https://gitee.com/uCharts/uCharts
- *
- * uni-app插件市场地址:
- * http://ext.dcloud.net.cn/plugin?id=271
- *
- */
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 5));
- var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
- var config = {
- version: 'v2.5.0-20230101',
- yAxisWidth: 15,
- xAxisHeight: 22,
- padding: [10, 10, 10, 10],
- rotate: false,
- fontSize: 13,
- fontColor: '#666666',
- dataPointShape: ['circle', 'circle', 'circle', 'circle'],
- color: ['#1890FF', '#91CB74', '#FAC858', '#EE6666', '#73C0DE', '#3CA272', '#FC8452', '#9A60B4', '#ea7ccc'],
- linearColor: ['#0EE2F8', '#2BDCA8', '#FA7D8D', '#EB88E2', '#2AE3A0', '#0EE2F8', '#EB88E2', '#6773E3', '#F78A85'],
- pieChartLinePadding: 15,
- pieChartTextPadding: 5,
- titleFontSize: 20,
- subtitleFontSize: 15,
- radarLabelTextMargin: 13
- };
- var assign = function assign(target) {
- for (var _len2 = arguments.length, varArgs = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
- varArgs[_key2 - 1] = arguments[_key2];
- }
- if (target == null) {
- throw new TypeError('[uCharts] Cannot convert undefined or null to object');
- }
- if (!varArgs || varArgs.length <= 0) {
- return target;
- }
- // 深度合并对象
- function deepAssign(obj1, obj2) {
- for (var key in obj2) {
- obj1[key] = obj1[key] && obj1[key].toString() === "[object Object]" ? deepAssign(obj1[key], obj2[key]) : obj1[key] = obj2[key];
- }
- return obj1;
- }
- varArgs.forEach(function (val) {
- target = deepAssign(target, val);
- });
- return target;
- };
- var util = {
- toFixed: function toFixed(num, limit) {
- limit = limit || 2;
- if (this.isFloat(num)) {
- num = num.toFixed(limit);
- }
- return num;
- },
- isFloat: function isFloat(num) {
- return num % 1 !== 0;
- },
- approximatelyEqual: function approximatelyEqual(num1, num2) {
- return Math.abs(num1 - num2) < 1e-10;
- },
- isSameSign: function isSameSign(num1, num2) {
- return Math.abs(num1) === num1 && Math.abs(num2) === num2 || Math.abs(num1) !== num1 && Math.abs(num2) !== num2;
- },
- isSameXCoordinateArea: function isSameXCoordinateArea(p1, p2) {
- return this.isSameSign(p1.x, p2.x);
- },
- isCollision: function isCollision(obj1, obj2) {
- obj1.end = {};
- obj1.end.x = obj1.start.x + obj1.width;
- obj1.end.y = obj1.start.y - obj1.height;
- obj2.end = {};
- obj2.end.x = obj2.start.x + obj2.width;
- obj2.end.y = obj2.start.y - obj2.height;
- var flag = obj2.start.x > obj1.end.x || obj2.end.x < obj1.start.x || obj2.end.y > obj1.start.y || obj2.start.y < obj1.end.y;
- return !flag;
- }
- };
- //兼容H5点击事件
- function getH5Offset(e) {
- e.mp = {
- changedTouches: []
- };
- e.mp.changedTouches.push({
- x: e.offsetX,
- y: e.offsetY
- });
- return e;
- }
- // hex 转 rgba
- function hexToRgb(hexValue, opc) {
- var rgx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
- var hex = hexValue.replace(rgx, function (m, r, g, b) {
- return r + r + g + g + b + b;
- });
- var rgb = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
- var r = parseInt(rgb[1], 16);
- var g = parseInt(rgb[2], 16);
- var b = parseInt(rgb[3], 16);
- return 'rgba(' + r + ',' + g + ',' + b + ',' + opc + ')';
- }
- function findRange(num, type, limit) {
- if (isNaN(num)) {
- throw new Error('[uCharts] series数据需为Number格式');
- }
- limit = limit || 10;
- type = type ? type : 'upper';
- var multiple = 1;
- while (limit < 1) {
- limit *= 10;
- multiple *= 10;
- }
- if (type === 'upper') {
- num = Math.ceil(num * multiple);
- } else {
- num = Math.floor(num * multiple);
- }
- while (num % limit !== 0) {
- if (type === 'upper') {
- if (num == num + 1) {
- //修复数据值过大num++无效的bug by 向日葵 @xrk_jy
- break;
- }
- num++;
- } else {
- num--;
- }
- }
- return num / multiple;
- }
- function calCandleMA(dayArr, nameArr, colorArr, kdata) {
- var seriesTemp = [];
- for (var k = 0; k < dayArr.length; k++) {
- var seriesItem = {
- data: [],
- name: nameArr[k],
- color: colorArr[k]
- };
- for (var i = 0, len = kdata.length; i < len; i++) {
- if (i < dayArr[k]) {
- seriesItem.data.push(null);
- continue;
- }
- var sum = 0;
- for (var j = 0; j < dayArr[k]; j++) {
- sum += kdata[i - j][1];
- }
- seriesItem.data.push(+(sum / dayArr[k]).toFixed(3));
- }
- seriesTemp.push(seriesItem);
- }
- return seriesTemp;
- }
- function calValidDistance(self, distance, chartData, config, opts) {
- var dataChartAreaWidth = opts.width - opts.area[1] - opts.area[3];
- var dataChartWidth = chartData.eachSpacing * (opts.chartData.xAxisData.xAxisPoints.length - 1);
- if (opts.type == 'mount' && opts.extra && opts.extra.mount && opts.extra.mount.widthRatio && opts.extra.mount.widthRatio > 1) {
- if (opts.extra.mount.widthRatio > 2) opts.extra.mount.widthRatio = 2;
- dataChartWidth += (opts.extra.mount.widthRatio - 1) * chartData.eachSpacing;
- }
- var validDistance = distance;
- if (distance >= 0) {
- validDistance = 0;
- self.uevent.trigger('scrollLeft');
- self.scrollOption.position = 'left';
- opts.xAxis.scrollPosition = 'left';
- } else if (Math.abs(distance) >= dataChartWidth - dataChartAreaWidth) {
- validDistance = dataChartAreaWidth - dataChartWidth;
- self.uevent.trigger('scrollRight');
- self.scrollOption.position = 'right';
- opts.xAxis.scrollPosition = 'right';
- } else {
- self.scrollOption.position = distance;
- opts.xAxis.scrollPosition = distance;
- }
- return validDistance;
- }
- function isInAngleRange(angle, startAngle, endAngle) {
- function adjust(angle) {
- while (angle < 0) {
- angle += 2 * Math.PI;
- }
- while (angle > 2 * Math.PI) {
- angle -= 2 * Math.PI;
- }
- return angle;
- }
- angle = adjust(angle);
- startAngle = adjust(startAngle);
- endAngle = adjust(endAngle);
- if (startAngle > endAngle) {
- endAngle += 2 * Math.PI;
- if (angle < startAngle) {
- angle += 2 * Math.PI;
- }
- }
- return angle >= startAngle && angle <= endAngle;
- }
- function createCurveControlPoints(points, i) {
- function isNotMiddlePoint(points, i) {
- if (points[i - 1] && points[i + 1]) {
- return points[i].y >= Math.max(points[i - 1].y, points[i + 1].y) || points[i].y <= Math.min(points[i - 1].y, points[i + 1].y);
- } else {
- return false;
- }
- }
- function isNotMiddlePointX(points, i) {
- if (points[i - 1] && points[i + 1]) {
- return points[i].x >= Math.max(points[i - 1].x, points[i + 1].x) || points[i].x <= Math.min(points[i - 1].x, points[i + 1].x);
- } else {
- return false;
- }
- }
- var a = 0.2;
- var b = 0.2;
- var pAx = null;
- var pAy = null;
- var pBx = null;
- var pBy = null;
- if (i < 1) {
- pAx = points[0].x + (points[1].x - points[0].x) * a;
- pAy = points[0].y + (points[1].y - points[0].y) * a;
- } else {
- pAx = points[i].x + (points[i + 1].x - points[i - 1].x) * a;
- pAy = points[i].y + (points[i + 1].y - points[i - 1].y) * a;
- }
- if (i > points.length - 3) {
- var last = points.length - 1;
- pBx = points[last].x - (points[last].x - points[last - 1].x) * b;
- pBy = points[last].y - (points[last].y - points[last - 1].y) * b;
- } else {
- pBx = points[i + 1].x - (points[i + 2].x - points[i].x) * b;
- pBy = points[i + 1].y - (points[i + 2].y - points[i].y) * b;
- }
- if (isNotMiddlePoint(points, i + 1)) {
- pBy = points[i + 1].y;
- }
- if (isNotMiddlePoint(points, i)) {
- pAy = points[i].y;
- }
- if (isNotMiddlePointX(points, i + 1)) {
- pBx = points[i + 1].x;
- }
- if (isNotMiddlePointX(points, i)) {
- pAx = points[i].x;
- }
- if (pAy >= Math.max(points[i].y, points[i + 1].y) || pAy <= Math.min(points[i].y, points[i + 1].y)) {
- pAy = points[i].y;
- }
- if (pBy >= Math.max(points[i].y, points[i + 1].y) || pBy <= Math.min(points[i].y, points[i + 1].y)) {
- pBy = points[i + 1].y;
- }
- if (pAx >= Math.max(points[i].x, points[i + 1].x) || pAx <= Math.min(points[i].x, points[i + 1].x)) {
- pAx = points[i].x;
- }
- if (pBx >= Math.max(points[i].x, points[i + 1].x) || pBx <= Math.min(points[i].x, points[i + 1].x)) {
- pBx = points[i + 1].x;
- }
- return {
- ctrA: {
- x: pAx,
- y: pAy
- },
- ctrB: {
- x: pBx,
- y: pBy
- }
- };
- }
- function convertCoordinateOrigin(x, y, center) {
- return {
- x: center.x + x,
- y: center.y - y
- };
- }
- function avoidCollision(obj, target) {
- if (target) {
- // is collision test
- while (util.isCollision(obj, target)) {
- if (obj.start.x > 0) {
- obj.start.y--;
- } else if (obj.start.x < 0) {
- obj.start.y++;
- } else {
- if (obj.start.y > 0) {
- obj.start.y++;
- } else {
- obj.start.y--;
- }
- }
- }
- }
- return obj;
- }
- function fixPieSeries(series, opts, config) {
- var pieSeriesArr = [];
- if (series.length > 0 && series[0].data.constructor.toString().indexOf('Array') > -1) {
- opts._pieSeries_ = series;
- var oldseries = series[0].data;
- for (var i = 0; i < oldseries.length; i++) {
- oldseries[i].formatter = series[0].formatter;
- oldseries[i].data = oldseries[i].value;
- pieSeriesArr.push(oldseries[i]);
- }
- opts.series = pieSeriesArr;
- } else {
- pieSeriesArr = series;
- }
- return pieSeriesArr;
- }
- function fillSeries(series, opts, config) {
- var index = 0;
- for (var i = 0; i < series.length; i++) {
- var item = series[i];
- if (!item.color) {
- item.color = config.color[index];
- index = (index + 1) % config.color.length;
- }
- if (!item.linearIndex) {
- item.linearIndex = i;
- }
- if (!item.index) {
- item.index = 0;
- }
- if (!item.type) {
- item.type = opts.type;
- }
- if (typeof item.show == "undefined") {
- item.show = true;
- }
- if (!item.type) {
- item.type = opts.type;
- }
- if (!item.pointShape) {
- item.pointShape = "circle";
- }
- if (!item.legendShape) {
- switch (item.type) {
- case 'line':
- item.legendShape = "line";
- break;
- case 'column':
- case 'bar':
- item.legendShape = "rect";
- break;
- case 'area':
- case 'mount':
- item.legendShape = "triangle";
- break;
- default:
- item.legendShape = "circle";
- }
- }
- }
- return series;
- }
- function fillCustomColor(linearType, customColor, series, config) {
- var newcolor = customColor || [];
- if (linearType == 'custom' && newcolor.length == 0) {
- newcolor = config.linearColor;
- }
- if (linearType == 'custom' && newcolor.length < series.length) {
- var chazhi = series.length - newcolor.length;
- for (var i = 0; i < chazhi; i++) {
- newcolor.push(config.linearColor[(i + 1) % config.linearColor.length]);
- }
- }
- return newcolor;
- }
- function getDataRange(minData, maxData) {
- var limit = 0;
- var range = maxData - minData;
- if (range >= 10000) {
- limit = 1000;
- } else if (range >= 1000) {
- limit = 100;
- } else if (range >= 100) {
- limit = 10;
- } else if (range >= 10) {
- limit = 5;
- } else if (range >= 1) {
- limit = 1;
- } else if (range >= 0.1) {
- limit = 0.1;
- } else if (range >= 0.01) {
- limit = 0.01;
- } else if (range >= 0.001) {
- limit = 0.001;
- } else if (range >= 0.0001) {
- limit = 0.0001;
- } else if (range >= 0.00001) {
- limit = 0.00001;
- } else {
- limit = 0.000001;
- }
- return {
- minRange: findRange(minData, 'lower', limit),
- maxRange: findRange(maxData, 'upper', limit)
- };
- }
- function measureText(text, fontSize, context) {
- var width = 0;
- text = String(text);
- if (context !== false && context !== undefined && context.setFontSize && context.measureText) {
- context.setFontSize(fontSize);
- return context.measureText(text).width;
- } else {
- var text = text.split('');
- for (var i = 0; i < text.length; i++) {
- var item = text[i];
- if (/[a-zA-Z]/.test(item)) {
- width += 7;
- } else if (/[0-9]/.test(item)) {
- width += 5.5;
- } else if (/\./.test(item)) {
- width += 2.7;
- } else if (/-/.test(item)) {
- width += 3.25;
- } else if (/:/.test(item)) {
- width += 2.5;
- } else if (/[\u4e00-\u9fa5]/.test(item)) {
- width += 10;
- } else if (/\(|\)/.test(item)) {
- width += 3.73;
- } else if (/\s/.test(item)) {
- width += 2.5;
- } else if (/%/.test(item)) {
- width += 8;
- } else {
- width += 10;
- }
- }
- return width * fontSize / 10;
- }
- }
- function dataCombine(series) {
- return series.reduce(function (a, b) {
- return (a.data ? a.data : a).concat(b.data);
- }, []);
- }
- function dataCombineStack(series, len) {
- var sum = new Array(len);
- for (var j = 0; j < sum.length; j++) {
- sum[j] = 0;
- }
- for (var i = 0; i < series.length; i++) {
- for (var j = 0; j < sum.length; j++) {
- sum[j] += series[i].data[j];
- }
- }
- return series.reduce(function (a, b) {
- return (a.data ? a.data : a).concat(b.data).concat(sum);
- }, []);
- }
- function getTouches(touches, opts, e) {
- var x, y;
- if (touches.clientX) {
- if (opts.rotate) {
- y = opts.height - touches.clientX * opts.pix;
- x = (touches.pageY - e.currentTarget.offsetTop - opts.height / opts.pix / 2 * (opts.pix - 1)) * opts.pix;
- } else {
- x = touches.clientX * opts.pix;
- y = (touches.pageY - e.currentTarget.offsetTop - opts.height / opts.pix / 2 * (opts.pix - 1)) * opts.pix;
- }
- } else {
- if (opts.rotate) {
- y = opts.height - touches.x * opts.pix;
- x = touches.y * opts.pix;
- } else {
- x = touches.x * opts.pix;
- y = touches.y * opts.pix;
- }
- }
- return {
- x: x,
- y: y
- };
- }
- function getSeriesDataItem(series, index, group) {
- var data = [];
- var newSeries = [];
- var indexIsArr = index.constructor.toString().indexOf('Array') > -1;
- if (indexIsArr) {
- var tempSeries = filterSeries(series);
- for (var i = 0; i < group.length; i++) {
- newSeries.push(tempSeries[group[i]]);
- }
- } else {
- newSeries = series;
- }
- ;
- for (var _i = 0; _i < newSeries.length; _i++) {
- var item = newSeries[_i];
- var tmpindex = -1;
- if (indexIsArr) {
- tmpindex = index[_i];
- } else {
- tmpindex = index;
- }
- if (item.data[tmpindex] !== null && typeof item.data[tmpindex] !== 'undefined' && item.show) {
- var seriesItem = {};
- seriesItem.color = item.color;
- seriesItem.type = item.type;
- seriesItem.style = item.style;
- seriesItem.pointShape = item.pointShape;
- seriesItem.disableLegend = item.disableLegend;
- seriesItem.legendShape = item.legendShape;
- seriesItem.name = item.name;
- seriesItem.show = item.show;
- seriesItem.data = item.formatter ? item.formatter(item.data[tmpindex]) : item.data[tmpindex];
- data.push(seriesItem);
- }
- }
- return data;
- }
- function getMaxTextListLength(list, fontSize, context) {
- var lengthList = list.map(function (item) {
- return measureText(item, fontSize, context);
- });
- return Math.max.apply(null, lengthList);
- }
- function getRadarCoordinateSeries(length) {
- var eachAngle = 2 * Math.PI / length;
- var CoordinateSeries = [];
- for (var i = 0; i < length; i++) {
- CoordinateSeries.push(eachAngle * i);
- }
- return CoordinateSeries.map(function (item) {
- return -1 * item + Math.PI / 2;
- });
- }
- function getToolTipData(seriesData, opts, index, group, categories) {
- var option = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
- var calPoints = opts.chartData.calPoints ? opts.chartData.calPoints : [];
- var points = {};
- if (group.length > 0) {
- var filterPoints = [];
- for (var i = 0; i < group.length; i++) {
- filterPoints.push(calPoints[group[i]]);
- }
- points = filterPoints[0][index[0]];
- } else {
- for (var _i2 = 0; _i2 < calPoints.length; _i2++) {
- if (calPoints[_i2][index]) {
- points = calPoints[_i2][index];
- break;
- }
- }
- }
- ;
- var textList = seriesData.map(function (item) {
- var titleText = null;
- if (opts.categories && opts.categories.length > 0) {
- titleText = categories[index];
- }
- ;
- return {
- text: option.formatter ? option.formatter(item, titleText, index, opts) : item.name + ': ' + item.data,
- color: item.color,
- legendShape: opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : opts.extra.tooltip.legendShape
- };
- });
- var offset = {
- x: Math.round(points.x),
- y: Math.round(points.y)
- };
- return {
- textList: textList,
- offset: offset
- };
- }
- function getMixToolTipData(seriesData, opts, index, categories) {
- var option = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
- var points = opts.chartData.xAxisPoints[index] + opts.chartData.eachSpacing / 2;
- var textList = seriesData.map(function (item) {
- return {
- text: option.formatter ? option.formatter(item, categories[index], index, opts) : item.name + ': ' + item.data,
- color: item.color,
- disableLegend: item.disableLegend ? true : false,
- legendShape: opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : opts.extra.tooltip.legendShape
- };
- });
- textList = textList.filter(function (item) {
- if (item.disableLegend !== true) {
- return item;
- }
- });
- var offset = {
- x: Math.round(points),
- y: 0
- };
- return {
- textList: textList,
- offset: offset
- };
- }
- function getCandleToolTipData(series, seriesData, opts, index, categories, extra) {
- var option = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : {};
- var calPoints = opts.chartData.calPoints;
- var upColor = extra.color.upFill;
- var downColor = extra.color.downFill;
- //颜色顺序为开盘,收盘,最低,最高
- var color = [upColor, upColor, downColor, upColor];
- var textList = [];
- seriesData.map(function (item) {
- if (index == 0) {
- if (item.data[1] - item.data[0] < 0) {
- color[1] = downColor;
- } else {
- color[1] = upColor;
- }
- } else {
- if (item.data[0] < series[index - 1][1]) {
- color[0] = downColor;
- }
- if (item.data[1] < item.data[0]) {
- color[1] = downColor;
- }
- if (item.data[2] > series[index - 1][1]) {
- color[2] = upColor;
- }
- if (item.data[3] < series[index - 1][1]) {
- color[3] = downColor;
- }
- }
- var text1 = {
- text: '开盘:' + item.data[0],
- color: color[0],
- legendShape: opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : opts.extra.tooltip.legendShape
- };
- var text2 = {
- text: '收盘:' + item.data[1],
- color: color[1],
- legendShape: opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : opts.extra.tooltip.legendShape
- };
- var text3 = {
- text: '最低:' + item.data[2],
- color: color[2],
- legendShape: opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : opts.extra.tooltip.legendShape
- };
- var text4 = {
- text: '最高:' + item.data[3],
- color: color[3],
- legendShape: opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : opts.extra.tooltip.legendShape
- };
- textList.push(text1, text2, text3, text4);
- });
- var validCalPoints = [];
- var offset = {
- x: 0,
- y: 0
- };
- for (var i = 0; i < calPoints.length; i++) {
- var points = calPoints[i];
- if (typeof points[index] !== 'undefined' && points[index] !== null) {
- validCalPoints.push(points[index]);
- }
- }
- offset.x = Math.round(validCalPoints[0][0].x);
- return {
- textList: textList,
- offset: offset
- };
- }
- function filterSeries(series) {
- var tempSeries = [];
- for (var i = 0; i < series.length; i++) {
- if (series[i].show == true) {
- tempSeries.push(series[i]);
- }
- }
- return tempSeries;
- }
- function findCurrentIndex(currentPoints, calPoints, opts, config) {
- var offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
- var current = {
- index: -1,
- group: []
- };
- var spacing = opts.chartData.eachSpacing / 2;
- var xAxisPoints = [];
- if (calPoints && calPoints.length > 0) {
- if (!opts.categories) {
- spacing = 0;
- } else {
- for (var i = 1; i < opts.chartData.xAxisPoints.length; i++) {
- xAxisPoints.push(opts.chartData.xAxisPoints[i] - spacing);
- }
- if ((opts.type == 'line' || opts.type == 'area') && opts.xAxis.boundaryGap == 'justify') {
- xAxisPoints = opts.chartData.xAxisPoints;
- }
- }
- if (isInExactChartArea(currentPoints, opts, config)) {
- if (!opts.categories) {
- var timePoints = Array(calPoints.length);
- for (var _i3 = 0; _i3 < calPoints.length; _i3++) {
- timePoints[_i3] = Array(calPoints[_i3].length);
- for (var j = 0; j < calPoints[_i3].length; j++) {
- timePoints[_i3][j] = Math.abs(calPoints[_i3][j].x - currentPoints.x);
- }
- }
- ;
- var pointValue = Array(timePoints.length);
- var pointIndex = Array(timePoints.length);
- for (var _i4 = 0; _i4 < timePoints.length; _i4++) {
- pointValue[_i4] = Math.min.apply(null, timePoints[_i4]);
- pointIndex[_i4] = timePoints[_i4].indexOf(pointValue[_i4]);
- }
- var minValue = Math.min.apply(null, pointValue);
- current.index = [];
- for (var _i5 = 0; _i5 < pointValue.length; _i5++) {
- if (pointValue[_i5] == minValue) {
- current.group.push(_i5);
- current.index.push(pointIndex[_i5]);
- }
- }
- ;
- } else {
- xAxisPoints.forEach(function (item, index) {
- if (currentPoints.x + offset + spacing > item) {
- current.index = index;
- }
- });
- }
- }
- }
- return current;
- }
- function findBarChartCurrentIndex(currentPoints, calPoints, opts, config) {
- var offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
- var current = {
- index: -1,
- group: []
- };
- var spacing = opts.chartData.eachSpacing / 2;
- var yAxisPoints = opts.chartData.yAxisPoints;
- if (calPoints && calPoints.length > 0) {
- if (isInExactChartArea(currentPoints, opts, config)) {
- yAxisPoints.forEach(function (item, index) {
- if (currentPoints.y + offset + spacing > item) {
- current.index = index;
- }
- });
- }
- }
- return current;
- }
- function findLegendIndex(currentPoints, legendData, opts) {
- var currentIndex = -1;
- var gap = 0;
- if (isInExactLegendArea(currentPoints, legendData.area)) {
- var points = legendData.points;
- var index = -1;
- for (var i = 0, len = points.length; i < len; i++) {
- var item = points[i];
- for (var j = 0; j < item.length; j++) {
- index += 1;
- var area = item[j]['area'];
- if (area && currentPoints.x > area[0] - gap && currentPoints.x < area[2] + gap && currentPoints.y > area[1] - gap && currentPoints.y < area[3] + gap) {
- currentIndex = index;
- break;
- }
- }
- }
- return currentIndex;
- }
- return currentIndex;
- }
- function isInExactLegendArea(currentPoints, area) {
- return currentPoints.x > area.start.x && currentPoints.x < area.end.x && currentPoints.y > area.start.y && currentPoints.y < area.end.y;
- }
- function isInExactChartArea(currentPoints, opts, config) {
- return currentPoints.x <= opts.width - opts.area[1] + 10 && currentPoints.x >= opts.area[3] - 10 && currentPoints.y >= opts.area[0] && currentPoints.y <= opts.height - opts.area[2];
- }
- function findRadarChartCurrentIndex(currentPoints, radarData, count) {
- var eachAngleArea = 2 * Math.PI / count;
- var currentIndex = -1;
- if (isInExactPieChartArea(currentPoints, radarData.center, radarData.radius)) {
- var fixAngle = function fixAngle(angle) {
- if (angle < 0) {
- angle += 2 * Math.PI;
- }
- if (angle > 2 * Math.PI) {
- angle -= 2 * Math.PI;
- }
- return angle;
- };
- var angle = Math.atan2(radarData.center.y - currentPoints.y, currentPoints.x - radarData.center.x);
- angle = -1 * angle;
- if (angle < 0) {
- angle += 2 * Math.PI;
- }
- var angleList = radarData.angleList.map(function (item) {
- item = fixAngle(-1 * item);
- return item;
- });
- angleList.forEach(function (item, index) {
- var rangeStart = fixAngle(item - eachAngleArea / 2);
- var rangeEnd = fixAngle(item + eachAngleArea / 2);
- if (rangeEnd < rangeStart) {
- rangeEnd += 2 * Math.PI;
- }
- if (angle >= rangeStart && angle <= rangeEnd || angle + 2 * Math.PI >= rangeStart && angle + 2 * Math.PI <= rangeEnd) {
- currentIndex = index;
- }
- });
- }
- return currentIndex;
- }
- function findFunnelChartCurrentIndex(currentPoints, funnelData) {
- var currentIndex = -1;
- for (var i = 0, len = funnelData.series.length; i < len; i++) {
- var item = funnelData.series[i];
- if (currentPoints.x > item.funnelArea[0] && currentPoints.x < item.funnelArea[2] && currentPoints.y > item.funnelArea[1] && currentPoints.y < item.funnelArea[3]) {
- currentIndex = i;
- break;
- }
- }
- return currentIndex;
- }
- function findWordChartCurrentIndex(currentPoints, wordData) {
- var currentIndex = -1;
- for (var i = 0, len = wordData.length; i < len; i++) {
- var item = wordData[i];
- if (currentPoints.x > item.area[0] && currentPoints.x < item.area[2] && currentPoints.y > item.area[1] && currentPoints.y < item.area[3]) {
- currentIndex = i;
- break;
- }
- }
- return currentIndex;
- }
- function findMapChartCurrentIndex(currentPoints, opts) {
- var currentIndex = -1;
- var cData = opts.chartData.mapData;
- var data = opts.series;
- var tmp = pointToCoordinate(currentPoints.y, currentPoints.x, cData.bounds, cData.scale, cData.xoffset, cData.yoffset);
- var poi = [tmp.x, tmp.y];
- for (var i = 0, len = data.length; i < len; i++) {
- var item = data[i].geometry.coordinates;
- if (isPoiWithinPoly(poi, item, opts.chartData.mapData.mercator)) {
- currentIndex = i;
- break;
- }
- }
- return currentIndex;
- }
- function findRoseChartCurrentIndex(currentPoints, pieData, opts) {
- var currentIndex = -1;
- var series = getRoseDataPoints(opts._series_, opts.extra.rose.type, pieData.radius, pieData.radius);
- if (pieData && pieData.center && isInExactPieChartArea(currentPoints, pieData.center, pieData.radius)) {
- var angle = Math.atan2(pieData.center.y - currentPoints.y, currentPoints.x - pieData.center.x);
- angle = -angle;
- if (opts.extra.rose && opts.extra.rose.offsetAngle) {
- angle = angle - opts.extra.rose.offsetAngle * Math.PI / 180;
- }
- for (var i = 0, len = series.length; i < len; i++) {
- if (isInAngleRange(angle, series[i]._start_, series[i]._start_ + series[i]._rose_proportion_ * 2 * Math.PI)) {
- currentIndex = i;
- break;
- }
- }
- }
- return currentIndex;
- }
- function findPieChartCurrentIndex(currentPoints, pieData, opts) {
- var currentIndex = -1;
- var series = getPieDataPoints(pieData.series);
- if (pieData && pieData.center && isInExactPieChartArea(currentPoints, pieData.center, pieData.radius)) {
- var angle = Math.atan2(pieData.center.y - currentPoints.y, currentPoints.x - pieData.center.x);
- angle = -angle;
- if (opts.extra.pie && opts.extra.pie.offsetAngle) {
- angle = angle - opts.extra.pie.offsetAngle * Math.PI / 180;
- }
- if (opts.extra.ring && opts.extra.ring.offsetAngle) {
- angle = angle - opts.extra.ring.offsetAngle * Math.PI / 180;
- }
- for (var i = 0, len = series.length; i < len; i++) {
- if (isInAngleRange(angle, series[i]._start_, series[i]._start_ + series[i]._proportion_ * 2 * Math.PI)) {
- currentIndex = i;
- break;
- }
- }
- }
- return currentIndex;
- }
- function isInExactPieChartArea(currentPoints, center, radius) {
- return Math.pow(currentPoints.x - center.x, 2) + Math.pow(currentPoints.y - center.y, 2) <= Math.pow(radius, 2);
- }
- function splitPoints(points, eachSeries) {
- var newPoints = [];
- var items = [];
- points.forEach(function (item, index) {
- if (eachSeries.connectNulls) {
- if (item !== null) {
- items.push(item);
- }
- } else {
- if (item !== null) {
- items.push(item);
- } else {
- if (items.length) {
- newPoints.push(items);
- }
- items = [];
- }
- }
- });
- if (items.length) {
- newPoints.push(items);
- }
- return newPoints;
- }
- function calLegendData(series, opts, config, chartData, context) {
- var legendData = {
- area: {
- start: {
- x: 0,
- y: 0
- },
- end: {
- x: 0,
- y: 0
- },
- width: 0,
- height: 0,
- wholeWidth: 0,
- wholeHeight: 0
- },
- points: [],
- widthArr: [],
- heightArr: []
- };
- if (opts.legend.show === false) {
- chartData.legendData = legendData;
- return legendData;
- }
- var padding = opts.legend.padding * opts.pix;
- var margin = opts.legend.margin * opts.pix;
- var fontSize = opts.legend.fontSize ? opts.legend.fontSize * opts.pix : config.fontSize;
- var shapeWidth = 15 * opts.pix;
- var shapeRight = 5 * opts.pix;
- var lineHeight = Math.max(opts.legend.lineHeight * opts.pix, fontSize);
- if (opts.legend.position == 'top' || opts.legend.position == 'bottom') {
- var legendList = [];
- var widthCount = 0;
- var widthCountArr = [];
- var currentRow = [];
- for (var i = 0; i < series.length; i++) {
- var item = series[i];
- var legendText = item.legendText ? item.legendText : item.name;
- var itemWidth = shapeWidth + shapeRight + measureText(legendText || 'undefined', fontSize, context) + opts.legend.itemGap * opts.pix;
- if (widthCount + itemWidth > opts.width - opts.area[1] - opts.area[3]) {
- legendList.push(currentRow);
- widthCountArr.push(widthCount - opts.legend.itemGap * opts.pix);
- widthCount = itemWidth;
- currentRow = [item];
- } else {
- widthCount += itemWidth;
- currentRow.push(item);
- }
- }
- if (currentRow.length) {
- legendList.push(currentRow);
- widthCountArr.push(widthCount - opts.legend.itemGap * opts.pix);
- legendData.widthArr = widthCountArr;
- var legendWidth = Math.max.apply(null, widthCountArr);
- switch (opts.legend.float) {
- case 'left':
- legendData.area.start.x = opts.area[3];
- legendData.area.end.x = opts.area[3] + legendWidth + 2 * padding;
- break;
- case 'right':
- legendData.area.start.x = opts.width - opts.area[1] - legendWidth - 2 * padding;
- legendData.area.end.x = opts.width - opts.area[1];
- break;
- default:
- legendData.area.start.x = (opts.width - legendWidth) / 2 - padding;
- legendData.area.end.x = (opts.width + legendWidth) / 2 + padding;
- }
- legendData.area.width = legendWidth + 2 * padding;
- legendData.area.wholeWidth = legendWidth + 2 * padding;
- legendData.area.height = legendList.length * lineHeight + 2 * padding;
- legendData.area.wholeHeight = legendList.length * lineHeight + 2 * padding + 2 * margin;
- legendData.points = legendList;
- }
- } else {
- var len = series.length;
- var maxHeight = opts.height - opts.area[0] - opts.area[2] - 2 * margin - 2 * padding;
- var maxLength = Math.min(Math.floor(maxHeight / lineHeight), len);
- legendData.area.height = maxLength * lineHeight + padding * 2;
- legendData.area.wholeHeight = maxLength * lineHeight + padding * 2;
- switch (opts.legend.float) {
- case 'top':
- legendData.area.start.y = opts.area[0] + margin;
- legendData.area.end.y = opts.area[0] + margin + legendData.area.height;
- break;
- case 'bottom':
- legendData.area.start.y = opts.height - opts.area[2] - margin - legendData.area.height;
- legendData.area.end.y = opts.height - opts.area[2] - margin;
- break;
- default:
- legendData.area.start.y = (opts.height - legendData.area.height) / 2;
- legendData.area.end.y = (opts.height + legendData.area.height) / 2;
- }
- var lineNum = len % maxLength === 0 ? len / maxLength : Math.floor(len / maxLength + 1);
- var _currentRow = [];
- for (var _i6 = 0; _i6 < lineNum; _i6++) {
- var temp = series.slice(_i6 * maxLength, _i6 * maxLength + maxLength);
- _currentRow.push(temp);
- }
- legendData.points = _currentRow;
- if (_currentRow.length) {
- for (var _i7 = 0; _i7 < _currentRow.length; _i7++) {
- var _item = _currentRow[_i7];
- var maxWidth = 0;
- for (var j = 0; j < _item.length; j++) {
- var _itemWidth = shapeWidth + shapeRight + measureText(_item[j].name || 'undefined', fontSize, context) + opts.legend.itemGap * opts.pix;
- if (_itemWidth > maxWidth) {
- maxWidth = _itemWidth;
- }
- }
- legendData.widthArr.push(maxWidth);
- legendData.heightArr.push(_item.length * lineHeight + padding * 2);
- }
- var _legendWidth = 0;
- for (var _i8 = 0; _i8 < legendData.widthArr.length; _i8++) {
- _legendWidth += legendData.widthArr[_i8];
- }
- legendData.area.width = _legendWidth - opts.legend.itemGap * opts.pix + 2 * padding;
- legendData.area.wholeWidth = legendData.area.width + padding;
- }
- }
- switch (opts.legend.position) {
- case 'top':
- legendData.area.start.y = opts.area[0] + margin;
- legendData.area.end.y = opts.area[0] + margin + legendData.area.height;
- break;
- case 'bottom':
- legendData.area.start.y = opts.height - opts.area[2] - legendData.area.height - margin;
- legendData.area.end.y = opts.height - opts.area[2] - margin;
- break;
- case 'left':
- legendData.area.start.x = opts.area[3];
- legendData.area.end.x = opts.area[3] + legendData.area.width;
- break;
- case 'right':
- legendData.area.start.x = opts.width - opts.area[1] - legendData.area.width;
- legendData.area.end.x = opts.width - opts.area[1];
- break;
- }
- chartData.legendData = legendData;
- return legendData;
- }
- function calCategoriesData(categories, opts, config, eachSpacing, context) {
- var result = {
- angle: 0,
- xAxisHeight: opts.xAxis.lineHeight * opts.pix + opts.xAxis.marginTop * opts.pix
- };
- var fontSize = opts.xAxis.fontSize * opts.pix;
- var categoriesTextLenth = categories.map(function (item, index) {
- var xitem = opts.xAxis.formatter ? opts.xAxis.formatter(item, index, opts) : item;
- return measureText(String(xitem), fontSize, context);
- });
- var maxTextLength = Math.max.apply(this, categoriesTextLenth);
- if (opts.xAxis.rotateLabel == true) {
- result.angle = opts.xAxis.rotateAngle * Math.PI / 180;
- var tempHeight = opts.xAxis.marginTop * opts.pix * 2 + Math.abs(maxTextLength * Math.sin(result.angle));
- tempHeight = tempHeight < fontSize + opts.xAxis.marginTop * opts.pix * 2 ? tempHeight + opts.xAxis.marginTop * opts.pix * 2 : tempHeight;
- result.xAxisHeight = tempHeight;
- }
- if (opts.enableScroll && opts.xAxis.scrollShow) {
- result.xAxisHeight += 6 * opts.pix;
- }
- if (opts.xAxis.disabled) {
- result.xAxisHeight = 0;
- }
- return result;
- }
- function getXAxisTextList(series, opts, config, stack) {
- var index = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : -1;
- var data;
- if (stack == 'stack') {
- data = dataCombineStack(series, opts.categories.length);
- } else {
- data = dataCombine(series);
- }
- var sorted = [];
- // remove null from data
- data = data.filter(function (item) {
- //return item !== null;
- if ((0, _typeof2.default)(item) === 'object' && item !== null) {
- if (item.constructor.toString().indexOf('Array') > -1) {
- return item !== null;
- } else {
- return item.value !== null;
- }
- } else {
- return item !== null;
- }
- });
- data.map(function (item) {
- if ((0, _typeof2.default)(item) === 'object') {
- if (item.constructor.toString().indexOf('Array') > -1) {
- if (opts.type == 'candle') {
- item.map(function (subitem) {
- sorted.push(subitem);
- });
- } else {
- sorted.push(item[0]);
- }
- } else {
- sorted.push(item.value);
- }
- } else {
- sorted.push(item);
- }
- });
- var minData = 0;
- var maxData = 0;
- if (sorted.length > 0) {
- minData = Math.min.apply(this, sorted);
- maxData = Math.max.apply(this, sorted);
- }
- //为了兼容v1.9.0之前的项目
- if (index > -1) {
- if (typeof opts.xAxis.data[index].min === 'number') {
- minData = Math.min(opts.xAxis.data[index].min, minData);
- }
- if (typeof opts.xAxis.data[index].max === 'number') {
- maxData = Math.max(opts.xAxis.data[index].max, maxData);
- }
- } else {
- if (typeof opts.xAxis.min === 'number') {
- minData = Math.min(opts.xAxis.min, minData);
- }
- if (typeof opts.xAxis.max === 'number') {
- maxData = Math.max(opts.xAxis.max, maxData);
- }
- }
- if (minData === maxData) {
- var rangeSpan = maxData || 10;
- maxData += rangeSpan;
- }
- //var dataRange = getDataRange(minData, maxData);
- var minRange = minData;
- var maxRange = maxData;
- var range = [];
- var eachRange = (maxRange - minRange) / opts.xAxis.splitNumber;
- for (var i = 0; i <= opts.xAxis.splitNumber; i++) {
- range.push(minRange + eachRange * i);
- }
- return range;
- }
- function calXAxisData(series, opts, config, context) {
- //堆叠图重算Y轴
- var columnstyle = assign({}, {
- type: ""
- }, opts.extra.bar);
- var result = {
- angle: 0,
- xAxisHeight: opts.xAxis.lineHeight * opts.pix + opts.xAxis.marginTop * opts.pix
- };
- result.ranges = getXAxisTextList(series, opts, config, columnstyle.type);
- result.rangesFormat = result.ranges.map(function (item) {
- //item = opts.xAxis.formatter ? opts.xAxis.formatter(item) : util.toFixed(item, 2);
- item = util.toFixed(item, 2);
- return item;
- });
- var xAxisScaleValues = result.ranges.map(function (item) {
- // 如果刻度值是浮点数,则保留两位小数
- item = util.toFixed(item, 2);
- // 若有自定义格式则调用自定义的格式化函数
- //item = opts.xAxis.formatter ? opts.xAxis.formatter(Number(item)) : item;
- return item;
- });
- result = Object.assign(result, getXAxisPoints(xAxisScaleValues, opts, config));
- // 计算X轴刻度的属性譬如每个刻度的间隔,刻度的起始点\结束点以及总长
- var eachSpacing = result.eachSpacing;
- var textLength = xAxisScaleValues.map(function (item) {
- return measureText(item, opts.xAxis.fontSize * opts.pix, context);
- });
- if (opts.xAxis.disabled === true) {
- result.xAxisHeight = 0;
- }
- return result;
- }
- function getRadarDataPoints(angleList, center, radius, series, opts) {
- var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
- var radarOption = opts.extra.radar || {};
- radarOption.max = radarOption.max || 0;
- var maxData = Math.max(radarOption.max, Math.max.apply(null, dataCombine(series)));
- var data = [];
- var _loop2 = function _loop2(i) {
- var each = series[i];
- var listItem = {};
- listItem.color = each.color;
- listItem.legendShape = each.legendShape;
- listItem.pointShape = each.pointShape;
- listItem.data = [];
- each.data.forEach(function (item, index) {
- var tmp = {};
- tmp.angle = angleList[index];
- tmp.proportion = item / maxData;
- tmp.value = item;
- tmp.position = convertCoordinateOrigin(radius * tmp.proportion * process * Math.cos(tmp.angle), radius * tmp.proportion * process * Math.sin(tmp.angle), center);
- listItem.data.push(tmp);
- });
- data.push(listItem);
- };
- for (var i = 0; i < series.length; i++) {
- _loop2(i);
- }
- return data;
- }
- function getPieDataPoints(series, radius) {
- var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
- var count = 0;
- var _start_ = 0;
- for (var i = 0; i < series.length; i++) {
- var item = series[i];
- item.data = item.data === null ? 0 : item.data;
- count += item.data;
- }
- for (var _i9 = 0; _i9 < series.length; _i9++) {
- var _item2 = series[_i9];
- _item2.data = _item2.data === null ? 0 : _item2.data;
- if (count === 0) {
- _item2._proportion_ = 1 / series.length * process;
- } else {
- _item2._proportion_ = _item2.data / count * process;
- }
- _item2._radius_ = radius;
- }
- for (var _i10 = 0; _i10 < series.length; _i10++) {
- var _item3 = series[_i10];
- _item3._start_ = _start_;
- _start_ += 2 * _item3._proportion_ * Math.PI;
- }
- return series;
- }
- function getFunnelDataPoints(series, radius, option, eachSpacing) {
- var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
- for (var i = 0; i < series.length; i++) {
- if (option.type == 'funnel') {
- series[i].radius = series[i].data / series[0].data * radius * process;
- } else {
- series[i].radius = eachSpacing * (series.length - i) / (eachSpacing * series.length) * radius * process;
- }
- series[i]._proportion_ = series[i].data / series[0].data;
- }
- // if(option.type !== 'pyramid'){
- // series.reverse();
- // }
- return series;
- }
- function getRoseDataPoints(series, type, minRadius, radius) {
- var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
- var count = 0;
- var _start_ = 0;
- var dataArr = [];
- for (var i = 0; i < series.length; i++) {
- var item = series[i];
- item.data = item.data === null ? 0 : item.data;
- count += item.data;
- dataArr.push(item.data);
- }
- var minData = Math.min.apply(null, dataArr);
- var maxData = Math.max.apply(null, dataArr);
- var radiusLength = radius - minRadius;
- for (var _i11 = 0; _i11 < series.length; _i11++) {
- var _item4 = series[_i11];
- _item4.data = _item4.data === null ? 0 : _item4.data;
- if (count === 0) {
- _item4._proportion_ = 1 / series.length * process;
- _item4._rose_proportion_ = 1 / series.length * process;
- } else {
- _item4._proportion_ = _item4.data / count * process;
- if (type == 'area') {
- _item4._rose_proportion_ = 1 / series.length * process;
- } else {
- _item4._rose_proportion_ = _item4.data / count * process;
- }
- }
- _item4._radius_ = minRadius + radiusLength * ((_item4.data - minData) / (maxData - minData)) || radius;
- }
- for (var _i12 = 0; _i12 < series.length; _i12++) {
- var _item5 = series[_i12];
- _item5._start_ = _start_;
- _start_ += 2 * _item5._rose_proportion_ * Math.PI;
- }
- return series;
- }
- function getArcbarDataPoints(series, arcbarOption) {
- var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
- if (process == 1) {
- process = 0.999999;
- }
- for (var i = 0; i < series.length; i++) {
- var item = series[i];
- item.data = item.data === null ? 0 : item.data;
- var totalAngle = void 0;
- if (arcbarOption.type == 'circle') {
- totalAngle = 2;
- } else {
- if (arcbarOption.direction == 'ccw') {
- if (arcbarOption.startAngle < arcbarOption.endAngle) {
- totalAngle = 2 + arcbarOption.startAngle - arcbarOption.endAngle;
- } else {
- totalAngle = arcbarOption.startAngle - arcbarOption.endAngle;
- }
- } else {
- if (arcbarOption.endAngle < arcbarOption.startAngle) {
- totalAngle = 2 + arcbarOption.endAngle - arcbarOption.startAngle;
- } else {
- totalAngle = arcbarOption.startAngle - arcbarOption.endAngle;
- }
- }
- }
- item._proportion_ = totalAngle * item.data * process + arcbarOption.startAngle;
- if (arcbarOption.direction == 'ccw') {
- item._proportion_ = arcbarOption.startAngle - totalAngle * item.data * process;
- }
- if (item._proportion_ >= 2) {
- item._proportion_ = item._proportion_ % 2;
- }
- }
- return series;
- }
- function getGaugeArcbarDataPoints(series, arcbarOption) {
- var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
- if (process == 1) {
- process = 0.999999;
- }
- for (var i = 0; i < series.length; i++) {
- var item = series[i];
- item.data = item.data === null ? 0 : item.data;
- var totalAngle = void 0;
- if (arcbarOption.type == 'circle') {
- totalAngle = 2;
- } else {
- if (arcbarOption.endAngle < arcbarOption.startAngle) {
- totalAngle = 2 + arcbarOption.endAngle - arcbarOption.startAngle;
- } else {
- totalAngle = arcbarOption.startAngle - arcbarOption.endAngle;
- }
- }
- item._proportion_ = totalAngle * item.data * process + arcbarOption.startAngle;
- if (item._proportion_ >= 2) {
- item._proportion_ = item._proportion_ % 2;
- }
- }
- return series;
- }
- function getGaugeAxisPoints(categories, startAngle, endAngle) {
- var totalAngle;
- if (endAngle < startAngle) {
- totalAngle = 2 + endAngle - startAngle;
- } else {
- totalAngle = startAngle - endAngle;
- }
- var tempStartAngle = startAngle;
- for (var i = 0; i < categories.length; i++) {
- categories[i].value = categories[i].value === null ? 0 : categories[i].value;
- categories[i]._startAngle_ = tempStartAngle;
- categories[i]._endAngle_ = totalAngle * categories[i].value + startAngle;
- if (categories[i]._endAngle_ >= 2) {
- categories[i]._endAngle_ = categories[i]._endAngle_ % 2;
- }
- tempStartAngle = categories[i]._endAngle_;
- }
- return categories;
- }
- function getGaugeDataPoints(series, categories, gaugeOption) {
- var process = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
- for (var i = 0; i < series.length; i++) {
- var item = series[i];
- item.data = item.data === null ? 0 : item.data;
- if (gaugeOption.pointer.color == 'auto') {
- for (var _i13 = 0; _i13 < categories.length; _i13++) {
- if (item.data <= categories[_i13].value) {
- item.color = categories[_i13].color;
- break;
- }
- }
- } else {
- item.color = gaugeOption.pointer.color;
- }
- var totalAngle = void 0;
- if (gaugeOption.endAngle < gaugeOption.startAngle) {
- totalAngle = 2 + gaugeOption.endAngle - gaugeOption.startAngle;
- } else {
- totalAngle = gaugeOption.startAngle - gaugeOption.endAngle;
- }
- item._endAngle_ = totalAngle * item.data + gaugeOption.startAngle;
- item._oldAngle_ = gaugeOption.oldAngle;
- if (gaugeOption.oldAngle < gaugeOption.endAngle) {
- item._oldAngle_ += 2;
- }
- if (item.data >= gaugeOption.oldData) {
- item._proportion_ = (item._endAngle_ - item._oldAngle_) * process + gaugeOption.oldAngle;
- } else {
- item._proportion_ = item._oldAngle_ - (item._oldAngle_ - item._endAngle_) * process;
- }
- if (item._proportion_ >= 2) {
- item._proportion_ = item._proportion_ % 2;
- }
- }
- return series;
- }
- function getPieTextMaxLength(series, config, context, opts) {
- series = getPieDataPoints(series);
- var maxLength = 0;
- for (var i = 0; i < series.length; i++) {
- var item = series[i];
- var text = item.formatter ? item.formatter(+item._proportion_.toFixed(2)) : util.toFixed(item._proportion_ * 100) + '%';
- maxLength = Math.max(maxLength, measureText(text, item.textSize * opts.pix || config.fontSize, context));
- }
- return maxLength;
- }
- function fixColumeData(points, eachSpacing, columnLen, index, config, opts) {
- return points.map(function (item) {
- if (item === null) {
- return null;
- }
- var seriesGap = 0;
- var categoryGap = 0;
- if (opts.type == 'mix') {
- seriesGap = opts.extra.mix.column.seriesGap * opts.pix || 0;
- categoryGap = opts.extra.mix.column.categoryGap * opts.pix || 0;
- } else {
- seriesGap = opts.extra.column.seriesGap * opts.pix || 0;
- categoryGap = opts.extra.column.categoryGap * opts.pix || 0;
- }
- seriesGap = Math.min(seriesGap, eachSpacing / columnLen);
- categoryGap = Math.min(categoryGap, eachSpacing / columnLen);
- item.width = Math.ceil((eachSpacing - 2 * categoryGap - seriesGap * (columnLen - 1)) / columnLen);
- if (opts.extra.mix && opts.extra.mix.column.width && +opts.extra.mix.column.width > 0) {
- item.width = Math.min(item.width, +opts.extra.mix.column.width * opts.pix);
- }
- if (opts.extra.column && opts.extra.column.width && +opts.extra.column.width > 0) {
- item.width = Math.min(item.width, +opts.extra.column.width * opts.pix);
- }
- if (item.width <= 0) {
- item.width = 1;
- }
- item.x += (index + 0.5 - columnLen / 2) * (item.width + seriesGap);
- return item;
- });
- }
- function fixBarData(points, eachSpacing, columnLen, index, config, opts) {
- return points.map(function (item) {
- if (item === null) {
- return null;
- }
- var seriesGap = 0;
- var categoryGap = 0;
- seriesGap = opts.extra.bar.seriesGap * opts.pix || 0;
- categoryGap = opts.extra.bar.categoryGap * opts.pix || 0;
- seriesGap = Math.min(seriesGap, eachSpacing / columnLen);
- categoryGap = Math.min(categoryGap, eachSpacing / columnLen);
- item.width = Math.ceil((eachSpacing - 2 * categoryGap - seriesGap * (columnLen - 1)) / columnLen);
- if (opts.extra.bar && opts.extra.bar.width && +opts.extra.bar.width > 0) {
- item.width = Math.min(item.width, +opts.extra.bar.width * opts.pix);
- }
- if (item.width <= 0) {
- item.width = 1;
- }
- item.y += (index + 0.5 - columnLen / 2) * (item.width + seriesGap);
- return item;
- });
- }
- function fixColumeMeterData(points, eachSpacing, columnLen, index, config, opts, border) {
- var categoryGap = opts.extra.column.categoryGap * opts.pix || 0;
- return points.map(function (item) {
- if (item === null) {
- return null;
- }
- item.width = eachSpacing - 2 * categoryGap;
- if (opts.extra.column && opts.extra.column.width && +opts.extra.column.width > 0) {
- item.width = Math.min(item.width, +opts.extra.column.width * opts.pix);
- }
- if (index > 0) {
- item.width -= border;
- }
- return item;
- });
- }
- function fixColumeStackData(points, eachSpacing, columnLen, index, config, opts, series) {
- var categoryGap = opts.extra.column.categoryGap * opts.pix || 0;
- return points.map(function (item, indexn) {
- if (item === null) {
- return null;
- }
- item.width = Math.ceil(eachSpacing - 2 * categoryGap);
- if (opts.extra.column && opts.extra.column.width && +opts.extra.column.width > 0) {
- item.width = Math.min(item.width, +opts.extra.column.width * opts.pix);
- }
- if (item.width <= 0) {
- item.width = 1;
- }
- return item;
- });
- }
- function fixBarStackData(points, eachSpacing, columnLen, index, config, opts, series) {
- var categoryGap = opts.extra.bar.categoryGap * opts.pix || 0;
- return points.map(function (item, indexn) {
- if (item === null) {
- return null;
- }
- item.width = Math.ceil(eachSpacing - 2 * categoryGap);
- if (opts.extra.bar && opts.extra.bar.width && +opts.extra.bar.width > 0) {
- item.width = Math.min(item.width, +opts.extra.bar.width * opts.pix);
- }
- if (item.width <= 0) {
- item.width = 1;
- }
- return item;
- });
- }
- function getXAxisPoints(categories, opts, config) {
- var spacingValid = opts.width - opts.area[1] - opts.area[3];
- var dataCount = opts.enableScroll ? Math.min(opts.xAxis.itemCount, categories.length) : categories.length;
- if ((opts.type == 'line' || opts.type == 'area' || opts.type == 'scatter' || opts.type == 'bubble' || opts.type == 'bar') && dataCount > 1 && opts.xAxis.boundaryGap == 'justify') {
- dataCount -= 1;
- }
- var widthRatio = 0;
- if (opts.type == 'mount' && opts.extra && opts.extra.mount && opts.extra.mount.widthRatio && opts.extra.mount.widthRatio > 1) {
- if (opts.extra.mount.widthRatio > 2) opts.extra.mount.widthRatio = 2;
- widthRatio = opts.extra.mount.widthRatio - 1;
- dataCount += widthRatio;
- }
- var eachSpacing = spacingValid / dataCount;
- var xAxisPoints = [];
- var startX = opts.area[3];
- var endX = opts.width - opts.area[1];
- categories.forEach(function (item, index) {
- xAxisPoints.push(startX + widthRatio / 2 * eachSpacing + index * eachSpacing);
- });
- if (opts.xAxis.boundaryGap !== 'justify') {
- if (opts.enableScroll === true) {
- xAxisPoints.push(startX + widthRatio * eachSpacing + categories.length * eachSpacing);
- } else {
- xAxisPoints.push(endX);
- }
- }
- return {
- xAxisPoints: xAxisPoints,
- startX: startX,
- endX: endX,
- eachSpacing: eachSpacing
- };
- }
- function getCandleDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config) {
- var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1;
- var points = [];
- var validHeight = opts.height - opts.area[0] - opts.area[2];
- data.forEach(function (item, index) {
- if (item === null) {
- points.push(null);
- } else {
- var cPoints = [];
- item.forEach(function (items, indexs) {
- var point = {};
- point.x = xAxisPoints[index] + Math.round(eachSpacing / 2);
- var value = items.value || items;
- var height = validHeight * (value - minRange) / (maxRange - minRange);
- height *= process;
- point.y = opts.height - Math.round(height) - opts.area[2];
- cPoints.push(point);
- });
- points.push(cPoints);
- }
- });
- return points;
- }
- function getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config) {
- var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1;
- var boundaryGap = 'center';
- if (opts.type == 'line' || opts.type == 'area' || opts.type == 'scatter' || opts.type == 'bubble') {
- boundaryGap = opts.xAxis.boundaryGap;
- }
- var points = [];
- var validHeight = opts.height - opts.area[0] - opts.area[2];
- var validWidth = opts.width - opts.area[1] - opts.area[3];
- data.forEach(function (item, index) {
- if (item === null) {
- points.push(null);
- } else {
- var point = {};
- point.color = item.color;
- point.x = xAxisPoints[index];
- var value = item;
- if ((0, _typeof2.default)(item) === 'object' && item !== null) {
- if (item.constructor.toString().indexOf('Array') > -1) {
- var xranges, xminRange, xmaxRange;
- xranges = [].concat(opts.chartData.xAxisData.ranges);
- xminRange = xranges.shift();
- xmaxRange = xranges.pop();
- value = item[1];
- point.x = opts.area[3] + validWidth * (item[0] - xminRange) / (xmaxRange - xminRange);
- if (opts.type == 'bubble') {
- point.r = item[2];
- point.t = item[3];
- }
- } else {
- value = item.value;
- }
- }
- if (boundaryGap == 'center') {
- point.x += eachSpacing / 2;
- }
- var height = validHeight * (value - minRange) / (maxRange - minRange);
- height *= process;
- point.y = opts.height - height - opts.area[2];
- points.push(point);
- }
- });
- return points;
- }
- function getLineDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, lineOption, process) {
- var process = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : 1;
- var boundaryGap = opts.xAxis.boundaryGap;
- var points = [];
- var validHeight = opts.height - opts.area[0] - opts.area[2];
- var validWidth = opts.width - opts.area[1] - opts.area[3];
- data.forEach(function (item, index) {
- if (item === null) {
- points.push(null);
- } else {
- var point = {};
- point.color = item.color;
- if (lineOption.animation == 'vertical') {
- point.x = xAxisPoints[index];
- var value = item;
- if ((0, _typeof2.default)(item) === 'object' && item !== null) {
- if (item.constructor.toString().indexOf('Array') > -1) {
- var xranges, xminRange, xmaxRange;
- xranges = [].concat(opts.chartData.xAxisData.ranges);
- xminRange = xranges.shift();
- xmaxRange = xranges.pop();
- value = item[1];
- point.x = opts.area[3] + validWidth * (item[0] - xminRange) / (xmaxRange - xminRange);
- } else {
- value = item.value;
- }
- }
- if (boundaryGap == 'center') {
- point.x += eachSpacing / 2;
- }
- var height = validHeight * (value - minRange) / (maxRange - minRange);
- height *= process;
- point.y = opts.height - height - opts.area[2];
- points.push(point);
- } else {
- point.x = xAxisPoints[0] + eachSpacing * index * process;
- var value = item;
- if (boundaryGap == 'center') {
- point.x += eachSpacing / 2;
- }
- var height = validHeight * (value - minRange) / (maxRange - minRange);
- point.y = opts.height - height - opts.area[2];
- points.push(point);
- }
- }
- });
- return points;
- }
- function getColumnDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, zeroPoints, process) {
- var process = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : 1;
- var points = [];
- var validHeight = opts.height - opts.area[0] - opts.area[2];
- var validWidth = opts.width - opts.area[1] - opts.area[3];
- data.forEach(function (item, index) {
- if (item === null) {
- points.push(null);
- } else {
- var point = {};
- point.color = item.color;
- point.x = xAxisPoints[index];
- var value = item;
- if ((0, _typeof2.default)(item) === 'object' && item !== null) {
- if (item.constructor.toString().indexOf('Array') > -1) {
- var xranges, xminRange, xmaxRange;
- xranges = [].concat(opts.chartData.xAxisData.ranges);
- xminRange = xranges.shift();
- xmaxRange = xranges.pop();
- value = item[1];
- point.x = opts.area[3] + validWidth * (item[0] - xminRange) / (xmaxRange - xminRange);
- } else {
- value = item.value;
- }
- }
- point.x += eachSpacing / 2;
- var height = validHeight * (value * process - minRange) / (maxRange - minRange);
- point.y = opts.height - height - opts.area[2];
- points.push(point);
- }
- });
- return points;
- }
- function getMountDataPoints(series, minRange, maxRange, xAxisPoints, eachSpacing, opts, mountOption, zeroPoints) {
- var process = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : 1;
- var points = [];
- var validHeight = opts.height - opts.area[0] - opts.area[2];
- var validWidth = opts.width - opts.area[1] - opts.area[3];
- var mountWidth = eachSpacing * mountOption.widthRatio;
- series.forEach(function (item, index) {
- if (item === null) {
- points.push(null);
- } else {
- var point = {};
- point.color = item.color;
- point.x = xAxisPoints[index];
- point.x += eachSpacing / 2;
- var value = item.data;
- var height = validHeight * (value * process - minRange) / (maxRange - minRange);
- point.y = opts.height - height - opts.area[2];
- point.value = value;
- point.width = mountWidth;
- points.push(point);
- }
- });
- return points;
- }
- function getBarDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config) {
- var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1;
- var points = [];
- var validHeight = opts.height - opts.area[0] - opts.area[2];
- var validWidth = opts.width - opts.area[1] - opts.area[3];
- data.forEach(function (item, index) {
- if (item === null) {
- points.push(null);
- } else {
- var point = {};
- point.color = item.color;
- point.y = yAxisPoints[index];
- var value = item;
- if ((0, _typeof2.default)(item) === 'object' && item !== null) {
- value = item.value;
- }
- var height = validWidth * (value - minRange) / (maxRange - minRange);
- height *= process;
- point.height = height;
- point.value = value;
- point.x = height + opts.area[3];
- points.push(point);
- }
- });
- return points;
- }
- function getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, stackSeries) {
- var process = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : 1;
- var points = [];
- var validHeight = opts.height - opts.area[0] - opts.area[2];
- data.forEach(function (item, index) {
- if (item === null) {
- points.push(null);
- } else {
- var point = {};
- point.color = item.color;
- point.x = xAxisPoints[index] + Math.round(eachSpacing / 2);
- if (seriesIndex > 0) {
- var value = 0;
- for (var i = 0; i <= seriesIndex; i++) {
- value += stackSeries[i].data[index];
- }
- var value0 = value - item;
- var height = validHeight * (value - minRange) / (maxRange - minRange);
- var height0 = validHeight * (value0 - minRange) / (maxRange - minRange);
- } else {
- var value = item;
- if ((0, _typeof2.default)(item) === 'object' && item !== null) {
- value = item.value;
- }
- var height = validHeight * (value - minRange) / (maxRange - minRange);
- var height0 = 0;
- }
- var heightc = height0;
- height *= process;
- heightc *= process;
- point.y = opts.height - Math.round(height) - opts.area[2];
- point.y0 = opts.height - Math.round(heightc) - opts.area[2];
- points.push(point);
- }
- });
- return points;
- }
- function getBarStackDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, seriesIndex, stackSeries) {
- var process = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : 1;
- var points = [];
- var validHeight = opts.width - opts.area[1] - opts.area[3];
- data.forEach(function (item, index) {
- if (item === null) {
- points.push(null);
- } else {
- var point = {};
- point.color = item.color;
- point.y = yAxisPoints[index];
- if (seriesIndex > 0) {
- var value = 0;
- for (var i = 0; i <= seriesIndex; i++) {
- value += stackSeries[i].data[index];
- }
- var value0 = value - item;
- var height = validHeight * (value - minRange) / (maxRange - minRange);
- var height0 = validHeight * (value0 - minRange) / (maxRange - minRange);
- } else {
- var value = item;
- if ((0, _typeof2.default)(item) === 'object' && item !== null) {
- value = item.value;
- }
- var height = validHeight * (value - minRange) / (maxRange - minRange);
- var height0 = 0;
- }
- var heightc = height0;
- height *= process;
- heightc *= process;
- point.height = height - heightc;
- point.x = opts.area[3] + height;
- point.x0 = opts.area[3] + heightc;
- points.push(point);
- }
- });
- return points;
- }
- function getYAxisTextList(series, opts, config, stack, yData) {
- var index = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : -1;
- var data;
- if (stack == 'stack') {
- data = dataCombineStack(series, opts.categories.length);
- } else {
- data = dataCombine(series);
- }
- var sorted = [];
- // remove null from data
- data = data.filter(function (item) {
- //return item !== null;
- if ((0, _typeof2.default)(item) === 'object' && item !== null) {
- if (item.constructor.toString().indexOf('Array') > -1) {
- return item !== null;
- } else {
- return item.value !== null;
- }
- } else {
- return item !== null;
- }
- });
- data.map(function (item) {
- if ((0, _typeof2.default)(item) === 'object') {
- if (item.constructor.toString().indexOf('Array') > -1) {
- if (opts.type == 'candle') {
- item.map(function (subitem) {
- sorted.push(subitem);
- });
- } else {
- sorted.push(item[1]);
- }
- } else {
- sorted.push(item.value);
- }
- } else {
- sorted.push(item);
- }
- });
- var minData = yData.min || 0;
- var maxData = yData.max || 0;
- if (sorted.length > 0) {
- minData = Math.min.apply(this, sorted);
- maxData = Math.max.apply(this, sorted);
- }
- if (minData === maxData) {
- if (maxData == 0) {
- maxData = 10;
- } else {
- minData = 0;
- }
- }
- var dataRange = getDataRange(minData, maxData);
- var minRange = yData.min === undefined || yData.min === null ? dataRange.minRange : yData.min;
- var maxRange = yData.max === undefined || yData.max === null ? dataRange.maxRange : yData.max;
- var eachRange = (maxRange - minRange) / opts.yAxis.splitNumber;
- var range = [];
- for (var i = 0; i <= opts.yAxis.splitNumber; i++) {
- range.push(minRange + eachRange * i);
- }
- return range.reverse();
- }
- function calYAxisData(series, opts, config, context) {
- //堆叠图重算Y轴
- var columnstyle = assign({}, {
- type: ""
- }, opts.extra.column);
- //如果是多Y轴,重新计算
- var YLength = opts.yAxis.data.length;
- var newSeries = new Array(YLength);
- if (YLength > 0) {
- for (var i = 0; i < YLength; i++) {
- newSeries[i] = [];
- for (var j = 0; j < series.length; j++) {
- if (series[j].index == i) {
- newSeries[i].push(series[j]);
- }
- }
- }
- var rangesArr = new Array(YLength);
- var rangesFormatArr = new Array(YLength);
- var yAxisWidthArr = new Array(YLength);
- var _loop3 = function _loop3(_i14) {
- var yData = opts.yAxis.data[_i14];
- //如果总开关不显示,强制每个Y轴为不显示
- if (opts.yAxis.disabled == true) {
- yData.disabled = true;
- }
- if (yData.type === 'categories') {
- if (!yData.formatter) {
- yData.formatter = function (val, index, opts) {
- return val + (yData.unit || '');
- };
- }
- yData.categories = yData.categories || opts.categories;
- rangesArr[_i14] = yData.categories;
- } else {
- if (!yData.formatter) {
- yData.formatter = function (val, index, opts) {
- return util.toFixed(val, yData.tofix || 0) + (yData.unit || '');
- };
- }
- rangesArr[_i14] = getYAxisTextList(newSeries[_i14], opts, config, columnstyle.type, yData, _i14);
- }
- var yAxisFontSizes = yData.fontSize * opts.pix || config.fontSize;
- yAxisWidthArr[_i14] = {
- position: yData.position ? yData.position : 'left',
- width: 0
- };
- rangesFormatArr[_i14] = rangesArr[_i14].map(function (items, index) {
- items = yData.formatter(items, index, opts);
- yAxisWidthArr[_i14].width = Math.max(yAxisWidthArr[_i14].width, measureText(items, yAxisFontSizes, context) + 5);
- return items;
- });
- var calibration = yData.calibration ? 4 * opts.pix : 0;
- yAxisWidthArr[_i14].width += calibration + 3 * opts.pix;
- if (yData.disabled === true) {
- yAxisWidthArr[_i14].width = 0;
- }
- };
- for (var _i14 = 0; _i14 < YLength; _i14++) {
- _loop3(_i14);
- }
- } else {
- var rangesArr = new Array(1);
- var rangesFormatArr = new Array(1);
- var yAxisWidthArr = new Array(1);
- if (opts.type === 'bar') {
- rangesArr[0] = opts.categories;
- if (!opts.yAxis.formatter) {
- opts.yAxis.formatter = function (val, index, opts) {
- return val + (opts.yAxis.unit || '');
- };
- }
- } else {
- if (!opts.yAxis.formatter) {
- opts.yAxis.formatter = function (val, index, opts) {
- return val.toFixed(opts.yAxis.tofix) + (opts.yAxis.unit || '');
- };
- }
- rangesArr[0] = getYAxisTextList(series, opts, config, columnstyle.type, {});
- }
- yAxisWidthArr[0] = {
- position: 'left',
- width: 0
- };
- var yAxisFontSize = opts.yAxis.fontSize * opts.pix || config.fontSize;
- rangesFormatArr[0] = rangesArr[0].map(function (item, index) {
- item = opts.yAxis.formatter(item, index, opts);
- yAxisWidthArr[0].width = Math.max(yAxisWidthArr[0].width, measureText(item, yAxisFontSize, context) + 5);
- return item;
- });
- yAxisWidthArr[0].width += 3 * opts.pix;
- if (opts.yAxis.disabled === true) {
- yAxisWidthArr[0] = {
- position: 'left',
- width: 0
- };
- opts.yAxis.data[0] = {
- disabled: true
- };
- } else {
- opts.yAxis.data[0] = {
- disabled: false,
- position: 'left',
- max: opts.yAxis.max,
- min: opts.yAxis.min,
- formatter: opts.yAxis.formatter
- };
- if (opts.type === 'bar') {
- opts.yAxis.data[0].categories = opts.categories;
- opts.yAxis.data[0].type = 'categories';
- }
- }
- }
- return {
- rangesFormat: rangesFormatArr,
- ranges: rangesArr,
- yAxisWidth: yAxisWidthArr
- };
- }
- function calTooltipYAxisData(point, series, opts, config, eachSpacing) {
- var ranges = [].concat(opts.chartData.yAxisData.ranges);
- var spacingValid = opts.height - opts.area[0] - opts.area[2];
- var minAxis = opts.area[0];
- var items = [];
- for (var i = 0; i < ranges.length; i++) {
- var maxVal = Math.max.apply(this, ranges[i]);
- var minVal = Math.min.apply(this, ranges[i]);
- var item = maxVal - (maxVal - minVal) * (point - minAxis) / spacingValid;
- item = opts.yAxis.data && opts.yAxis.data[i].formatter ? opts.yAxis.data[i].formatter(item, i, opts) : item.toFixed(0);
- items.push(String(item));
- }
- return items;
- }
- function calMarkLineData(points, opts) {
- var minRange, maxRange;
- var spacingValid = opts.height - opts.area[0] - opts.area[2];
- for (var i = 0; i < points.length; i++) {
- points[i].yAxisIndex = points[i].yAxisIndex ? points[i].yAxisIndex : 0;
- var range = [].concat(opts.chartData.yAxisData.ranges[points[i].yAxisIndex]);
- minRange = range.pop();
- maxRange = range.shift();
- var height = spacingValid * (points[i].value - minRange) / (maxRange - minRange);
- points[i].y = opts.height - Math.round(height) - opts.area[2];
- }
- return points;
- }
- function contextRotate(context, opts) {
- if (opts.rotateLock !== true) {
- context.translate(opts.height, 0);
- context.rotate(90 * Math.PI / 180);
- } else if (opts._rotate_ !== true) {
- context.translate(opts.height, 0);
- context.rotate(90 * Math.PI / 180);
- opts._rotate_ = true;
- }
- }
- function drawPointShape(points, color, shape, context, opts) {
- context.beginPath();
- if (opts.dataPointShapeType == 'hollow') {
- context.setStrokeStyle(color);
- context.setFillStyle(opts.background);
- context.setLineWidth(2 * opts.pix);
- } else {
- context.setStrokeStyle("#ffffff");
- context.setFillStyle(color);
- context.setLineWidth(1 * opts.pix);
- }
- if (shape === 'diamond') {
- points.forEach(function (item, index) {
- if (item !== null) {
- context.moveTo(item.x, item.y - 4.5);
- context.lineTo(item.x - 4.5, item.y);
- context.lineTo(item.x, item.y + 4.5);
- context.lineTo(item.x + 4.5, item.y);
- context.lineTo(item.x, item.y - 4.5);
- }
- });
- } else if (shape === 'circle') {
- points.forEach(function (item, index) {
- if (item !== null) {
- context.moveTo(item.x + 2.5 * opts.pix, item.y);
- context.arc(item.x, item.y, 3 * opts.pix, 0, 2 * Math.PI, false);
- }
- });
- } else if (shape === 'square') {
- points.forEach(function (item, index) {
- if (item !== null) {
- context.moveTo(item.x - 3.5, item.y - 3.5);
- context.rect(item.x - 3.5, item.y - 3.5, 7, 7);
- }
- });
- } else if (shape === 'triangle') {
- points.forEach(function (item, index) {
- if (item !== null) {
- context.moveTo(item.x, item.y - 4.5);
- context.lineTo(item.x - 4.5, item.y + 4.5);
- context.lineTo(item.x + 4.5, item.y + 4.5);
- context.lineTo(item.x, item.y - 4.5);
- }
- });
- } else if (shape === 'none') {
- return;
- }
- context.closePath();
- context.fill();
- context.stroke();
- }
- function drawActivePoint(points, color, shape, context, opts, option, seriesIndex) {
- if (!opts.tooltip) {
- return;
- }
- if (opts.tooltip.group.length > 0 && opts.tooltip.group.includes(seriesIndex) == false) {
- return;
- }
- var pointIndex = typeof opts.tooltip.index === 'number' ? opts.tooltip.index : opts.tooltip.index[opts.tooltip.group.indexOf(seriesIndex)];
- context.beginPath();
- if (option.activeType == 'hollow') {
- context.setStrokeStyle(color);
- context.setFillStyle(opts.background);
- context.setLineWidth(2 * opts.pix);
- } else {
- context.setStrokeStyle("#ffffff");
- context.setFillStyle(color);
- context.setLineWidth(1 * opts.pix);
- }
- if (shape === 'diamond') {
- points.forEach(function (item, index) {
- if (item !== null && pointIndex == index) {
- context.moveTo(item.x, item.y - 4.5);
- context.lineTo(item.x - 4.5, item.y);
- context.lineTo(item.x, item.y + 4.5);
- context.lineTo(item.x + 4.5, item.y);
- context.lineTo(item.x, item.y - 4.5);
- }
- });
- } else if (shape === 'circle') {
- points.forEach(function (item, index) {
- if (item !== null && pointIndex == index) {
- context.moveTo(item.x + 2.5 * opts.pix, item.y);
- context.arc(item.x, item.y, 3 * opts.pix, 0, 2 * Math.PI, false);
- }
- });
- } else if (shape === 'square') {
- points.forEach(function (item, index) {
- if (item !== null && pointIndex == index) {
- context.moveTo(item.x - 3.5, item.y - 3.5);
- context.rect(item.x - 3.5, item.y - 3.5, 7, 7);
- }
- });
- } else if (shape === 'triangle') {
- points.forEach(function (item, index) {
- if (item !== null && pointIndex == index) {
- context.moveTo(item.x, item.y - 4.5);
- context.lineTo(item.x - 4.5, item.y + 4.5);
- context.lineTo(item.x + 4.5, item.y + 4.5);
- context.lineTo(item.x, item.y - 4.5);
- }
- });
- } else if (shape === 'none') {
- return;
- }
- context.closePath();
- context.fill();
- context.stroke();
- }
- function drawRingTitle(opts, config, context, center) {
- var titlefontSize = opts.title.fontSize || config.titleFontSize;
- var subtitlefontSize = opts.subtitle.fontSize || config.subtitleFontSize;
- var title = opts.title.name || '';
- var subtitle = opts.subtitle.name || '';
- var titleFontColor = opts.title.color || opts.fontColor;
- var subtitleFontColor = opts.subtitle.color || opts.fontColor;
- var titleHeight = title ? titlefontSize : 0;
- var subtitleHeight = subtitle ? subtitlefontSize : 0;
- var margin = 5;
- if (subtitle) {
- var textWidth = measureText(subtitle, subtitlefontSize * opts.pix, context);
- var startX = center.x - textWidth / 2 + (opts.subtitle.offsetX || 0) * opts.pix;
- var startY = center.y + subtitlefontSize * opts.pix / 2 + (opts.subtitle.offsetY || 0) * opts.pix;
- if (title) {
- startY += (titleHeight * opts.pix + margin) / 2;
- }
- context.beginPath();
- context.setFontSize(subtitlefontSize * opts.pix);
- context.setFillStyle(subtitleFontColor);
- context.fillText(subtitle, startX, startY);
- context.closePath();
- context.stroke();
- }
- if (title) {
- var _textWidth = measureText(title, titlefontSize * opts.pix, context);
- var _startX = center.x - _textWidth / 2 + (opts.title.offsetX || 0);
- var _startY = center.y + titlefontSize * opts.pix / 2 + (opts.title.offsetY || 0) * opts.pix;
- if (subtitle) {
- _startY -= (subtitleHeight * opts.pix + margin) / 2;
- }
- context.beginPath();
- context.setFontSize(titlefontSize * opts.pix);
- context.setFillStyle(titleFontColor);
- context.fillText(title, _startX, _startY);
- context.closePath();
- context.stroke();
- }
- }
- function drawPointText(points, series, config, context, opts) {
- // 绘制数据文案
- var data = series.data;
- var textOffset = series.textOffset ? series.textOffset : 0;
- points.forEach(function (item, index) {
- if (item !== null) {
- context.beginPath();
- var fontSize = series.textSize ? series.textSize * opts.pix : config.fontSize;
- context.setFontSize(fontSize);
- context.setFillStyle(series.textColor || opts.fontColor);
- var value = data[index];
- if ((0, _typeof2.default)(data[index]) === 'object' && data[index] !== null) {
- if (data[index].constructor.toString().indexOf('Array') > -1) {
- value = data[index][1];
- } else {
- value = data[index].value;
- }
- }
- var formatVal = series.formatter ? series.formatter(value, index, series, opts) : value;
- context.setTextAlign('center');
- context.fillText(String(formatVal), item.x, item.y - 4 + textOffset * opts.pix);
- context.closePath();
- context.stroke();
- context.setTextAlign('left');
- }
- });
- }
- function drawColumePointText(points, series, config, context, opts) {
- // 绘制数据文案
- var data = series.data;
- var textOffset = series.textOffset ? series.textOffset : 0;
- var Position = opts.extra.column.labelPosition;
- points.forEach(function (item, index) {
- if (item !== null) {
- context.beginPath();
- var fontSize = series.textSize ? series.textSize * opts.pix : config.fontSize;
- context.setFontSize(fontSize);
- context.setFillStyle(series.textColor || opts.fontColor);
- var value = data[index];
- if ((0, _typeof2.default)(data[index]) === 'object' && data[index] !== null) {
- if (data[index].constructor.toString().indexOf('Array') > -1) {
- value = data[index][1];
- } else {
- value = data[index].value;
- }
- }
- var formatVal = series.formatter ? series.formatter(value, index, series, opts) : value;
- context.setTextAlign('center');
- var startY = item.y - 4 * opts.pix + textOffset * opts.pix;
- if (item.y > series.zeroPoints) {
- startY = item.y + textOffset * opts.pix + fontSize;
- }
- if (Position == 'insideTop') {
- startY = item.y + fontSize + textOffset * opts.pix;
- if (item.y > series.zeroPoints) {
- startY = item.y - textOffset * opts.pix - 4 * opts.pix;
- }
- }
- if (Position == 'center') {
- startY = item.y + textOffset * opts.pix + (opts.height - opts.area[2] - item.y + fontSize) / 2;
- if (series.zeroPoints < opts.height - opts.area[2]) {
- startY = item.y + textOffset * opts.pix + (series.zeroPoints - item.y + fontSize) / 2;
- }
- if (item.y > series.zeroPoints) {
- startY = item.y - textOffset * opts.pix - (item.y - series.zeroPoints - fontSize) / 2;
- }
- if (opts.extra.column.type == 'stack') {
- startY = item.y + textOffset * opts.pix + (item.y0 - item.y + fontSize) / 2;
- }
- }
- if (Position == 'bottom') {
- startY = opts.height - opts.area[2] + textOffset * opts.pix - 4 * opts.pix;
- if (series.zeroPoints < opts.height - opts.area[2]) {
- startY = series.zeroPoints + textOffset * opts.pix - 4 * opts.pix;
- }
- if (item.y > series.zeroPoints) {
- startY = series.zeroPoints - textOffset * opts.pix + fontSize + 2 * opts.pix;
- }
- if (opts.extra.column.type == 'stack') {
- startY = item.y0 + textOffset * opts.pix - 4 * opts.pix;
- }
- }
- context.fillText(String(formatVal), item.x, startY);
- context.closePath();
- context.stroke();
- context.setTextAlign('left');
- }
- });
- }
- function drawMountPointText(points, series, config, context, opts, zeroPoints) {
- // 绘制数据文案
- var data = series.data;
- var textOffset = series.textOffset ? series.textOffset : 0;
- var Position = opts.extra.mount.labelPosition;
- points.forEach(function (item, index) {
- if (item !== null) {
- context.beginPath();
- var fontSize = series[index].textSize ? series[index].textSize * opts.pix : config.fontSize;
- context.setFontSize(fontSize);
- context.setFillStyle(series[index].textColor || opts.fontColor);
- var value = item.value;
- var formatVal = series[index].formatter ? series[index].formatter(value, index, series, opts) : value;
- context.setTextAlign('center');
- var startY = item.y - 4 * opts.pix + textOffset * opts.pix;
- if (item.y > zeroPoints) {
- startY = item.y + textOffset * opts.pix + fontSize;
- }
- context.fillText(String(formatVal), item.x, startY);
- context.closePath();
- context.stroke();
- context.setTextAlign('left');
- }
- });
- }
- function drawBarPointText(points, series, config, context, opts) {
- // 绘制数据文案
- var data = series.data;
- var textOffset = series.textOffset ? series.textOffset : 0;
- points.forEach(function (item, index) {
- if (item !== null) {
- context.beginPath();
- var fontSize = series.textSize ? series.textSize * opts.pix : config.fontSize;
- context.setFontSize(fontSize);
- context.setFillStyle(series.textColor || opts.fontColor);
- var value = data[index];
- if ((0, _typeof2.default)(data[index]) === 'object' && data[index] !== null) {
- value = data[index].value;
- }
- var formatVal = series.formatter ? series.formatter(value, index, series, opts) : value;
- context.setTextAlign('left');
- context.fillText(String(formatVal), item.x + 4 * opts.pix, item.y + fontSize / 2 - 3);
- context.closePath();
- context.stroke();
- }
- });
- }
- function drawGaugeLabel(gaugeOption, radius, centerPosition, opts, config, context) {
- radius -= gaugeOption.width / 2 + gaugeOption.labelOffset * opts.pix;
- radius = radius < 10 ? 10 : radius;
- var totalAngle;
- if (gaugeOption.endAngle < gaugeOption.startAngle) {
- totalAngle = 2 + gaugeOption.endAngle - gaugeOption.startAngle;
- } else {
- totalAngle = gaugeOption.startAngle - gaugeOption.endAngle;
- }
- var splitAngle = totalAngle / gaugeOption.splitLine.splitNumber;
- var totalNumber = gaugeOption.endNumber - gaugeOption.startNumber;
- var splitNumber = totalNumber / gaugeOption.splitLine.splitNumber;
- var nowAngle = gaugeOption.startAngle;
- var nowNumber = gaugeOption.startNumber;
- for (var i = 0; i < gaugeOption.splitLine.splitNumber + 1; i++) {
- var pos = {
- x: radius * Math.cos(nowAngle * Math.PI),
- y: radius * Math.sin(nowAngle * Math.PI)
- };
- var labelText = gaugeOption.formatter ? gaugeOption.formatter(nowNumber, i, opts) : nowNumber;
- pos.x += centerPosition.x - measureText(labelText, config.fontSize, context) / 2;
- pos.y += centerPosition.y;
- var startX = pos.x;
- var startY = pos.y;
- context.beginPath();
- context.setFontSize(config.fontSize);
- context.setFillStyle(gaugeOption.labelColor || opts.fontColor);
- context.fillText(labelText, startX, startY + config.fontSize / 2);
- context.closePath();
- context.stroke();
- nowAngle += splitAngle;
- if (nowAngle >= 2) {
- nowAngle = nowAngle % 2;
- }
- nowNumber += splitNumber;
- }
- }
- function drawRadarLabel(angleList, radius, centerPosition, opts, config, context) {
- var radarOption = opts.extra.radar || {};
- angleList.forEach(function (angle, index) {
- if (radarOption.labelPointShow === true && opts.categories[index] !== '') {
- var posPoint = {
- x: radius * Math.cos(angle),
- y: radius * Math.sin(angle)
- };
- var posPointAxis = convertCoordinateOrigin(posPoint.x, posPoint.y, centerPosition);
- context.setFillStyle(radarOption.labelPointColor);
- context.beginPath();
- context.arc(posPointAxis.x, posPointAxis.y, radarOption.labelPointRadius * opts.pix, 0, 2 * Math.PI, false);
- context.closePath();
- context.fill();
- }
- if (radarOption.labelShow === true) {
- var pos = {
- x: (radius + config.radarLabelTextMargin * opts.pix) * Math.cos(angle),
- y: (radius + config.radarLabelTextMargin * opts.pix) * Math.sin(angle)
- };
- var posRelativeCanvas = convertCoordinateOrigin(pos.x, pos.y, centerPosition);
- var startX = posRelativeCanvas.x;
- var startY = posRelativeCanvas.y;
- if (util.approximatelyEqual(pos.x, 0)) {
- startX -= measureText(opts.categories[index] || '', config.fontSize, context) / 2;
- } else if (pos.x < 0) {
- startX -= measureText(opts.categories[index] || '', config.fontSize, context);
- }
- context.beginPath();
- context.setFontSize(config.fontSize);
- context.setFillStyle(radarOption.labelColor || opts.fontColor);
- context.fillText(opts.categories[index] || '', startX, startY + config.fontSize / 2);
- context.closePath();
- context.stroke();
- }
- });
- }
- function drawPieText(series, opts, config, context, radius, center) {
- var lineRadius = config.pieChartLinePadding;
- var textObjectCollection = [];
- var lastTextObject = null;
- var seriesConvert = series.map(function (item, index) {
- var text = item.formatter ? item.formatter(item, index, series, opts) : util.toFixed(item._proportion_.toFixed(4) * 100) + '%';
- text = item.labelText ? item.labelText : text;
- var arc = 2 * Math.PI - (item._start_ + 2 * Math.PI * item._proportion_ / 2);
- if (item._rose_proportion_) {
- arc = 2 * Math.PI - (item._start_ + 2 * Math.PI * item._rose_proportion_ / 2);
- }
- var color = item.color;
- var radius = item._radius_;
- return {
- arc: arc,
- text: text,
- color: color,
- radius: radius,
- textColor: item.textColor,
- textSize: item.textSize,
- labelShow: item.labelShow
- };
- });
- for (var i = 0; i < seriesConvert.length; i++) {
- var item = seriesConvert[i];
- // line end
- var orginX1 = Math.cos(item.arc) * (item.radius + lineRadius);
- var orginY1 = Math.sin(item.arc) * (item.radius + lineRadius);
- // line start
- var orginX2 = Math.cos(item.arc) * item.radius;
- var orginY2 = Math.sin(item.arc) * item.radius;
- // text start
- var orginX3 = orginX1 >= 0 ? orginX1 + config.pieChartTextPadding : orginX1 - config.pieChartTextPadding;
- var orginY3 = orginY1;
- var textWidth = measureText(item.text, item.textSize * opts.pix || config.fontSize, context);
- var startY = orginY3;
- if (lastTextObject && util.isSameXCoordinateArea(lastTextObject.start, {
- x: orginX3
- })) {
- if (orginX3 > 0) {
- startY = Math.min(orginY3, lastTextObject.start.y);
- } else if (orginX1 < 0) {
- startY = Math.max(orginY3, lastTextObject.start.y);
- } else {
- if (orginY3 > 0) {
- startY = Math.max(orginY3, lastTextObject.start.y);
- } else {
- startY = Math.min(orginY3, lastTextObject.start.y);
- }
- }
- }
- if (orginX3 < 0) {
- orginX3 -= textWidth;
- }
- var textObject = {
- lineStart: {
- x: orginX2,
- y: orginY2
- },
- lineEnd: {
- x: orginX1,
- y: orginY1
- },
- start: {
- x: orginX3,
- y: startY
- },
- width: textWidth,
- height: config.fontSize,
- text: item.text,
- color: item.color,
- textColor: item.textColor,
- textSize: item.textSize
- };
- lastTextObject = avoidCollision(textObject, lastTextObject);
- textObjectCollection.push(lastTextObject);
- }
- for (var _i15 = 0; _i15 < textObjectCollection.length; _i15++) {
- if (seriesConvert[_i15].labelShow === false) {
- continue;
- }
- var _item6 = textObjectCollection[_i15];
- var lineStartPoistion = convertCoordinateOrigin(_item6.lineStart.x, _item6.lineStart.y, center);
- var lineEndPoistion = convertCoordinateOrigin(_item6.lineEnd.x, _item6.lineEnd.y, center);
- var textPosition = convertCoordinateOrigin(_item6.start.x, _item6.start.y, center);
- context.setLineWidth(1 * opts.pix);
- context.setFontSize(_item6.textSize * opts.pix || config.fontSize);
- context.beginPath();
- context.setStrokeStyle(_item6.color);
- context.setFillStyle(_item6.color);
- context.moveTo(lineStartPoistion.x, lineStartPoistion.y);
- var curveStartX = _item6.start.x < 0 ? textPosition.x + _item6.width : textPosition.x;
- var textStartX = _item6.start.x < 0 ? textPosition.x - 5 : textPosition.x + 5;
- context.quadraticCurveTo(lineEndPoistion.x, lineEndPoistion.y, curveStartX, textPosition.y);
- context.moveTo(lineStartPoistion.x, lineStartPoistion.y);
- context.stroke();
- context.closePath();
- context.beginPath();
- context.moveTo(textPosition.x + _item6.width, textPosition.y);
- context.arc(curveStartX, textPosition.y, 2 * opts.pix, 0, 2 * Math.PI);
- context.closePath();
- context.fill();
- context.beginPath();
- context.setFontSize(_item6.textSize * opts.pix || config.fontSize);
- context.setFillStyle(_item6.textColor || opts.fontColor);
- context.fillText(_item6.text, textStartX, textPosition.y + 3);
- context.closePath();
- context.stroke();
- context.closePath();
- }
- }
- function drawToolTipSplitLine(offsetX, opts, config, context) {
- var toolTipOption = opts.extra.tooltip || {};
- toolTipOption.gridType = toolTipOption.gridType == undefined ? 'solid' : toolTipOption.gridType;
- toolTipOption.dashLength = toolTipOption.dashLength == undefined ? 4 : toolTipOption.dashLength;
- var startY = opts.area[0];
- var endY = opts.height - opts.area[2];
- if (toolTipOption.gridType == 'dash') {
- context.setLineDash([toolTipOption.dashLength, toolTipOption.dashLength]);
- }
- context.setStrokeStyle(toolTipOption.gridColor || '#cccccc');
- context.setLineWidth(1 * opts.pix);
- context.beginPath();
- context.moveTo(offsetX, startY);
- context.lineTo(offsetX, endY);
- context.stroke();
- context.setLineDash([]);
- if (toolTipOption.xAxisLabel) {
- var labelText = opts.categories[opts.tooltip.index];
- context.setFontSize(config.fontSize);
- var textWidth = measureText(labelText, config.fontSize, context);
- var textX = offsetX - 0.5 * textWidth;
- var textY = endY + 2 * opts.pix;
- context.beginPath();
- context.setFillStyle(hexToRgb(toolTipOption.labelBgColor || config.toolTipBackground, toolTipOption.labelBgOpacity || config.toolTipOpacity));
- context.setStrokeStyle(toolTipOption.labelBgColor || config.toolTipBackground);
- context.setLineWidth(1 * opts.pix);
- context.rect(textX - toolTipOption.boxPadding * opts.pix, textY, textWidth + 2 * toolTipOption.boxPadding * opts.pix, config.fontSize + 2 * toolTipOption.boxPadding * opts.pix);
- context.closePath();
- context.stroke();
- context.fill();
- context.beginPath();
- context.setFontSize(config.fontSize);
- context.setFillStyle(toolTipOption.labelFontColor || opts.fontColor);
- context.fillText(String(labelText), textX, textY + toolTipOption.boxPadding * opts.pix + config.fontSize);
- context.closePath();
- context.stroke();
- }
- }
- function drawMarkLine(opts, config, context) {
- var markLineOption = assign({}, {
- type: 'solid',
- dashLength: 4,
- data: []
- }, opts.extra.markLine);
- var startX = opts.area[3];
- var endX = opts.width - opts.area[1];
- var points = calMarkLineData(markLineOption.data, opts);
- for (var i = 0; i < points.length; i++) {
- var item = assign({}, {
- lineColor: '#DE4A42',
- showLabel: false,
- labelFontSize: 13,
- labelPadding: 6,
- labelFontColor: '#666666',
- labelBgColor: '#DFE8FF',
- labelBgOpacity: 0.8,
- labelAlign: 'left',
- labelOffsetX: 0,
- labelOffsetY: 0
- }, points[i]);
- if (markLineOption.type == 'dash') {
- context.setLineDash([markLineOption.dashLength, markLineOption.dashLength]);
- }
- context.setStrokeStyle(item.lineColor);
- context.setLineWidth(1 * opts.pix);
- context.beginPath();
- context.moveTo(startX, item.y);
- context.lineTo(endX, item.y);
- context.stroke();
- context.setLineDash([]);
- if (item.showLabel) {
- var fontSize = item.labelFontSize * opts.pix;
- var labelText = item.labelText ? item.labelText : item.value;
- context.setFontSize(fontSize);
- var textWidth = measureText(labelText, fontSize, context);
- var bgWidth = textWidth + item.labelPadding * opts.pix * 2;
- var bgStartX = item.labelAlign == 'left' ? opts.area[3] - bgWidth : opts.width - opts.area[1];
- bgStartX += item.labelOffsetX;
- var bgStartY = item.y - 0.5 * fontSize - item.labelPadding * opts.pix;
- bgStartY += item.labelOffsetY;
- var textX = bgStartX + item.labelPadding * opts.pix;
- var textY = item.y;
- context.setFillStyle(hexToRgb(item.labelBgColor, item.labelBgOpacity));
- context.setStrokeStyle(item.labelBgColor);
- context.setLineWidth(1 * opts.pix);
- context.beginPath();
- context.rect(bgStartX, bgStartY, bgWidth, fontSize + 2 * item.labelPadding * opts.pix);
- context.closePath();
- context.stroke();
- context.fill();
- context.setFontSize(fontSize);
- context.setTextAlign('left');
- context.setFillStyle(item.labelFontColor);
- context.fillText(String(labelText), textX, bgStartY + fontSize + item.labelPadding * opts.pix / 2);
- context.stroke();
- context.setTextAlign('left');
- }
- }
- }
- function drawToolTipHorizentalLine(opts, config, context, eachSpacing, xAxisPoints) {
- var toolTipOption = assign({}, {
- gridType: 'solid',
- dashLength: 4
- }, opts.extra.tooltip);
- var startX = opts.area[3];
- var endX = opts.width - opts.area[1];
- if (toolTipOption.gridType == 'dash') {
- context.setLineDash([toolTipOption.dashLength, toolTipOption.dashLength]);
- }
- context.setStrokeStyle(toolTipOption.gridColor || '#cccccc');
- context.setLineWidth(1 * opts.pix);
- context.beginPath();
- context.moveTo(startX, opts.tooltip.offset.y);
- context.lineTo(endX, opts.tooltip.offset.y);
- context.stroke();
- context.setLineDash([]);
- if (toolTipOption.yAxisLabel) {
- var boxPadding = toolTipOption.boxPadding * opts.pix;
- var labelText = calTooltipYAxisData(opts.tooltip.offset.y, opts.series, opts, config, eachSpacing);
- var widthArr = opts.chartData.yAxisData.yAxisWidth;
- var tStartLeft = opts.area[3];
- var tStartRight = opts.width - opts.area[1];
- for (var i = 0; i < labelText.length; i++) {
- context.setFontSize(toolTipOption.fontSize * opts.pix);
- var textWidth = measureText(labelText[i], toolTipOption.fontSize * opts.pix, context);
- var bgStartX = void 0,
- bgEndX = void 0,
- bgWidth = void 0;
- if (widthArr[i].position == 'left') {
- bgStartX = tStartLeft - (textWidth + boxPadding * 2) - 2 * opts.pix;
- bgEndX = Math.max(bgStartX, bgStartX + textWidth + boxPadding * 2);
- } else {
- bgStartX = tStartRight + 2 * opts.pix;
- bgEndX = Math.max(bgStartX + widthArr[i].width, bgStartX + textWidth + boxPadding * 2);
- }
- bgWidth = bgEndX - bgStartX;
- var textX = bgStartX + (bgWidth - textWidth) / 2;
- var textY = opts.tooltip.offset.y;
- context.beginPath();
- context.setFillStyle(hexToRgb(toolTipOption.labelBgColor || config.toolTipBackground, toolTipOption.labelBgOpacity || config.toolTipOpacity));
- context.setStrokeStyle(toolTipOption.labelBgColor || config.toolTipBackground);
- context.setLineWidth(1 * opts.pix);
- context.rect(bgStartX, textY - 0.5 * config.fontSize - boxPadding, bgWidth, config.fontSize + 2 * boxPadding);
- context.closePath();
- context.stroke();
- context.fill();
- context.beginPath();
- context.setFontSize(config.fontSize);
- context.setFillStyle(toolTipOption.labelFontColor || opts.fontColor);
- context.fillText(labelText[i], textX, textY + 0.5 * config.fontSize);
- context.closePath();
- context.stroke();
- if (widthArr[i].position == 'left') {
- tStartLeft -= widthArr[i].width + opts.yAxis.padding * opts.pix;
- } else {
- tStartRight += widthArr[i].width + opts.yAxis.padding * opts.pix;
- }
- }
- }
- }
- function drawToolTipSplitArea(offsetX, opts, config, context, eachSpacing) {
- var toolTipOption = assign({}, {
- activeBgColor: '#000000',
- activeBgOpacity: 0.08,
- activeWidth: eachSpacing
- }, opts.extra.column);
- toolTipOption.activeWidth = toolTipOption.activeWidth > eachSpacing ? eachSpacing : toolTipOption.activeWidth;
- var startY = opts.area[0];
- var endY = opts.height - opts.area[2];
- context.beginPath();
- context.setFillStyle(hexToRgb(toolTipOption.activeBgColor, toolTipOption.activeBgOpacity));
- context.rect(offsetX - toolTipOption.activeWidth / 2, startY, toolTipOption.activeWidth, endY - startY);
- context.closePath();
- context.fill();
- context.setFillStyle("#FFFFFF");
- }
- function drawBarToolTipSplitArea(offsetX, opts, config, context, eachSpacing) {
- var toolTipOption = assign({}, {
- activeBgColor: '#000000',
- activeBgOpacity: 0.08
- }, opts.extra.bar);
- var startX = opts.area[3];
- var endX = opts.width - opts.area[1];
- context.beginPath();
- context.setFillStyle(hexToRgb(toolTipOption.activeBgColor, toolTipOption.activeBgOpacity));
- context.rect(startX, offsetX - eachSpacing / 2, endX - startX, eachSpacing);
- context.closePath();
- context.fill();
- context.setFillStyle("#FFFFFF");
- }
- function drawToolTip(textList, offset, opts, config, context, eachSpacing, xAxisPoints) {
- var toolTipOption = assign({}, {
- showBox: true,
- showArrow: true,
- showCategory: false,
- bgColor: '#000000',
- bgOpacity: 0.7,
- borderColor: '#000000',
- borderWidth: 0,
- borderRadius: 0,
- borderOpacity: 0.7,
- boxPadding: 3,
- fontColor: '#FFFFFF',
- fontSize: 13,
- lineHeight: 20,
- legendShow: true,
- legendShape: 'auto',
- splitLine: true
- }, opts.extra.tooltip);
- if (toolTipOption.showCategory == true && opts.categories) {
- textList.unshift({
- text: opts.categories[opts.tooltip.index],
- color: null
- });
- }
- var fontSize = toolTipOption.fontSize * opts.pix;
- var lineHeight = toolTipOption.lineHeight * opts.pix;
- var boxPadding = toolTipOption.boxPadding * opts.pix;
- var legendWidth = fontSize;
- var legendMarginRight = 5 * opts.pix;
- if (toolTipOption.legendShow == false) {
- legendWidth = 0;
- legendMarginRight = 0;
- }
- var arrowWidth = toolTipOption.showArrow ? 8 * opts.pix : 0;
- var isOverRightBorder = false;
- if (opts.type == 'line' || opts.type == 'mount' || opts.type == 'area' || opts.type == 'candle' || opts.type == 'mix') {
- if (toolTipOption.splitLine == true) {
- drawToolTipSplitLine(opts.tooltip.offset.x, opts, config, context);
- }
- }
- offset = assign({
- x: 0,
- y: 0
- }, offset);
- offset.y -= 8 * opts.pix;
- var textWidth = textList.map(function (item) {
- return measureText(item.text, fontSize, context);
- });
- var toolTipWidth = legendWidth + legendMarginRight + 4 * boxPadding + Math.max.apply(null, textWidth);
- var toolTipHeight = 2 * boxPadding + textList.length * lineHeight;
- if (toolTipOption.showBox == false) {
- return;
- }
- // if beyond the right border
- if (offset.x - Math.abs(opts._scrollDistance_ || 0) + arrowWidth + toolTipWidth > opts.width) {
- isOverRightBorder = true;
- }
- if (toolTipHeight + offset.y > opts.height) {
- offset.y = opts.height - toolTipHeight;
- }
- // draw background rect
- context.beginPath();
- context.setFillStyle(hexToRgb(toolTipOption.bgColor, toolTipOption.bgOpacity));
- context.setLineWidth(toolTipOption.borderWidth * opts.pix);
- context.setStrokeStyle(hexToRgb(toolTipOption.borderColor, toolTipOption.borderOpacity));
- var radius = toolTipOption.borderRadius;
- if (isOverRightBorder) {
- // 增加左侧仍然超出的判断
- if (toolTipWidth + arrowWidth > opts.width) {
- offset.x = opts.width + Math.abs(opts._scrollDistance_ || 0) + arrowWidth + (toolTipWidth - opts.width);
- }
- if (toolTipWidth > offset.x) {
- offset.x = opts.width + Math.abs(opts._scrollDistance_ || 0) + arrowWidth + (toolTipWidth - opts.width);
- }
- if (toolTipOption.showArrow) {
- context.moveTo(offset.x, offset.y + 10 * opts.pix);
- context.lineTo(offset.x - arrowWidth, offset.y + 10 * opts.pix + 5 * opts.pix);
- }
- context.arc(offset.x - arrowWidth - radius, offset.y + toolTipHeight - radius, radius, 0, Math.PI / 2, false);
- context.arc(offset.x - arrowWidth - Math.round(toolTipWidth) + radius, offset.y + toolTipHeight - radius, radius, Math.PI / 2, Math.PI, false);
- context.arc(offset.x - arrowWidth - Math.round(toolTipWidth) + radius, offset.y + radius, radius, -Math.PI, -Math.PI / 2, false);
- context.arc(offset.x - arrowWidth - radius, offset.y + radius, radius, -Math.PI / 2, 0, false);
- if (toolTipOption.showArrow) {
- context.lineTo(offset.x - arrowWidth, offset.y + 10 * opts.pix - 5 * opts.pix);
- context.lineTo(offset.x, offset.y + 10 * opts.pix);
- }
- } else {
- if (toolTipOption.showArrow) {
- context.moveTo(offset.x, offset.y + 10 * opts.pix);
- context.lineTo(offset.x + arrowWidth, offset.y + 10 * opts.pix - 5 * opts.pix);
- }
- context.arc(offset.x + arrowWidth + radius, offset.y + radius, radius, -Math.PI, -Math.PI / 2, false);
- context.arc(offset.x + arrowWidth + Math.round(toolTipWidth) - radius, offset.y + radius, radius, -Math.PI / 2, 0, false);
- context.arc(offset.x + arrowWidth + Math.round(toolTipWidth) - radius, offset.y + toolTipHeight - radius, radius, 0, Math.PI / 2, false);
- context.arc(offset.x + arrowWidth + radius, offset.y + toolTipHeight - radius, radius, Math.PI / 2, Math.PI, false);
- if (toolTipOption.showArrow) {
- context.lineTo(offset.x + arrowWidth, offset.y + 10 * opts.pix + 5 * opts.pix);
- context.lineTo(offset.x, offset.y + 10 * opts.pix);
- }
- }
- context.closePath();
- context.fill();
- if (toolTipOption.borderWidth > 0) {
- context.stroke();
- }
- // draw legend
- if (toolTipOption.legendShow) {
- textList.forEach(function (item, index) {
- if (item.color !== null) {
- context.beginPath();
- context.setFillStyle(item.color);
- var startX = offset.x + arrowWidth + 2 * boxPadding;
- var startY = offset.y + (lineHeight - fontSize) / 2 + lineHeight * index + boxPadding + 1;
- if (isOverRightBorder) {
- startX = offset.x - toolTipWidth - arrowWidth + 2 * boxPadding;
- }
- switch (item.legendShape) {
- case 'line':
- context.moveTo(startX, startY + 0.5 * legendWidth - 2 * opts.pix);
- context.fillRect(startX, startY + 0.5 * legendWidth - 2 * opts.pix, legendWidth, 4 * opts.pix);
- break;
- case 'triangle':
- context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth - 5 * opts.pix);
- context.lineTo(startX + 2.5 * opts.pix, startY + 0.5 * legendWidth + 5 * opts.pix);
- context.lineTo(startX + 12.5 * opts.pix, startY + 0.5 * legendWidth + 5 * opts.pix);
- context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth - 5 * opts.pix);
- break;
- case 'diamond':
- context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth - 5 * opts.pix);
- context.lineTo(startX + 2.5 * opts.pix, startY + 0.5 * legendWidth);
- context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth + 5 * opts.pix);
- context.lineTo(startX + 12.5 * opts.pix, startY + 0.5 * legendWidth);
- context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth - 5 * opts.pix);
- break;
- case 'circle':
- context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth);
- context.arc(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth, 5 * opts.pix, 0, 2 * Math.PI);
- break;
- case 'rect':
- context.moveTo(startX, startY + 0.5 * legendWidth - 5 * opts.pix);
- context.fillRect(startX, startY + 0.5 * legendWidth - 5 * opts.pix, 15 * opts.pix, 10 * opts.pix);
- break;
- case 'square':
- context.moveTo(startX + 2 * opts.pix, startY + 0.5 * legendWidth - 5 * opts.pix);
- context.fillRect(startX + 2 * opts.pix, startY + 0.5 * legendWidth - 5 * opts.pix, 10 * opts.pix, 10 * opts.pix);
- break;
- default:
- context.moveTo(startX, startY + 0.5 * legendWidth - 5 * opts.pix);
- context.fillRect(startX, startY + 0.5 * legendWidth - 5 * opts.pix, 15 * opts.pix, 10 * opts.pix);
- }
- context.closePath();
- context.fill();
- }
- });
- }
- // draw text list
- textList.forEach(function (item, index) {
- var startX = offset.x + arrowWidth + 2 * boxPadding + legendWidth + legendMarginRight;
- if (isOverRightBorder) {
- startX = offset.x - toolTipWidth - arrowWidth + 2 * boxPadding + legendWidth + legendMarginRight;
- }
- var startY = offset.y + lineHeight * index + (lineHeight - fontSize) / 2 - 1 + boxPadding + fontSize;
- context.beginPath();
- context.setFontSize(fontSize);
- context.setTextBaseline('normal');
- context.setFillStyle(toolTipOption.fontColor);
- context.fillText(item.text, startX, startY);
- context.closePath();
- context.stroke();
- });
- }
- function drawColumnDataPoints(series, opts, config, context) {
- var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
- var xAxisData = opts.chartData.xAxisData,
- xAxisPoints = xAxisData.xAxisPoints,
- eachSpacing = xAxisData.eachSpacing;
- var columnOption = assign({}, {
- type: 'group',
- width: eachSpacing / 2,
- meterBorder: 4,
- meterFillColor: '#FFFFFF',
- barBorderCircle: false,
- barBorderRadius: [],
- seriesGap: 2,
- linearType: 'none',
- linearOpacity: 1,
- customColor: [],
- colorStop: 0,
- labelPosition: 'outside'
- }, opts.extra.column);
- var calPoints = [];
- context.save();
- var leftNum = -2;
- var rightNum = xAxisPoints.length + 2;
- if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
- context.translate(opts._scrollDistance_, 0);
- leftNum = Math.floor(-opts._scrollDistance_ / eachSpacing) - 2;
- rightNum = leftNum + opts.xAxis.itemCount + 4;
- }
- if (opts.tooltip && opts.tooltip.textList && opts.tooltip.textList.length && process === 1) {
- drawToolTipSplitArea(opts.tooltip.offset.x, opts, config, context, eachSpacing);
- }
- columnOption.customColor = fillCustomColor(columnOption.linearType, columnOption.customColor, series, config);
- series.forEach(function (eachSeries, seriesIndex) {
- var ranges, minRange, maxRange;
- ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
- minRange = ranges.pop();
- maxRange = ranges.shift();
- // 计算0轴坐标
- var spacingValid = opts.height - opts.area[0] - opts.area[2];
- var zeroHeight = spacingValid * (0 - minRange) / (maxRange - minRange);
- var zeroPoints = opts.height - Math.round(zeroHeight) - opts.area[2];
- eachSeries.zeroPoints = zeroPoints;
- var data = eachSeries.data;
- switch (columnOption.type) {
- case 'group':
- var points = getColumnDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, zeroPoints, process);
- var tooltipPoints = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
- calPoints.push(tooltipPoints);
- points = fixColumeData(points, eachSpacing, series.length, seriesIndex, config, opts);
- for (var i = 0; i < points.length; i++) {
- var item = points[i];
- //fix issues/I27B1N yyoinge & Joeshu
- if (item !== null && i > leftNum && i < rightNum) {
- var startX = item.x - item.width / 2;
- var height = opts.height - item.y - opts.area[2];
- context.beginPath();
- var fillColor = item.color || eachSeries.color;
- var strokeColor = item.color || eachSeries.color;
- if (columnOption.linearType !== 'none') {
- var grd = context.createLinearGradient(startX, item.y, startX, zeroPoints);
- //透明渐变
- if (columnOption.linearType == 'opacity') {
- grd.addColorStop(0, hexToRgb(fillColor, columnOption.linearOpacity));
- grd.addColorStop(1, hexToRgb(fillColor, 1));
- } else {
- grd.addColorStop(0, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
- grd.addColorStop(columnOption.colorStop, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
- grd.addColorStop(1, hexToRgb(fillColor, 1));
- }
- fillColor = grd;
- }
- // 圆角边框
- if (columnOption.barBorderRadius && columnOption.barBorderRadius.length === 4 || columnOption.barBorderCircle === true) {
- var left = startX;
- var top = item.y > zeroPoints ? zeroPoints : item.y;
- var width = item.width;
- var _height = Math.abs(zeroPoints - item.y);
- if (columnOption.barBorderCircle) {
- columnOption.barBorderRadius = [width / 2, width / 2, 0, 0];
- }
- if (item.y > zeroPoints) {
- columnOption.barBorderRadius = [0, 0, width / 2, width / 2];
- }
- var _columnOption$barBord = (0, _slicedToArray2.default)(columnOption.barBorderRadius, 4),
- r0 = _columnOption$barBord[0],
- r1 = _columnOption$barBord[1],
- r2 = _columnOption$barBord[2],
- r3 = _columnOption$barBord[3];
- var minRadius = Math.min(width / 2, _height / 2);
- r0 = r0 > minRadius ? minRadius : r0;
- r1 = r1 > minRadius ? minRadius : r1;
- r2 = r2 > minRadius ? minRadius : r2;
- r3 = r3 > minRadius ? minRadius : r3;
- r0 = r0 < 0 ? 0 : r0;
- r1 = r1 < 0 ? 0 : r1;
- r2 = r2 < 0 ? 0 : r2;
- r3 = r3 < 0 ? 0 : r3;
- context.arc(left + r0, top + r0, r0, -Math.PI, -Math.PI / 2);
- context.arc(left + width - r1, top + r1, r1, -Math.PI / 2, 0);
- context.arc(left + width - r2, top + _height - r2, r2, 0, Math.PI / 2);
- context.arc(left + r3, top + _height - r3, r3, Math.PI / 2, Math.PI);
- } else {
- context.moveTo(startX, item.y);
- context.lineTo(startX + item.width, item.y);
- context.lineTo(startX + item.width, zeroPoints);
- context.lineTo(startX, zeroPoints);
- context.lineTo(startX, item.y);
- context.setLineWidth(1);
- context.setStrokeStyle(strokeColor);
- }
- context.setFillStyle(fillColor);
- context.closePath();
- //context.stroke();
- context.fill();
- }
- }
- ;
- break;
- case 'stack':
- // 绘制堆叠数据图
- var points = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
- calPoints.push(points);
- points = fixColumeStackData(points, eachSpacing, series.length, seriesIndex, config, opts, series);
- for (var _i16 = 0; _i16 < points.length; _i16++) {
- var _item7 = points[_i16];
- if (_item7 !== null && _i16 > leftNum && _i16 < rightNum) {
- context.beginPath();
- var fillColor = _item7.color || eachSeries.color;
- var startX = _item7.x - _item7.width / 2 + 1;
- var height = opts.height - _item7.y - opts.area[2];
- var height0 = opts.height - _item7.y0 - opts.area[2];
- if (seriesIndex > 0) {
- height -= height0;
- }
- context.setFillStyle(fillColor);
- context.moveTo(startX, _item7.y);
- context.fillRect(startX, _item7.y, _item7.width, height);
- context.closePath();
- context.fill();
- }
- }
- ;
- break;
- case 'meter':
- // 绘制温度计数据图
- var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
- calPoints.push(points);
- points = fixColumeMeterData(points, eachSpacing, series.length, seriesIndex, config, opts, columnOption.meterBorder);
- for (var _i17 = 0; _i17 < points.length; _i17++) {
- var _item8 = points[_i17];
- if (_item8 !== null && _i17 > leftNum && _i17 < rightNum) {
- //画背景颜色
- context.beginPath();
- if (seriesIndex == 0 && columnOption.meterBorder > 0) {
- context.setStrokeStyle(eachSeries.color);
- context.setLineWidth(columnOption.meterBorder * opts.pix);
- }
- if (seriesIndex == 0) {
- context.setFillStyle(columnOption.meterFillColor);
- } else {
- context.setFillStyle(_item8.color || eachSeries.color);
- }
- var startX = _item8.x - _item8.width / 2;
- var height = opts.height - _item8.y - opts.area[2];
- if (columnOption.barBorderRadius && columnOption.barBorderRadius.length === 4 || columnOption.barBorderCircle === true) {
- var _left = startX;
- var _top = _item8.y;
- var _width = _item8.width;
- var _height2 = zeroPoints - _item8.y;
- if (columnOption.barBorderCircle) {
- columnOption.barBorderRadius = [_width / 2, _width / 2, 0, 0];
- }
- var _columnOption$barBord2 = (0, _slicedToArray2.default)(columnOption.barBorderRadius, 4),
- _r = _columnOption$barBord2[0],
- _r2 = _columnOption$barBord2[1],
- _r3 = _columnOption$barBord2[2],
- _r4 = _columnOption$barBord2[3];
- var _minRadius = Math.min(_width / 2, _height2 / 2);
- _r = _r > _minRadius ? _minRadius : _r;
- _r2 = _r2 > _minRadius ? _minRadius : _r2;
- _r3 = _r3 > _minRadius ? _minRadius : _r3;
- _r4 = _r4 > _minRadius ? _minRadius : _r4;
- _r = _r < 0 ? 0 : _r;
- _r2 = _r2 < 0 ? 0 : _r2;
- _r3 = _r3 < 0 ? 0 : _r3;
- _r4 = _r4 < 0 ? 0 : _r4;
- context.arc(_left + _r, _top + _r, _r, -Math.PI, -Math.PI / 2);
- context.arc(_left + _width - _r2, _top + _r2, _r2, -Math.PI / 2, 0);
- context.arc(_left + _width - _r3, _top + _height2 - _r3, _r3, 0, Math.PI / 2);
- context.arc(_left + _r4, _top + _height2 - _r4, _r4, Math.PI / 2, Math.PI);
- context.fill();
- } else {
- context.moveTo(startX, _item8.y);
- context.lineTo(startX + _item8.width, _item8.y);
- context.lineTo(startX + _item8.width, zeroPoints);
- context.lineTo(startX, zeroPoints);
- context.lineTo(startX, _item8.y);
- context.fill();
- }
- if (seriesIndex == 0 && columnOption.meterBorder > 0) {
- context.closePath();
- context.stroke();
- }
- }
- }
- break;
- }
- });
- if (opts.dataLabel !== false && process === 1) {
- series.forEach(function (eachSeries, seriesIndex) {
- var ranges, minRange, maxRange;
- ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
- minRange = ranges.pop();
- maxRange = ranges.shift();
- var data = eachSeries.data;
- switch (columnOption.type) {
- case 'group':
- var points = getColumnDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
- points = fixColumeData(points, eachSpacing, series.length, seriesIndex, config, opts);
- drawColumePointText(points, eachSeries, config, context, opts);
- break;
- case 'stack':
- var points = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
- drawColumePointText(points, eachSeries, config, context, opts);
- break;
- case 'meter':
- var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
- drawColumePointText(points, eachSeries, config, context, opts);
- break;
- }
- });
- }
- context.restore();
- return {
- xAxisPoints: xAxisPoints,
- calPoints: calPoints,
- eachSpacing: eachSpacing
- };
- }
- function drawMountDataPoints(series, opts, config, context) {
- var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
- var xAxisData = opts.chartData.xAxisData,
- xAxisPoints = xAxisData.xAxisPoints,
- eachSpacing = xAxisData.eachSpacing;
- var mountOption = assign({}, {
- type: 'mount',
- widthRatio: 1,
- borderWidth: 1,
- barBorderCircle: false,
- barBorderRadius: [],
- linearType: 'none',
- linearOpacity: 1,
- customColor: [],
- colorStop: 0
- }, opts.extra.mount);
- mountOption.widthRatio = mountOption.widthRatio <= 0 ? 0 : mountOption.widthRatio;
- mountOption.widthRatio = mountOption.widthRatio >= 2 ? 2 : mountOption.widthRatio;
- var calPoints = [];
- context.save();
- var leftNum = -2;
- var rightNum = xAxisPoints.length + 2;
- if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
- context.translate(opts._scrollDistance_, 0);
- leftNum = Math.floor(-opts._scrollDistance_ / eachSpacing) - 2;
- rightNum = leftNum + opts.xAxis.itemCount + 4;
- }
- mountOption.customColor = fillCustomColor(mountOption.linearType, mountOption.customColor, series, config);
- var ranges, minRange, maxRange;
- ranges = [].concat(opts.chartData.yAxisData.ranges[0]);
- minRange = ranges.pop();
- maxRange = ranges.shift();
- // 计算0轴坐标
- var spacingValid = opts.height - opts.area[0] - opts.area[2];
- var zeroHeight = spacingValid * (0 - minRange) / (maxRange - minRange);
- var zeroPoints = opts.height - Math.round(zeroHeight) - opts.area[2];
- var points = getMountDataPoints(series, minRange, maxRange, xAxisPoints, eachSpacing, opts, mountOption, zeroPoints, process);
- switch (mountOption.type) {
- case 'bar':
- for (var i = 0; i < points.length; i++) {
- var item = points[i];
- if (item !== null && i > leftNum && i < rightNum) {
- var startX = item.x - eachSpacing * mountOption.widthRatio / 2;
- var height = opts.height - item.y - opts.area[2];
- context.beginPath();
- var fillColor = item.color || series[i].color;
- var strokeColor = item.color || series[i].color;
- if (mountOption.linearType !== 'none') {
- var grd = context.createLinearGradient(startX, item.y, startX, zeroPoints);
- //透明渐变
- if (mountOption.linearType == 'opacity') {
- grd.addColorStop(0, hexToRgb(fillColor, mountOption.linearOpacity));
- grd.addColorStop(1, hexToRgb(fillColor, 1));
- } else {
- grd.addColorStop(0, hexToRgb(mountOption.customColor[series[i].linearIndex], mountOption.linearOpacity));
- grd.addColorStop(mountOption.colorStop, hexToRgb(mountOption.customColor[series[i].linearIndex], mountOption.linearOpacity));
- grd.addColorStop(1, hexToRgb(fillColor, 1));
- }
- fillColor = grd;
- }
- // 圆角边框
- if (mountOption.barBorderRadius && mountOption.barBorderRadius.length === 4 || mountOption.barBorderCircle === true) {
- var left = startX;
- var top = item.y > zeroPoints ? zeroPoints : item.y;
- var width = item.width;
- var _height3 = Math.abs(zeroPoints - item.y);
- if (mountOption.barBorderCircle) {
- mountOption.barBorderRadius = [width / 2, width / 2, 0, 0];
- }
- if (item.y > zeroPoints) {
- mountOption.barBorderRadius = [0, 0, width / 2, width / 2];
- }
- var _mountOption$barBorde = (0, _slicedToArray2.default)(mountOption.barBorderRadius, 4),
- r0 = _mountOption$barBorde[0],
- r1 = _mountOption$barBorde[1],
- r2 = _mountOption$barBorde[2],
- r3 = _mountOption$barBorde[3];
- var minRadius = Math.min(width / 2, _height3 / 2);
- r0 = r0 > minRadius ? minRadius : r0;
- r1 = r1 > minRadius ? minRadius : r1;
- r2 = r2 > minRadius ? minRadius : r2;
- r3 = r3 > minRadius ? minRadius : r3;
- r0 = r0 < 0 ? 0 : r0;
- r1 = r1 < 0 ? 0 : r1;
- r2 = r2 < 0 ? 0 : r2;
- r3 = r3 < 0 ? 0 : r3;
- context.arc(left + r0, top + r0, r0, -Math.PI, -Math.PI / 2);
- context.arc(left + width - r1, top + r1, r1, -Math.PI / 2, 0);
- context.arc(left + width - r2, top + _height3 - r2, r2, 0, Math.PI / 2);
- context.arc(left + r3, top + _height3 - r3, r3, Math.PI / 2, Math.PI);
- } else {
- context.moveTo(startX, item.y);
- context.lineTo(startX + item.width, item.y);
- context.lineTo(startX + item.width, zeroPoints);
- context.lineTo(startX, zeroPoints);
- context.lineTo(startX, item.y);
- }
- context.setStrokeStyle(strokeColor);
- context.setFillStyle(fillColor);
- if (mountOption.borderWidth > 0) {
- context.setLineWidth(mountOption.borderWidth * opts.pix);
- context.closePath();
- context.stroke();
- }
- context.fill();
- }
- }
- ;
- break;
- case 'triangle':
- for (var _i18 = 0; _i18 < points.length; _i18++) {
- var _item9 = points[_i18];
- if (_item9 !== null && _i18 > leftNum && _i18 < rightNum) {
- var startX = _item9.x - eachSpacing * mountOption.widthRatio / 2;
- var height = opts.height - _item9.y - opts.area[2];
- context.beginPath();
- var fillColor = _item9.color || series[_i18].color;
- var strokeColor = _item9.color || series[_i18].color;
- if (mountOption.linearType !== 'none') {
- var grd = context.createLinearGradient(startX, _item9.y, startX, zeroPoints);
- //透明渐变
- if (mountOption.linearType == 'opacity') {
- grd.addColorStop(0, hexToRgb(fillColor, mountOption.linearOpacity));
- grd.addColorStop(1, hexToRgb(fillColor, 1));
- } else {
- grd.addColorStop(0, hexToRgb(mountOption.customColor[series[_i18].linearIndex], mountOption.linearOpacity));
- grd.addColorStop(mountOption.colorStop, hexToRgb(mountOption.customColor[series[_i18].linearIndex], mountOption.linearOpacity));
- grd.addColorStop(1, hexToRgb(fillColor, 1));
- }
- fillColor = grd;
- }
- context.moveTo(startX, zeroPoints);
- context.lineTo(_item9.x, _item9.y);
- context.lineTo(startX + _item9.width, zeroPoints);
- context.setStrokeStyle(strokeColor);
- context.setFillStyle(fillColor);
- if (mountOption.borderWidth > 0) {
- context.setLineWidth(mountOption.borderWidth * opts.pix);
- context.stroke();
- }
- context.fill();
- }
- }
- ;
- break;
- case 'mount':
- for (var _i19 = 0; _i19 < points.length; _i19++) {
- var _item10 = points[_i19];
- if (_item10 !== null && _i19 > leftNum && _i19 < rightNum) {
- var startX = _item10.x - eachSpacing * mountOption.widthRatio / 2;
- var height = opts.height - _item10.y - opts.area[2];
- context.beginPath();
- var fillColor = _item10.color || series[_i19].color;
- var strokeColor = _item10.color || series[_i19].color;
- if (mountOption.linearType !== 'none') {
- var grd = context.createLinearGradient(startX, _item10.y, startX, zeroPoints);
- //透明渐变
- if (mountOption.linearType == 'opacity') {
- grd.addColorStop(0, hexToRgb(fillColor, mountOption.linearOpacity));
- grd.addColorStop(1, hexToRgb(fillColor, 1));
- } else {
- grd.addColorStop(0, hexToRgb(mountOption.customColor[series[_i19].linearIndex], mountOption.linearOpacity));
- grd.addColorStop(mountOption.colorStop, hexToRgb(mountOption.customColor[series[_i19].linearIndex], mountOption.linearOpacity));
- grd.addColorStop(1, hexToRgb(fillColor, 1));
- }
- fillColor = grd;
- }
- context.moveTo(startX, zeroPoints);
- context.bezierCurveTo(_item10.x - _item10.width / 4, zeroPoints, _item10.x - _item10.width / 4, _item10.y, _item10.x, _item10.y);
- context.bezierCurveTo(_item10.x + _item10.width / 4, _item10.y, _item10.x + _item10.width / 4, zeroPoints, startX + _item10.width, zeroPoints);
- context.setStrokeStyle(strokeColor);
- context.setFillStyle(fillColor);
- if (mountOption.borderWidth > 0) {
- context.setLineWidth(mountOption.borderWidth * opts.pix);
- context.stroke();
- }
- context.fill();
- }
- }
- ;
- break;
- case 'sharp':
- for (var _i20 = 0; _i20 < points.length; _i20++) {
- var _item11 = points[_i20];
- if (_item11 !== null && _i20 > leftNum && _i20 < rightNum) {
- var startX = _item11.x - eachSpacing * mountOption.widthRatio / 2;
- var height = opts.height - _item11.y - opts.area[2];
- context.beginPath();
- var fillColor = _item11.color || series[_i20].color;
- var strokeColor = _item11.color || series[_i20].color;
- if (mountOption.linearType !== 'none') {
- var grd = context.createLinearGradient(startX, _item11.y, startX, zeroPoints);
- //透明渐变
- if (mountOption.linearType == 'opacity') {
- grd.addColorStop(0, hexToRgb(fillColor, mountOption.linearOpacity));
- grd.addColorStop(1, hexToRgb(fillColor, 1));
- } else {
- grd.addColorStop(0, hexToRgb(mountOption.customColor[series[_i20].linearIndex], mountOption.linearOpacity));
- grd.addColorStop(mountOption.colorStop, hexToRgb(mountOption.customColor[series[_i20].linearIndex], mountOption.linearOpacity));
- grd.addColorStop(1, hexToRgb(fillColor, 1));
- }
- fillColor = grd;
- }
- context.moveTo(startX, zeroPoints);
- context.quadraticCurveTo(_item11.x - 0, zeroPoints - height / 4, _item11.x, _item11.y);
- context.quadraticCurveTo(_item11.x + 0, zeroPoints - height / 4, startX + _item11.width, zeroPoints);
- context.setStrokeStyle(strokeColor);
- context.setFillStyle(fillColor);
- if (mountOption.borderWidth > 0) {
- context.setLineWidth(mountOption.borderWidth * opts.pix);
- context.stroke();
- }
- context.fill();
- }
- }
- ;
- break;
- }
- if (opts.dataLabel !== false && process === 1) {
- var _ranges, _minRange, _maxRange;
- _ranges = [].concat(opts.chartData.yAxisData.ranges[0]);
- _minRange = _ranges.pop();
- _maxRange = _ranges.shift();
- var points = getMountDataPoints(series, _minRange, _maxRange, xAxisPoints, eachSpacing, opts, mountOption, zeroPoints, process);
- drawMountPointText(points, series, config, context, opts, zeroPoints);
- }
- context.restore();
- return {
- xAxisPoints: xAxisPoints,
- calPoints: points,
- eachSpacing: eachSpacing
- };
- }
- function drawBarDataPoints(series, opts, config, context) {
- var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
- var yAxisPoints = [];
- var eachSpacing = (opts.height - opts.area[0] - opts.area[2]) / opts.categories.length;
- for (var i = 0; i < opts.categories.length; i++) {
- yAxisPoints.push(opts.area[0] + eachSpacing / 2 + eachSpacing * i);
- }
- var columnOption = assign({}, {
- type: 'group',
- width: eachSpacing / 2,
- meterBorder: 4,
- meterFillColor: '#FFFFFF',
- barBorderCircle: false,
- barBorderRadius: [],
- seriesGap: 2,
- linearType: 'none',
- linearOpacity: 1,
- customColor: [],
- colorStop: 0
- }, opts.extra.bar);
- var calPoints = [];
- context.save();
- var leftNum = -2;
- var rightNum = yAxisPoints.length + 2;
- if (opts.tooltip && opts.tooltip.textList && opts.tooltip.textList.length && process === 1) {
- drawBarToolTipSplitArea(opts.tooltip.offset.y, opts, config, context, eachSpacing);
- }
- columnOption.customColor = fillCustomColor(columnOption.linearType, columnOption.customColor, series, config);
- series.forEach(function (eachSeries, seriesIndex) {
- var ranges, minRange, maxRange;
- ranges = [].concat(opts.chartData.xAxisData.ranges);
- maxRange = ranges.pop();
- minRange = ranges.shift();
- var data = eachSeries.data;
- switch (columnOption.type) {
- case 'group':
- var points = getBarDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, process);
- var tooltipPoints = getBarStackDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
- calPoints.push(tooltipPoints);
- points = fixBarData(points, eachSpacing, series.length, seriesIndex, config, opts);
- for (var _i21 = 0; _i21 < points.length; _i21++) {
- var item = points[_i21];
- //fix issues/I27B1N yyoinge & Joeshu
- if (item !== null && _i21 > leftNum && _i21 < rightNum) {
- //var startX = item.x - item.width / 2;
- var startX = opts.area[3];
- var startY = item.y - item.width / 2;
- var height = item.height;
- context.beginPath();
- var fillColor = item.color || eachSeries.color;
- var strokeColor = item.color || eachSeries.color;
- if (columnOption.linearType !== 'none') {
- var grd = context.createLinearGradient(startX, item.y, item.x, item.y);
- //透明渐变
- if (columnOption.linearType == 'opacity') {
- grd.addColorStop(0, hexToRgb(fillColor, columnOption.linearOpacity));
- grd.addColorStop(1, hexToRgb(fillColor, 1));
- } else {
- grd.addColorStop(0, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
- grd.addColorStop(columnOption.colorStop, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
- grd.addColorStop(1, hexToRgb(fillColor, 1));
- }
- fillColor = grd;
- }
- // 圆角边框
- if (columnOption.barBorderRadius && columnOption.barBorderRadius.length === 4 || columnOption.barBorderCircle === true) {
- var left = startX;
- var width = item.width;
- var top = item.y - item.width / 2;
- var _height4 = item.height;
- if (columnOption.barBorderCircle) {
- columnOption.barBorderRadius = [width / 2, width / 2, 0, 0];
- }
- var _columnOption$barBord3 = (0, _slicedToArray2.default)(columnOption.barBorderRadius, 4),
- r0 = _columnOption$barBord3[0],
- r1 = _columnOption$barBord3[1],
- r2 = _columnOption$barBord3[2],
- r3 = _columnOption$barBord3[3];
- var minRadius = Math.min(width / 2, _height4 / 2);
- r0 = r0 > minRadius ? minRadius : r0;
- r1 = r1 > minRadius ? minRadius : r1;
- r2 = r2 > minRadius ? minRadius : r2;
- r3 = r3 > minRadius ? minRadius : r3;
- r0 = r0 < 0 ? 0 : r0;
- r1 = r1 < 0 ? 0 : r1;
- r2 = r2 < 0 ? 0 : r2;
- r3 = r3 < 0 ? 0 : r3;
- context.arc(left + r3, top + r3, r3, -Math.PI, -Math.PI / 2);
- context.arc(item.x - r0, top + r0, r0, -Math.PI / 2, 0);
- context.arc(item.x - r1, top + width - r1, r1, 0, Math.PI / 2);
- context.arc(left + r2, top + width - r2, r2, Math.PI / 2, Math.PI);
- } else {
- context.moveTo(startX, startY);
- context.lineTo(item.x, startY);
- context.lineTo(item.x, startY + item.width);
- context.lineTo(startX, startY + item.width);
- context.lineTo(startX, startY);
- context.setLineWidth(1);
- context.setStrokeStyle(strokeColor);
- }
- context.setFillStyle(fillColor);
- context.closePath();
- //context.stroke();
- context.fill();
- }
- }
- ;
- break;
- case 'stack':
- // 绘制堆叠数据图
- var points = getBarStackDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
- calPoints.push(points);
- points = fixBarStackData(points, eachSpacing, series.length, seriesIndex, config, opts, series);
- for (var _i22 = 0; _i22 < points.length; _i22++) {
- var _item12 = points[_i22];
- if (_item12 !== null && _i22 > leftNum && _i22 < rightNum) {
- context.beginPath();
- var fillColor = _item12.color || eachSeries.color;
- var startX = _item12.x0;
- context.setFillStyle(fillColor);
- context.moveTo(startX, _item12.y - _item12.width / 2);
- context.fillRect(startX, _item12.y - _item12.width / 2, _item12.height, _item12.width);
- context.closePath();
- context.fill();
- }
- }
- ;
- break;
- }
- });
- if (opts.dataLabel !== false && process === 1) {
- series.forEach(function (eachSeries, seriesIndex) {
- var ranges, minRange, maxRange;
- ranges = [].concat(opts.chartData.xAxisData.ranges);
- maxRange = ranges.pop();
- minRange = ranges.shift();
- var data = eachSeries.data;
- switch (columnOption.type) {
- case 'group':
- var points = getBarDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, process);
- points = fixBarData(points, eachSpacing, series.length, seriesIndex, config, opts);
- drawBarPointText(points, eachSeries, config, context, opts);
- break;
- case 'stack':
- var points = getBarStackDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
- drawBarPointText(points, eachSeries, config, context, opts);
- break;
- }
- });
- }
- return {
- yAxisPoints: yAxisPoints,
- calPoints: calPoints,
- eachSpacing: eachSpacing
- };
- }
- function drawCandleDataPoints(series, seriesMA, opts, config, context) {
- var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
- var candleOption = assign({}, {
- color: {},
- average: {}
- }, opts.extra.candle);
- candleOption.color = assign({}, {
- upLine: '#f04864',
- upFill: '#f04864',
- downLine: '#2fc25b',
- downFill: '#2fc25b'
- }, candleOption.color);
- candleOption.average = assign({}, {
- show: false,
- name: [],
- day: [],
- color: config.color
- }, candleOption.average);
- opts.extra.candle = candleOption;
- var xAxisData = opts.chartData.xAxisData,
- xAxisPoints = xAxisData.xAxisPoints,
- eachSpacing = xAxisData.eachSpacing;
- var calPoints = [];
- context.save();
- var leftNum = -2;
- var rightNum = xAxisPoints.length + 2;
- var leftSpace = 0;
- var rightSpace = opts.width + eachSpacing;
- if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
- context.translate(opts._scrollDistance_, 0);
- leftNum = Math.floor(-opts._scrollDistance_ / eachSpacing) - 2;
- rightNum = leftNum + opts.xAxis.itemCount + 4;
- leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
- rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
- }
- //画均线
- if (candleOption.average.show || seriesMA) {
- //Merge pull request !12 from 邱贵翔
- seriesMA.forEach(function (eachSeries, seriesIndex) {
- var ranges, minRange, maxRange;
- ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
- minRange = ranges.pop();
- maxRange = ranges.shift();
- var data = eachSeries.data;
- var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
- var splitPointList = splitPoints(points, eachSeries);
- for (var i = 0; i < splitPointList.length; i++) {
- var _points = splitPointList[i];
- context.beginPath();
- context.setStrokeStyle(eachSeries.color);
- context.setLineWidth(1);
- if (_points.length === 1) {
- context.moveTo(_points[0].x, _points[0].y);
- context.arc(_points[0].x, _points[0].y, 1, 0, 2 * Math.PI);
- } else {
- context.moveTo(_points[0].x, _points[0].y);
- var startPoint = 0;
- for (var j = 0; j < _points.length; j++) {
- var item = _points[j];
- if (startPoint == 0 && item.x > leftSpace) {
- context.moveTo(item.x, item.y);
- startPoint = 1;
- }
- if (j > 0 && item.x > leftSpace && item.x < rightSpace) {
- var ctrlPoint = createCurveControlPoints(_points, j - 1);
- context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, item.x, item.y);
- }
- }
- context.moveTo(_points[0].x, _points[0].y);
- }
- context.closePath();
- context.stroke();
- }
- });
- }
- //画K线
- series.forEach(function (eachSeries, seriesIndex) {
- var ranges, minRange, maxRange;
- ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
- minRange = ranges.pop();
- maxRange = ranges.shift();
- var data = eachSeries.data;
- var points = getCandleDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
- calPoints.push(points);
- var splitPointList = splitPoints(points, eachSeries);
- for (var i = 0; i < splitPointList[0].length; i++) {
- if (i > leftNum && i < rightNum) {
- var item = splitPointList[0][i];
- context.beginPath();
- //如果上涨
- if (data[i][1] - data[i][0] > 0) {
- context.setStrokeStyle(candleOption.color.upLine);
- context.setFillStyle(candleOption.color.upFill);
- context.setLineWidth(1 * opts.pix);
- context.moveTo(item[3].x, item[3].y); //顶点
- context.lineTo(item[1].x, item[1].y); //收盘中间点
- context.lineTo(item[1].x - eachSpacing / 4, item[1].y); //收盘左侧点
- context.lineTo(item[0].x - eachSpacing / 4, item[0].y); //开盘左侧点
- context.lineTo(item[0].x, item[0].y); //开盘中间点
- context.lineTo(item[2].x, item[2].y); //底点
- context.lineTo(item[0].x, item[0].y); //开盘中间点
- context.lineTo(item[0].x + eachSpacing / 4, item[0].y); //开盘右侧点
- context.lineTo(item[1].x + eachSpacing / 4, item[1].y); //收盘右侧点
- context.lineTo(item[1].x, item[1].y); //收盘中间点
- context.moveTo(item[3].x, item[3].y); //顶点
- } else {
- context.setStrokeStyle(candleOption.color.downLine);
- context.setFillStyle(candleOption.color.downFill);
- context.setLineWidth(1 * opts.pix);
- context.moveTo(item[3].x, item[3].y); //顶点
- context.lineTo(item[0].x, item[0].y); //开盘中间点
- context.lineTo(item[0].x - eachSpacing / 4, item[0].y); //开盘左侧点
- context.lineTo(item[1].x - eachSpacing / 4, item[1].y); //收盘左侧点
- context.lineTo(item[1].x, item[1].y); //收盘中间点
- context.lineTo(item[2].x, item[2].y); //底点
- context.lineTo(item[1].x, item[1].y); //收盘中间点
- context.lineTo(item[1].x + eachSpacing / 4, item[1].y); //收盘右侧点
- context.lineTo(item[0].x + eachSpacing / 4, item[0].y); //开盘右侧点
- context.lineTo(item[0].x, item[0].y); //开盘中间点
- context.moveTo(item[3].x, item[3].y); //顶点
- }
- context.closePath();
- context.fill();
- context.stroke();
- }
- }
- });
- context.restore();
- return {
- xAxisPoints: xAxisPoints,
- calPoints: calPoints,
- eachSpacing: eachSpacing
- };
- }
- function drawAreaDataPoints(series, opts, config, context) {
- var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
- var areaOption = assign({}, {
- type: 'straight',
- opacity: 0.2,
- addLine: false,
- width: 2,
- gradient: false,
- activeType: 'none'
- }, opts.extra.area);
- var xAxisData = opts.chartData.xAxisData,
- xAxisPoints = xAxisData.xAxisPoints,
- eachSpacing = xAxisData.eachSpacing;
- var endY = opts.height - opts.area[2];
- var calPoints = [];
- context.save();
- var leftSpace = 0;
- var rightSpace = opts.width + eachSpacing;
- if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
- context.translate(opts._scrollDistance_, 0);
- leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
- rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
- }
- series.forEach(function (eachSeries, seriesIndex) {
- var ranges, minRange, maxRange;
- ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
- minRange = ranges.pop();
- maxRange = ranges.shift();
- var data = eachSeries.data;
- var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
- calPoints.push(points);
- var splitPointList = splitPoints(points, eachSeries);
- for (var i = 0; i < splitPointList.length; i++) {
- var _points2 = splitPointList[i];
- // 绘制区域数
- context.beginPath();
- context.setStrokeStyle(hexToRgb(eachSeries.color, areaOption.opacity));
- if (areaOption.gradient) {
- var gradient = context.createLinearGradient(0, opts.area[0], 0, opts.height - opts.area[2]);
- gradient.addColorStop('0', hexToRgb(eachSeries.color, areaOption.opacity));
- gradient.addColorStop('1.0', hexToRgb("#FFFFFF", 0.1));
- context.setFillStyle(gradient);
- } else {
- context.setFillStyle(hexToRgb(eachSeries.color, areaOption.opacity));
- }
- context.setLineWidth(areaOption.width * opts.pix);
- if (_points2.length > 1) {
- var firstPoint = _points2[0];
- var lastPoint = _points2[_points2.length - 1];
- context.moveTo(firstPoint.x, firstPoint.y);
- var startPoint = 0;
- if (areaOption.type === 'curve') {
- for (var j = 0; j < _points2.length; j++) {
- var item = _points2[j];
- if (startPoint == 0 && item.x > leftSpace) {
- context.moveTo(item.x, item.y);
- startPoint = 1;
- }
- if (j > 0 && item.x > leftSpace && item.x < rightSpace) {
- var ctrlPoint = createCurveControlPoints(_points2, j - 1);
- context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, item.x, item.y);
- }
- }
- ;
- }
- if (areaOption.type === 'straight') {
- for (var _j = 0; _j < _points2.length; _j++) {
- var _item13 = _points2[_j];
- if (startPoint == 0 && _item13.x > leftSpace) {
- context.moveTo(_item13.x, _item13.y);
- startPoint = 1;
- }
- if (_j > 0 && _item13.x > leftSpace && _item13.x < rightSpace) {
- context.lineTo(_item13.x, _item13.y);
- }
- }
- ;
- }
- if (areaOption.type === 'step') {
- for (var _j2 = 0; _j2 < _points2.length; _j2++) {
- var _item14 = _points2[_j2];
- if (startPoint == 0 && _item14.x > leftSpace) {
- context.moveTo(_item14.x, _item14.y);
- startPoint = 1;
- }
- if (_j2 > 0 && _item14.x > leftSpace && _item14.x < rightSpace) {
- context.lineTo(_item14.x, _points2[_j2 - 1].y);
- context.lineTo(_item14.x, _item14.y);
- }
- }
- ;
- }
- context.lineTo(lastPoint.x, endY);
- context.lineTo(firstPoint.x, endY);
- context.lineTo(firstPoint.x, firstPoint.y);
- } else {
- var _item15 = _points2[0];
- context.moveTo(_item15.x - eachSpacing / 2, _item15.y);
- // context.lineTo(item.x + eachSpacing / 2, item.y);
- // context.lineTo(item.x + eachSpacing / 2, endY);
- // context.lineTo(item.x - eachSpacing / 2, endY);
- // context.moveTo(item.x - eachSpacing / 2, item.y);
- }
- context.closePath();
- context.fill();
- //画连线
- if (areaOption.addLine) {
- if (eachSeries.lineType == 'dash') {
- var dashLength = eachSeries.dashLength ? eachSeries.dashLength : 8;
- dashLength *= opts.pix;
- context.setLineDash([dashLength, dashLength]);
- }
- context.beginPath();
- context.setStrokeStyle(eachSeries.color);
- context.setLineWidth(areaOption.width * opts.pix);
- if (_points2.length === 1) {
- context.moveTo(_points2[0].x, _points2[0].y);
- // context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI);
- } else {
- context.moveTo(_points2[0].x, _points2[0].y);
- var _startPoint = 0;
- if (areaOption.type === 'curve') {
- for (var _j3 = 0; _j3 < _points2.length; _j3++) {
- var _item16 = _points2[_j3];
- if (_startPoint == 0 && _item16.x > leftSpace) {
- context.moveTo(_item16.x, _item16.y);
- _startPoint = 1;
- }
- if (_j3 > 0 && _item16.x > leftSpace && _item16.x < rightSpace) {
- var _ctrlPoint = createCurveControlPoints(_points2, _j3 - 1);
- context.bezierCurveTo(_ctrlPoint.ctrA.x, _ctrlPoint.ctrA.y, _ctrlPoint.ctrB.x, _ctrlPoint.ctrB.y, _item16.x, _item16.y);
- }
- }
- ;
- }
- if (areaOption.type === 'straight') {
- for (var _j4 = 0; _j4 < _points2.length; _j4++) {
- var _item17 = _points2[_j4];
- if (_startPoint == 0 && _item17.x > leftSpace) {
- context.moveTo(_item17.x, _item17.y);
- _startPoint = 1;
- }
- if (_j4 > 0 && _item17.x > leftSpace && _item17.x < rightSpace) {
- context.lineTo(_item17.x, _item17.y);
- }
- }
- ;
- }
- if (areaOption.type === 'step') {
- for (var _j5 = 0; _j5 < _points2.length; _j5++) {
- var _item18 = _points2[_j5];
- if (_startPoint == 0 && _item18.x > leftSpace) {
- context.moveTo(_item18.x, _item18.y);
- _startPoint = 1;
- }
- if (_j5 > 0 && _item18.x > leftSpace && _item18.x < rightSpace) {
- context.lineTo(_item18.x, _points2[_j5 - 1].y);
- context.lineTo(_item18.x, _item18.y);
- }
- }
- ;
- }
- context.moveTo(_points2[0].x, _points2[0].y);
- }
- context.stroke();
- context.setLineDash([]);
- }
- }
- //画点
- if (opts.dataPointShape !== false) {
- drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts);
- }
- drawActivePoint(points, eachSeries.color, eachSeries.pointShape, context, opts, areaOption, seriesIndex);
- });
- if (opts.dataLabel !== false && process === 1) {
- series.forEach(function (eachSeries, seriesIndex) {
- var ranges, minRange, maxRange;
- ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
- minRange = ranges.pop();
- maxRange = ranges.shift();
- var data = eachSeries.data;
- var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
- drawPointText(points, eachSeries, config, context, opts);
- });
- }
- context.restore();
- return {
- xAxisPoints: xAxisPoints,
- calPoints: calPoints,
- eachSpacing: eachSpacing
- };
- }
- function drawScatterDataPoints(series, opts, config, context) {
- var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
- var scatterOption = assign({}, {
- type: 'circle'
- }, opts.extra.scatter);
- var xAxisData = opts.chartData.xAxisData,
- xAxisPoints = xAxisData.xAxisPoints,
- eachSpacing = xAxisData.eachSpacing;
- var calPoints = [];
- context.save();
- var leftSpace = 0;
- var rightSpace = opts.width + eachSpacing;
- if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
- context.translate(opts._scrollDistance_, 0);
- leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
- rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
- }
- series.forEach(function (eachSeries, seriesIndex) {
- var ranges, minRange, maxRange;
- ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
- minRange = ranges.pop();
- maxRange = ranges.shift();
- var data = eachSeries.data;
- var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
- context.beginPath();
- context.setStrokeStyle(eachSeries.color);
- context.setFillStyle(eachSeries.color);
- context.setLineWidth(1 * opts.pix);
- var shape = eachSeries.pointShape;
- if (shape === 'diamond') {
- points.forEach(function (item, index) {
- if (item !== null) {
- context.moveTo(item.x, item.y - 4.5);
- context.lineTo(item.x - 4.5, item.y);
- context.lineTo(item.x, item.y + 4.5);
- context.lineTo(item.x + 4.5, item.y);
- context.lineTo(item.x, item.y - 4.5);
- }
- });
- } else if (shape === 'circle') {
- points.forEach(function (item, index) {
- if (item !== null) {
- context.moveTo(item.x + 2.5 * opts.pix, item.y);
- context.arc(item.x, item.y, 3 * opts.pix, 0, 2 * Math.PI, false);
- }
- });
- } else if (shape === 'square') {
- points.forEach(function (item, index) {
- if (item !== null) {
- context.moveTo(item.x - 3.5, item.y - 3.5);
- context.rect(item.x - 3.5, item.y - 3.5, 7, 7);
- }
- });
- } else if (shape === 'triangle') {
- points.forEach(function (item, index) {
- if (item !== null) {
- context.moveTo(item.x, item.y - 4.5);
- context.lineTo(item.x - 4.5, item.y + 4.5);
- context.lineTo(item.x + 4.5, item.y + 4.5);
- context.lineTo(item.x, item.y - 4.5);
- }
- });
- } else if (shape === 'triangle') {
- return;
- }
- context.closePath();
- context.fill();
- context.stroke();
- });
- if (opts.dataLabel !== false && process === 1) {
- series.forEach(function (eachSeries, seriesIndex) {
- var ranges, minRange, maxRange;
- ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
- minRange = ranges.pop();
- maxRange = ranges.shift();
- var data = eachSeries.data;
- var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
- drawPointText(points, eachSeries, config, context, opts);
- });
- }
- context.restore();
- return {
- xAxisPoints: xAxisPoints,
- calPoints: calPoints,
- eachSpacing: eachSpacing
- };
- }
- function drawBubbleDataPoints(series, opts, config, context) {
- var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
- var bubbleOption = assign({}, {
- opacity: 1,
- border: 2
- }, opts.extra.bubble);
- var xAxisData = opts.chartData.xAxisData,
- xAxisPoints = xAxisData.xAxisPoints,
- eachSpacing = xAxisData.eachSpacing;
- var calPoints = [];
- context.save();
- var leftSpace = 0;
- var rightSpace = opts.width + eachSpacing;
- if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
- context.translate(opts._scrollDistance_, 0);
- leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
- rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
- }
- series.forEach(function (eachSeries, seriesIndex) {
- var ranges, minRange, maxRange;
- ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
- minRange = ranges.pop();
- maxRange = ranges.shift();
- var data = eachSeries.data;
- var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
- context.beginPath();
- context.setStrokeStyle(eachSeries.color);
- context.setLineWidth(bubbleOption.border * opts.pix);
- context.setFillStyle(hexToRgb(eachSeries.color, bubbleOption.opacity));
- points.forEach(function (item, index) {
- context.moveTo(item.x + item.r, item.y);
- context.arc(item.x, item.y, item.r * opts.pix, 0, 2 * Math.PI, false);
- });
- context.closePath();
- context.fill();
- context.stroke();
- if (opts.dataLabel !== false && process === 1) {
- points.forEach(function (item, index) {
- context.beginPath();
- var fontSize = eachSeries.textSize * opts.pix || config.fontSize;
- context.setFontSize(fontSize);
- context.setFillStyle(eachSeries.textColor || "#FFFFFF");
- context.setTextAlign('center');
- context.fillText(String(item.t), item.x, item.y + fontSize / 2);
- context.closePath();
- context.stroke();
- context.setTextAlign('left');
- });
- }
- });
- context.restore();
- return {
- xAxisPoints: xAxisPoints,
- calPoints: calPoints,
- eachSpacing: eachSpacing
- };
- }
- function drawLineDataPoints(series, opts, config, context) {
- var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
- var lineOption = assign({}, {
- type: 'straight',
- width: 2,
- activeType: 'none',
- linearType: 'none',
- onShadow: false,
- animation: 'vertical'
- }, opts.extra.line);
- lineOption.width *= opts.pix;
- var xAxisData = opts.chartData.xAxisData,
- xAxisPoints = xAxisData.xAxisPoints,
- eachSpacing = xAxisData.eachSpacing;
- var calPoints = [];
- context.save();
- var leftSpace = 0;
- var rightSpace = opts.width + eachSpacing;
- if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
- context.translate(opts._scrollDistance_, 0);
- leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
- rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
- }
- series.forEach(function (eachSeries, seriesIndex) {
- // 这段很神奇的代码用于解决ios16的setStrokeStyle失效的bug
- context.beginPath();
- context.setStrokeStyle(eachSeries.color);
- context.moveTo(-10000, -10000);
- context.lineTo(-10001, -10001);
- context.stroke();
- var ranges, minRange, maxRange;
- ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
- minRange = ranges.pop();
- maxRange = ranges.shift();
- var data = eachSeries.data;
- var points = getLineDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, lineOption, process);
- calPoints.push(points);
- var splitPointList = splitPoints(points, eachSeries);
- if (eachSeries.lineType == 'dash') {
- var dashLength = eachSeries.dashLength ? eachSeries.dashLength : 8;
- dashLength *= opts.pix;
- context.setLineDash([dashLength, dashLength]);
- }
- context.beginPath();
- var strokeColor = eachSeries.color;
- if (lineOption.linearType !== 'none' && eachSeries.linearColor && eachSeries.linearColor.length > 0) {
- var grd = context.createLinearGradient(opts.chartData.xAxisData.startX, opts.height / 2, opts.chartData.xAxisData.endX, opts.height / 2);
- for (var i = 0; i < eachSeries.linearColor.length; i++) {
- grd.addColorStop(eachSeries.linearColor[i][0], hexToRgb(eachSeries.linearColor[i][1], 1));
- }
- strokeColor = grd;
- }
- context.setStrokeStyle(strokeColor);
- if (lineOption.onShadow == true && eachSeries.setShadow && eachSeries.setShadow.length > 0) {
- context.setShadow(eachSeries.setShadow[0], eachSeries.setShadow[1], eachSeries.setShadow[2], eachSeries.setShadow[3]);
- } else {
- context.setShadow(0, 0, 0, 'rgba(0,0,0,0)');
- }
- context.setLineWidth(lineOption.width);
- splitPointList.forEach(function (points, index) {
- if (points.length === 1) {
- context.moveTo(points[0].x, points[0].y);
- // context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI);
- } else {
- context.moveTo(points[0].x, points[0].y);
- var startPoint = 0;
- if (lineOption.type === 'curve') {
- for (var j = 0; j < points.length; j++) {
- var item = points[j];
- if (startPoint == 0 && item.x > leftSpace) {
- context.moveTo(item.x, item.y);
- startPoint = 1;
- }
- if (j > 0 && item.x > leftSpace && item.x < rightSpace) {
- var ctrlPoint = createCurveControlPoints(points, j - 1);
- context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, item.x, item.y);
- }
- }
- ;
- }
- if (lineOption.type === 'straight') {
- for (var _j6 = 0; _j6 < points.length; _j6++) {
- var _item19 = points[_j6];
- if (startPoint == 0 && _item19.x > leftSpace) {
- context.moveTo(_item19.x, _item19.y);
- startPoint = 1;
- }
- if (_j6 > 0 && _item19.x > leftSpace && _item19.x < rightSpace) {
- context.lineTo(_item19.x, _item19.y);
- }
- }
- ;
- }
- if (lineOption.type === 'step') {
- for (var _j7 = 0; _j7 < points.length; _j7++) {
- var _item20 = points[_j7];
- if (startPoint == 0 && _item20.x > leftSpace) {
- context.moveTo(_item20.x, _item20.y);
- startPoint = 1;
- }
- if (_j7 > 0 && _item20.x > leftSpace && _item20.x < rightSpace) {
- context.lineTo(_item20.x, points[_j7 - 1].y);
- context.lineTo(_item20.x, _item20.y);
- }
- }
- ;
- }
- context.moveTo(points[0].x, points[0].y);
- }
- });
- context.stroke();
- context.setLineDash([]);
- if (opts.dataPointShape !== false) {
- drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts);
- }
- drawActivePoint(points, eachSeries.color, eachSeries.pointShape, context, opts, lineOption);
- });
- if (opts.dataLabel !== false && process === 1) {
- series.forEach(function (eachSeries, seriesIndex) {
- var ranges, minRange, maxRange;
- ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
- minRange = ranges.pop();
- maxRange = ranges.shift();
- var data = eachSeries.data;
- var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
- drawPointText(points, eachSeries, config, context, opts);
- });
- }
- context.restore();
- return {
- xAxisPoints: xAxisPoints,
- calPoints: calPoints,
- eachSpacing: eachSpacing
- };
- }
- function drawMixDataPoints(series, opts, config, context) {
- var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
- var xAxisData = opts.chartData.xAxisData,
- xAxisPoints = xAxisData.xAxisPoints,
- eachSpacing = xAxisData.eachSpacing;
- var columnOption = assign({}, {
- width: eachSpacing / 2,
- barBorderCircle: false,
- barBorderRadius: [],
- seriesGap: 2,
- linearType: 'none',
- linearOpacity: 1,
- customColor: [],
- colorStop: 0
- }, opts.extra.mix.column);
- var areaOption = assign({}, {
- opacity: 0.2,
- gradient: false
- }, opts.extra.mix.area);
- var lineOption = assign({}, {
- width: 2
- }, opts.extra.mix.line);
- var endY = opts.height - opts.area[2];
- var calPoints = [];
- var columnIndex = 0;
- var columnLength = 0;
- series.forEach(function (eachSeries, seriesIndex) {
- if (eachSeries.type == 'column') {
- columnLength += 1;
- }
- });
- context.save();
- var leftNum = -2;
- var rightNum = xAxisPoints.length + 2;
- var leftSpace = 0;
- var rightSpace = opts.width + eachSpacing;
- if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
- context.translate(opts._scrollDistance_, 0);
- leftNum = Math.floor(-opts._scrollDistance_ / eachSpacing) - 2;
- rightNum = leftNum + opts.xAxis.itemCount + 4;
- leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
- rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
- }
- columnOption.customColor = fillCustomColor(columnOption.linearType, columnOption.customColor, series, config);
- series.forEach(function (eachSeries, seriesIndex) {
- var ranges, minRange, maxRange;
- ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
- minRange = ranges.pop();
- maxRange = ranges.shift();
- var data = eachSeries.data;
- var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
- calPoints.push(points);
- // 绘制柱状数据图
- if (eachSeries.type == 'column') {
- points = fixColumeData(points, eachSpacing, columnLength, columnIndex, config, opts);
- for (var i = 0; i < points.length; i++) {
- var item = points[i];
- if (item !== null && i > leftNum && i < rightNum) {
- var startX = item.x - item.width / 2;
- var height = opts.height - item.y - opts.area[2];
- context.beginPath();
- var fillColor = item.color || eachSeries.color;
- var strokeColor = item.color || eachSeries.color;
- if (columnOption.linearType !== 'none') {
- var grd = context.createLinearGradient(startX, item.y, startX, opts.height - opts.area[2]);
- //透明渐变
- if (columnOption.linearType == 'opacity') {
- grd.addColorStop(0, hexToRgb(fillColor, columnOption.linearOpacity));
- grd.addColorStop(1, hexToRgb(fillColor, 1));
- } else {
- grd.addColorStop(0, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
- grd.addColorStop(columnOption.colorStop, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
- grd.addColorStop(1, hexToRgb(fillColor, 1));
- }
- fillColor = grd;
- }
- // 圆角边框
- if (columnOption.barBorderRadius && columnOption.barBorderRadius.length === 4 || columnOption.barBorderCircle) {
- var left = startX;
- var top = item.y;
- var width = item.width;
- var _height5 = opts.height - opts.area[2] - item.y;
- if (columnOption.barBorderCircle) {
- columnOption.barBorderRadius = [width / 2, width / 2, 0, 0];
- }
- var _columnOption$barBord4 = (0, _slicedToArray2.default)(columnOption.barBorderRadius, 4),
- r0 = _columnOption$barBord4[0],
- r1 = _columnOption$barBord4[1],
- r2 = _columnOption$barBord4[2],
- r3 = _columnOption$barBord4[3];
- var minRadius = Math.min(width / 2, _height5 / 2);
- r0 = r0 > minRadius ? minRadius : r0;
- r1 = r1 > minRadius ? minRadius : r1;
- r2 = r2 > minRadius ? minRadius : r2;
- r3 = r3 > minRadius ? minRadius : r3;
- r0 = r0 < 0 ? 0 : r0;
- r1 = r1 < 0 ? 0 : r1;
- r2 = r2 < 0 ? 0 : r2;
- r3 = r3 < 0 ? 0 : r3;
- context.arc(left + r0, top + r0, r0, -Math.PI, -Math.PI / 2);
- context.arc(left + width - r1, top + r1, r1, -Math.PI / 2, 0);
- context.arc(left + width - r2, top + _height5 - r2, r2, 0, Math.PI / 2);
- context.arc(left + r3, top + _height5 - r3, r3, Math.PI / 2, Math.PI);
- } else {
- context.moveTo(startX, item.y);
- context.lineTo(startX + item.width, item.y);
- context.lineTo(startX + item.width, opts.height - opts.area[2]);
- context.lineTo(startX, opts.height - opts.area[2]);
- context.lineTo(startX, item.y);
- context.setLineWidth(1);
- context.setStrokeStyle(strokeColor);
- }
- context.setFillStyle(fillColor);
- context.closePath();
- context.fill();
- }
- }
- columnIndex += 1;
- }
- //绘制区域图数据
- if (eachSeries.type == 'area') {
- var _splitPointList = splitPoints(points, eachSeries);
- for (var _i23 = 0; _i23 < _splitPointList.length; _i23++) {
- var _points3 = _splitPointList[_i23];
- // 绘制区域数据
- context.beginPath();
- context.setStrokeStyle(eachSeries.color);
- context.setStrokeStyle(hexToRgb(eachSeries.color, areaOption.opacity));
- if (areaOption.gradient) {
- var gradient = context.createLinearGradient(0, opts.area[0], 0, opts.height - opts.area[2]);
- gradient.addColorStop('0', hexToRgb(eachSeries.color, areaOption.opacity));
- gradient.addColorStop('1.0', hexToRgb("#FFFFFF", 0.1));
- context.setFillStyle(gradient);
- } else {
- context.setFillStyle(hexToRgb(eachSeries.color, areaOption.opacity));
- }
- context.setLineWidth(2 * opts.pix);
- if (_points3.length > 1) {
- var firstPoint = _points3[0];
- var lastPoint = _points3[_points3.length - 1];
- context.moveTo(firstPoint.x, firstPoint.y);
- var startPoint = 0;
- if (eachSeries.style === 'curve') {
- for (var j = 0; j < _points3.length; j++) {
- var _item21 = _points3[j];
- if (startPoint == 0 && _item21.x > leftSpace) {
- context.moveTo(_item21.x, _item21.y);
- startPoint = 1;
- }
- if (j > 0 && _item21.x > leftSpace && _item21.x < rightSpace) {
- var ctrlPoint = createCurveControlPoints(_points3, j - 1);
- context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, _item21.x, _item21.y);
- }
- }
- ;
- } else {
- for (var _j8 = 0; _j8 < _points3.length; _j8++) {
- var _item22 = _points3[_j8];
- if (startPoint == 0 && _item22.x > leftSpace) {
- context.moveTo(_item22.x, _item22.y);
- startPoint = 1;
- }
- if (_j8 > 0 && _item22.x > leftSpace && _item22.x < rightSpace) {
- context.lineTo(_item22.x, _item22.y);
- }
- }
- ;
- }
- context.lineTo(lastPoint.x, endY);
- context.lineTo(firstPoint.x, endY);
- context.lineTo(firstPoint.x, firstPoint.y);
- } else {
- var _item23 = _points3[0];
- context.moveTo(_item23.x - eachSpacing / 2, _item23.y);
- // context.lineTo(item.x + eachSpacing / 2, item.y);
- // context.lineTo(item.x + eachSpacing / 2, endY);
- // context.lineTo(item.x - eachSpacing / 2, endY);
- // context.moveTo(item.x - eachSpacing / 2, item.y);
- }
- context.closePath();
- context.fill();
- }
- }
- // 绘制折线数据图
- if (eachSeries.type == 'line') {
- var splitPointList = splitPoints(points, eachSeries);
- splitPointList.forEach(function (points, index) {
- if (eachSeries.lineType == 'dash') {
- var dashLength = eachSeries.dashLength ? eachSeries.dashLength : 8;
- dashLength *= opts.pix;
- context.setLineDash([dashLength, dashLength]);
- }
- context.beginPath();
- context.setStrokeStyle(eachSeries.color);
- context.setLineWidth(lineOption.width * opts.pix);
- if (points.length === 1) {
- context.moveTo(points[0].x, points[0].y);
- // context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI);
- } else {
- context.moveTo(points[0].x, points[0].y);
- var _startPoint2 = 0;
- if (eachSeries.style == 'curve') {
- for (var _j9 = 0; _j9 < points.length; _j9++) {
- var _item24 = points[_j9];
- if (_startPoint2 == 0 && _item24.x > leftSpace) {
- context.moveTo(_item24.x, _item24.y);
- _startPoint2 = 1;
- }
- if (_j9 > 0 && _item24.x > leftSpace && _item24.x < rightSpace) {
- var ctrlPoint = createCurveControlPoints(points, _j9 - 1);
- context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, _item24.x, _item24.y);
- }
- }
- } else {
- for (var _j10 = 0; _j10 < points.length; _j10++) {
- var _item25 = points[_j10];
- if (_startPoint2 == 0 && _item25.x > leftSpace) {
- context.moveTo(_item25.x, _item25.y);
- _startPoint2 = 1;
- }
- if (_j10 > 0 && _item25.x > leftSpace && _item25.x < rightSpace) {
- context.lineTo(_item25.x, _item25.y);
- }
- }
- }
- context.moveTo(points[0].x, points[0].y);
- }
- context.stroke();
- context.setLineDash([]);
- });
- }
- // 绘制点数据图
- if (eachSeries.type == 'point') {
- eachSeries.addPoint = true;
- }
- if (eachSeries.addPoint == true && eachSeries.type !== 'column') {
- drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts);
- }
- });
- if (opts.dataLabel !== false && process === 1) {
- var columnIndex = 0;
- series.forEach(function (eachSeries, seriesIndex) {
- var ranges, minRange, maxRange;
- ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
- minRange = ranges.pop();
- maxRange = ranges.shift();
- var data = eachSeries.data;
- var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
- if (eachSeries.type !== 'column') {
- drawPointText(points, eachSeries, config, context, opts);
- } else {
- points = fixColumeData(points, eachSpacing, columnLength, columnIndex, config, opts);
- drawPointText(points, eachSeries, config, context, opts);
- columnIndex += 1;
- }
- });
- }
- context.restore();
- return {
- xAxisPoints: xAxisPoints,
- calPoints: calPoints,
- eachSpacing: eachSpacing
- };
- }
- function drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints) {
- var toolTipOption = opts.extra.tooltip || {};
- if (toolTipOption.horizentalLine && opts.tooltip && process === 1 && (opts.type == 'line' || opts.type == 'area' || opts.type == 'column' || opts.type == 'mount' || opts.type == 'candle' || opts.type == 'mix')) {
- drawToolTipHorizentalLine(opts, config, context, eachSpacing, xAxisPoints);
- }
- context.save();
- if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
- context.translate(opts._scrollDistance_, 0);
- }
- if (opts.tooltip && opts.tooltip.textList && opts.tooltip.textList.length && process === 1) {
- drawToolTip(opts.tooltip.textList, opts.tooltip.offset, opts, config, context, eachSpacing, xAxisPoints);
- }
- context.restore();
- }
- function drawXAxis(categories, opts, config, context) {
- var xAxisData = opts.chartData.xAxisData,
- xAxisPoints = xAxisData.xAxisPoints,
- startX = xAxisData.startX,
- endX = xAxisData.endX,
- eachSpacing = xAxisData.eachSpacing;
- var boundaryGap = 'center';
- if (opts.type == 'bar' || opts.type == 'line' || opts.type == 'area' || opts.type == 'scatter' || opts.type == 'bubble') {
- boundaryGap = opts.xAxis.boundaryGap;
- }
- var startY = opts.height - opts.area[2];
- var endY = opts.area[0];
- //绘制滚动条
- if (opts.enableScroll && opts.xAxis.scrollShow) {
- var scrollY = opts.height - opts.area[2] + config.xAxisHeight;
- var scrollScreenWidth = endX - startX;
- var scrollTotalWidth = eachSpacing * (xAxisPoints.length - 1);
- if (opts.type == 'mount' && opts.extra && opts.extra.mount && opts.extra.mount.widthRatio && opts.extra.mount.widthRatio > 1) {
- if (opts.extra.mount.widthRatio > 2) opts.extra.mount.widthRatio = 2;
- scrollTotalWidth += (opts.extra.mount.widthRatio - 1) * eachSpacing;
- }
- var scrollWidth = scrollScreenWidth * scrollScreenWidth / scrollTotalWidth;
- var scrollLeft = 0;
- if (opts._scrollDistance_) {
- scrollLeft = -opts._scrollDistance_ * scrollScreenWidth / scrollTotalWidth;
- }
- context.beginPath();
- context.setLineCap('round');
- context.setLineWidth(6 * opts.pix);
- context.setStrokeStyle(opts.xAxis.scrollBackgroundColor || "#EFEBEF");
- context.moveTo(startX, scrollY);
- context.lineTo(endX, scrollY);
- context.stroke();
- context.closePath();
- context.beginPath();
- context.setLineCap('round');
- context.setLineWidth(6 * opts.pix);
- context.setStrokeStyle(opts.xAxis.scrollColor || "#A6A6A6");
- context.moveTo(startX + scrollLeft, scrollY);
- context.lineTo(startX + scrollLeft + scrollWidth, scrollY);
- context.stroke();
- context.closePath();
- context.setLineCap('butt');
- }
- context.save();
- if (opts._scrollDistance_ && opts._scrollDistance_ !== 0) {
- context.translate(opts._scrollDistance_, 0);
- }
- //绘制X轴刻度线
- if (opts.xAxis.calibration === true) {
- context.setStrokeStyle(opts.xAxis.gridColor || "#cccccc");
- context.setLineCap('butt');
- context.setLineWidth(1 * opts.pix);
- xAxisPoints.forEach(function (item, index) {
- if (index > 0) {
- context.beginPath();
- context.moveTo(item - eachSpacing / 2, startY);
- context.lineTo(item - eachSpacing / 2, startY + 3 * opts.pix);
- context.closePath();
- context.stroke();
- }
- });
- }
- //绘制X轴网格
- if (opts.xAxis.disableGrid !== true) {
- context.setStrokeStyle(opts.xAxis.gridColor || "#cccccc");
- context.setLineCap('butt');
- context.setLineWidth(1 * opts.pix);
- if (opts.xAxis.gridType == 'dash') {
- context.setLineDash([opts.xAxis.dashLength * opts.pix, opts.xAxis.dashLength * opts.pix]);
- }
- opts.xAxis.gridEval = opts.xAxis.gridEval || 1;
- xAxisPoints.forEach(function (item, index) {
- if (index % opts.xAxis.gridEval == 0) {
- context.beginPath();
- context.moveTo(item, startY);
- context.lineTo(item, endY);
- context.stroke();
- }
- });
- context.setLineDash([]);
- }
- //绘制X轴文案
- if (opts.xAxis.disabled !== true) {
- // 对X轴列表做抽稀处理
- //默认全部显示X轴标签
- var maxXAxisListLength = categories.length;
- //如果设置了X轴单屏数量
- if (opts.xAxis.labelCount) {
- //如果设置X轴密度
- if (opts.xAxis.itemCount) {
- maxXAxisListLength = Math.ceil(categories.length / opts.xAxis.itemCount * opts.xAxis.labelCount);
- } else {
- maxXAxisListLength = opts.xAxis.labelCount;
- }
- maxXAxisListLength -= 1;
- }
- var ratio = Math.ceil(categories.length / maxXAxisListLength);
- var newCategories = [];
- var cgLength = categories.length;
- for (var i = 0; i < cgLength; i++) {
- if (i % ratio !== 0) {
- newCategories.push("");
- } else {
- newCategories.push(categories[i]);
- }
- }
- newCategories[cgLength - 1] = categories[cgLength - 1];
- var xAxisFontSize = opts.xAxis.fontSize * opts.pix || config.fontSize;
- if (config._xAxisTextAngle_ === 0) {
- newCategories.forEach(function (item, index) {
- var xitem = opts.xAxis.formatter ? opts.xAxis.formatter(item, index, opts) : item;
- var offset = -measureText(String(xitem), xAxisFontSize, context) / 2;
- if (boundaryGap == 'center') {
- offset += eachSpacing / 2;
- }
- var scrollHeight = 0;
- if (opts.xAxis.scrollShow) {
- scrollHeight = 6 * opts.pix;
- }
- // 如果在主视图区域内
- var _scrollDistance_ = opts._scrollDistance_ || 0;
- var truePoints = boundaryGap == 'center' ? xAxisPoints[index] + eachSpacing / 2 : xAxisPoints[index];
- if (truePoints - Math.abs(_scrollDistance_) >= opts.area[3] - 1 && truePoints - Math.abs(_scrollDistance_) <= opts.width - opts.area[1] + 1) {
- context.beginPath();
- context.setFontSize(xAxisFontSize);
- context.setFillStyle(opts.xAxis.fontColor || opts.fontColor);
- context.fillText(String(xitem), xAxisPoints[index] + offset, startY + opts.xAxis.marginTop * opts.pix + (opts.xAxis.lineHeight - opts.xAxis.fontSize) * opts.pix / 2 + opts.xAxis.fontSize * opts.pix);
- context.closePath();
- context.stroke();
- }
- });
- } else {
- newCategories.forEach(function (item, index) {
- var xitem = opts.xAxis.formatter ? opts.xAxis.formatter(item) : item;
- // 如果在主视图区域内
- var _scrollDistance_ = opts._scrollDistance_ || 0;
- var truePoints = boundaryGap == 'center' ? xAxisPoints[index] + eachSpacing / 2 : xAxisPoints[index];
- if (truePoints - Math.abs(_scrollDistance_) >= opts.area[3] - 1 && truePoints - Math.abs(_scrollDistance_) <= opts.width - opts.area[1] + 1) {
- context.save();
- context.beginPath();
- context.setFontSize(xAxisFontSize);
- context.setFillStyle(opts.xAxis.fontColor || opts.fontColor);
- var textWidth = measureText(String(xitem), xAxisFontSize, context);
- var offsetX = xAxisPoints[index];
- if (boundaryGap == 'center') {
- offsetX = xAxisPoints[index] + eachSpacing / 2;
- }
- var scrollHeight = 0;
- if (opts.xAxis.scrollShow) {
- scrollHeight = 6 * opts.pix;
- }
- var offsetY = startY + opts.xAxis.marginTop * opts.pix + xAxisFontSize - xAxisFontSize * Math.abs(Math.sin(config._xAxisTextAngle_));
- if (opts.xAxis.rotateAngle < 0) {
- offsetX -= xAxisFontSize / 2;
- textWidth = 0;
- } else {
- offsetX += xAxisFontSize / 2;
- textWidth = -textWidth;
- }
- context.translate(offsetX, offsetY);
- context.rotate(-1 * config._xAxisTextAngle_);
- context.fillText(String(xitem), textWidth, 0);
- context.closePath();
- context.stroke();
- context.restore();
- }
- });
- }
- }
- context.restore();
- //画X轴标题
- if (opts.xAxis.title) {
- context.beginPath();
- context.setFontSize(opts.xAxis.titleFontSize * opts.pix);
- context.setFillStyle(opts.xAxis.titleFontColor);
- context.fillText(String(opts.xAxis.title), opts.width - opts.area[1] + opts.xAxis.titleOffsetX * opts.pix, opts.height - opts.area[2] + opts.xAxis.marginTop * opts.pix + (opts.xAxis.lineHeight - opts.xAxis.titleFontSize) * opts.pix / 2 + (opts.xAxis.titleFontSize + opts.xAxis.titleOffsetY) * opts.pix);
- context.closePath();
- context.stroke();
- }
- //绘制X轴轴线
- if (opts.xAxis.axisLine) {
- context.beginPath();
- context.setStrokeStyle(opts.xAxis.axisLineColor);
- context.setLineWidth(1 * opts.pix);
- context.moveTo(startX, opts.height - opts.area[2]);
- context.lineTo(endX, opts.height - opts.area[2]);
- context.stroke();
- }
- }
- function drawYAxisGrid(categories, opts, config, context) {
- if (opts.yAxis.disableGrid === true) {
- return;
- }
- var spacingValid = opts.height - opts.area[0] - opts.area[2];
- var eachSpacing = spacingValid / opts.yAxis.splitNumber;
- var startX = opts.area[3];
- var xAxisPoints = opts.chartData.xAxisData.xAxisPoints,
- xAxiseachSpacing = opts.chartData.xAxisData.eachSpacing;
- var TotalWidth = xAxiseachSpacing * (xAxisPoints.length - 1);
- if (opts.type == 'mount' && opts.extra && opts.extra.mount && opts.extra.mount.widthRatio && opts.extra.mount.widthRatio > 1) {
- if (opts.extra.mount.widthRatio > 2) opts.extra.mount.widthRatio = 2;
- TotalWidth += (opts.extra.mount.widthRatio - 1) * xAxiseachSpacing;
- }
- var endX = startX + TotalWidth;
- var points = [];
- var startY = 1;
- if (opts.xAxis.axisLine === false) {
- startY = 0;
- }
- for (var i = startY; i < opts.yAxis.splitNumber + 1; i++) {
- points.push(opts.height - opts.area[2] - eachSpacing * i);
- }
- context.save();
- if (opts._scrollDistance_ && opts._scrollDistance_ !== 0) {
- context.translate(opts._scrollDistance_, 0);
- }
- if (opts.yAxis.gridType == 'dash') {
- context.setLineDash([opts.yAxis.dashLength * opts.pix, opts.yAxis.dashLength * opts.pix]);
- }
- context.setStrokeStyle(opts.yAxis.gridColor);
- context.setLineWidth(1 * opts.pix);
- points.forEach(function (item, index) {
- context.beginPath();
- context.moveTo(startX, item);
- context.lineTo(endX, item);
- context.stroke();
- });
- context.setLineDash([]);
- context.restore();
- }
- function drawYAxis(series, opts, config, context) {
- if (opts.yAxis.disabled === true) {
- return;
- }
- var spacingValid = opts.height - opts.area[0] - opts.area[2];
- var eachSpacing = spacingValid / opts.yAxis.splitNumber;
- var startX = opts.area[3];
- var endX = opts.width - opts.area[1];
- var endY = opts.height - opts.area[2];
- // set YAxis background
- context.beginPath();
- context.setFillStyle(opts.background);
- if (opts.enableScroll == true && opts.xAxis.scrollPosition && opts.xAxis.scrollPosition !== 'left') {
- context.fillRect(0, 0, startX, endY + 2 * opts.pix);
- }
- if (opts.enableScroll == true && opts.xAxis.scrollPosition && opts.xAxis.scrollPosition !== 'right') {
- context.fillRect(endX, 0, opts.width, endY + 2 * opts.pix);
- }
- context.closePath();
- context.stroke();
- var tStartLeft = opts.area[3];
- var tStartRight = opts.width - opts.area[1];
- var tStartCenter = opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2;
- if (opts.yAxis.data) {
- var _loop4 = function _loop4(i) {
- var yData = opts.yAxis.data[i];
- points = [];
- if (yData.type === 'categories') {
- for (var _i24 = 0; _i24 <= yData.categories.length; _i24++) {
- points.push(opts.area[0] + spacingValid / yData.categories.length / 2 + spacingValid / yData.categories.length * _i24);
- }
- } else {
- for (var _i25 = 0; _i25 <= opts.yAxis.splitNumber; _i25++) {
- points.push(opts.area[0] + eachSpacing * _i25);
- }
- }
- if (yData.disabled !== true) {
- var rangesFormat = opts.chartData.yAxisData.rangesFormat[i];
- var yAxisFontSize = yData.fontSize ? yData.fontSize * opts.pix : config.fontSize;
- var yAxisWidth = opts.chartData.yAxisData.yAxisWidth[i];
- var textAlign = yData.textAlign || "right";
- //画Y轴刻度及文案
- rangesFormat.forEach(function (item, index) {
- var pos = points[index];
- context.beginPath();
- context.setFontSize(yAxisFontSize);
- context.setLineWidth(1 * opts.pix);
- context.setStrokeStyle(yData.axisLineColor || '#cccccc');
- context.setFillStyle(yData.fontColor || opts.fontColor);
- var tmpstrat = 0;
- var gapwidth = 4 * opts.pix;
- if (yAxisWidth.position == 'left') {
- //画刻度线
- if (yData.calibration == true) {
- context.moveTo(tStartLeft, pos);
- context.lineTo(tStartLeft - 3 * opts.pix, pos);
- gapwidth += 3 * opts.pix;
- }
- //画文字
- switch (textAlign) {
- case "left":
- context.setTextAlign('left');
- tmpstrat = tStartLeft - yAxisWidth.width;
- break;
- case "right":
- context.setTextAlign('right');
- tmpstrat = tStartLeft - gapwidth;
- break;
- default:
- context.setTextAlign('center');
- tmpstrat = tStartLeft - yAxisWidth.width / 2;
- }
- context.fillText(String(item), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix);
- } else if (yAxisWidth.position == 'right') {
- //画刻度线
- if (yData.calibration == true) {
- context.moveTo(tStartRight, pos);
- context.lineTo(tStartRight + 3 * opts.pix, pos);
- gapwidth += 3 * opts.pix;
- }
- switch (textAlign) {
- case "left":
- context.setTextAlign('left');
- tmpstrat = tStartRight + gapwidth;
- break;
- case "right":
- context.setTextAlign('right');
- tmpstrat = tStartRight + yAxisWidth.width;
- break;
- default:
- context.setTextAlign('center');
- tmpstrat = tStartRight + yAxisWidth.width / 2;
- }
- context.fillText(String(item), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix);
- } else if (yAxisWidth.position == 'center') {
- //画刻度线
- if (yData.calibration == true) {
- context.moveTo(tStartCenter, pos);
- context.lineTo(tStartCenter - 3 * opts.pix, pos);
- gapwidth += 3 * opts.pix;
- }
- //画文字
- switch (textAlign) {
- case "left":
- context.setTextAlign('left');
- tmpstrat = tStartCenter - yAxisWidth.width;
- break;
- case "right":
- context.setTextAlign('right');
- tmpstrat = tStartCenter - gapwidth;
- break;
- default:
- context.setTextAlign('center');
- tmpstrat = tStartCenter - yAxisWidth.width / 2;
- }
- context.fillText(String(item), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix);
- }
- context.closePath();
- context.stroke();
- context.setTextAlign('left');
- });
- //画Y轴轴线
- if (yData.axisLine !== false) {
- context.beginPath();
- context.setStrokeStyle(yData.axisLineColor || '#cccccc');
- context.setLineWidth(1 * opts.pix);
- if (yAxisWidth.position == 'left') {
- context.moveTo(tStartLeft, opts.height - opts.area[2]);
- context.lineTo(tStartLeft, opts.area[0]);
- } else if (yAxisWidth.position == 'right') {
- context.moveTo(tStartRight, opts.height - opts.area[2]);
- context.lineTo(tStartRight, opts.area[0]);
- } else if (yAxisWidth.position == 'center') {
- context.moveTo(tStartCenter, opts.height - opts.area[2]);
- context.lineTo(tStartCenter, opts.area[0]);
- }
- context.stroke();
- }
- //画Y轴标题
- if (opts.yAxis.showTitle) {
- var titleFontSize = yData.titleFontSize * opts.pix || config.fontSize;
- var title = yData.title;
- context.beginPath();
- context.setFontSize(titleFontSize);
- context.setFillStyle(yData.titleFontColor || opts.fontColor);
- if (yAxisWidth.position == 'left') {
- context.fillText(title, tStartLeft - measureText(title, titleFontSize, context) / 2 + (yData.titleOffsetX || 0), opts.area[0] - (10 - (yData.titleOffsetY || 0)) * opts.pix);
- } else if (yAxisWidth.position == 'right') {
- context.fillText(title, tStartRight - measureText(title, titleFontSize, context) / 2 + (yData.titleOffsetX || 0), opts.area[0] - (10 - (yData.titleOffsetY || 0)) * opts.pix);
- } else if (yAxisWidth.position == 'center') {
- context.fillText(title, tStartCenter - measureText(title, titleFontSize, context) / 2 + (yData.titleOffsetX || 0), opts.area[0] - (10 - (yData.titleOffsetY || 0)) * opts.pix);
- }
- context.closePath();
- context.stroke();
- }
- if (yAxisWidth.position == 'left') {
- tStartLeft -= yAxisWidth.width + opts.yAxis.padding * opts.pix;
- } else {
- tStartRight += yAxisWidth.width + opts.yAxis.padding * opts.pix;
- }
- }
- };
- for (var i = 0; i < opts.yAxis.data.length; i++) {
- var points;
- _loop4(i);
- }
- }
- }
- function drawLegend(series, opts, config, context, chartData) {
- if (opts.legend.show === false) {
- return;
- }
- var legendData = chartData.legendData;
- var legendList = legendData.points;
- var legendArea = legendData.area;
- var padding = opts.legend.padding * opts.pix;
- var fontSize = opts.legend.fontSize * opts.pix;
- var shapeWidth = 15 * opts.pix;
- var shapeRight = 5 * opts.pix;
- var itemGap = opts.legend.itemGap * opts.pix;
- var lineHeight = Math.max(opts.legend.lineHeight * opts.pix, fontSize);
- //画背景及边框
- context.beginPath();
- context.setLineWidth(opts.legend.borderWidth * opts.pix);
- context.setStrokeStyle(opts.legend.borderColor);
- context.setFillStyle(opts.legend.backgroundColor);
- context.moveTo(legendArea.start.x, legendArea.start.y);
- context.rect(legendArea.start.x, legendArea.start.y, legendArea.width, legendArea.height);
- context.closePath();
- context.fill();
- context.stroke();
- legendList.forEach(function (itemList, listIndex) {
- var width = 0;
- var height = 0;
- width = legendData.widthArr[listIndex];
- height = legendData.heightArr[listIndex];
- var startX = 0;
- var startY = 0;
- if (opts.legend.position == 'top' || opts.legend.position == 'bottom') {
- switch (opts.legend.float) {
- case 'left':
- startX = legendArea.start.x + padding;
- break;
- case 'right':
- startX = legendArea.start.x + legendArea.width - width;
- break;
- default:
- startX = legendArea.start.x + (legendArea.width - width) / 2;
- }
- startY = legendArea.start.y + padding + listIndex * lineHeight;
- } else {
- if (listIndex == 0) {
- width = 0;
- } else {
- width = legendData.widthArr[listIndex - 1];
- }
- startX = legendArea.start.x + padding + width;
- startY = legendArea.start.y + padding + (legendArea.height - height) / 2;
- }
- context.setFontSize(config.fontSize);
- for (var i = 0; i < itemList.length; i++) {
- var item = itemList[i];
- item.area = [0, 0, 0, 0];
- item.area[0] = startX;
- item.area[1] = startY;
- item.area[3] = startY + lineHeight;
- context.beginPath();
- context.setLineWidth(1 * opts.pix);
- context.setStrokeStyle(item.show ? item.color : opts.legend.hiddenColor);
- context.setFillStyle(item.show ? item.color : opts.legend.hiddenColor);
- switch (item.legendShape) {
- case 'line':
- context.moveTo(startX, startY + 0.5 * lineHeight - 2 * opts.pix);
- context.fillRect(startX, startY + 0.5 * lineHeight - 2 * opts.pix, 15 * opts.pix, 4 * opts.pix);
- break;
- case 'triangle':
- context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix);
- context.lineTo(startX + 2.5 * opts.pix, startY + 0.5 * lineHeight + 5 * opts.pix);
- context.lineTo(startX + 12.5 * opts.pix, startY + 0.5 * lineHeight + 5 * opts.pix);
- context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix);
- break;
- case 'diamond':
- context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix);
- context.lineTo(startX + 2.5 * opts.pix, startY + 0.5 * lineHeight);
- context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight + 5 * opts.pix);
- context.lineTo(startX + 12.5 * opts.pix, startY + 0.5 * lineHeight);
- context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix);
- break;
- case 'circle':
- context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight);
- context.arc(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight, 5 * opts.pix, 0, 2 * Math.PI);
- break;
- case 'rect':
- context.moveTo(startX, startY + 0.5 * lineHeight - 5 * opts.pix);
- context.fillRect(startX, startY + 0.5 * lineHeight - 5 * opts.pix, 15 * opts.pix, 10 * opts.pix);
- break;
- case 'square':
- context.moveTo(startX + 5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix);
- context.fillRect(startX + 5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix, 10 * opts.pix, 10 * opts.pix);
- break;
- case 'none':
- break;
- default:
- context.moveTo(startX, startY + 0.5 * lineHeight - 5 * opts.pix);
- context.fillRect(startX, startY + 0.5 * lineHeight - 5 * opts.pix, 15 * opts.pix, 10 * opts.pix);
- }
- context.closePath();
- context.fill();
- context.stroke();
- startX += shapeWidth + shapeRight;
- var fontTrans = 0.5 * lineHeight + 0.5 * fontSize - 2;
- var legendText = item.legendText ? item.legendText : item.name;
- context.beginPath();
- context.setFontSize(fontSize);
- context.setFillStyle(item.show ? opts.legend.fontColor : opts.legend.hiddenColor);
- context.fillText(legendText, startX, startY + fontTrans);
- context.closePath();
- context.stroke();
- if (opts.legend.position == 'top' || opts.legend.position == 'bottom') {
- startX += measureText(legendText, fontSize, context) + itemGap;
- item.area[2] = startX;
- } else {
- item.area[2] = startX + measureText(legendText, fontSize, context) + itemGap;
- ;
- startX -= shapeWidth + shapeRight;
- startY += lineHeight;
- }
- }
- });
- }
- function drawPieDataPoints(series, opts, config, context) {
- var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
- var pieOption = assign({}, {
- activeOpacity: 0.5,
- activeRadius: 10,
- offsetAngle: 0,
- labelWidth: 15,
- ringWidth: 30,
- customRadius: 0,
- border: false,
- borderWidth: 2,
- borderColor: '#FFFFFF',
- centerColor: '#FFFFFF',
- linearType: 'none',
- customColor: []
- }, opts.type == "pie" ? opts.extra.pie : opts.extra.ring);
- var centerPosition = {
- x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
- y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2
- };
- if (config.pieChartLinePadding == 0) {
- config.pieChartLinePadding = pieOption.activeRadius * opts.pix;
- }
- var radius = Math.min((opts.width - opts.area[1] - opts.area[3]) / 2 - config.pieChartLinePadding - config.pieChartTextPadding - config._pieTextMaxLength_, (opts.height - opts.area[0] - opts.area[2]) / 2 - config.pieChartLinePadding - config.pieChartTextPadding);
- radius = radius < 10 ? 10 : radius;
- if (pieOption.customRadius > 0) {
- radius = pieOption.customRadius * opts.pix;
- }
- series = getPieDataPoints(series, radius, process);
- var activeRadius = pieOption.activeRadius * opts.pix;
- pieOption.customColor = fillCustomColor(pieOption.linearType, pieOption.customColor, series, config);
- series = series.map(function (eachSeries) {
- eachSeries._start_ += pieOption.offsetAngle * Math.PI / 180;
- return eachSeries;
- });
- series.forEach(function (eachSeries, seriesIndex) {
- if (opts.tooltip) {
- if (opts.tooltip.index == seriesIndex) {
- context.beginPath();
- context.setFillStyle(hexToRgb(eachSeries.color, pieOption.activeOpacity || 0.5));
- context.moveTo(centerPosition.x, centerPosition.y);
- context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_ + activeRadius, eachSeries._start_, eachSeries._start_ + 2 * eachSeries._proportion_ * Math.PI);
- context.closePath();
- context.fill();
- }
- }
- context.beginPath();
- context.setLineWidth(pieOption.borderWidth * opts.pix);
- context.lineJoin = "round";
- context.setStrokeStyle(pieOption.borderColor);
- var fillcolor = eachSeries.color;
- if (pieOption.linearType == 'custom') {
- var grd;
- if (context.createCircularGradient) {
- grd = context.createCircularGradient(centerPosition.x, centerPosition.y, eachSeries._radius_);
- } else {
- grd = context.createRadialGradient(centerPosition.x, centerPosition.y, 0, centerPosition.x, centerPosition.y, eachSeries._radius_);
- }
- grd.addColorStop(0, hexToRgb(pieOption.customColor[eachSeries.linearIndex], 1));
- grd.addColorStop(1, hexToRgb(eachSeries.color, 1));
- fillcolor = grd;
- }
- context.setFillStyle(fillcolor);
- context.moveTo(centerPosition.x, centerPosition.y);
- context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_, eachSeries._start_, eachSeries._start_ + 2 * eachSeries._proportion_ * Math.PI);
- context.closePath();
- context.fill();
- if (pieOption.border == true) {
- context.stroke();
- }
- });
- if (opts.type === 'ring') {
- var innerPieWidth = radius * 0.6;
- if (typeof pieOption.ringWidth === 'number' && pieOption.ringWidth > 0) {
- innerPieWidth = Math.max(0, radius - pieOption.ringWidth * opts.pix);
- }
- context.beginPath();
- context.setFillStyle(pieOption.centerColor);
- context.moveTo(centerPosition.x, centerPosition.y);
- context.arc(centerPosition.x, centerPosition.y, innerPieWidth, 0, 2 * Math.PI);
- context.closePath();
- context.fill();
- }
- if (opts.dataLabel !== false && process === 1) {
- drawPieText(series, opts, config, context, radius, centerPosition);
- }
- if (process === 1 && opts.type === 'ring') {
- drawRingTitle(opts, config, context, centerPosition);
- }
- return {
- center: centerPosition,
- radius: radius,
- series: series
- };
- }
- function drawRoseDataPoints(series, opts, config, context) {
- var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
- var roseOption = assign({}, {
- type: 'area',
- activeOpacity: 0.5,
- activeRadius: 10,
- offsetAngle: 0,
- labelWidth: 15,
- border: false,
- borderWidth: 2,
- borderColor: '#FFFFFF',
- linearType: 'none',
- customColor: []
- }, opts.extra.rose);
- if (config.pieChartLinePadding == 0) {
- config.pieChartLinePadding = roseOption.activeRadius * opts.pix;
- }
- var centerPosition = {
- x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
- y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2
- };
- var radius = Math.min((opts.width - opts.area[1] - opts.area[3]) / 2 - config.pieChartLinePadding - config.pieChartTextPadding - config._pieTextMaxLength_, (opts.height - opts.area[0] - opts.area[2]) / 2 - config.pieChartLinePadding - config.pieChartTextPadding);
- radius = radius < 10 ? 10 : radius;
- var minRadius = roseOption.minRadius || radius * 0.5;
- if (radius < minRadius) {
- radius = minRadius + 10;
- }
- series = getRoseDataPoints(series, roseOption.type, minRadius, radius, process);
- var activeRadius = roseOption.activeRadius * opts.pix;
- roseOption.customColor = fillCustomColor(roseOption.linearType, roseOption.customColor, series, config);
- series = series.map(function (eachSeries) {
- eachSeries._start_ += (roseOption.offsetAngle || 0) * Math.PI / 180;
- return eachSeries;
- });
- series.forEach(function (eachSeries, seriesIndex) {
- if (opts.tooltip) {
- if (opts.tooltip.index == seriesIndex) {
- context.beginPath();
- context.setFillStyle(hexToRgb(eachSeries.color, roseOption.activeOpacity || 0.5));
- context.moveTo(centerPosition.x, centerPosition.y);
- context.arc(centerPosition.x, centerPosition.y, activeRadius + eachSeries._radius_, eachSeries._start_, eachSeries._start_ + 2 * eachSeries._rose_proportion_ * Math.PI);
- context.closePath();
- context.fill();
- }
- }
- context.beginPath();
- context.setLineWidth(roseOption.borderWidth * opts.pix);
- context.lineJoin = "round";
- context.setStrokeStyle(roseOption.borderColor);
- var fillcolor = eachSeries.color;
- if (roseOption.linearType == 'custom') {
- var grd;
- if (context.createCircularGradient) {
- grd = context.createCircularGradient(centerPosition.x, centerPosition.y, eachSeries._radius_);
- } else {
- grd = context.createRadialGradient(centerPosition.x, centerPosition.y, 0, centerPosition.x, centerPosition.y, eachSeries._radius_);
- }
- grd.addColorStop(0, hexToRgb(roseOption.customColor[eachSeries.linearIndex], 1));
- grd.addColorStop(1, hexToRgb(eachSeries.color, 1));
- fillcolor = grd;
- }
- context.setFillStyle(fillcolor);
- context.moveTo(centerPosition.x, centerPosition.y);
- context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_, eachSeries._start_, eachSeries._start_ + 2 * eachSeries._rose_proportion_ * Math.PI);
- context.closePath();
- context.fill();
- if (roseOption.border == true) {
- context.stroke();
- }
- });
- if (opts.dataLabel !== false && process === 1) {
- drawPieText(series, opts, config, context, radius, centerPosition);
- }
- return {
- center: centerPosition,
- radius: radius,
- series: series
- };
- }
- function drawArcbarDataPoints(series, opts, config, context) {
- var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
- var arcbarOption = assign({}, {
- startAngle: 0.75,
- endAngle: 0.25,
- type: 'default',
- direction: 'cw',
- lineCap: 'round',
- width: 12,
- gap: 2,
- linearType: 'none',
- customColor: []
- }, opts.extra.arcbar);
- series = getArcbarDataPoints(series, arcbarOption, process);
- var centerPosition;
- if (arcbarOption.centerX || arcbarOption.centerY) {
- centerPosition = {
- x: arcbarOption.centerX ? arcbarOption.centerX : opts.width / 2,
- y: arcbarOption.centerY ? arcbarOption.centerY : opts.height / 2
- };
- } else {
- centerPosition = {
- x: opts.width / 2,
- y: opts.height / 2
- };
- }
- var radius;
- if (arcbarOption.radius) {
- radius = arcbarOption.radius;
- } else {
- radius = Math.min(centerPosition.x, centerPosition.y);
- radius -= 5 * opts.pix;
- radius -= arcbarOption.width / 2;
- }
- radius = radius < 10 ? 10 : radius;
- arcbarOption.customColor = fillCustomColor(arcbarOption.linearType, arcbarOption.customColor, series, config);
- for (var i = 0; i < series.length; i++) {
- var eachSeries = series[i];
- //背景颜色
- context.setLineWidth(arcbarOption.width * opts.pix);
- context.setStrokeStyle(arcbarOption.backgroundColor || '#E9E9E9');
- context.setLineCap(arcbarOption.lineCap);
- context.beginPath();
- if (arcbarOption.type == 'default') {
- context.arc(centerPosition.x, centerPosition.y, radius - (arcbarOption.width * opts.pix + arcbarOption.gap * opts.pix) * i, arcbarOption.startAngle * Math.PI, arcbarOption.endAngle * Math.PI, arcbarOption.direction == 'ccw');
- } else {
- context.arc(centerPosition.x, centerPosition.y, radius - (arcbarOption.width * opts.pix + arcbarOption.gap * opts.pix) * i, 0, 2 * Math.PI, arcbarOption.direction == 'ccw');
- }
- context.stroke();
- //进度条
- var fillColor = eachSeries.color;
- if (arcbarOption.linearType == 'custom') {
- var grd = context.createLinearGradient(centerPosition.x - radius, centerPosition.y, centerPosition.x + radius, centerPosition.y);
- grd.addColorStop(1, hexToRgb(arcbarOption.customColor[eachSeries.linearIndex], 1));
- grd.addColorStop(0, hexToRgb(eachSeries.color, 1));
- fillColor = grd;
- }
- context.setLineWidth(arcbarOption.width * opts.pix);
- context.setStrokeStyle(fillColor);
- context.setLineCap(arcbarOption.lineCap);
- context.beginPath();
- context.arc(centerPosition.x, centerPosition.y, radius - (arcbarOption.width * opts.pix + arcbarOption.gap * opts.pix) * i, arcbarOption.startAngle * Math.PI, eachSeries._proportion_ * Math.PI, arcbarOption.direction == 'ccw');
- context.stroke();
- }
- drawRingTitle(opts, config, context, centerPosition);
- return {
- center: centerPosition,
- radius: radius,
- series: series
- };
- }
- function drawGaugeDataPoints(categories, series, opts, config, context) {
- var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
- var gaugeOption = assign({}, {
- type: 'default',
- startAngle: 0.75,
- endAngle: 0.25,
- width: 15,
- labelOffset: 13,
- splitLine: {
- fixRadius: 0,
- splitNumber: 10,
- width: 15,
- color: '#FFFFFF',
- childNumber: 5,
- childWidth: 5
- },
- pointer: {
- width: 15,
- color: 'auto'
- }
- }, opts.extra.gauge);
- if (gaugeOption.oldAngle == undefined) {
- gaugeOption.oldAngle = gaugeOption.startAngle;
- }
- if (gaugeOption.oldData == undefined) {
- gaugeOption.oldData = 0;
- }
- categories = getGaugeAxisPoints(categories, gaugeOption.startAngle, gaugeOption.endAngle);
- var centerPosition = {
- x: opts.width / 2,
- y: opts.height / 2
- };
- var radius = Math.min(centerPosition.x, centerPosition.y);
- radius -= 5 * opts.pix;
- radius -= gaugeOption.width / 2;
- radius = radius < 10 ? 10 : radius;
- var innerRadius = radius - gaugeOption.width;
- var totalAngle = 0;
- //判断仪表盘的样式:default百度样式,progress新样式
- if (gaugeOption.type == 'progress') {
- //## 第一步画中心圆形背景和进度条背景
- //中心圆形背景
- var pieRadius = radius - gaugeOption.width * 3;
- context.beginPath();
- var gradient = context.createLinearGradient(centerPosition.x, centerPosition.y - pieRadius, centerPosition.x, centerPosition.y + pieRadius);
- //配置渐变填充(起点:中心点向上减半径;结束点中心点向下加半径)
- gradient.addColorStop('0', hexToRgb(series[0].color, 0.3));
- gradient.addColorStop('1.0', hexToRgb("#FFFFFF", 0.1));
- context.setFillStyle(gradient);
- context.arc(centerPosition.x, centerPosition.y, pieRadius, 0, 2 * Math.PI, false);
- context.fill();
- //画进度条背景
- context.setLineWidth(gaugeOption.width);
- context.setStrokeStyle(hexToRgb(series[0].color, 0.3));
- context.setLineCap('round');
- context.beginPath();
- context.arc(centerPosition.x, centerPosition.y, innerRadius, gaugeOption.startAngle * Math.PI, gaugeOption.endAngle * Math.PI, false);
- context.stroke();
- //## 第二步画刻度线
- if (gaugeOption.endAngle < gaugeOption.startAngle) {
- totalAngle = 2 + gaugeOption.endAngle - gaugeOption.startAngle;
- } else {
- totalAngle = gaugeOption.startAngle - gaugeOption.endAngle;
- }
- var splitAngle = totalAngle / gaugeOption.splitLine.splitNumber;
- var childAngle = totalAngle / gaugeOption.splitLine.splitNumber / gaugeOption.splitLine.childNumber;
- var startX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius;
- var endX = -radius - gaugeOption.width - gaugeOption.splitLine.fixRadius + gaugeOption.splitLine.width;
- context.save();
- context.translate(centerPosition.x, centerPosition.y);
- context.rotate((gaugeOption.startAngle - 1) * Math.PI);
- var len = gaugeOption.splitLine.splitNumber * gaugeOption.splitLine.childNumber + 1;
- var proc = series[0].data * process;
- for (var i = 0; i < len; i++) {
- context.beginPath();
- //刻度线随进度变色
- if (proc > i / len) {
- context.setStrokeStyle(hexToRgb(series[0].color, 1));
- } else {
- context.setStrokeStyle(hexToRgb(series[0].color, 0.3));
- }
- context.setLineWidth(3 * opts.pix);
- context.moveTo(startX, 0);
- context.lineTo(endX, 0);
- context.stroke();
- context.rotate(childAngle * Math.PI);
- }
- context.restore();
- //## 第三步画进度条
- series = getGaugeArcbarDataPoints(series, gaugeOption, process);
- context.setLineWidth(gaugeOption.width);
- context.setStrokeStyle(series[0].color);
- context.setLineCap('round');
- context.beginPath();
- context.arc(centerPosition.x, centerPosition.y, innerRadius, gaugeOption.startAngle * Math.PI, series[0]._proportion_ * Math.PI, false);
- context.stroke();
- //## 第四步画指针
- var pointerRadius = radius - gaugeOption.width * 2.5;
- context.save();
- context.translate(centerPosition.x, centerPosition.y);
- context.rotate((series[0]._proportion_ - 1) * Math.PI);
- context.beginPath();
- context.setLineWidth(gaugeOption.width / 3);
- var gradient3 = context.createLinearGradient(0, -pointerRadius * 0.6, 0, pointerRadius * 0.6);
- gradient3.addColorStop('0', hexToRgb('#FFFFFF', 0));
- gradient3.addColorStop('0.5', hexToRgb(series[0].color, 1));
- gradient3.addColorStop('1.0', hexToRgb('#FFFFFF', 0));
- context.setStrokeStyle(gradient3);
- context.arc(0, 0, pointerRadius, 0.85 * Math.PI, 1.15 * Math.PI, false);
- context.stroke();
- context.beginPath();
- context.setLineWidth(1);
- context.setStrokeStyle(series[0].color);
- context.setFillStyle(series[0].color);
- context.moveTo(-pointerRadius - gaugeOption.width / 3 / 2, -4);
- context.lineTo(-pointerRadius - gaugeOption.width / 3 / 2 - 4, 0);
- context.lineTo(-pointerRadius - gaugeOption.width / 3 / 2, 4);
- context.lineTo(-pointerRadius - gaugeOption.width / 3 / 2, -4);
- context.stroke();
- context.fill();
- context.restore();
- //default百度样式
- } else {
- //画背景
- context.setLineWidth(gaugeOption.width);
- context.setLineCap('butt');
- for (var _i26 = 0; _i26 < categories.length; _i26++) {
- var eachCategories = categories[_i26];
- context.beginPath();
- context.setStrokeStyle(eachCategories.color);
- context.arc(centerPosition.x, centerPosition.y, radius, eachCategories._startAngle_ * Math.PI, eachCategories._endAngle_ * Math.PI, false);
- context.stroke();
- }
- context.save();
- //画刻度线
- if (gaugeOption.endAngle < gaugeOption.startAngle) {
- totalAngle = 2 + gaugeOption.endAngle - gaugeOption.startAngle;
- } else {
- totalAngle = gaugeOption.startAngle - gaugeOption.endAngle;
- }
- var _splitAngle = totalAngle / gaugeOption.splitLine.splitNumber;
- var _childAngle = totalAngle / gaugeOption.splitLine.splitNumber / gaugeOption.splitLine.childNumber;
- var _startX2 = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius;
- var _endX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius + gaugeOption.splitLine.width;
- var childendX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius + gaugeOption.splitLine.childWidth;
- context.translate(centerPosition.x, centerPosition.y);
- context.rotate((gaugeOption.startAngle - 1) * Math.PI);
- for (var _i27 = 0; _i27 < gaugeOption.splitLine.splitNumber + 1; _i27++) {
- context.beginPath();
- context.setStrokeStyle(gaugeOption.splitLine.color);
- context.setLineWidth(2 * opts.pix);
- context.moveTo(_startX2, 0);
- context.lineTo(_endX, 0);
- context.stroke();
- context.rotate(_splitAngle * Math.PI);
- }
- context.restore();
- context.save();
- context.translate(centerPosition.x, centerPosition.y);
- context.rotate((gaugeOption.startAngle - 1) * Math.PI);
- for (var _i28 = 0; _i28 < gaugeOption.splitLine.splitNumber * gaugeOption.splitLine.childNumber + 1; _i28++) {
- context.beginPath();
- context.setStrokeStyle(gaugeOption.splitLine.color);
- context.setLineWidth(1 * opts.pix);
- context.moveTo(_startX2, 0);
- context.lineTo(childendX, 0);
- context.stroke();
- context.rotate(_childAngle * Math.PI);
- }
- context.restore();
- //画指针
- series = getGaugeDataPoints(series, categories, gaugeOption, process);
- for (var _i29 = 0; _i29 < series.length; _i29++) {
- var eachSeries = series[_i29];
- context.save();
- context.translate(centerPosition.x, centerPosition.y);
- context.rotate((eachSeries._proportion_ - 1) * Math.PI);
- context.beginPath();
- context.setFillStyle(eachSeries.color);
- context.moveTo(gaugeOption.pointer.width, 0);
- context.lineTo(0, -gaugeOption.pointer.width / 2);
- context.lineTo(-innerRadius, 0);
- context.lineTo(0, gaugeOption.pointer.width / 2);
- context.lineTo(gaugeOption.pointer.width, 0);
- context.closePath();
- context.fill();
- context.beginPath();
- context.setFillStyle('#FFFFFF');
- context.arc(0, 0, gaugeOption.pointer.width / 6, 0, 2 * Math.PI, false);
- context.fill();
- context.restore();
- }
- if (opts.dataLabel !== false) {
- drawGaugeLabel(gaugeOption, radius, centerPosition, opts, config, context);
- }
- }
- //画仪表盘标题,副标题
- drawRingTitle(opts, config, context, centerPosition);
- if (process === 1 && opts.type === 'gauge') {
- opts.extra.gauge.oldAngle = series[0]._proportion_;
- opts.extra.gauge.oldData = series[0].data;
- }
- return {
- center: centerPosition,
- radius: radius,
- innerRadius: innerRadius,
- categories: categories,
- totalAngle: totalAngle
- };
- }
- function drawRadarDataPoints(series, opts, config, context) {
- var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
- var radarOption = assign({}, {
- gridColor: '#cccccc',
- gridType: 'radar',
- gridEval: 1,
- axisLabel: false,
- axisLabelTofix: 0,
- labelShow: true,
- labelColor: '#666666',
- labelPointShow: false,
- labelPointRadius: 3,
- labelPointColor: '#cccccc',
- opacity: 0.2,
- gridCount: 3,
- border: false,
- borderWidth: 2,
- linearType: 'none',
- customColor: []
- }, opts.extra.radar);
- var coordinateAngle = getRadarCoordinateSeries(opts.categories.length);
- var centerPosition = {
- x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
- y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2
- };
- var xr = (opts.width - opts.area[1] - opts.area[3]) / 2;
- var yr = (opts.height - opts.area[0] - opts.area[2]) / 2;
- var radius = Math.min(xr - (getMaxTextListLength(opts.categories, config.fontSize, context) + config.radarLabelTextMargin), yr - config.radarLabelTextMargin);
- radius -= config.radarLabelTextMargin * opts.pix;
- radius = radius < 10 ? 10 : radius;
- radius = radarOption.radius ? radarOption.radius : radius;
- // 画分割线
- context.beginPath();
- context.setLineWidth(1 * opts.pix);
- context.setStrokeStyle(radarOption.gridColor);
- coordinateAngle.forEach(function (angle, index) {
- var pos = convertCoordinateOrigin(radius * Math.cos(angle), radius * Math.sin(angle), centerPosition);
- context.moveTo(centerPosition.x, centerPosition.y);
- if (index % radarOption.gridEval == 0) {
- context.lineTo(pos.x, pos.y);
- }
- });
- context.stroke();
- context.closePath();
- // 画背景网格
- var _loop = function _loop(i) {
- var startPos = {};
- context.beginPath();
- context.setLineWidth(1 * opts.pix);
- context.setStrokeStyle(radarOption.gridColor);
- if (radarOption.gridType == 'radar') {
- coordinateAngle.forEach(function (angle, index) {
- var pos = convertCoordinateOrigin(radius / radarOption.gridCount * i * Math.cos(angle), radius / radarOption.gridCount * i * Math.sin(angle), centerPosition);
- if (index === 0) {
- startPos = pos;
- context.moveTo(pos.x, pos.y);
- } else {
- context.lineTo(pos.x, pos.y);
- }
- });
- context.lineTo(startPos.x, startPos.y);
- } else {
- var pos = convertCoordinateOrigin(radius / radarOption.gridCount * i * Math.cos(1.5), radius / radarOption.gridCount * i * Math.sin(1.5), centerPosition);
- context.arc(centerPosition.x, centerPosition.y, centerPosition.y - pos.y, 0, 2 * Math.PI, false);
- }
- context.stroke();
- context.closePath();
- };
- for (var i = 1; i <= radarOption.gridCount; i++) {
- _loop(i);
- }
- radarOption.customColor = fillCustomColor(radarOption.linearType, radarOption.customColor, series, config);
- var radarDataPoints = getRadarDataPoints(coordinateAngle, centerPosition, radius, series, opts, process);
- radarDataPoints.forEach(function (eachSeries, seriesIndex) {
- // 绘制区域数据
- context.beginPath();
- context.setLineWidth(radarOption.borderWidth * opts.pix);
- context.setStrokeStyle(eachSeries.color);
- var fillcolor = hexToRgb(eachSeries.color, radarOption.opacity);
- if (radarOption.linearType == 'custom') {
- var grd;
- if (context.createCircularGradient) {
- grd = context.createCircularGradient(centerPosition.x, centerPosition.y, radius);
- } else {
- grd = context.createRadialGradient(centerPosition.x, centerPosition.y, 0, centerPosition.x, centerPosition.y, radius);
- }
- grd.addColorStop(0, hexToRgb(radarOption.customColor[series[seriesIndex].linearIndex], radarOption.opacity));
- grd.addColorStop(1, hexToRgb(eachSeries.color, radarOption.opacity));
- fillcolor = grd;
- }
- context.setFillStyle(fillcolor);
- eachSeries.data.forEach(function (item, index) {
- if (index === 0) {
- context.moveTo(item.position.x, item.position.y);
- } else {
- context.lineTo(item.position.x, item.position.y);
- }
- });
- context.closePath();
- context.fill();
- if (radarOption.border === true) {
- context.stroke();
- }
- context.closePath();
- if (opts.dataPointShape !== false) {
- var points = eachSeries.data.map(function (item) {
- return item.position;
- });
- drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts);
- }
- });
- // 画刻度值
- if (radarOption.axisLabel === true) {
- var maxData = Math.max(radarOption.max, Math.max.apply(null, dataCombine(series)));
- var stepLength = radius / radarOption.gridCount;
- var fontSize = opts.fontSize * opts.pix;
- context.setFontSize(fontSize);
- context.setFillStyle(opts.fontColor);
- context.setTextAlign('left');
- for (var i = 0; i < radarOption.gridCount + 1; i++) {
- var label = i * maxData / radarOption.gridCount;
- label = label.toFixed(radarOption.axisLabelTofix);
- context.fillText(String(label), centerPosition.x + 3 * opts.pix, centerPosition.y - i * stepLength + fontSize / 2);
- }
- }
- // draw label text
- drawRadarLabel(coordinateAngle, radius, centerPosition, opts, config, context);
- // draw dataLabel
- if (opts.dataLabel !== false && process === 1) {
- radarDataPoints.forEach(function (eachSeries, seriesIndex) {
- context.beginPath();
- var fontSize = eachSeries.textSize * opts.pix || config.fontSize;
- context.setFontSize(fontSize);
- context.setFillStyle(eachSeries.textColor || opts.fontColor);
- eachSeries.data.forEach(function (item, index) {
- //如果是中心点垂直的上下点位
- if (Math.abs(item.position.x - centerPosition.x) < 2) {
- //如果在上面
- if (item.position.y < centerPosition.y) {
- context.setTextAlign('center');
- context.fillText(item.value, item.position.x, item.position.y - 4);
- } else {
- context.setTextAlign('center');
- context.fillText(item.value, item.position.x, item.position.y + fontSize + 2);
- }
- } else {
- //如果在左侧
- if (item.position.x < centerPosition.x) {
- context.setTextAlign('right');
- context.fillText(item.value, item.position.x - 4, item.position.y + fontSize / 2 - 2);
- } else {
- context.setTextAlign('left');
- context.fillText(item.value, item.position.x + 4, item.position.y + fontSize / 2 - 2);
- }
- }
- });
- context.closePath();
- context.stroke();
- });
- context.setTextAlign('left');
- }
- return {
- center: centerPosition,
- radius: radius,
- angleList: coordinateAngle
- };
- }
- // 经纬度转墨卡托
- function lonlat2mercator(longitude, latitude) {
- var mercator = Array(2);
- var x = longitude * 20037508.34 / 180;
- var y = Math.log(Math.tan((90 + latitude) * Math.PI / 360)) / (Math.PI / 180);
- y = y * 20037508.34 / 180;
- mercator[0] = x;
- mercator[1] = y;
- return mercator;
- }
- // 墨卡托转经纬度
- function mercator2lonlat(longitude, latitude) {
- var lonlat = Array(2);
- var x = longitude / 20037508.34 * 180;
- var y = latitude / 20037508.34 * 180;
- y = 180 / Math.PI * (2 * Math.atan(Math.exp(y * Math.PI / 180)) - Math.PI / 2);
- lonlat[0] = x;
- lonlat[1] = y;
- return lonlat;
- }
- function getBoundingBox(data) {
- var bounds = {},
- coords;
- bounds.xMin = 180;
- bounds.xMax = 0;
- bounds.yMin = 90;
- bounds.yMax = 0;
- for (var i = 0; i < data.length; i++) {
- var coorda = data[i].geometry.coordinates;
- for (var k = 0; k < coorda.length; k++) {
- coords = coorda[k];
- if (coords.length == 1) {
- coords = coords[0];
- }
- for (var j = 0; j < coords.length; j++) {
- var longitude = coords[j][0];
- var latitude = coords[j][1];
- var point = {
- x: longitude,
- y: latitude
- };
- bounds.xMin = bounds.xMin < point.x ? bounds.xMin : point.x;
- bounds.xMax = bounds.xMax > point.x ? bounds.xMax : point.x;
- bounds.yMin = bounds.yMin < point.y ? bounds.yMin : point.y;
- bounds.yMax = bounds.yMax > point.y ? bounds.yMax : point.y;
- }
- }
- }
- return bounds;
- }
- function coordinateToPoint(latitude, longitude, bounds, scale, xoffset, yoffset) {
- return {
- x: (longitude - bounds.xMin) * scale + xoffset,
- y: (bounds.yMax - latitude) * scale + yoffset
- };
- }
- function pointToCoordinate(pointY, pointX, bounds, scale, xoffset, yoffset) {
- return {
- x: (pointX - xoffset) / scale + bounds.xMin,
- y: bounds.yMax - (pointY - yoffset) / scale
- };
- }
- function isRayIntersectsSegment(poi, s_poi, e_poi) {
- if (s_poi[1] == e_poi[1]) {
- return false;
- }
- if (s_poi[1] > poi[1] && e_poi[1] > poi[1]) {
- return false;
- }
- if (s_poi[1] < poi[1] && e_poi[1] < poi[1]) {
- return false;
- }
- if (s_poi[1] == poi[1] && e_poi[1] > poi[1]) {
- return false;
- }
- if (e_poi[1] == poi[1] && s_poi[1] > poi[1]) {
- return false;
- }
- if (s_poi[0] < poi[0] && e_poi[1] < poi[1]) {
- return false;
- }
- var xseg = e_poi[0] - (e_poi[0] - s_poi[0]) * (e_poi[1] - poi[1]) / (e_poi[1] - s_poi[1]);
- if (xseg < poi[0]) {
- return false;
- } else {
- return true;
- }
- }
- function isPoiWithinPoly(poi, poly, mercator) {
- var sinsc = 0;
- for (var i = 0; i < poly.length; i++) {
- var epoly = poly[i][0];
- if (poly.length == 1) {
- epoly = poly[i][0];
- }
- for (var j = 0; j < epoly.length - 1; j++) {
- var s_poi = epoly[j];
- var e_poi = epoly[j + 1];
- if (mercator) {
- s_poi = lonlat2mercator(epoly[j][0], epoly[j][1]);
- e_poi = lonlat2mercator(epoly[j + 1][0], epoly[j + 1][1]);
- }
- if (isRayIntersectsSegment(poi, s_poi, e_poi)) {
- sinsc += 1;
- }
- }
- }
- if (sinsc % 2 == 1) {
- return true;
- } else {
- return false;
- }
- }
- function drawMapDataPoints(series, opts, config, context) {
- var mapOption = assign({}, {
- border: true,
- mercator: false,
- borderWidth: 1,
- active: true,
- borderColor: '#666666',
- fillOpacity: 0.6,
- activeBorderColor: '#f04864',
- activeFillColor: '#facc14',
- activeFillOpacity: 1
- }, opts.extra.map);
- var coords, point;
- var data = series;
- var bounds = getBoundingBox(data);
- if (mapOption.mercator) {
- var max = lonlat2mercator(bounds.xMax, bounds.yMax);
- var min = lonlat2mercator(bounds.xMin, bounds.yMin);
- bounds.xMax = max[0];
- bounds.yMax = max[1];
- bounds.xMin = min[0];
- bounds.yMin = min[1];
- }
- var xScale = opts.width / Math.abs(bounds.xMax - bounds.xMin);
- var yScale = opts.height / Math.abs(bounds.yMax - bounds.yMin);
- var scale = xScale < yScale ? xScale : yScale;
- var xoffset = opts.width / 2 - Math.abs(bounds.xMax - bounds.xMin) / 2 * scale;
- var yoffset = opts.height / 2 - Math.abs(bounds.yMax - bounds.yMin) / 2 * scale;
- for (var i = 0; i < data.length; i++) {
- context.beginPath();
- context.setLineWidth(mapOption.borderWidth * opts.pix);
- context.setStrokeStyle(mapOption.borderColor);
- context.setFillStyle(hexToRgb(series[i].color, series[i].fillOpacity || mapOption.fillOpacity));
- if (mapOption.active == true && opts.tooltip) {
- if (opts.tooltip.index == i) {
- context.setStrokeStyle(mapOption.activeBorderColor);
- context.setFillStyle(hexToRgb(mapOption.activeFillColor, mapOption.activeFillOpacity));
- }
- }
- var coorda = data[i].geometry.coordinates;
- for (var k = 0; k < coorda.length; k++) {
- coords = coorda[k];
- if (coords.length == 1) {
- coords = coords[0];
- }
- for (var j = 0; j < coords.length; j++) {
- var gaosi = Array(2);
- if (mapOption.mercator) {
- gaosi = lonlat2mercator(coords[j][0], coords[j][1]);
- } else {
- gaosi = coords[j];
- }
- point = coordinateToPoint(gaosi[1], gaosi[0], bounds, scale, xoffset, yoffset);
- if (j === 0) {
- context.beginPath();
- context.moveTo(point.x, point.y);
- } else {
- context.lineTo(point.x, point.y);
- }
- }
- context.fill();
- if (mapOption.border == true) {
- context.stroke();
- }
- }
- }
- if (opts.dataLabel == true) {
- for (var i = 0; i < data.length; i++) {
- var centerPoint = data[i].properties.centroid;
- if (centerPoint) {
- if (mapOption.mercator) {
- centerPoint = lonlat2mercator(data[i].properties.centroid[0], data[i].properties.centroid[1]);
- }
- point = coordinateToPoint(centerPoint[1], centerPoint[0], bounds, scale, xoffset, yoffset);
- var fontSize = data[i].textSize * opts.pix || config.fontSize;
- var fontColor = data[i].textColor || opts.fontColor;
- if (mapOption.active && mapOption.activeTextColor && opts.tooltip && opts.tooltip.index == i) {
- fontColor = mapOption.activeTextColor;
- }
- var text = data[i].properties.name;
- context.beginPath();
- context.setFontSize(fontSize);
- context.setFillStyle(fontColor);
- context.fillText(text, point.x - measureText(text, fontSize, context) / 2, point.y + fontSize / 2);
- context.closePath();
- context.stroke();
- }
- }
- }
- opts.chartData.mapData = {
- bounds: bounds,
- scale: scale,
- xoffset: xoffset,
- yoffset: yoffset,
- mercator: mapOption.mercator
- };
- drawToolTipBridge(opts, config, context, 1);
- context.draw();
- }
- function normalInt(min, max, iter) {
- iter = iter == 0 ? 1 : iter;
- var arr = [];
- for (var i = 0; i < iter; i++) {
- arr[i] = Math.random();
- }
- ;
- return Math.floor(arr.reduce(function (i, j) {
- return i + j;
- }) / iter * (max - min)) + min;
- }
- ;
- function collisionNew(area, points, width, height) {
- var isIn = false;
- for (var i = 0; i < points.length; i++) {
- if (points[i].area) {
- if (area[3] < points[i].area[1] || area[0] > points[i].area[2] || area[1] > points[i].area[3] || area[2] < points[i].area[0]) {
- if (area[0] < 0 || area[1] < 0 || area[2] > width || area[3] > height) {
- isIn = true;
- break;
- } else {
- isIn = false;
- }
- } else {
- isIn = true;
- break;
- }
- }
- }
- return isIn;
- }
- ;
- function getWordCloudPoint(opts, type, context) {
- var points = opts.series;
- switch (type) {
- case 'normal':
- for (var i = 0; i < points.length; i++) {
- var text = points[i].name;
- var tHeight = points[i].textSize * opts.pix;
- var tWidth = measureText(text, tHeight, context);
- var x = void 0,
- y = void 0;
- var area = void 0;
- var breaknum = 0;
- while (true) {
- breaknum++;
- x = normalInt(-opts.width / 2, opts.width / 2, 5) - tWidth / 2;
- y = normalInt(-opts.height / 2, opts.height / 2, 5) + tHeight / 2;
- area = [x - 5 + opts.width / 2, y - 5 - tHeight + opts.height / 2, x + tWidth + 5 + opts.width / 2, y + 5 + opts.height / 2];
- var isCollision = collisionNew(area, points, opts.width, opts.height);
- if (!isCollision) break;
- if (breaknum == 1000) {
- area = [-100, -100, -100, -100];
- break;
- }
- }
- ;
- points[i].area = area;
- }
- break;
- case 'vertical':
- var Spin = function Spin() {
- //获取均匀随机值,是否旋转,旋转的概率为(1-0.5)
- if (Math.random() > 0.7) {
- return true;
- } else {
- return false;
- }
- ;
- };
- ;
- for (var _i30 = 0; _i30 < points.length; _i30++) {
- var _text = points[_i30].name;
- var _tHeight = points[_i30].textSize * opts.pix;
- var _tWidth = measureText(_text, _tHeight, context);
- var isSpin = Spin();
- var _x = void 0,
- _y = void 0,
- _area = void 0,
- areav = void 0;
- var _breaknum = 0;
- while (true) {
- _breaknum++;
- var _isCollision = void 0;
- if (isSpin) {
- _x = normalInt(-opts.width / 2, opts.width / 2, 5) - _tWidth / 2;
- _y = normalInt(-opts.height / 2, opts.height / 2, 5) + _tHeight / 2;
- _area = [_y - 5 - _tWidth + opts.width / 2, -_x - 5 + opts.height / 2, _y + 5 + opts.width / 2, -_x + _tHeight + 5 + opts.height / 2];
- areav = [opts.width - (opts.width / 2 - opts.height / 2) - (-_x + _tHeight + 5 + opts.height / 2) - 5, opts.height / 2 - opts.width / 2 + (_y - 5 - _tWidth + opts.width / 2) - 5, opts.width - (opts.width / 2 - opts.height / 2) - (-_x + _tHeight + 5 + opts.height / 2) + _tHeight, opts.height / 2 - opts.width / 2 + (_y - 5 - _tWidth + opts.width / 2) + _tWidth + 5];
- _isCollision = collisionNew(areav, points, opts.height, opts.width);
- } else {
- _x = normalInt(-opts.width / 2, opts.width / 2, 5) - _tWidth / 2;
- _y = normalInt(-opts.height / 2, opts.height / 2, 5) + _tHeight / 2;
- _area = [_x - 5 + opts.width / 2, _y - 5 - _tHeight + opts.height / 2, _x + _tWidth + 5 + opts.width / 2, _y + 5 + opts.height / 2];
- _isCollision = collisionNew(_area, points, opts.width, opts.height);
- }
- if (!_isCollision) break;
- if (_breaknum == 1000) {
- _area = [-1000, -1000, -1000, -1000];
- break;
- }
- }
- ;
- if (isSpin) {
- points[_i30].area = areav;
- points[_i30].areav = _area;
- } else {
- points[_i30].area = _area;
- }
- points[_i30].rotate = isSpin;
- }
- ;
- break;
- }
- return points;
- }
- function drawWordCloudDataPoints(series, opts, config, context) {
- var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
- var wordOption = assign({}, {
- type: 'normal',
- autoColors: true
- }, opts.extra.word);
- if (!opts.chartData.wordCloudData) {
- opts.chartData.wordCloudData = getWordCloudPoint(opts, wordOption.type, context);
- }
- context.beginPath();
- context.setFillStyle(opts.background);
- context.rect(0, 0, opts.width, opts.height);
- context.fill();
- context.save();
- var points = opts.chartData.wordCloudData;
- context.translate(opts.width / 2, opts.height / 2);
- for (var i = 0; i < points.length; i++) {
- context.save();
- if (points[i].rotate) {
- context.rotate(90 * Math.PI / 180);
- }
- var text = points[i].name;
- var tHeight = points[i].textSize * opts.pix;
- var tWidth = measureText(text, tHeight, context);
- context.beginPath();
- context.setStrokeStyle(points[i].color);
- context.setFillStyle(points[i].color);
- context.setFontSize(tHeight);
- if (points[i].rotate) {
- if (points[i].areav[0] > 0) {
- if (opts.tooltip) {
- if (opts.tooltip.index == i) {
- context.strokeText(text, (points[i].areav[0] + 5 - opts.width / 2) * process - tWidth * (1 - process) / 2, (points[i].areav[1] + 5 + tHeight - opts.height / 2) * process);
- } else {
- context.fillText(text, (points[i].areav[0] + 5 - opts.width / 2) * process - tWidth * (1 - process) / 2, (points[i].areav[1] + 5 + tHeight - opts.height / 2) * process);
- }
- } else {
- context.fillText(text, (points[i].areav[0] + 5 - opts.width / 2) * process - tWidth * (1 - process) / 2, (points[i].areav[1] + 5 + tHeight - opts.height / 2) * process);
- }
- }
- } else {
- if (points[i].area[0] > 0) {
- if (opts.tooltip) {
- if (opts.tooltip.index == i) {
- context.strokeText(text, (points[i].area[0] + 5 - opts.width / 2) * process - tWidth * (1 - process) / 2, (points[i].area[1] + 5 + tHeight - opts.height / 2) * process);
- } else {
- context.fillText(text, (points[i].area[0] + 5 - opts.width / 2) * process - tWidth * (1 - process) / 2, (points[i].area[1] + 5 + tHeight - opts.height / 2) * process);
- }
- } else {
- context.fillText(text, (points[i].area[0] + 5 - opts.width / 2) * process - tWidth * (1 - process) / 2, (points[i].area[1] + 5 + tHeight - opts.height / 2) * process);
- }
- }
- }
- context.stroke();
- context.restore();
- }
- context.restore();
- }
- function drawFunnelDataPoints(series, opts, config, context) {
- var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
- var funnelOption = assign({}, {
- type: 'funnel',
- activeWidth: 10,
- activeOpacity: 0.3,
- border: false,
- borderWidth: 2,
- borderColor: '#FFFFFF',
- fillOpacity: 1,
- minSize: 0,
- labelAlign: 'right',
- linearType: 'none',
- customColor: []
- }, opts.extra.funnel);
- var eachSpacing = (opts.height - opts.area[0] - opts.area[2]) / series.length;
- var centerPosition = {
- x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
- y: opts.height - opts.area[2]
- };
- var activeWidth = funnelOption.activeWidth * opts.pix;
- var radius = Math.min((opts.width - opts.area[1] - opts.area[3]) / 2 - activeWidth, (opts.height - opts.area[0] - opts.area[2]) / 2 - activeWidth);
- var seriesNew = getFunnelDataPoints(series, radius, funnelOption, eachSpacing, process);
- context.save();
- context.translate(centerPosition.x, centerPosition.y);
- funnelOption.customColor = fillCustomColor(funnelOption.linearType, funnelOption.customColor, series, config);
- if (funnelOption.type == 'pyramid') {
- for (var i = 0; i < seriesNew.length; i++) {
- if (i == seriesNew.length - 1) {
- if (opts.tooltip) {
- if (opts.tooltip.index == i) {
- context.beginPath();
- context.setFillStyle(hexToRgb(seriesNew[i].color, funnelOption.activeOpacity));
- context.moveTo(-activeWidth, -eachSpacing);
- context.lineTo(-seriesNew[i].radius - activeWidth, 0);
- context.lineTo(seriesNew[i].radius + activeWidth, 0);
- context.lineTo(activeWidth, -eachSpacing);
- context.lineTo(-activeWidth, -eachSpacing);
- context.closePath();
- context.fill();
- }
- }
- seriesNew[i].funnelArea = [centerPosition.x - seriesNew[i].radius, centerPosition.y - eachSpacing * (i + 1), centerPosition.x + seriesNew[i].radius, centerPosition.y - eachSpacing * i];
- context.beginPath();
- context.setLineWidth(funnelOption.borderWidth * opts.pix);
- context.setStrokeStyle(funnelOption.borderColor);
- var fillColor = hexToRgb(seriesNew[i].color, funnelOption.fillOpacity);
- if (funnelOption.linearType == 'custom') {
- var grd = context.createLinearGradient(seriesNew[i].radius, -eachSpacing, -seriesNew[i].radius, -eachSpacing);
- grd.addColorStop(0, hexToRgb(seriesNew[i].color, funnelOption.fillOpacity));
- grd.addColorStop(0.5, hexToRgb(funnelOption.customColor[seriesNew[i].linearIndex], funnelOption.fillOpacity));
- grd.addColorStop(1, hexToRgb(seriesNew[i].color, funnelOption.fillOpacity));
- fillColor = grd;
- }
- context.setFillStyle(fillColor);
- context.moveTo(0, -eachSpacing);
- context.lineTo(-seriesNew[i].radius, 0);
- context.lineTo(seriesNew[i].radius, 0);
- context.lineTo(0, -eachSpacing);
- context.closePath();
- context.fill();
- if (funnelOption.border == true) {
- context.stroke();
- }
- } else {
- if (opts.tooltip) {
- if (opts.tooltip.index == i) {
- context.beginPath();
- context.setFillStyle(hexToRgb(seriesNew[i].color, funnelOption.activeOpacity));
- context.moveTo(0, 0);
- context.lineTo(-seriesNew[i].radius - activeWidth, 0);
- context.lineTo(-seriesNew[i + 1].radius - activeWidth, -eachSpacing);
- context.lineTo(seriesNew[i + 1].radius + activeWidth, -eachSpacing);
- context.lineTo(seriesNew[i].radius + activeWidth, 0);
- context.lineTo(0, 0);
- context.closePath();
- context.fill();
- }
- }
- seriesNew[i].funnelArea = [centerPosition.x - seriesNew[i].radius, centerPosition.y - eachSpacing * (i + 1), centerPosition.x + seriesNew[i].radius, centerPosition.y - eachSpacing * i];
- context.beginPath();
- context.setLineWidth(funnelOption.borderWidth * opts.pix);
- context.setStrokeStyle(funnelOption.borderColor);
- var fillColor = hexToRgb(seriesNew[i].color, funnelOption.fillOpacity);
- if (funnelOption.linearType == 'custom') {
- var grd = context.createLinearGradient(seriesNew[i].radius, -eachSpacing, -seriesNew[i].radius, -eachSpacing);
- grd.addColorStop(0, hexToRgb(seriesNew[i].color, funnelOption.fillOpacity));
- grd.addColorStop(0.5, hexToRgb(funnelOption.customColor[seriesNew[i].linearIndex], funnelOption.fillOpacity));
- grd.addColorStop(1, hexToRgb(seriesNew[i].color, funnelOption.fillOpacity));
- fillColor = grd;
- }
- context.setFillStyle(fillColor);
- context.moveTo(0, 0);
- context.lineTo(-seriesNew[i].radius, 0);
- context.lineTo(-seriesNew[i + 1].radius, -eachSpacing);
- context.lineTo(seriesNew[i + 1].radius, -eachSpacing);
- context.lineTo(seriesNew[i].radius, 0);
- context.lineTo(0, 0);
- context.closePath();
- context.fill();
- if (funnelOption.border == true) {
- context.stroke();
- }
- }
- context.translate(0, -eachSpacing);
- }
- } else {
- context.translate(0, -(seriesNew.length - 1) * eachSpacing);
- for (var _i31 = 0; _i31 < seriesNew.length; _i31++) {
- if (_i31 == seriesNew.length - 1) {
- if (opts.tooltip) {
- if (opts.tooltip.index == _i31) {
- context.beginPath();
- context.setFillStyle(hexToRgb(seriesNew[_i31].color, funnelOption.activeOpacity));
- context.moveTo(-activeWidth - funnelOption.minSize / 2, 0);
- context.lineTo(-seriesNew[_i31].radius - activeWidth, -eachSpacing);
- context.lineTo(seriesNew[_i31].radius + activeWidth, -eachSpacing);
- context.lineTo(activeWidth + funnelOption.minSize / 2, 0);
- context.lineTo(-activeWidth - funnelOption.minSize / 2, 0);
- context.closePath();
- context.fill();
- }
- }
- seriesNew[_i31].funnelArea = [centerPosition.x - seriesNew[_i31].radius, centerPosition.y - eachSpacing, centerPosition.x + seriesNew[_i31].radius, centerPosition.y];
- context.beginPath();
- context.setLineWidth(funnelOption.borderWidth * opts.pix);
- context.setStrokeStyle(funnelOption.borderColor);
- var fillColor = hexToRgb(seriesNew[_i31].color, funnelOption.fillOpacity);
- if (funnelOption.linearType == 'custom') {
- var grd = context.createLinearGradient(seriesNew[_i31].radius, -eachSpacing, -seriesNew[_i31].radius, -eachSpacing);
- grd.addColorStop(0, hexToRgb(seriesNew[_i31].color, funnelOption.fillOpacity));
- grd.addColorStop(0.5, hexToRgb(funnelOption.customColor[seriesNew[_i31].linearIndex], funnelOption.fillOpacity));
- grd.addColorStop(1, hexToRgb(seriesNew[_i31].color, funnelOption.fillOpacity));
- fillColor = grd;
- }
- context.setFillStyle(fillColor);
- context.moveTo(0, 0);
- context.lineTo(-funnelOption.minSize / 2, 0);
- context.lineTo(-seriesNew[_i31].radius, -eachSpacing);
- context.lineTo(seriesNew[_i31].radius, -eachSpacing);
- context.lineTo(funnelOption.minSize / 2, 0);
- context.lineTo(0, 0);
- context.closePath();
- context.fill();
- if (funnelOption.border == true) {
- context.stroke();
- }
- } else {
- if (opts.tooltip) {
- if (opts.tooltip.index == _i31) {
- context.beginPath();
- context.setFillStyle(hexToRgb(seriesNew[_i31].color, funnelOption.activeOpacity));
- context.moveTo(0, 0);
- context.lineTo(-seriesNew[_i31 + 1].radius - activeWidth, 0);
- context.lineTo(-seriesNew[_i31].radius - activeWidth, -eachSpacing);
- context.lineTo(seriesNew[_i31].radius + activeWidth, -eachSpacing);
- context.lineTo(seriesNew[_i31 + 1].radius + activeWidth, 0);
- context.lineTo(0, 0);
- context.closePath();
- context.fill();
- }
- }
- seriesNew[_i31].funnelArea = [centerPosition.x - seriesNew[_i31].radius, centerPosition.y - eachSpacing * (seriesNew.length - _i31), centerPosition.x + seriesNew[_i31].radius, centerPosition.y - eachSpacing * (seriesNew.length - _i31 - 1)];
- context.beginPath();
- context.setLineWidth(funnelOption.borderWidth * opts.pix);
- context.setStrokeStyle(funnelOption.borderColor);
- var fillColor = hexToRgb(seriesNew[_i31].color, funnelOption.fillOpacity);
- if (funnelOption.linearType == 'custom') {
- var grd = context.createLinearGradient(seriesNew[_i31].radius, -eachSpacing, -seriesNew[_i31].radius, -eachSpacing);
- grd.addColorStop(0, hexToRgb(seriesNew[_i31].color, funnelOption.fillOpacity));
- grd.addColorStop(0.5, hexToRgb(funnelOption.customColor[seriesNew[_i31].linearIndex], funnelOption.fillOpacity));
- grd.addColorStop(1, hexToRgb(seriesNew[_i31].color, funnelOption.fillOpacity));
- fillColor = grd;
- }
- context.setFillStyle(fillColor);
- context.moveTo(0, 0);
- context.lineTo(-seriesNew[_i31 + 1].radius, 0);
- context.lineTo(-seriesNew[_i31].radius, -eachSpacing);
- context.lineTo(seriesNew[_i31].radius, -eachSpacing);
- context.lineTo(seriesNew[_i31 + 1].radius, 0);
- context.lineTo(0, 0);
- context.closePath();
- context.fill();
- if (funnelOption.border == true) {
- context.stroke();
- }
- }
- context.translate(0, eachSpacing);
- }
- }
- context.restore();
- if (opts.dataLabel !== false && process === 1) {
- drawFunnelText(seriesNew, opts, context, eachSpacing, funnelOption.labelAlign, activeWidth, centerPosition);
- }
- if (process === 1) {
- drawFunnelCenterText(seriesNew, opts, context, eachSpacing, funnelOption.labelAlign, activeWidth, centerPosition);
- }
- return {
- center: centerPosition,
- radius: radius,
- series: seriesNew
- };
- }
- function drawFunnelText(series, opts, context, eachSpacing, labelAlign, activeWidth, centerPosition) {
- for (var i = 0; i < series.length; i++) {
- var item = series[i];
- if (item.labelShow === false) {
- continue;
- }
- var startX = void 0,
- endX = void 0,
- startY = void 0,
- fontSize = void 0;
- var text = item.formatter ? item.formatter(item, i, series, opts) : util.toFixed(item._proportion_ * 100) + '%';
- text = item.labelText ? item.labelText : text;
- if (labelAlign == 'right') {
- if (i == series.length - 1) {
- startX = (item.funnelArea[2] + centerPosition.x) / 2;
- } else {
- startX = (item.funnelArea[2] + series[i + 1].funnelArea[2]) / 2;
- }
- endX = startX + activeWidth * 2;
- startY = item.funnelArea[1] + eachSpacing / 2;
- fontSize = item.textSize * opts.pix || opts.fontSize * opts.pix;
- context.setLineWidth(1 * opts.pix);
- context.setStrokeStyle(item.color);
- context.setFillStyle(item.color);
- context.beginPath();
- context.moveTo(startX, startY);
- context.lineTo(endX, startY);
- context.stroke();
- context.closePath();
- context.beginPath();
- context.moveTo(endX, startY);
- context.arc(endX, startY, 2 * opts.pix, 0, 2 * Math.PI);
- context.closePath();
- context.fill();
- context.beginPath();
- context.setFontSize(fontSize);
- context.setFillStyle(item.textColor || opts.fontColor);
- context.fillText(text, endX + 5, startY + fontSize / 2 - 2);
- context.closePath();
- context.stroke();
- context.closePath();
- }
- if (labelAlign == 'left') {
- if (i == series.length - 1) {
- startX = (item.funnelArea[0] + centerPosition.x) / 2;
- } else {
- startX = (item.funnelArea[0] + series[i + 1].funnelArea[0]) / 2;
- }
- endX = startX - activeWidth * 2;
- startY = item.funnelArea[1] + eachSpacing / 2;
- fontSize = item.textSize * opts.pix || opts.fontSize * opts.pix;
- context.setLineWidth(1 * opts.pix);
- context.setStrokeStyle(item.color);
- context.setFillStyle(item.color);
- context.beginPath();
- context.moveTo(startX, startY);
- context.lineTo(endX, startY);
- context.stroke();
- context.closePath();
- context.beginPath();
- context.moveTo(endX, startY);
- context.arc(endX, startY, 2, 0, 2 * Math.PI);
- context.closePath();
- context.fill();
- context.beginPath();
- context.setFontSize(fontSize);
- context.setFillStyle(item.textColor || opts.fontColor);
- context.fillText(text, endX - 5 - measureText(text, fontSize, context), startY + fontSize / 2 - 2);
- context.closePath();
- context.stroke();
- context.closePath();
- }
- }
- }
- function drawFunnelCenterText(series, opts, context, eachSpacing, labelAlign, activeWidth, centerPosition) {
- for (var i = 0; i < series.length; i++) {
- var item = series[i];
- var startY = void 0,
- fontSize = void 0;
- if (item.centerText) {
- startY = item.funnelArea[1] + eachSpacing / 2;
- fontSize = item.centerTextSize * opts.pix || opts.fontSize * opts.pix;
- context.beginPath();
- context.setFontSize(fontSize);
- context.setFillStyle(item.centerTextColor || "#FFFFFF");
- context.fillText(item.centerText, centerPosition.x - measureText(item.centerText, fontSize, context) / 2, startY + fontSize / 2 - 2);
- context.closePath();
- context.stroke();
- context.closePath();
- }
- }
- }
- function drawCanvas(opts, context) {
- context.save();
- context.translate(0, 0.5);
- context.restore();
- context.draw();
- }
- var Timing = {
- easeIn: function easeIn(pos) {
- return Math.pow(pos, 3);
- },
- easeOut: function easeOut(pos) {
- return Math.pow(pos - 1, 3) + 1;
- },
- easeInOut: function easeInOut(pos) {
- if ((pos /= 0.5) < 1) {
- return 0.5 * Math.pow(pos, 3);
- } else {
- return 0.5 * (Math.pow(pos - 2, 3) + 2);
- }
- },
- linear: function linear(pos) {
- return pos;
- }
- };
- function Animation(opts) {
- this.isStop = false;
- opts.duration = typeof opts.duration === 'undefined' ? 1000 : opts.duration;
- opts.timing = opts.timing || 'easeInOut';
- var delay = 17;
- function createAnimationFrame() {
- if (typeof setTimeout !== 'undefined') {
- return function (step, delay) {
- setTimeout(function () {
- var timeStamp = +new Date();
- step(timeStamp);
- }, delay);
- };
- } else if (typeof requestAnimationFrame !== 'undefined') {
- return requestAnimationFrame;
- } else {
- return function (step) {
- step(null);
- };
- }
- }
- ;
- var animationFrame = createAnimationFrame();
- var startTimeStamp = null;
- var _step = function step(timestamp) {
- if (timestamp === null || this.isStop === true) {
- opts.onProcess && opts.onProcess(1);
- opts.onAnimationFinish && opts.onAnimationFinish();
- return;
- }
- if (startTimeStamp === null) {
- startTimeStamp = timestamp;
- }
- if (timestamp - startTimeStamp < opts.duration) {
- var process = (timestamp - startTimeStamp) / opts.duration;
- var timingFunction = Timing[opts.timing];
- process = timingFunction(process);
- opts.onProcess && opts.onProcess(process);
- animationFrame(_step, delay);
- } else {
- opts.onProcess && opts.onProcess(1);
- opts.onAnimationFinish && opts.onAnimationFinish();
- }
- };
- _step = _step.bind(this);
- animationFrame(_step, delay);
- }
- Animation.prototype.stop = function () {
- this.isStop = true;
- };
- function drawCharts(type, opts, config, context) {
- var _this2 = this;
- var _this = this;
- var series = opts.series;
- //兼容ECharts饼图类数据格式
- if (type === 'pie' || type === 'ring' || type === 'mount' || type === 'rose' || type === 'funnel') {
- series = fixPieSeries(series, opts, config);
- }
- var categories = opts.categories;
- if (type === 'mount') {
- categories = [];
- for (var j = 0; j < series.length; j++) {
- if (series[j].show !== false) categories.push(series[j].name);
- }
- opts.categories = categories;
- }
- series = fillSeries(series, opts, config);
- var duration = opts.animation ? opts.duration : 0;
- _this.animationInstance && _this.animationInstance.stop();
- var seriesMA = null;
- if (type == 'candle') {
- var average = assign({}, opts.extra.candle.average);
- if (average.show) {
- seriesMA = calCandleMA(average.day, average.name, average.color, series[0].data);
- seriesMA = fillSeries(seriesMA, opts, config);
- opts.seriesMA = seriesMA;
- } else if (opts.seriesMA) {
- seriesMA = opts.seriesMA = fillSeries(opts.seriesMA, opts, config);
- } else {
- seriesMA = series;
- }
- } else {
- seriesMA = series;
- }
- /* 过滤掉show=false的series */
- opts._series_ = series = filterSeries(series);
- //重新计算图表区域
- opts.area = new Array(4);
- //复位绘图区域
- for (var _j11 = 0; _j11 < 4; _j11++) {
- opts.area[_j11] = opts.padding[_j11] * opts.pix;
- }
- //通过计算三大区域:图例、X轴、Y轴的大小,确定绘图区域
- var _calLegendData = calLegendData(seriesMA, opts, config, opts.chartData, context),
- legendHeight = _calLegendData.area.wholeHeight,
- legendWidth = _calLegendData.area.wholeWidth;
- switch (opts.legend.position) {
- case 'top':
- opts.area[0] += legendHeight;
- break;
- case 'bottom':
- opts.area[2] += legendHeight;
- break;
- case 'left':
- opts.area[3] += legendWidth;
- break;
- case 'right':
- opts.area[1] += legendWidth;
- break;
- }
- var _calYAxisData = {},
- yAxisWidth = 0;
- if (opts.type === 'line' || opts.type === 'column' || opts.type === 'mount' || opts.type === 'area' || opts.type === 'mix' || opts.type === 'candle' || opts.type === 'scatter' || opts.type === 'bubble' || opts.type === 'bar') {
- _calYAxisData = calYAxisData(series, opts, config, context);
- yAxisWidth = _calYAxisData.yAxisWidth;
- //如果显示Y轴标题
- if (opts.yAxis.showTitle) {
- var maxTitleHeight = 0;
- for (var i = 0; i < opts.yAxis.data.length; i++) {
- maxTitleHeight = Math.max(maxTitleHeight, opts.yAxis.data[i].titleFontSize ? opts.yAxis.data[i].titleFontSize * opts.pix : config.fontSize);
- }
- opts.area[0] += maxTitleHeight;
- }
- var rightIndex = 0,
- leftIndex = 0;
- //计算主绘图区域左右位置
- for (var _i32 = 0; _i32 < yAxisWidth.length; _i32++) {
- if (yAxisWidth[_i32].position == 'left') {
- if (leftIndex > 0) {
- opts.area[3] += yAxisWidth[_i32].width + opts.yAxis.padding * opts.pix;
- } else {
- opts.area[3] += yAxisWidth[_i32].width;
- }
- leftIndex += 1;
- } else if (yAxisWidth[_i32].position == 'right') {
- if (rightIndex > 0) {
- opts.area[1] += yAxisWidth[_i32].width + opts.yAxis.padding * opts.pix;
- } else {
- opts.area[1] += yAxisWidth[_i32].width;
- }
- rightIndex += 1;
- }
- }
- } else {
- config.yAxisWidth = yAxisWidth;
- }
- opts.chartData.yAxisData = _calYAxisData;
- if (opts.categories && opts.categories.length && opts.type !== 'radar' && opts.type !== 'gauge' && opts.type !== 'bar') {
- opts.chartData.xAxisData = getXAxisPoints(opts.categories, opts, config);
- var _calCategoriesData = calCategoriesData(opts.categories, opts, config, opts.chartData.xAxisData.eachSpacing, context),
- xAxisHeight = _calCategoriesData.xAxisHeight,
- angle = _calCategoriesData.angle;
- config.xAxisHeight = xAxisHeight;
- config._xAxisTextAngle_ = angle;
- opts.area[2] += xAxisHeight;
- opts.chartData.categoriesData = _calCategoriesData;
- } else {
- if (opts.type === 'line' || opts.type === 'area' || opts.type === 'scatter' || opts.type === 'bubble' || opts.type === 'bar') {
- opts.chartData.xAxisData = calXAxisData(series, opts, config, context);
- categories = opts.chartData.xAxisData.rangesFormat;
- var _calCategoriesData2 = calCategoriesData(categories, opts, config, opts.chartData.xAxisData.eachSpacing, context),
- _xAxisHeight = _calCategoriesData2.xAxisHeight,
- _angle = _calCategoriesData2.angle;
- config.xAxisHeight = _xAxisHeight;
- config._xAxisTextAngle_ = _angle;
- opts.area[2] += _xAxisHeight;
- opts.chartData.categoriesData = _calCategoriesData2;
- } else {
- opts.chartData.xAxisData = {
- xAxisPoints: []
- };
- }
- }
- //计算右对齐偏移距离
- if (opts.enableScroll && opts.xAxis.scrollAlign == 'right' && opts._scrollDistance_ === undefined) {
- var offsetLeft = 0,
- xAxisPoints = opts.chartData.xAxisData.xAxisPoints,
- startX = opts.chartData.xAxisData.startX,
- endX = opts.chartData.xAxisData.endX,
- eachSpacing = opts.chartData.xAxisData.eachSpacing;
- var totalWidth = eachSpacing * (xAxisPoints.length - 1);
- var screenWidth = endX - startX;
- offsetLeft = screenWidth - totalWidth;
- _this.scrollOption.currentOffset = offsetLeft;
- _this.scrollOption.startTouchX = offsetLeft;
- _this.scrollOption.distance = 0;
- _this.scrollOption.lastMoveTime = 0;
- opts._scrollDistance_ = offsetLeft;
- }
- if (type === 'pie' || type === 'ring' || type === 'rose') {
- config._pieTextMaxLength_ = opts.dataLabel === false ? 0 : getPieTextMaxLength(seriesMA, config, context, opts);
- }
- switch (type) {
- case 'word':
- this.animationInstance = new Animation({
- timing: opts.timing,
- duration: duration,
- onProcess: function onProcess(process) {
- context.clearRect(0, 0, opts.width, opts.height);
- if (opts.rotate) {
- contextRotate(context, opts);
- }
- drawWordCloudDataPoints(series, opts, config, context, process);
- drawCanvas(opts, context);
- },
- onAnimationFinish: function onAnimationFinish() {
- _this.uevent.trigger('renderComplete');
- }
- });
- break;
- case 'map':
- context.clearRect(0, 0, opts.width, opts.height);
- drawMapDataPoints(series, opts, config, context);
- setTimeout(function () {
- _this2.uevent.trigger('renderComplete');
- }, 50);
- break;
- case 'funnel':
- this.animationInstance = new Animation({
- timing: opts.timing,
- duration: duration,
- onProcess: function onProcess(process) {
- context.clearRect(0, 0, opts.width, opts.height);
- if (opts.rotate) {
- contextRotate(context, opts);
- }
- opts.chartData.funnelData = drawFunnelDataPoints(series, opts, config, context, process);
- drawLegend(opts.series, opts, config, context, opts.chartData);
- drawToolTipBridge(opts, config, context, process);
- drawCanvas(opts, context);
- },
- onAnimationFinish: function onAnimationFinish() {
- _this.uevent.trigger('renderComplete');
- }
- });
- break;
- case 'line':
- this.animationInstance = new Animation({
- timing: opts.timing,
- duration: duration,
- onProcess: function onProcess(process) {
- context.clearRect(0, 0, opts.width, opts.height);
- if (opts.rotate) {
- contextRotate(context, opts);
- }
- drawYAxisGrid(categories, opts, config, context);
- drawXAxis(categories, opts, config, context);
- var _drawLineDataPoints = drawLineDataPoints(series, opts, config, context, process),
- xAxisPoints = _drawLineDataPoints.xAxisPoints,
- calPoints = _drawLineDataPoints.calPoints,
- eachSpacing = _drawLineDataPoints.eachSpacing;
- opts.chartData.xAxisPoints = xAxisPoints;
- opts.chartData.calPoints = calPoints;
- opts.chartData.eachSpacing = eachSpacing;
- drawYAxis(series, opts, config, context);
- if (opts.enableMarkLine !== false && process === 1) {
- drawMarkLine(opts, config, context);
- }
- drawLegend(opts.series, opts, config, context, opts.chartData);
- drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
- drawCanvas(opts, context);
- },
- onAnimationFinish: function onAnimationFinish() {
- _this.uevent.trigger('renderComplete');
- }
- });
- break;
- case 'scatter':
- this.animationInstance = new Animation({
- timing: opts.timing,
- duration: duration,
- onProcess: function onProcess(process) {
- context.clearRect(0, 0, opts.width, opts.height);
- if (opts.rotate) {
- contextRotate(context, opts);
- }
- drawYAxisGrid(categories, opts, config, context);
- drawXAxis(categories, opts, config, context);
- var _drawScatterDataPoints = drawScatterDataPoints(series, opts, config, context, process),
- xAxisPoints = _drawScatterDataPoints.xAxisPoints,
- calPoints = _drawScatterDataPoints.calPoints,
- eachSpacing = _drawScatterDataPoints.eachSpacing;
- opts.chartData.xAxisPoints = xAxisPoints;
- opts.chartData.calPoints = calPoints;
- opts.chartData.eachSpacing = eachSpacing;
- drawYAxis(series, opts, config, context);
- if (opts.enableMarkLine !== false && process === 1) {
- drawMarkLine(opts, config, context);
- }
- drawLegend(opts.series, opts, config, context, opts.chartData);
- drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
- drawCanvas(opts, context);
- },
- onAnimationFinish: function onAnimationFinish() {
- _this.uevent.trigger('renderComplete');
- }
- });
- break;
- case 'bubble':
- this.animationInstance = new Animation({
- timing: opts.timing,
- duration: duration,
- onProcess: function onProcess(process) {
- context.clearRect(0, 0, opts.width, opts.height);
- if (opts.rotate) {
- contextRotate(context, opts);
- }
- drawYAxisGrid(categories, opts, config, context);
- drawXAxis(categories, opts, config, context);
- var _drawBubbleDataPoints = drawBubbleDataPoints(series, opts, config, context, process),
- xAxisPoints = _drawBubbleDataPoints.xAxisPoints,
- calPoints = _drawBubbleDataPoints.calPoints,
- eachSpacing = _drawBubbleDataPoints.eachSpacing;
- opts.chartData.xAxisPoints = xAxisPoints;
- opts.chartData.calPoints = calPoints;
- opts.chartData.eachSpacing = eachSpacing;
- drawYAxis(series, opts, config, context);
- if (opts.enableMarkLine !== false && process === 1) {
- drawMarkLine(opts, config, context);
- }
- drawLegend(opts.series, opts, config, context, opts.chartData);
- drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
- drawCanvas(opts, context);
- },
- onAnimationFinish: function onAnimationFinish() {
- _this.uevent.trigger('renderComplete');
- }
- });
- break;
- case 'mix':
- this.animationInstance = new Animation({
- timing: opts.timing,
- duration: duration,
- onProcess: function onProcess(process) {
- context.clearRect(0, 0, opts.width, opts.height);
- if (opts.rotate) {
- contextRotate(context, opts);
- }
- drawYAxisGrid(categories, opts, config, context);
- drawXAxis(categories, opts, config, context);
- var _drawMixDataPoints = drawMixDataPoints(series, opts, config, context, process),
- xAxisPoints = _drawMixDataPoints.xAxisPoints,
- calPoints = _drawMixDataPoints.calPoints,
- eachSpacing = _drawMixDataPoints.eachSpacing;
- opts.chartData.xAxisPoints = xAxisPoints;
- opts.chartData.calPoints = calPoints;
- opts.chartData.eachSpacing = eachSpacing;
- drawYAxis(series, opts, config, context);
- if (opts.enableMarkLine !== false && process === 1) {
- drawMarkLine(opts, config, context);
- }
- drawLegend(opts.series, opts, config, context, opts.chartData);
- drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
- drawCanvas(opts, context);
- },
- onAnimationFinish: function onAnimationFinish() {
- _this.uevent.trigger('renderComplete');
- }
- });
- break;
- case 'column':
- this.animationInstance = new Animation({
- timing: opts.timing,
- duration: duration,
- onProcess: function onProcess(process) {
- context.clearRect(0, 0, opts.width, opts.height);
- if (opts.rotate) {
- contextRotate(context, opts);
- }
- drawYAxisGrid(categories, opts, config, context);
- drawXAxis(categories, opts, config, context);
- var _drawColumnDataPoints = drawColumnDataPoints(series, opts, config, context, process),
- xAxisPoints = _drawColumnDataPoints.xAxisPoints,
- calPoints = _drawColumnDataPoints.calPoints,
- eachSpacing = _drawColumnDataPoints.eachSpacing;
- opts.chartData.xAxisPoints = xAxisPoints;
- opts.chartData.calPoints = calPoints;
- opts.chartData.eachSpacing = eachSpacing;
- drawYAxis(series, opts, config, context);
- if (opts.enableMarkLine !== false && process === 1) {
- drawMarkLine(opts, config, context);
- }
- drawLegend(opts.series, opts, config, context, opts.chartData);
- drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
- drawCanvas(opts, context);
- },
- onAnimationFinish: function onAnimationFinish() {
- _this.uevent.trigger('renderComplete');
- }
- });
- break;
- case 'mount':
- this.animationInstance = new Animation({
- timing: opts.timing,
- duration: duration,
- onProcess: function onProcess(process) {
- context.clearRect(0, 0, opts.width, opts.height);
- if (opts.rotate) {
- contextRotate(context, opts);
- }
- drawYAxisGrid(categories, opts, config, context);
- drawXAxis(categories, opts, config, context);
- var _drawMountDataPoints = drawMountDataPoints(series, opts, config, context, process),
- xAxisPoints = _drawMountDataPoints.xAxisPoints,
- calPoints = _drawMountDataPoints.calPoints,
- eachSpacing = _drawMountDataPoints.eachSpacing;
- opts.chartData.xAxisPoints = xAxisPoints;
- opts.chartData.calPoints = calPoints;
- opts.chartData.eachSpacing = eachSpacing;
- drawYAxis(series, opts, config, context);
- if (opts.enableMarkLine !== false && process === 1) {
- drawMarkLine(opts, config, context);
- }
- drawLegend(opts.series, opts, config, context, opts.chartData);
- drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
- drawCanvas(opts, context);
- },
- onAnimationFinish: function onAnimationFinish() {
- _this.uevent.trigger('renderComplete');
- }
- });
- break;
- case 'bar':
- this.animationInstance = new Animation({
- timing: opts.timing,
- duration: duration,
- onProcess: function onProcess(process) {
- context.clearRect(0, 0, opts.width, opts.height);
- if (opts.rotate) {
- contextRotate(context, opts);
- }
- drawXAxis(categories, opts, config, context);
- var _drawBarDataPoints = drawBarDataPoints(series, opts, config, context, process),
- yAxisPoints = _drawBarDataPoints.yAxisPoints,
- calPoints = _drawBarDataPoints.calPoints,
- eachSpacing = _drawBarDataPoints.eachSpacing;
- opts.chartData.yAxisPoints = yAxisPoints;
- opts.chartData.xAxisPoints = opts.chartData.xAxisData.xAxisPoints;
- opts.chartData.calPoints = calPoints;
- opts.chartData.eachSpacing = eachSpacing;
- drawYAxis(series, opts, config, context);
- if (opts.enableMarkLine !== false && process === 1) {
- drawMarkLine(opts, config, context);
- }
- drawLegend(opts.series, opts, config, context, opts.chartData);
- drawToolTipBridge(opts, config, context, process, eachSpacing, yAxisPoints);
- drawCanvas(opts, context);
- },
- onAnimationFinish: function onAnimationFinish() {
- _this.uevent.trigger('renderComplete');
- }
- });
- break;
- case 'area':
- this.animationInstance = new Animation({
- timing: opts.timing,
- duration: duration,
- onProcess: function onProcess(process) {
- context.clearRect(0, 0, opts.width, opts.height);
- if (opts.rotate) {
- contextRotate(context, opts);
- }
- drawYAxisGrid(categories, opts, config, context);
- drawXAxis(categories, opts, config, context);
- var _drawAreaDataPoints = drawAreaDataPoints(series, opts, config, context, process),
- xAxisPoints = _drawAreaDataPoints.xAxisPoints,
- calPoints = _drawAreaDataPoints.calPoints,
- eachSpacing = _drawAreaDataPoints.eachSpacing;
- opts.chartData.xAxisPoints = xAxisPoints;
- opts.chartData.calPoints = calPoints;
- opts.chartData.eachSpacing = eachSpacing;
- drawYAxis(series, opts, config, context);
- if (opts.enableMarkLine !== false && process === 1) {
- drawMarkLine(opts, config, context);
- }
- drawLegend(opts.series, opts, config, context, opts.chartData);
- drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
- drawCanvas(opts, context);
- },
- onAnimationFinish: function onAnimationFinish() {
- _this.uevent.trigger('renderComplete');
- }
- });
- break;
- case 'ring':
- this.animationInstance = new Animation({
- timing: opts.timing,
- duration: duration,
- onProcess: function onProcess(process) {
- context.clearRect(0, 0, opts.width, opts.height);
- if (opts.rotate) {
- contextRotate(context, opts);
- }
- opts.chartData.pieData = drawPieDataPoints(series, opts, config, context, process);
- drawLegend(opts.series, opts, config, context, opts.chartData);
- drawToolTipBridge(opts, config, context, process);
- drawCanvas(opts, context);
- },
- onAnimationFinish: function onAnimationFinish() {
- _this.uevent.trigger('renderComplete');
- }
- });
- break;
- case 'pie':
- this.animationInstance = new Animation({
- timing: opts.timing,
- duration: duration,
- onProcess: function onProcess(process) {
- context.clearRect(0, 0, opts.width, opts.height);
- if (opts.rotate) {
- contextRotate(context, opts);
- }
- opts.chartData.pieData = drawPieDataPoints(series, opts, config, context, process);
- drawLegend(opts.series, opts, config, context, opts.chartData);
- drawToolTipBridge(opts, config, context, process);
- drawCanvas(opts, context);
- },
- onAnimationFinish: function onAnimationFinish() {
- _this.uevent.trigger('renderComplete');
- }
- });
- break;
- case 'rose':
- this.animationInstance = new Animation({
- timing: opts.timing,
- duration: duration,
- onProcess: function onProcess(process) {
- context.clearRect(0, 0, opts.width, opts.height);
- if (opts.rotate) {
- contextRotate(context, opts);
- }
- opts.chartData.pieData = drawRoseDataPoints(series, opts, config, context, process);
- drawLegend(opts.series, opts, config, context, opts.chartData);
- drawToolTipBridge(opts, config, context, process);
- drawCanvas(opts, context);
- },
- onAnimationFinish: function onAnimationFinish() {
- _this.uevent.trigger('renderComplete');
- }
- });
- break;
- case 'radar':
- this.animationInstance = new Animation({
- timing: opts.timing,
- duration: duration,
- onProcess: function onProcess(process) {
- context.clearRect(0, 0, opts.width, opts.height);
- if (opts.rotate) {
- contextRotate(context, opts);
- }
- opts.chartData.radarData = drawRadarDataPoints(series, opts, config, context, process);
- drawLegend(opts.series, opts, config, context, opts.chartData);
- drawToolTipBridge(opts, config, context, process);
- drawCanvas(opts, context);
- },
- onAnimationFinish: function onAnimationFinish() {
- _this.uevent.trigger('renderComplete');
- }
- });
- break;
- case 'arcbar':
- this.animationInstance = new Animation({
- timing: opts.timing,
- duration: duration,
- onProcess: function onProcess(process) {
- context.clearRect(0, 0, opts.width, opts.height);
- if (opts.rotate) {
- contextRotate(context, opts);
- }
- opts.chartData.arcbarData = drawArcbarDataPoints(series, opts, config, context, process);
- drawCanvas(opts, context);
- },
- onAnimationFinish: function onAnimationFinish() {
- _this.uevent.trigger('renderComplete');
- }
- });
- break;
- case 'gauge':
- this.animationInstance = new Animation({
- timing: opts.timing,
- duration: duration,
- onProcess: function onProcess(process) {
- context.clearRect(0, 0, opts.width, opts.height);
- if (opts.rotate) {
- contextRotate(context, opts);
- }
- opts.chartData.gaugeData = drawGaugeDataPoints(categories, series, opts, config, context, process);
- drawCanvas(opts, context);
- },
- onAnimationFinish: function onAnimationFinish() {
- _this.uevent.trigger('renderComplete');
- }
- });
- break;
- case 'candle':
- this.animationInstance = new Animation({
- timing: opts.timing,
- duration: duration,
- onProcess: function onProcess(process) {
- context.clearRect(0, 0, opts.width, opts.height);
- if (opts.rotate) {
- contextRotate(context, opts);
- }
- drawYAxisGrid(categories, opts, config, context);
- drawXAxis(categories, opts, config, context);
- var _drawCandleDataPoints = drawCandleDataPoints(series, seriesMA, opts, config, context, process),
- xAxisPoints = _drawCandleDataPoints.xAxisPoints,
- calPoints = _drawCandleDataPoints.calPoints,
- eachSpacing = _drawCandleDataPoints.eachSpacing;
- opts.chartData.xAxisPoints = xAxisPoints;
- opts.chartData.calPoints = calPoints;
- opts.chartData.eachSpacing = eachSpacing;
- drawYAxis(series, opts, config, context);
- if (opts.enableMarkLine !== false && process === 1) {
- drawMarkLine(opts, config, context);
- }
- if (seriesMA) {
- drawLegend(seriesMA, opts, config, context, opts.chartData);
- } else {
- drawLegend(opts.series, opts, config, context, opts.chartData);
- }
- drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
- drawCanvas(opts, context);
- },
- onAnimationFinish: function onAnimationFinish() {
- _this.uevent.trigger('renderComplete');
- }
- });
- break;
- }
- }
- function uChartsEvent() {
- this.events = {};
- }
- uChartsEvent.prototype.addEventListener = function (type, listener) {
- this.events[type] = this.events[type] || [];
- this.events[type].push(listener);
- };
- uChartsEvent.prototype.delEventListener = function (type) {
- this.events[type] = [];
- };
- uChartsEvent.prototype.trigger = function () {
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- var type = args[0];
- var params = args.slice(1);
- if (!!this.events[type]) {
- this.events[type].forEach(function (listener) {
- try {
- listener.apply(null, params);
- } catch (e) {
- //console.log('[uCharts] '+e);
- }
- });
- }
- };
- var uCharts = function uCharts(opts) {
- opts.pix = opts.pixelRatio ? opts.pixelRatio : 1;
- opts.fontSize = opts.fontSize ? opts.fontSize : 13;
- opts.fontColor = opts.fontColor ? opts.fontColor : config.fontColor;
- if (opts.background == "" || opts.background == "none") {
- opts.background = "#FFFFFF";
- }
- opts.title = assign({}, opts.title);
- opts.subtitle = assign({}, opts.subtitle);
- opts.duration = opts.duration ? opts.duration : 1000;
- opts.yAxis = assign({}, {
- data: [],
- showTitle: false,
- disabled: false,
- disableGrid: false,
- gridSet: 'number',
- splitNumber: 5,
- gridType: 'solid',
- dashLength: 4 * opts.pix,
- gridColor: '#cccccc',
- padding: 10,
- fontColor: '#666666'
- }, opts.yAxis);
- opts.xAxis = assign({}, {
- rotateLabel: false,
- rotateAngle: 45,
- disabled: false,
- disableGrid: false,
- splitNumber: 5,
- calibration: false,
- fontColor: '#666666',
- fontSize: 13,
- lineHeight: 20,
- marginTop: 0,
- gridType: 'solid',
- dashLength: 4,
- scrollAlign: 'left',
- boundaryGap: 'center',
- axisLine: true,
- axisLineColor: '#cccccc',
- titleFontSize: 13,
- titleOffsetY: 0,
- titleOffsetX: 0,
- titleFontColor: '#666666'
- }, opts.xAxis);
- opts.xAxis.scrollPosition = opts.xAxis.scrollAlign;
- opts.legend = assign({}, {
- show: true,
- position: 'bottom',
- float: 'center',
- backgroundColor: 'rgba(0,0,0,0)',
- borderColor: 'rgba(0,0,0,0)',
- borderWidth: 0,
- padding: 5,
- margin: 5,
- itemGap: 10,
- fontSize: opts.fontSize,
- lineHeight: opts.fontSize,
- fontColor: opts.fontColor,
- formatter: {},
- hiddenColor: '#CECECE'
- }, opts.legend);
- opts.extra = assign({
- tooltip: {
- legendShape: 'auto'
- }
- }, opts.extra);
- opts.rotate = opts.rotate ? true : false;
- opts.animation = opts.animation ? true : false;
- opts.rotate = opts.rotate ? true : false;
- opts.canvas2d = opts.canvas2d ? true : false;
- var config$$1 = assign({}, config);
- config$$1.color = opts.color ? opts.color : config$$1.color;
- if (opts.type == 'pie') {
- config$$1.pieChartLinePadding = opts.dataLabel === false ? 0 : opts.extra.pie.labelWidth * opts.pix || config$$1.pieChartLinePadding * opts.pix;
- }
- if (opts.type == 'ring') {
- config$$1.pieChartLinePadding = opts.dataLabel === false ? 0 : opts.extra.ring.labelWidth * opts.pix || config$$1.pieChartLinePadding * opts.pix;
- }
- if (opts.type == 'rose') {
- config$$1.pieChartLinePadding = opts.dataLabel === false ? 0 : opts.extra.rose.labelWidth * opts.pix || config$$1.pieChartLinePadding * opts.pix;
- }
- config$$1.pieChartTextPadding = opts.dataLabel === false ? 0 : config$$1.pieChartTextPadding * opts.pix;
- //屏幕旋转
- config$$1.rotate = opts.rotate;
- if (opts.rotate) {
- var tempWidth = opts.width;
- var tempHeight = opts.height;
- opts.width = tempHeight;
- opts.height = tempWidth;
- }
- //适配高分屏
- opts.padding = opts.padding ? opts.padding : config$$1.padding;
- config$$1.yAxisWidth = config.yAxisWidth * opts.pix;
- config$$1.fontSize = opts.fontSize * opts.pix;
- config$$1.titleFontSize = config.titleFontSize * opts.pix;
- config$$1.subtitleFontSize = config.subtitleFontSize * opts.pix;
- if (!opts.context) {
- throw new Error('[uCharts] 未获取到context!注意:v2.0版本后,需要自行获取canvas的绘图上下文并传入opts.context!');
- }
- this.context = opts.context;
- if (!this.context.setTextAlign) {
- this.context.setStrokeStyle = function (e) {
- return this.strokeStyle = e;
- };
- this.context.setLineWidth = function (e) {
- return this.lineWidth = e;
- };
- this.context.setLineCap = function (e) {
- return this.lineCap = e;
- };
- this.context.setFontSize = function (e) {
- return this.font = e + "px sans-serif";
- };
- this.context.setFillStyle = function (e) {
- return this.fillStyle = e;
- };
- this.context.setTextAlign = function (e) {
- return this.textAlign = e;
- };
- this.context.setTextBaseline = function (e) {
- return this.textBaseline = e;
- };
- this.context.setShadow = function (offsetX, offsetY, blur, color) {
- this.shadowColor = color;
- this.shadowOffsetX = offsetX;
- this.shadowOffsetY = offsetY;
- this.shadowBlur = blur;
- };
- this.context.draw = function () {};
- }
- //兼容NVUEsetLineDash
- if (!this.context.setLineDash) {
- this.context.setLineDash = function (e) {};
- }
- opts.chartData = {};
- this.uevent = new uChartsEvent();
- this.scrollOption = {
- currentOffset: 0,
- startTouchX: 0,
- distance: 0,
- lastMoveTime: 0
- };
- this.opts = opts;
- this.config = config$$1;
- drawCharts.call(this, opts.type, opts, config$$1, this.context);
- };
- uCharts.prototype.updateData = function () {
- var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- this.opts = assign({}, this.opts, data);
- this.opts.updateData = true;
- var scrollPosition = data.scrollPosition || 'current';
- switch (scrollPosition) {
- case 'current':
- this.opts._scrollDistance_ = this.scrollOption.currentOffset;
- break;
- case 'left':
- this.opts._scrollDistance_ = 0;
- this.scrollOption = {
- currentOffset: 0,
- startTouchX: 0,
- distance: 0,
- lastMoveTime: 0
- };
- break;
- case 'right':
- var _calYAxisData = calYAxisData(this.opts.series, this.opts, this.config, this.context),
- yAxisWidth = _calYAxisData.yAxisWidth;
- this.config.yAxisWidth = yAxisWidth;
- var offsetLeft = 0;
- var _getXAxisPoints0 = getXAxisPoints(this.opts.categories, this.opts, this.config),
- xAxisPoints = _getXAxisPoints0.xAxisPoints,
- startX = _getXAxisPoints0.startX,
- endX = _getXAxisPoints0.endX,
- eachSpacing = _getXAxisPoints0.eachSpacing;
- var totalWidth = eachSpacing * (xAxisPoints.length - 1);
- var screenWidth = endX - startX;
- offsetLeft = screenWidth - totalWidth;
- this.scrollOption = {
- currentOffset: offsetLeft,
- startTouchX: offsetLeft,
- distance: 0,
- lastMoveTime: 0
- };
- this.opts._scrollDistance_ = offsetLeft;
- break;
- }
- drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
- };
- uCharts.prototype.zoom = function () {
- var val = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.opts.xAxis.itemCount;
- if (this.opts.enableScroll !== true) {
- console.log('[uCharts] 请启用滚动条后使用');
- return;
- }
- //当前屏幕中间点
- var centerPoint = Math.round(Math.abs(this.scrollOption.currentOffset) / this.opts.chartData.eachSpacing) + Math.round(this.opts.xAxis.itemCount / 2);
- this.opts.animation = false;
- this.opts.xAxis.itemCount = val.itemCount;
- //重新计算x轴偏移距离
- var _calYAxisData = calYAxisData(this.opts.series, this.opts, this.config, this.context),
- yAxisWidth = _calYAxisData.yAxisWidth;
- this.config.yAxisWidth = yAxisWidth;
- var offsetLeft = 0;
- var _getXAxisPoints0 = getXAxisPoints(this.opts.categories, this.opts, this.config),
- xAxisPoints = _getXAxisPoints0.xAxisPoints,
- startX = _getXAxisPoints0.startX,
- endX = _getXAxisPoints0.endX,
- eachSpacing = _getXAxisPoints0.eachSpacing;
- var centerLeft = eachSpacing * centerPoint;
- var screenWidth = endX - startX;
- var MaxLeft = screenWidth - eachSpacing * (xAxisPoints.length - 1);
- offsetLeft = screenWidth / 2 - centerLeft;
- if (offsetLeft > 0) {
- offsetLeft = 0;
- }
- if (offsetLeft < MaxLeft) {
- offsetLeft = MaxLeft;
- }
- this.scrollOption = {
- currentOffset: offsetLeft,
- startTouchX: 0,
- distance: 0,
- lastMoveTime: 0
- };
- calValidDistance(this, offsetLeft, this.opts.chartData, this.config, this.opts);
- this.opts._scrollDistance_ = offsetLeft;
- drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
- };
- uCharts.prototype.dobuleZoom = function (e) {
- if (this.opts.enableScroll !== true) {
- console.log('[uCharts] 请启用滚动条后使用');
- return;
- }
- var tcs = e.changedTouches;
- if (tcs.length < 2) {
- return;
- }
- for (var i = 0; i < tcs.length; i++) {
- tcs[i].x = tcs[i].x ? tcs[i].x : tcs[i].clientX;
- tcs[i].y = tcs[i].y ? tcs[i].y : tcs[i].clientY;
- }
- var ntcs = [getTouches(tcs[0], this.opts, e), getTouches(tcs[1], this.opts, e)];
- var xlength = Math.abs(ntcs[0].x - ntcs[1].x);
- // 记录初始的两指之间的数据
- if (!this.scrollOption.moveCount) {
- var cts0 = {
- changedTouches: [{
- x: tcs[0].x,
- y: this.opts.area[0] / this.opts.pix + 2
- }]
- };
- var cts1 = {
- changedTouches: [{
- x: tcs[1].x,
- y: this.opts.area[0] / this.opts.pix + 2
- }]
- };
- if (this.opts.rotate) {
- cts0 = {
- changedTouches: [{
- x: this.opts.height / this.opts.pix - this.opts.area[0] / this.opts.pix - 2,
- y: tcs[0].y
- }]
- };
- cts1 = {
- changedTouches: [{
- x: this.opts.height / this.opts.pix - this.opts.area[0] / this.opts.pix - 2,
- y: tcs[1].y
- }]
- };
- }
- var moveCurrent1 = this.getCurrentDataIndex(cts0).index;
- var moveCurrent2 = this.getCurrentDataIndex(cts1).index;
- var moveCount = Math.abs(moveCurrent1 - moveCurrent2);
- this.scrollOption.moveCount = moveCount;
- this.scrollOption.moveCurrent1 = Math.min(moveCurrent1, moveCurrent2);
- this.scrollOption.moveCurrent2 = Math.max(moveCurrent1, moveCurrent2);
- return;
- }
- var currentEachSpacing = xlength / this.scrollOption.moveCount;
- var itemCount = (this.opts.width - this.opts.area[1] - this.opts.area[3]) / currentEachSpacing;
- itemCount = itemCount <= 2 ? 2 : itemCount;
- itemCount = itemCount >= this.opts.categories.length ? this.opts.categories.length : itemCount;
- this.opts.animation = false;
- this.opts.xAxis.itemCount = itemCount;
- // 重新计算滚动条偏移距离
- var offsetLeft = 0;
- var _getXAxisPoints0 = getXAxisPoints(this.opts.categories, this.opts, this.config),
- xAxisPoints = _getXAxisPoints0.xAxisPoints,
- startX = _getXAxisPoints0.startX,
- endX = _getXAxisPoints0.endX,
- eachSpacing = _getXAxisPoints0.eachSpacing;
- var currentLeft = eachSpacing * this.scrollOption.moveCurrent1;
- var screenWidth = endX - startX;
- var MaxLeft = screenWidth - eachSpacing * (xAxisPoints.length - 1);
- offsetLeft = -currentLeft + Math.min(ntcs[0].x, ntcs[1].x) - this.opts.area[3] - eachSpacing;
- if (offsetLeft > 0) {
- offsetLeft = 0;
- }
- if (offsetLeft < MaxLeft) {
- offsetLeft = MaxLeft;
- }
- this.scrollOption.currentOffset = offsetLeft;
- this.scrollOption.startTouchX = 0;
- this.scrollOption.distance = 0;
- calValidDistance(this, offsetLeft, this.opts.chartData, this.config, this.opts);
- this.opts._scrollDistance_ = offsetLeft;
- drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
- };
- uCharts.prototype.stopAnimation = function () {
- this.animationInstance && this.animationInstance.stop();
- };
- uCharts.prototype.addEventListener = function (type, listener) {
- this.uevent.addEventListener(type, listener);
- };
- uCharts.prototype.delEventListener = function (type) {
- this.uevent.delEventListener(type);
- };
- uCharts.prototype.getCurrentDataIndex = function (e) {
- var touches = null;
- if (e.changedTouches) {
- touches = e.changedTouches[0];
- } else {
- touches = e.mp.changedTouches[0];
- }
- if (touches) {
- var _touches$ = getTouches(touches, this.opts, e);
- if (this.opts.type === 'pie' || this.opts.type === 'ring') {
- return findPieChartCurrentIndex({
- x: _touches$.x,
- y: _touches$.y
- }, this.opts.chartData.pieData, this.opts);
- } else if (this.opts.type === 'rose') {
- return findRoseChartCurrentIndex({
- x: _touches$.x,
- y: _touches$.y
- }, this.opts.chartData.pieData, this.opts);
- } else if (this.opts.type === 'radar') {
- return findRadarChartCurrentIndex({
- x: _touches$.x,
- y: _touches$.y
- }, this.opts.chartData.radarData, this.opts.categories.length);
- } else if (this.opts.type === 'funnel') {
- return findFunnelChartCurrentIndex({
- x: _touches$.x,
- y: _touches$.y
- }, this.opts.chartData.funnelData);
- } else if (this.opts.type === 'map') {
- return findMapChartCurrentIndex({
- x: _touches$.x,
- y: _touches$.y
- }, this.opts);
- } else if (this.opts.type === 'word') {
- return findWordChartCurrentIndex({
- x: _touches$.x,
- y: _touches$.y
- }, this.opts.chartData.wordCloudData);
- } else if (this.opts.type === 'bar') {
- return findBarChartCurrentIndex({
- x: _touches$.x,
- y: _touches$.y
- }, this.opts.chartData.calPoints, this.opts, this.config, Math.abs(this.scrollOption.currentOffset));
- } else {
- return findCurrentIndex({
- x: _touches$.x,
- y: _touches$.y
- }, this.opts.chartData.calPoints, this.opts, this.config, Math.abs(this.scrollOption.currentOffset));
- }
- }
- return -1;
- };
- uCharts.prototype.getLegendDataIndex = function (e) {
- var touches = null;
- if (e.changedTouches) {
- touches = e.changedTouches[0];
- } else {
- touches = e.mp.changedTouches[0];
- }
- if (touches) {
- var _touches$ = getTouches(touches, this.opts, e);
- return findLegendIndex({
- x: _touches$.x,
- y: _touches$.y
- }, this.opts.chartData.legendData);
- }
- return -1;
- };
- uCharts.prototype.touchLegend = function (e) {
- var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var touches = null;
- if (e.changedTouches) {
- touches = e.changedTouches[0];
- } else {
- touches = e.mp.changedTouches[0];
- }
- if (touches) {
- var _touches$ = getTouches(touches, this.opts, e);
- var index = this.getLegendDataIndex(e);
- if (index >= 0) {
- if (this.opts.type == 'candle') {
- this.opts.seriesMA[index].show = !this.opts.seriesMA[index].show;
- } else {
- this.opts.series[index].show = !this.opts.series[index].show;
- }
- this.opts.animation = option.animation ? true : false;
- this.opts._scrollDistance_ = this.scrollOption.currentOffset;
- drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
- }
- }
- };
- uCharts.prototype.showToolTip = function (e) {
- var _this3 = this;
- var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var touches = null;
- if (e.changedTouches) {
- touches = e.changedTouches[0];
- } else {
- touches = e.mp.changedTouches[0];
- }
- if (!touches) {
- console.log("[uCharts] 未获取到event坐标信息");
- }
- var _touches$ = getTouches(touches, this.opts, e);
- var currentOffset = this.scrollOption.currentOffset;
- var opts = assign({}, this.opts, {
- _scrollDistance_: currentOffset,
- animation: false
- });
- if (this.opts.type === 'line' || this.opts.type === 'area' || this.opts.type === 'column' || this.opts.type === 'scatter' || this.opts.type === 'bubble') {
- var current = this.getCurrentDataIndex(e);
- var index = option.index == undefined ? current.index : option.index;
- if (index > -1 || index.length > 0) {
- var seriesData = getSeriesDataItem(this.opts.series, index, current.group);
- if (seriesData.length !== 0) {
- var _getToolTipData = getToolTipData(seriesData, this.opts, index, current.group, this.opts.categories, option),
- textList = _getToolTipData.textList,
- offset = _getToolTipData.offset;
- offset.y = _touches$.y;
- opts.tooltip = {
- textList: option.textList !== undefined ? option.textList : textList,
- offset: option.offset !== undefined ? option.offset : offset,
- option: option,
- index: index,
- group: current.group
- };
- }
- }
- drawCharts.call(this, opts.type, opts, this.config, this.context);
- }
- if (this.opts.type === 'mount') {
- var index = option.index == undefined ? this.getCurrentDataIndex(e).index : option.index;
- if (index > -1) {
- var opts = assign({}, this.opts, {
- animation: false
- });
- var seriesData = assign({}, opts._series_[index]);
- var textList = [{
- text: option.formatter ? option.formatter(seriesData, undefined, index, opts) : seriesData.name + ': ' + seriesData.data,
- color: seriesData.color,
- legendShape: this.opts.extra.tooltip.legendShape == 'auto' ? seriesData.legendShape : this.opts.extra.tooltip.legendShape
- }];
- var offset = {
- x: opts.chartData.calPoints[index].x,
- y: _touches$.y
- };
- opts.tooltip = {
- textList: option.textList ? option.textList : textList,
- offset: option.offset !== undefined ? option.offset : offset,
- option: option,
- index: index
- };
- }
- drawCharts.call(this, opts.type, opts, this.config, this.context);
- }
- if (this.opts.type === 'bar') {
- var current = this.getCurrentDataIndex(e);
- var index = option.index == undefined ? current.index : option.index;
- if (index > -1 || index.length > 0) {
- var seriesData = getSeriesDataItem(this.opts.series, index, current.group);
- if (seriesData.length !== 0) {
- var _getToolTipData = getToolTipData(seriesData, this.opts, index, current.group, this.opts.categories, option),
- textList = _getToolTipData.textList,
- offset = _getToolTipData.offset;
- offset.x = _touches$.x;
- opts.tooltip = {
- textList: option.textList !== undefined ? option.textList : textList,
- offset: option.offset !== undefined ? option.offset : offset,
- option: option,
- index: index
- };
- }
- }
- drawCharts.call(this, opts.type, opts, this.config, this.context);
- }
- if (this.opts.type === 'mix') {
- var current = this.getCurrentDataIndex(e);
- var index = option.index == undefined ? current.index : option.index;
- if (index > -1) {
- var currentOffset = this.scrollOption.currentOffset;
- var opts = assign({}, this.opts, {
- _scrollDistance_: currentOffset,
- animation: false
- });
- var seriesData = getSeriesDataItem(this.opts.series, index);
- if (seriesData.length !== 0) {
- var _getMixToolTipData = getMixToolTipData(seriesData, this.opts, index, this.opts.categories, option),
- textList = _getMixToolTipData.textList,
- offset = _getMixToolTipData.offset;
- offset.y = _touches$.y;
- opts.tooltip = {
- textList: option.textList ? option.textList : textList,
- offset: option.offset !== undefined ? option.offset : offset,
- option: option,
- index: index
- };
- }
- }
- drawCharts.call(this, opts.type, opts, this.config, this.context);
- }
- if (this.opts.type === 'candle') {
- var current = this.getCurrentDataIndex(e);
- var index = option.index == undefined ? current.index : option.index;
- if (index > -1) {
- var currentOffset = this.scrollOption.currentOffset;
- var opts = assign({}, this.opts, {
- _scrollDistance_: currentOffset,
- animation: false
- });
- var seriesData = getSeriesDataItem(this.opts.series, index);
- if (seriesData.length !== 0) {
- var _getToolTipData = getCandleToolTipData(this.opts.series[0].data, seriesData, this.opts, index, this.opts.categories, this.opts.extra.candle, option),
- textList = _getToolTipData.textList,
- offset = _getToolTipData.offset;
- offset.y = _touches$.y;
- opts.tooltip = {
- textList: option.textList ? option.textList : textList,
- offset: option.offset !== undefined ? option.offset : offset,
- option: option,
- index: index
- };
- }
- }
- drawCharts.call(this, opts.type, opts, this.config, this.context);
- }
- if (this.opts.type === 'pie' || this.opts.type === 'ring' || this.opts.type === 'rose' || this.opts.type === 'funnel') {
- var index = option.index == undefined ? this.getCurrentDataIndex(e) : option.index;
- if (index > -1) {
- var opts = assign({}, this.opts, {
- animation: false
- });
- var seriesData = assign({}, opts._series_[index]);
- var textList = [{
- text: option.formatter ? option.formatter(seriesData, undefined, index, opts) : seriesData.name + ': ' + seriesData.data,
- color: seriesData.color,
- legendShape: this.opts.extra.tooltip.legendShape == 'auto' ? seriesData.legendShape : this.opts.extra.tooltip.legendShape
- }];
- var offset = {
- x: _touches$.x,
- y: _touches$.y
- };
- opts.tooltip = {
- textList: option.textList ? option.textList : textList,
- offset: option.offset !== undefined ? option.offset : offset,
- option: option,
- index: index
- };
- }
- drawCharts.call(this, opts.type, opts, this.config, this.context);
- }
- if (this.opts.type === 'map') {
- var index = option.index == undefined ? this.getCurrentDataIndex(e) : option.index;
- if (index > -1) {
- var opts = assign({}, this.opts, {
- animation: false
- });
- var seriesData = assign({}, this.opts.series[index]);
- seriesData.name = seriesData.properties.name;
- var textList = [{
- text: option.formatter ? option.formatter(seriesData, undefined, index, this.opts) : seriesData.name,
- color: seriesData.color,
- legendShape: this.opts.extra.tooltip.legendShape == 'auto' ? seriesData.legendShape : this.opts.extra.tooltip.legendShape
- }];
- var offset = {
- x: _touches$.x,
- y: _touches$.y
- };
- opts.tooltip = {
- textList: option.textList ? option.textList : textList,
- offset: option.offset !== undefined ? option.offset : offset,
- option: option,
- index: index
- };
- }
- opts.updateData = false;
- drawCharts.call(this, opts.type, opts, this.config, this.context);
- }
- if (this.opts.type === 'word') {
- var index = option.index == undefined ? this.getCurrentDataIndex(e) : option.index;
- if (index > -1) {
- var opts = assign({}, this.opts, {
- animation: false
- });
- var seriesData = assign({}, this.opts.series[index]);
- var textList = [{
- text: option.formatter ? option.formatter(seriesData, undefined, index, this.opts) : seriesData.name,
- color: seriesData.color,
- legendShape: this.opts.extra.tooltip.legendShape == 'auto' ? seriesData.legendShape : this.opts.extra.tooltip.legendShape
- }];
- var offset = {
- x: _touches$.x,
- y: _touches$.y
- };
- opts.tooltip = {
- textList: option.textList ? option.textList : textList,
- offset: option.offset !== undefined ? option.offset : offset,
- option: option,
- index: index
- };
- }
- opts.updateData = false;
- drawCharts.call(this, opts.type, opts, this.config, this.context);
- }
- if (this.opts.type === 'radar') {
- var index = option.index == undefined ? this.getCurrentDataIndex(e) : option.index;
- if (index > -1) {
- var opts = assign({}, this.opts, {
- animation: false
- });
- var seriesData = getSeriesDataItem(this.opts.series, index);
- if (seriesData.length !== 0) {
- var textList = seriesData.map(function (item) {
- return {
- text: option.formatter ? option.formatter(item, _this3.opts.categories[index], index, _this3.opts) : item.name + ': ' + item.data,
- color: item.color,
- legendShape: _this3.opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : _this3.opts.extra.tooltip.legendShape
- };
- });
- var offset = {
- x: _touches$.x,
- y: _touches$.y
- };
- opts.tooltip = {
- textList: option.textList ? option.textList : textList,
- offset: option.offset !== undefined ? option.offset : offset,
- option: option,
- index: index
- };
- }
- }
- drawCharts.call(this, opts.type, opts, this.config, this.context);
- }
- };
- uCharts.prototype.translate = function (distance) {
- this.scrollOption = {
- currentOffset: distance,
- startTouchX: distance,
- distance: 0,
- lastMoveTime: 0
- };
- var opts = assign({}, this.opts, {
- _scrollDistance_: distance,
- animation: false
- });
- drawCharts.call(this, this.opts.type, opts, this.config, this.context);
- };
- uCharts.prototype.scrollStart = function (e) {
- var touches = null;
- if (e.changedTouches) {
- touches = e.changedTouches[0];
- } else {
- touches = e.mp.changedTouches[0];
- }
- var _touches$ = getTouches(touches, this.opts, e);
- if (touches && this.opts.enableScroll === true) {
- this.scrollOption.startTouchX = _touches$.x;
- }
- };
- uCharts.prototype.scroll = function (e) {
- if (this.scrollOption.lastMoveTime === 0) {
- this.scrollOption.lastMoveTime = Date.now();
- }
- var Limit = this.opts.touchMoveLimit || 60;
- var currMoveTime = Date.now();
- var duration = currMoveTime - this.scrollOption.lastMoveTime;
- if (duration < Math.floor(1000 / Limit)) return;
- if (this.scrollOption.startTouchX == 0) return;
- this.scrollOption.lastMoveTime = currMoveTime;
- var touches = null;
- if (e.changedTouches) {
- touches = e.changedTouches[0];
- } else {
- touches = e.mp.changedTouches[0];
- }
- if (touches && this.opts.enableScroll === true) {
- var _touches$ = getTouches(touches, this.opts, e);
- var _distance;
- _distance = _touches$.x - this.scrollOption.startTouchX;
- var currentOffset = this.scrollOption.currentOffset;
- var validDistance = calValidDistance(this, currentOffset + _distance, this.opts.chartData, this.config, this.opts);
- this.scrollOption.distance = _distance = validDistance - currentOffset;
- var opts = assign({}, this.opts, {
- _scrollDistance_: currentOffset + _distance,
- animation: false
- });
- this.opts = opts;
- drawCharts.call(this, opts.type, opts, this.config, this.context);
- return currentOffset + _distance;
- }
- };
- uCharts.prototype.scrollEnd = function (e) {
- if (this.opts.enableScroll === true) {
- var _scrollOption = this.scrollOption,
- currentOffset = _scrollOption.currentOffset,
- distance = _scrollOption.distance;
- this.scrollOption.currentOffset = currentOffset + distance;
- this.scrollOption.distance = 0;
- this.scrollOption.moveCount = 0;
- }
- };
- var _default = uCharts;
- exports.default = _default;
- /***/ }),
- /* 1382 */
- /*!******************************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/uni_modules/qiun-data-charts/js_sdk/u-charts/config-ucharts.js ***!
- \******************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- /*
- * uCharts®
- * 高性能跨平台图表库,支持H5、APP、小程序(微信/支付宝/百度/头条/QQ/360)、Vue、Taro等支持canvas的框架平台
- * Copyright (c) 2021 QIUN®秋云 https://www.ucharts.cn All rights reserved.
- * Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
- * 复制使用请保留本段注释,感谢支持开源!
- *
- * uCharts®官方网站
- * https://www.uCharts.cn
- *
- * 开源地址:
- * https://gitee.com/uCharts/uCharts
- *
- * uni-app插件市场地址:
- * http://ext.dcloud.net.cn/plugin?id=271
- *
- */
- // 主题颜色配置:如每个图表类型需要不同主题,请在对应图表类型上更改color属性
- var color = ['#1890FF', '#91CB74', '#FAC858', '#EE6666', '#73C0DE', '#3CA272', '#FC8452', '#9A60B4', '#ea7ccc'];
- //事件转换函数,主要用作格式化x轴为时间轴,根据需求自行修改
- var formatDateTime = function formatDateTime(timeStamp, returnType) {
- var date = new Date();
- date.setTime(timeStamp * 1000);
- var y = date.getFullYear();
- var m = date.getMonth() + 1;
- m = m < 10 ? '0' + m : m;
- var d = date.getDate();
- d = d < 10 ? '0' + d : d;
- var h = date.getHours();
- h = h < 10 ? '0' + h : h;
- var minute = date.getMinutes();
- var second = date.getSeconds();
- minute = minute < 10 ? '0' + minute : minute;
- second = second < 10 ? '0' + second : second;
- if (returnType == 'full') {
- return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
- }
- if (returnType == 'y-m-d') {
- return y + '-' + m + '-' + d;
- }
- if (returnType == 'h:m') {
- return h + ':' + minute;
- }
- if (returnType == 'h:m:s') {
- return h + ':' + minute + ':' + second;
- }
- return [y, m, d, h, minute, second];
- };
- var cfu = {
- //demotype为自定义图表类型,一般不需要自定义图表类型,只需要改根节点上对应的类型即可
- "type": ["pie", "ring", "rose", "word", "funnel", "map", "arcbar", "line", "column", "mount", "bar", "area", "radar", "gauge", "candle", "mix", "tline", "tarea", "scatter", "bubble", "demotype"],
- "range": ["饼状图", "圆环图", "玫瑰图", "词云图", "漏斗图", "地图", "圆弧进度条", "折线图", "柱状图", "山峰图", "条状图", "区域图", "雷达图", "仪表盘", "K线图", "混合图", "时间轴折线", "时间轴区域", "散点图", "气泡图", "自定义类型"],
- //增加自定义图表类型,如果需要categories,请在这里加入您的图表类型,例如最后的"demotype"
- //自定义类型时需要注意"tline","tarea","scatter","bubble"等时间轴(矢量x轴)类图表,没有categories,不需要加入categories
- "categories": ["line", "column", "mount", "bar", "area", "radar", "gauge", "candle", "mix", "demotype"],
- //instance为实例变量承载属性,不要删除
- "instance": {},
- //option为opts及eopts承载属性,不要删除
- "option": {},
- //下面是自定义format配置,因除H5端外的其他端无法通过props传递函数,只能通过此属性对应下标的方式来替换
- "formatter": {
- "yAxisDemo1": function yAxisDemo1(val, index, opts) {
- return val + '元';
- },
- "yAxisDemo2": function yAxisDemo2(val, index, opts) {
- return val.toFixed(2);
- },
- "xAxisDemo1": function xAxisDemo1(val, index, opts) {
- return val + '年';
- },
- "xAxisDemo2": function xAxisDemo2(val, index, opts) {
- return formatDateTime(val, 'h:m');
- },
- "seriesDemo1": function seriesDemo1(val, index, series, opts) {
- return val + '元';
- },
- "tooltipDemo1": function tooltipDemo1(item, category, index, opts) {
- if (index == 0) {
- return '随便用' + item.data + '年';
- } else {
- return '其他我没改' + item.data + '天';
- }
- },
- "pieDemo": function pieDemo(val, index, series, opts) {
- if (index !== undefined) {
- return series[index].name + ':' + series[index].data + '元';
- }
- }
- },
- //这里演示了自定义您的图表类型的option,可以随意命名,之后在组件上 type="demotype" 后,组件会调用这个花括号里的option,如果组件上还存在opts参数,会将demotype与opts中option合并后渲染图表。
- "demotype": {
- //我这里把曲线图当做了自定义图表类型,您可以根据需要随意指定类型或配置
- "type": "line",
- "color": color,
- "padding": [15, 10, 0, 15],
- "xAxis": {
- "disableGrid": true
- },
- "yAxis": {
- "gridType": "dash",
- "dashLength": 2
- },
- "legend": {},
- "extra": {
- "line": {
- "type": "curve",
- "width": 2
- }
- }
- },
- //下面是自定义配置,请添加项目所需的通用配置
- "pie": {
- "type": "pie",
- "color": color,
- "padding": [5, 5, 5, 5],
- "extra": {
- "pie": {
- "activeOpacity": 0.5,
- "activeRadius": 10,
- "offsetAngle": 0,
- "labelWidth": 15,
- "border": true,
- "borderWidth": 3,
- "borderColor": "#FFFFFF"
- }
- }
- },
- "ring": {
- "type": "ring",
- "color": color,
- "padding": [5, 5, 5, 5],
- "rotate": false,
- "dataLabel": true,
- "legend": {
- "show": true,
- "position": "right",
- "lineHeight": 25
- },
- "title": {
- "name": "收益率",
- "fontSize": 15,
- "color": "#666666"
- },
- "subtitle": {
- "name": "70%",
- "fontSize": 25,
- "color": "#7cb5ec"
- },
- "extra": {
- "ring": {
- "ringWidth": 30,
- "activeOpacity": 0.5,
- "activeRadius": 10,
- "offsetAngle": 0,
- "labelWidth": 15,
- "border": true,
- "borderWidth": 3,
- "borderColor": "#FFFFFF"
- }
- }
- },
- "rose": {
- "type": "rose",
- "color": color,
- "padding": [5, 5, 5, 5],
- "legend": {
- "show": true,
- "position": "left",
- "lineHeight": 25
- },
- "extra": {
- "rose": {
- "type": "area",
- "minRadius": 50,
- "activeOpacity": 0.5,
- "activeRadius": 10,
- "offsetAngle": 0,
- "labelWidth": 15,
- "border": false,
- "borderWidth": 2,
- "borderColor": "#FFFFFF"
- }
- }
- },
- "word": {
- "type": "word",
- "color": color,
- "extra": {
- "word": {
- "type": "normal",
- "autoColors": false
- }
- }
- },
- "funnel": {
- "type": "funnel",
- "color": color,
- "padding": [15, 15, 0, 15],
- "extra": {
- "funnel": {
- "activeOpacity": 0.3,
- "activeWidth": 10,
- "border": true,
- "borderWidth": 2,
- "borderColor": "#FFFFFF",
- "fillOpacity": 1,
- "labelAlign": "right"
- }
- }
- },
- "map": {
- "type": "map",
- "color": color,
- "padding": [0, 0, 0, 0],
- "dataLabel": true,
- "extra": {
- "map": {
- "border": true,
- "borderWidth": 1,
- "borderColor": "#666666",
- "fillOpacity": 0.6,
- "activeBorderColor": "#F04864",
- "activeFillColor": "#FACC14",
- "activeFillOpacity": 1
- }
- }
- },
- "arcbar": {
- "type": "arcbar",
- "color": color,
- "title": {
- "name": "百分比",
- "fontSize": 25,
- "color": "#00FF00"
- },
- "subtitle": {
- "name": "默认标题",
- "fontSize": 15,
- "color": "#666666"
- },
- "extra": {
- "arcbar": {
- "type": "default",
- "width": 12,
- "backgroundColor": "#E9E9E9",
- "startAngle": 0.75,
- "endAngle": 0.25,
- "gap": 2
- }
- }
- },
- "line": {
- "type": "line",
- "color": color,
- "padding": [15, 10, 0, 15],
- "xAxis": {
- "disableGrid": true
- },
- "yAxis": {
- "gridType": "dash",
- "dashLength": 2
- },
- "legend": {},
- "extra": {
- "line": {
- "type": "straight",
- "width": 2,
- "activeType": "hollow"
- }
- }
- },
- "tline": {
- "type": "line",
- "color": color,
- "padding": [15, 10, 0, 15],
- "xAxis": {
- "disableGrid": false,
- "boundaryGap": "justify"
- },
- "yAxis": {
- "gridType": "dash",
- "dashLength": 2,
- "data": [{
- "min": 0,
- "max": 80
- }]
- },
- "legend": {},
- "extra": {
- "line": {
- "type": "curve",
- "width": 2,
- "activeType": "hollow"
- }
- }
- },
- "tarea": {
- "type": "area",
- "color": color,
- "padding": [15, 10, 0, 15],
- "xAxis": {
- "disableGrid": true,
- "boundaryGap": "justify"
- },
- "yAxis": {
- "gridType": "dash",
- "dashLength": 2,
- "data": [{
- "min": 0,
- "max": 80
- }]
- },
- "legend": {},
- "extra": {
- "area": {
- "type": "curve",
- "opacity": 0.2,
- "addLine": true,
- "width": 2,
- "gradient": true,
- "activeType": "hollow"
- }
- }
- },
- "column": {
- "type": "column",
- "color": color,
- "padding": [15, 15, 0, 5],
- "xAxis": {
- "disableGrid": true
- },
- "yAxis": {
- "data": [{
- "min": 0
- }]
- },
- "legend": {},
- "extra": {
- "column": {
- "type": "group",
- "width": 30,
- "activeBgColor": "#000000",
- "activeBgOpacity": 0.08
- }
- }
- },
- "mount": {
- "type": "mount",
- "color": color,
- "padding": [15, 15, 0, 5],
- "xAxis": {
- "disableGrid": true
- },
- "yAxis": {
- "data": [{
- "min": 0
- }]
- },
- "legend": {},
- "extra": {
- "mount": {
- "type": "mount",
- "widthRatio": 1.5
- }
- }
- },
- "bar": {
- "type": "bar",
- "color": color,
- "padding": [15, 30, 0, 5],
- "xAxis": {
- "boundaryGap": "justify",
- "disableGrid": false,
- "min": 0,
- "axisLine": false
- },
- "yAxis": {},
- "legend": {},
- "extra": {
- "bar": {
- "type": "group",
- "width": 30,
- "meterBorde": 1,
- "meterFillColor": "#FFFFFF",
- "activeBgColor": "#000000",
- "activeBgOpacity": 0.08
- }
- }
- },
- "area": {
- "type": "area",
- "color": color,
- "padding": [15, 15, 0, 15],
- "xAxis": {
- "disableGrid": true
- },
- "yAxis": {
- "gridType": "dash",
- "dashLength": 2
- },
- "legend": {},
- "extra": {
- "area": {
- "type": "straight",
- "opacity": 0.2,
- "addLine": true,
- "width": 2,
- "gradient": false,
- "activeType": "hollow"
- }
- }
- },
- "radar": {
- "type": "radar",
- "color": color,
- "padding": [5, 5, 5, 5],
- "dataLabel": false,
- "legend": {
- "show": true,
- "position": "right",
- "lineHeight": 25
- },
- "extra": {
- "radar": {
- "gridType": "radar",
- "gridColor": "#CCCCCC",
- "gridCount": 3,
- "opacity": 0.2,
- "max": 200,
- "labelShow": true
- }
- }
- },
- "gauge": {
- "type": "gauge",
- "color": color,
- "title": {
- "name": "66Km/H",
- "fontSize": 25,
- "color": "#2fc25b",
- "offsetY": 50
- },
- "subtitle": {
- "name": "实时速度",
- "fontSize": 15,
- "color": "#1890ff",
- "offsetY": -50
- },
- "extra": {
- "gauge": {
- "type": "default",
- "width": 30,
- "labelColor": "#666666",
- "startAngle": 0.75,
- "endAngle": 0.25,
- "startNumber": 0,
- "endNumber": 100,
- "labelFormat": "",
- "splitLine": {
- "fixRadius": 0,
- "splitNumber": 10,
- "width": 30,
- "color": "#FFFFFF",
- "childNumber": 5,
- "childWidth": 12
- },
- "pointer": {
- "width": 24,
- "color": "auto"
- }
- }
- }
- },
- "candle": {
- "type": "candle",
- "color": color,
- "padding": [15, 15, 0, 15],
- "enableScroll": true,
- "enableMarkLine": true,
- "dataLabel": false,
- "xAxis": {
- "labelCount": 4,
- "itemCount": 40,
- "disableGrid": true,
- "gridColor": "#CCCCCC",
- "gridType": "solid",
- "dashLength": 4,
- "scrollShow": true,
- "scrollAlign": "left",
- "scrollColor": "#A6A6A6",
- "scrollBackgroundColor": "#EFEBEF"
- },
- "yAxis": {},
- "legend": {},
- "extra": {
- "candle": {
- "color": {
- "upLine": "#f04864",
- "upFill": "#f04864",
- "downLine": "#2fc25b",
- "downFill": "#2fc25b"
- },
- "average": {
- "show": true,
- "name": ["MA5", "MA10", "MA30"],
- "day": [5, 10, 20],
- "color": ["#1890ff", "#2fc25b", "#facc14"]
- }
- },
- "markLine": {
- "type": "dash",
- "dashLength": 5,
- "data": [{
- "value": 2150,
- "lineColor": "#f04864",
- "showLabel": true
- }, {
- "value": 2350,
- "lineColor": "#f04864",
- "showLabel": true
- }]
- }
- }
- },
- "mix": {
- "type": "mix",
- "color": color,
- "padding": [15, 15, 0, 15],
- "xAxis": {
- "disableGrid": true
- },
- "yAxis": {
- "disabled": false,
- "disableGrid": false,
- "splitNumber": 5,
- "gridType": "dash",
- "dashLength": 4,
- "gridColor": "#CCCCCC",
- "padding": 10,
- "showTitle": true,
- "data": []
- },
- "legend": {},
- "extra": {
- "mix": {
- "column": {
- "width": 20
- }
- }
- }
- },
- "scatter": {
- "type": "scatter",
- "color": color,
- "padding": [15, 15, 0, 15],
- "dataLabel": false,
- "xAxis": {
- "disableGrid": false,
- "gridType": "dash",
- "splitNumber": 5,
- "boundaryGap": "justify",
- "min": 0
- },
- "yAxis": {
- "disableGrid": false,
- "gridType": "dash"
- },
- "legend": {},
- "extra": {
- "scatter": {}
- }
- },
- "bubble": {
- "type": "bubble",
- "color": color,
- "padding": [15, 15, 0, 15],
- "xAxis": {
- "disableGrid": false,
- "gridType": "dash",
- "splitNumber": 5,
- "boundaryGap": "justify",
- "min": 0,
- "max": 250
- },
- "yAxis": {
- "disableGrid": false,
- "gridType": "dash",
- "data": [{
- "min": 0,
- "max": 150
- }]
- },
- "legend": {},
- "extra": {
- "bubble": {
- "border": 2,
- "opacity": 0.5
- }
- }
- }
- };
- var _default = cfu;
- exports.default = _default;
- /***/ }),
- /* 1383 */,
- /* 1384 */,
- /* 1385 */,
- /* 1386 */,
- /* 1387 */,
- /* 1388 */,
- /* 1389 */,
- /* 1390 */,
- /* 1391 */,
- /* 1392 */,
- /* 1393 */,
- /* 1394 */,
- /* 1395 */,
- /* 1396 */,
- /* 1397 */,
- /* 1398 */,
- /* 1399 */,
- /* 1400 */,
- /* 1401 */,
- /* 1402 */,
- /* 1403 */,
- /* 1404 */,
- /* 1405 */,
- /* 1406 */,
- /* 1407 */,
- /* 1408 */,
- /* 1409 */,
- /* 1410 */,
- /* 1411 */,
- /* 1412 */,
- /* 1413 */,
- /* 1414 */,
- /* 1415 */,
- /* 1416 */,
- /* 1417 */,
- /* 1418 */
- /*!**********************************************************************************!*\
- !*** E:/git/2021项目/v3-H5/uni_modules/zb-table/components/zb-table/js/summary.js ***!
- \**********************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _default2 = {
- props: {
- scrollbarSize: {
- type: Number,
- default: 0
- },
- fixedLeftColumns: {
- type: Array,
- default: function _default() {
- return [];
- }
- },
- data: {
- type: Array,
- default: function _default() {
- return [];
- }
- },
- transColumns: {
- type: Array,
- default: function _default() {
- return [];
- }
- },
- border: {
- type: Boolean,
- default: false
- },
- showSummary: {
- type: Boolean,
- default: false
- },
- summaryMethod: {
- type: Function
- },
- sumText: {
- type: String,
- default: '合计'
- },
- headerFooterTableLeft: {
- type: Number,
- default: 0
- },
- handleFooterTableScrollLeft: Function
- },
- data: function data() {
- return {
- sums: []
- };
- },
- watch: {
- 'data': {
- deep: true,
- immediate: true,
- handler: function handler(newValue, oldValue) {
- var _this = this;
- var sums = [];
- if (this.summaryMethod) {
- sums = this.summaryMethod({
- columns: this.transColumns,
- data: this.data
- });
- } else {
- this.transColumns.forEach(function (column, index) {
- if (index === 0) {
- sums[index] = _this.sumText;
- return;
- }
- var values = _this.data.map(function (item) {
- return Number(item[column.name]);
- });
- var precisions = [];
- var notNumber = true;
- values.forEach(function (value) {
- if (!isNaN(value)) {
- notNumber = false;
- var decimal = ('' + value).split('.')[1];
- precisions.push(decimal ? decimal.length : 0);
- }
- });
- var precision = Math.max.apply(null, precisions);
- if (!notNumber) {
- sums[index] = values.reduce(function (prev, curr) {
- var value = Number(curr);
- if (!isNaN(value)) {
- return parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
- } else {
- return prev;
- }
- }, 0);
- } else {
- sums[index] = '';
- }
- });
- }
- this.sums = sums;
- }
- }
- }
- };
- exports.default = _default2;
- /***/ })
- ]]);
- //# sourceMappingURL=../../.sourcemap/mp-weixin/common/vendor.js.map
|