html5-qrcode.min.js 961 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365
  1. /*! For license information please see html5-qrcode.min.js.LICENSE.txt */
  2. var __Html5QrcodeLibrary__
  3. ;(() => {
  4. var t = {
  5. 449: function(t, e, r) {
  6. !(function(t) {
  7. 'use strict'
  8. var e =
  9. Object.setPrototypeOf ||
  10. ({ __proto__: [] } instanceof Array &&
  11. function(t, e) {
  12. t.__proto__ = e
  13. }) ||
  14. function(t, e) {
  15. for (var r in e) e.hasOwnProperty(r) && (t[r] = e[r])
  16. }
  17. var n,
  18. i = (function(t) {
  19. function r(e) {
  20. var r,
  21. n,
  22. i,
  23. o = this.constructor,
  24. s = t.call(this, e) || this
  25. return (
  26. Object.defineProperty(s, 'name', { value: o.name, enumerable: !1 }),
  27. (r = s),
  28. (n = o.prototype),
  29. (i = Object.setPrototypeOf) ? i(r, n) : (r.__proto__ = n),
  30. (function(t, e) {
  31. void 0 === e && (e = t.constructor)
  32. var r = Error.captureStackTrace
  33. r && r(t, e)
  34. })(s),
  35. s
  36. )
  37. }
  38. return (
  39. (function(t, r) {
  40. function n() {
  41. this.constructor = t
  42. }
  43. e(t, r), (t.prototype = null === r ? Object.create(r) : ((n.prototype = r.prototype), new n()))
  44. })(r, t),
  45. r
  46. )
  47. })(Error)
  48. class o extends i {
  49. constructor(t) {
  50. super(t), (this.message = t)
  51. }
  52. getKind() {
  53. return this.constructor.kind
  54. }
  55. }
  56. o.kind = 'Exception'
  57. class s extends o {}
  58. s.kind = 'ArgumentException'
  59. class a extends o {}
  60. a.kind = 'IllegalArgumentException'
  61. class l {
  62. constructor(t) {
  63. if (((this.binarizer = t), null === t)) throw new a('Binarizer must be non-null.')
  64. }
  65. getWidth() {
  66. return this.binarizer.getWidth()
  67. }
  68. getHeight() {
  69. return this.binarizer.getHeight()
  70. }
  71. getBlackRow(t, e) {
  72. return this.binarizer.getBlackRow(t, e)
  73. }
  74. getBlackMatrix() {
  75. return (null !== this.matrix && void 0 !== this.matrix) || (this.matrix = this.binarizer.getBlackMatrix()), this.matrix
  76. }
  77. isCropSupported() {
  78. return this.binarizer.getLuminanceSource().isCropSupported()
  79. }
  80. crop(t, e, r, n) {
  81. const i = this.binarizer.getLuminanceSource().crop(t, e, r, n)
  82. return new l(this.binarizer.createBinarizer(i))
  83. }
  84. isRotateSupported() {
  85. return this.binarizer.getLuminanceSource().isRotateSupported()
  86. }
  87. rotateCounterClockwise() {
  88. const t = this.binarizer.getLuminanceSource().rotateCounterClockwise()
  89. return new l(this.binarizer.createBinarizer(t))
  90. }
  91. rotateCounterClockwise45() {
  92. const t = this.binarizer.getLuminanceSource().rotateCounterClockwise45()
  93. return new l(this.binarizer.createBinarizer(t))
  94. }
  95. toString() {
  96. try {
  97. return this.getBlackMatrix().toString()
  98. } catch (t) {
  99. return ''
  100. }
  101. }
  102. }
  103. class c extends o {
  104. static getChecksumInstance() {
  105. return new c()
  106. }
  107. }
  108. c.kind = 'ChecksumException'
  109. class h {
  110. constructor(t) {
  111. this.source = t
  112. }
  113. getLuminanceSource() {
  114. return this.source
  115. }
  116. getWidth() {
  117. return this.source.getWidth()
  118. }
  119. getHeight() {
  120. return this.source.getHeight()
  121. }
  122. }
  123. class u {
  124. static arraycopy(t, e, r, n, i) {
  125. for (; i--; ) r[n++] = t[e++]
  126. }
  127. static currentTimeMillis() {
  128. return Date.now()
  129. }
  130. }
  131. class d extends o {}
  132. d.kind = 'IndexOutOfBoundsException'
  133. class g extends d {
  134. constructor(t, e) {
  135. super(e), (this.index = t), (this.message = e)
  136. }
  137. }
  138. g.kind = 'ArrayIndexOutOfBoundsException'
  139. class f {
  140. static fill(t, e) {
  141. for (let r = 0, n = t.length; r < n; r++) t[r] = e
  142. }
  143. static fillWithin(t, e, r, n) {
  144. f.rangeCheck(t.length, e, r)
  145. for (let i = e; i < r; i++) t[i] = n
  146. }
  147. static rangeCheck(t, e, r) {
  148. if (e > r) throw new a('fromIndex(' + e + ') > toIndex(' + r + ')')
  149. if (e < 0) throw new g(e)
  150. if (r > t) throw new g(r)
  151. }
  152. static asList(...t) {
  153. return t
  154. }
  155. static create(t, e, r) {
  156. return Array.from({ length: t }).map(t => Array.from({ length: e }).fill(r))
  157. }
  158. static createInt32Array(t, e, r) {
  159. return Array.from({ length: t }).map(t => Int32Array.from({ length: e }).fill(r))
  160. }
  161. static equals(t, e) {
  162. if (!t) return !1
  163. if (!e) return !1
  164. if (!t.length) return !1
  165. if (!e.length) return !1
  166. if (t.length !== e.length) return !1
  167. for (let r = 0, n = t.length; r < n; r++) if (t[r] !== e[r]) return !1
  168. return !0
  169. }
  170. static hashCode(t) {
  171. if (null === t) return 0
  172. let e = 1
  173. for (const r of t) e = 31 * e + r
  174. return e
  175. }
  176. static fillUint8Array(t, e) {
  177. for (let r = 0; r !== t.length; r++) t[r] = e
  178. }
  179. static copyOf(t, e) {
  180. return t.slice(0, e)
  181. }
  182. static copyOfUint8Array(t, e) {
  183. if (t.length <= e) {
  184. const r = new Uint8Array(e)
  185. return r.set(t), r
  186. }
  187. return t.slice(0, e)
  188. }
  189. static copyOfRange(t, e, r) {
  190. const n = r - e,
  191. i = new Int32Array(n)
  192. return u.arraycopy(t, e, i, 0, n), i
  193. }
  194. static binarySearch(t, e, r) {
  195. void 0 === r && (r = f.numberComparator)
  196. let n = 0,
  197. i = t.length - 1
  198. for (; n <= i; ) {
  199. const o = (i + n) >> 1,
  200. s = r(e, t[o])
  201. if (s > 0) n = o + 1
  202. else {
  203. if (!(s < 0)) return o
  204. i = o - 1
  205. }
  206. }
  207. return -n - 1
  208. }
  209. static numberComparator(t, e) {
  210. return t - e
  211. }
  212. }
  213. class w {
  214. static numberOfTrailingZeros(t) {
  215. let e
  216. if (0 === t) return 32
  217. let r = 31
  218. return (
  219. (e = t << 16),
  220. 0 !== e && ((r -= 16), (t = e)),
  221. (e = t << 8),
  222. 0 !== e && ((r -= 8), (t = e)),
  223. (e = t << 4),
  224. 0 !== e && ((r -= 4), (t = e)),
  225. (e = t << 2),
  226. 0 !== e && ((r -= 2), (t = e)),
  227. r - ((t << 1) >>> 31)
  228. )
  229. }
  230. static numberOfLeadingZeros(t) {
  231. if (0 === t) return 32
  232. let e = 1
  233. return (
  234. t >>> 16 == 0 && ((e += 16), (t <<= 16)),
  235. t >>> 24 == 0 && ((e += 8), (t <<= 8)),
  236. t >>> 28 == 0 && ((e += 4), (t <<= 4)),
  237. t >>> 30 == 0 && ((e += 2), (t <<= 2)),
  238. (e -= t >>> 31),
  239. e
  240. )
  241. }
  242. static toHexString(t) {
  243. return t.toString(16)
  244. }
  245. static toBinaryString(t) {
  246. return String(parseInt(String(t), 2))
  247. }
  248. static bitCount(t) {
  249. return (t = ((t = (858993459 & (t -= (t >>> 1) & 1431655765)) + ((t >>> 2) & 858993459)) + (t >>> 4)) & 252645135), 63 & ((t += t >>> 8) + (t >>> 16))
  250. }
  251. static truncDivision(t, e) {
  252. return Math.trunc(t / e)
  253. }
  254. static parseInt(t, e) {
  255. return parseInt(t, e)
  256. }
  257. }
  258. ;(w.MIN_VALUE_32_BITS = -2147483648), (w.MAX_VALUE = Number.MAX_SAFE_INTEGER)
  259. class A {
  260. constructor(t, e) {
  261. void 0 === t ? ((this.size = 0), (this.bits = new Int32Array(1))) : ((this.size = t), (this.bits = null == e ? A.makeArray(t) : e))
  262. }
  263. getSize() {
  264. return this.size
  265. }
  266. getSizeInBytes() {
  267. return Math.floor((this.size + 7) / 8)
  268. }
  269. ensureCapacity(t) {
  270. if (t > 32 * this.bits.length) {
  271. const e = A.makeArray(t)
  272. u.arraycopy(this.bits, 0, e, 0, this.bits.length), (this.bits = e)
  273. }
  274. }
  275. get(t) {
  276. return 0 != (this.bits[Math.floor(t / 32)] & (1 << (31 & t)))
  277. }
  278. set(t) {
  279. this.bits[Math.floor(t / 32)] |= 1 << (31 & t)
  280. }
  281. flip(t) {
  282. this.bits[Math.floor(t / 32)] ^= 1 << (31 & t)
  283. }
  284. getNextSet(t) {
  285. const e = this.size
  286. if (t >= e) return e
  287. const r = this.bits
  288. let n = Math.floor(t / 32),
  289. i = r[n]
  290. i &= ~((1 << (31 & t)) - 1)
  291. const o = r.length
  292. for (; 0 === i; ) {
  293. if (++n === o) return e
  294. i = r[n]
  295. }
  296. const s = 32 * n + w.numberOfTrailingZeros(i)
  297. return s > e ? e : s
  298. }
  299. getNextUnset(t) {
  300. const e = this.size
  301. if (t >= e) return e
  302. const r = this.bits
  303. let n = Math.floor(t / 32),
  304. i = ~r[n]
  305. i &= ~((1 << (31 & t)) - 1)
  306. const o = r.length
  307. for (; 0 === i; ) {
  308. if (++n === o) return e
  309. i = ~r[n]
  310. }
  311. const s = 32 * n + w.numberOfTrailingZeros(i)
  312. return s > e ? e : s
  313. }
  314. setBulk(t, e) {
  315. this.bits[Math.floor(t / 32)] = e
  316. }
  317. setRange(t, e) {
  318. if (e < t || t < 0 || e > this.size) throw new a()
  319. if (e === t) return
  320. e--
  321. const r = Math.floor(t / 32),
  322. n = Math.floor(e / 32),
  323. i = this.bits
  324. for (let o = r; o <= n; o++) {
  325. const s = (2 << (o < n ? 31 : 31 & e)) - (1 << (o > r ? 0 : 31 & t))
  326. i[o] |= s
  327. }
  328. }
  329. clear() {
  330. const t = this.bits.length,
  331. e = this.bits
  332. for (let r = 0; r < t; r++) e[r] = 0
  333. }
  334. isRange(t, e, r) {
  335. if (e < t || t < 0 || e > this.size) throw new a()
  336. if (e === t) return !0
  337. e--
  338. const n = Math.floor(t / 32),
  339. i = Math.floor(e / 32),
  340. o = this.bits
  341. for (let s = n; s <= i; s++) {
  342. const a = ((2 << (s < i ? 31 : 31 & e)) - (1 << (s > n ? 0 : 31 & t))) & 4294967295
  343. if ((o[s] & a) !== (r ? a : 0)) return !1
  344. }
  345. return !0
  346. }
  347. appendBit(t) {
  348. this.ensureCapacity(this.size + 1), t && (this.bits[Math.floor(this.size / 32)] |= 1 << (31 & this.size)), this.size++
  349. }
  350. appendBits(t, e) {
  351. if (e < 0 || e > 32) throw new a('Num bits must be between 0 and 32')
  352. this.ensureCapacity(this.size + e)
  353. for (let r = e; r > 0; r--) this.appendBit(1 == ((t >> (r - 1)) & 1))
  354. }
  355. appendBitArray(t) {
  356. const e = t.size
  357. this.ensureCapacity(this.size + e)
  358. for (let r = 0; r < e; r++) this.appendBit(t.get(r))
  359. }
  360. xor(t) {
  361. if (this.size !== t.size) throw new a("Sizes don't match")
  362. const e = this.bits
  363. for (let r = 0, n = e.length; r < n; r++) e[r] ^= t.bits[r]
  364. }
  365. toBytes(t, e, r, n) {
  366. for (let i = 0; i < n; i++) {
  367. let n = 0
  368. for (let e = 0; e < 8; e++) this.get(t) && (n |= 1 << (7 - e)), t++
  369. e[r + i] = n
  370. }
  371. }
  372. getBitArray() {
  373. return this.bits
  374. }
  375. reverse() {
  376. const t = new Int32Array(this.bits.length),
  377. e = Math.floor((this.size - 1) / 32),
  378. r = e + 1,
  379. n = this.bits
  380. for (let i = 0; i < r; i++) {
  381. let r = n[i]
  382. ;(r = ((r >> 1) & 1431655765) | ((1431655765 & r) << 1)),
  383. (r = ((r >> 2) & 858993459) | ((858993459 & r) << 2)),
  384. (r = ((r >> 4) & 252645135) | ((252645135 & r) << 4)),
  385. (r = ((r >> 8) & 16711935) | ((16711935 & r) << 8)),
  386. (r = ((r >> 16) & 65535) | ((65535 & r) << 16)),
  387. (t[e - i] = r)
  388. }
  389. if (this.size !== 32 * r) {
  390. const e = 32 * r - this.size
  391. let n = t[0] >>> e
  392. for (let i = 1; i < r; i++) {
  393. const r = t[i]
  394. ;(n |= r << (32 - e)), (t[i - 1] = n), (n = r >>> e)
  395. }
  396. t[r - 1] = n
  397. }
  398. this.bits = t
  399. }
  400. static makeArray(t) {
  401. return new Int32Array(Math.floor((t + 31) / 32))
  402. }
  403. equals(t) {
  404. if (!(t instanceof A)) return !1
  405. const e = t
  406. return this.size === e.size && f.equals(this.bits, e.bits)
  407. }
  408. hashCode() {
  409. return 31 * this.size + f.hashCode(this.bits)
  410. }
  411. toString() {
  412. let t = ''
  413. for (let e = 0, r = this.size; e < r; e++) 0 == (7 & e) && (t += ' '), (t += this.get(e) ? 'X' : '.')
  414. return t
  415. }
  416. clone() {
  417. return new A(this.size, this.bits.slice())
  418. }
  419. }
  420. !(function(t) {
  421. ;(t[(t.OTHER = 0)] = 'OTHER'),
  422. (t[(t.PURE_BARCODE = 1)] = 'PURE_BARCODE'),
  423. (t[(t.POSSIBLE_FORMATS = 2)] = 'POSSIBLE_FORMATS'),
  424. (t[(t.TRY_HARDER = 3)] = 'TRY_HARDER'),
  425. (t[(t.CHARACTER_SET = 4)] = 'CHARACTER_SET'),
  426. (t[(t.ALLOWED_LENGTHS = 5)] = 'ALLOWED_LENGTHS'),
  427. (t[(t.ASSUME_CODE_39_CHECK_DIGIT = 6)] = 'ASSUME_CODE_39_CHECK_DIGIT'),
  428. (t[(t.ASSUME_GS1 = 7)] = 'ASSUME_GS1'),
  429. (t[(t.RETURN_CODABAR_START_END = 8)] = 'RETURN_CODABAR_START_END'),
  430. (t[(t.NEED_RESULT_POINT_CALLBACK = 9)] = 'NEED_RESULT_POINT_CALLBACK'),
  431. (t[(t.ALLOWED_EAN_EXTENSIONS = 10)] = 'ALLOWED_EAN_EXTENSIONS')
  432. })(n || (n = {}))
  433. var m,
  434. E = n
  435. class C extends o {
  436. static getFormatInstance() {
  437. return new C()
  438. }
  439. }
  440. ;(C.kind = 'FormatException'),
  441. (function(t) {
  442. ;(t[(t.Cp437 = 0)] = 'Cp437'),
  443. (t[(t.ISO8859_1 = 1)] = 'ISO8859_1'),
  444. (t[(t.ISO8859_2 = 2)] = 'ISO8859_2'),
  445. (t[(t.ISO8859_3 = 3)] = 'ISO8859_3'),
  446. (t[(t.ISO8859_4 = 4)] = 'ISO8859_4'),
  447. (t[(t.ISO8859_5 = 5)] = 'ISO8859_5'),
  448. (t[(t.ISO8859_6 = 6)] = 'ISO8859_6'),
  449. (t[(t.ISO8859_7 = 7)] = 'ISO8859_7'),
  450. (t[(t.ISO8859_8 = 8)] = 'ISO8859_8'),
  451. (t[(t.ISO8859_9 = 9)] = 'ISO8859_9'),
  452. (t[(t.ISO8859_10 = 10)] = 'ISO8859_10'),
  453. (t[(t.ISO8859_11 = 11)] = 'ISO8859_11'),
  454. (t[(t.ISO8859_13 = 12)] = 'ISO8859_13'),
  455. (t[(t.ISO8859_14 = 13)] = 'ISO8859_14'),
  456. (t[(t.ISO8859_15 = 14)] = 'ISO8859_15'),
  457. (t[(t.ISO8859_16 = 15)] = 'ISO8859_16'),
  458. (t[(t.SJIS = 16)] = 'SJIS'),
  459. (t[(t.Cp1250 = 17)] = 'Cp1250'),
  460. (t[(t.Cp1251 = 18)] = 'Cp1251'),
  461. (t[(t.Cp1252 = 19)] = 'Cp1252'),
  462. (t[(t.Cp1256 = 20)] = 'Cp1256'),
  463. (t[(t.UnicodeBigUnmarked = 21)] = 'UnicodeBigUnmarked'),
  464. (t[(t.UTF8 = 22)] = 'UTF8'),
  465. (t[(t.ASCII = 23)] = 'ASCII'),
  466. (t[(t.Big5 = 24)] = 'Big5'),
  467. (t[(t.GB18030 = 25)] = 'GB18030'),
  468. (t[(t.EUC_KR = 26)] = 'EUC_KR')
  469. })(m || (m = {}))
  470. class I {
  471. constructor(t, e, r, ...n) {
  472. ;(this.valueIdentifier = t),
  473. (this.name = r),
  474. (this.values = 'number' == typeof e ? Int32Array.from([e]) : e),
  475. (this.otherEncodingNames = n),
  476. I.VALUE_IDENTIFIER_TO_ECI.set(t, this),
  477. I.NAME_TO_ECI.set(r, this)
  478. const i = this.values
  479. for (let t = 0, e = i.length; t !== e; t++) {
  480. const e = i[t]
  481. I.VALUES_TO_ECI.set(e, this)
  482. }
  483. for (const t of n) I.NAME_TO_ECI.set(t, this)
  484. }
  485. getValueIdentifier() {
  486. return this.valueIdentifier
  487. }
  488. getName() {
  489. return this.name
  490. }
  491. getValue() {
  492. return this.values[0]
  493. }
  494. static getCharacterSetECIByValue(t) {
  495. if (t < 0 || t >= 900) throw new C('incorect value')
  496. const e = I.VALUES_TO_ECI.get(t)
  497. if (void 0 === e) throw new C('incorect value')
  498. return e
  499. }
  500. static getCharacterSetECIByName(t) {
  501. const e = I.NAME_TO_ECI.get(t)
  502. if (void 0 === e) throw new C('incorect value')
  503. return e
  504. }
  505. equals(t) {
  506. if (!(t instanceof I)) return !1
  507. const e = t
  508. return this.getName() === e.getName()
  509. }
  510. }
  511. ;(I.VALUE_IDENTIFIER_TO_ECI = new Map()),
  512. (I.VALUES_TO_ECI = new Map()),
  513. (I.NAME_TO_ECI = new Map()),
  514. (I.Cp437 = new I(m.Cp437, Int32Array.from([0, 2]), 'Cp437')),
  515. (I.ISO8859_1 = new I(m.ISO8859_1, Int32Array.from([1, 3]), 'ISO-8859-1', 'ISO88591', 'ISO8859_1')),
  516. (I.ISO8859_2 = new I(m.ISO8859_2, 4, 'ISO-8859-2', 'ISO88592', 'ISO8859_2')),
  517. (I.ISO8859_3 = new I(m.ISO8859_3, 5, 'ISO-8859-3', 'ISO88593', 'ISO8859_3')),
  518. (I.ISO8859_4 = new I(m.ISO8859_4, 6, 'ISO-8859-4', 'ISO88594', 'ISO8859_4')),
  519. (I.ISO8859_5 = new I(m.ISO8859_5, 7, 'ISO-8859-5', 'ISO88595', 'ISO8859_5')),
  520. (I.ISO8859_6 = new I(m.ISO8859_6, 8, 'ISO-8859-6', 'ISO88596', 'ISO8859_6')),
  521. (I.ISO8859_7 = new I(m.ISO8859_7, 9, 'ISO-8859-7', 'ISO88597', 'ISO8859_7')),
  522. (I.ISO8859_8 = new I(m.ISO8859_8, 10, 'ISO-8859-8', 'ISO88598', 'ISO8859_8')),
  523. (I.ISO8859_9 = new I(m.ISO8859_9, 11, 'ISO-8859-9', 'ISO88599', 'ISO8859_9')),
  524. (I.ISO8859_10 = new I(m.ISO8859_10, 12, 'ISO-8859-10', 'ISO885910', 'ISO8859_10')),
  525. (I.ISO8859_11 = new I(m.ISO8859_11, 13, 'ISO-8859-11', 'ISO885911', 'ISO8859_11')),
  526. (I.ISO8859_13 = new I(m.ISO8859_13, 15, 'ISO-8859-13', 'ISO885913', 'ISO8859_13')),
  527. (I.ISO8859_14 = new I(m.ISO8859_14, 16, 'ISO-8859-14', 'ISO885914', 'ISO8859_14')),
  528. (I.ISO8859_15 = new I(m.ISO8859_15, 17, 'ISO-8859-15', 'ISO885915', 'ISO8859_15')),
  529. (I.ISO8859_16 = new I(m.ISO8859_16, 18, 'ISO-8859-16', 'ISO885916', 'ISO8859_16')),
  530. (I.SJIS = new I(m.SJIS, 20, 'SJIS', 'Shift_JIS')),
  531. (I.Cp1250 = new I(m.Cp1250, 21, 'Cp1250', 'windows-1250')),
  532. (I.Cp1251 = new I(m.Cp1251, 22, 'Cp1251', 'windows-1251')),
  533. (I.Cp1252 = new I(m.Cp1252, 23, 'Cp1252', 'windows-1252')),
  534. (I.Cp1256 = new I(m.Cp1256, 24, 'Cp1256', 'windows-1256')),
  535. (I.UnicodeBigUnmarked = new I(m.UnicodeBigUnmarked, 25, 'UnicodeBigUnmarked', 'UTF-16BE', 'UnicodeBig')),
  536. (I.UTF8 = new I(m.UTF8, 26, 'UTF8', 'UTF-8')),
  537. (I.ASCII = new I(m.ASCII, Int32Array.from([27, 170]), 'ASCII', 'US-ASCII')),
  538. (I.Big5 = new I(m.Big5, 28, 'Big5')),
  539. (I.GB18030 = new I(m.GB18030, 29, 'GB18030', 'GB2312', 'EUC_CN', 'GBK')),
  540. (I.EUC_KR = new I(m.EUC_KR, 30, 'EUC_KR', 'EUC-KR'))
  541. class p extends o {}
  542. p.kind = 'UnsupportedOperationException'
  543. class S {
  544. static decode(t, e) {
  545. const r = this.encodingName(e)
  546. return this.customDecoder
  547. ? this.customDecoder(t, r)
  548. : 'undefined' == typeof TextDecoder || this.shouldDecodeOnFallback(r)
  549. ? this.decodeFallback(t, r)
  550. : new TextDecoder(r).decode(t)
  551. }
  552. static shouldDecodeOnFallback(t) {
  553. return !S.isBrowser() && 'ISO-8859-1' === t
  554. }
  555. static encode(t, e) {
  556. const r = this.encodingName(e)
  557. return this.customEncoder ? this.customEncoder(t, r) : 'undefined' == typeof TextEncoder ? this.encodeFallback(t) : new TextEncoder().encode(t)
  558. }
  559. static isBrowser() {
  560. return 'undefined' != typeof window && '[object Window]' === {}.toString.call(window)
  561. }
  562. static encodingName(t) {
  563. return 'string' == typeof t ? t : t.getName()
  564. }
  565. static encodingCharacterSet(t) {
  566. return t instanceof I ? t : I.getCharacterSetECIByName(t)
  567. }
  568. static decodeFallback(t, e) {
  569. const r = this.encodingCharacterSet(e)
  570. if (S.isDecodeFallbackSupported(r)) {
  571. let e = ''
  572. for (let r = 0, n = t.length; r < n; r++) {
  573. let n = t[r].toString(16)
  574. n.length < 2 && (n = '0' + n), (e += '%' + n)
  575. }
  576. return decodeURIComponent(e)
  577. }
  578. if (r.equals(I.UnicodeBigUnmarked)) return String.fromCharCode.apply(null, new Uint16Array(t.buffer))
  579. throw new p(`Encoding ${this.encodingName(e)} not supported by fallback.`)
  580. }
  581. static isDecodeFallbackSupported(t) {
  582. return t.equals(I.UTF8) || t.equals(I.ISO8859_1) || t.equals(I.ASCII)
  583. }
  584. static encodeFallback(t) {
  585. const e = btoa(unescape(encodeURIComponent(t))).split(''),
  586. r = []
  587. for (let t = 0; t < e.length; t++) r.push(e[t].charCodeAt(0))
  588. return new Uint8Array(r)
  589. }
  590. }
  591. class _ {
  592. static castAsNonUtf8Char(t, e = null) {
  593. const r = e ? e.getName() : this.ISO88591
  594. return S.decode(new Uint8Array([t]), r)
  595. }
  596. static guessEncoding(t, e) {
  597. if (null != e && void 0 !== e.get(E.CHARACTER_SET)) return e.get(E.CHARACTER_SET).toString()
  598. const r = t.length
  599. let n = !0,
  600. i = !0,
  601. o = !0,
  602. s = 0,
  603. a = 0,
  604. l = 0,
  605. c = 0,
  606. h = 0,
  607. u = 0,
  608. d = 0,
  609. g = 0,
  610. f = 0,
  611. w = 0,
  612. A = 0
  613. const m = t.length > 3 && 239 === t[0] && 187 === t[1] && 191 === t[2]
  614. for (let e = 0; e < r && (n || i || o); e++) {
  615. const r = 255 & t[e]
  616. o &&
  617. (s > 0
  618. ? 0 == (128 & r)
  619. ? (o = !1)
  620. : s--
  621. : 0 != (128 & r) && (0 == (64 & r) ? (o = !1) : (s++, 0 == (32 & r) ? a++ : (s++, 0 == (16 & r) ? l++ : (s++, 0 == (8 & r) ? c++ : (o = !1)))))),
  622. n && (r > 127 && r < 160 ? (n = !1) : r > 159 && (r < 192 || 215 === r || 247 === r) && A++),
  623. i &&
  624. (h > 0
  625. ? r < 64 || 127 === r || r > 252
  626. ? (i = !1)
  627. : h--
  628. : 128 === r || 160 === r || r > 239
  629. ? (i = !1)
  630. : r > 160 && r < 224
  631. ? (u++, (g = 0), d++, d > f && (f = d))
  632. : r > 127
  633. ? (h++, (d = 0), g++, g > w && (w = g))
  634. : ((d = 0), (g = 0)))
  635. }
  636. return (
  637. o && s > 0 && (o = !1),
  638. i && h > 0 && (i = !1),
  639. o && (m || a + l + c > 0)
  640. ? _.UTF8
  641. : i && (_.ASSUME_SHIFT_JIS || f >= 3 || w >= 3)
  642. ? _.SHIFT_JIS
  643. : n && i
  644. ? (2 === f && 2 === u) || 10 * A >= r
  645. ? _.SHIFT_JIS
  646. : _.ISO88591
  647. : n
  648. ? _.ISO88591
  649. : i
  650. ? _.SHIFT_JIS
  651. : o
  652. ? _.UTF8
  653. : _.PLATFORM_DEFAULT_ENCODING
  654. )
  655. }
  656. static format(t, ...e) {
  657. let r = -1
  658. return t.replace(/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g, function(t, n, i, o, s, a) {
  659. if ('%%' === t) return '%'
  660. if (void 0 === e[++r]) return
  661. t = o ? parseInt(o.substr(1)) : void 0
  662. let l,
  663. c = s ? parseInt(s.substr(1)) : void 0
  664. switch (a) {
  665. case 's':
  666. l = e[r]
  667. break
  668. case 'c':
  669. l = e[r][0]
  670. break
  671. case 'f':
  672. l = parseFloat(e[r]).toFixed(t)
  673. break
  674. case 'p':
  675. l = parseFloat(e[r]).toPrecision(t)
  676. break
  677. case 'e':
  678. l = parseFloat(e[r]).toExponential(t)
  679. break
  680. case 'x':
  681. l = parseInt(e[r]).toString(c || 16)
  682. break
  683. case 'd':
  684. l = parseFloat(parseInt(e[r], c || 10).toPrecision(t)).toFixed(0)
  685. }
  686. l = 'object' == typeof l ? JSON.stringify(l) : (+l).toString(c)
  687. let h = parseInt(i),
  688. u = i && i[0] + '' == '0' ? '0' : ' '
  689. for (; l.length < h; ) l = void 0 !== n ? l + u : u + l
  690. return l
  691. })
  692. }
  693. static getBytes(t, e) {
  694. return S.encode(t, e)
  695. }
  696. static getCharCode(t, e = 0) {
  697. return t.charCodeAt(e)
  698. }
  699. static getCharAt(t) {
  700. return String.fromCharCode(t)
  701. }
  702. }
  703. ;(_.SHIFT_JIS = I.SJIS.getName()),
  704. (_.GB2312 = 'GB2312'),
  705. (_.ISO88591 = I.ISO8859_1.getName()),
  706. (_.EUC_JP = 'EUC_JP'),
  707. (_.UTF8 = I.UTF8.getName()),
  708. (_.PLATFORM_DEFAULT_ENCODING = _.UTF8),
  709. (_.ASSUME_SHIFT_JIS = !1)
  710. class T {
  711. constructor(t = '') {
  712. this.value = t
  713. }
  714. enableDecoding(t) {
  715. return (this.encoding = t), this
  716. }
  717. append(t) {
  718. return (
  719. 'string' == typeof t ? (this.value += t.toString()) : this.encoding ? (this.value += _.castAsNonUtf8Char(t, this.encoding)) : (this.value += String.fromCharCode(t)),
  720. this
  721. )
  722. }
  723. appendChars(t, e, r) {
  724. for (let n = e; e < e + r; n++) this.append(t[n])
  725. return this
  726. }
  727. length() {
  728. return this.value.length
  729. }
  730. charAt(t) {
  731. return this.value.charAt(t)
  732. }
  733. deleteCharAt(t) {
  734. this.value = this.value.substr(0, t) + this.value.substring(t + 1)
  735. }
  736. setCharAt(t, e) {
  737. this.value = this.value.substr(0, t) + e + this.value.substr(t + 1)
  738. }
  739. substring(t, e) {
  740. return this.value.substring(t, e)
  741. }
  742. setLengthToZero() {
  743. this.value = ''
  744. }
  745. toString() {
  746. return this.value
  747. }
  748. insert(t, e) {
  749. this.value = this.value.substr(0, t) + e + this.value.substr(t + e.length)
  750. }
  751. }
  752. class y {
  753. constructor(t, e, r, n) {
  754. if (((this.width = t), (this.height = e), (this.rowSize = r), (this.bits = n), null == e && (e = t), (this.height = e), t < 1 || e < 1))
  755. throw new a('Both dimensions must be greater than 0')
  756. null == r && (r = Math.floor((t + 31) / 32)), (this.rowSize = r), null == n && (this.bits = new Int32Array(this.rowSize * this.height))
  757. }
  758. static parseFromBooleanArray(t) {
  759. const e = t.length,
  760. r = t[0].length,
  761. n = new y(r, e)
  762. for (let i = 0; i < e; i++) {
  763. const e = t[i]
  764. for (let t = 0; t < r; t++) e[t] && n.set(t, i)
  765. }
  766. return n
  767. }
  768. static parseFromString(t, e, r) {
  769. if (null === t) throw new a('stringRepresentation cannot be null')
  770. const n = new Array(t.length)
  771. let i = 0,
  772. o = 0,
  773. s = -1,
  774. l = 0,
  775. c = 0
  776. for (; c < t.length; )
  777. if ('\n' === t.charAt(c) || '\r' === t.charAt(c)) {
  778. if (i > o) {
  779. if (-1 === s) s = i - o
  780. else if (i - o !== s) throw new a('row lengths do not match')
  781. ;(o = i), l++
  782. }
  783. c++
  784. } else if (t.substring(c, c + e.length) === e) (c += e.length), (n[i] = !0), i++
  785. else {
  786. if (t.substring(c, c + r.length) !== r) throw new a('illegal character encountered: ' + t.substring(c))
  787. ;(c += r.length), (n[i] = !1), i++
  788. }
  789. if (i > o) {
  790. if (-1 === s) s = i - o
  791. else if (i - o !== s) throw new a('row lengths do not match')
  792. l++
  793. }
  794. const h = new y(s, l)
  795. for (let t = 0; t < i; t++) n[t] && h.set(Math.floor(t % s), Math.floor(t / s))
  796. return h
  797. }
  798. get(t, e) {
  799. const r = e * this.rowSize + Math.floor(t / 32)
  800. return 0 != ((this.bits[r] >>> (31 & t)) & 1)
  801. }
  802. set(t, e) {
  803. const r = e * this.rowSize + Math.floor(t / 32)
  804. this.bits[r] |= (1 << (31 & t)) & 4294967295
  805. }
  806. unset(t, e) {
  807. const r = e * this.rowSize + Math.floor(t / 32)
  808. this.bits[r] &= ~((1 << (31 & t)) & 4294967295)
  809. }
  810. flip(t, e) {
  811. const r = e * this.rowSize + Math.floor(t / 32)
  812. this.bits[r] ^= (1 << (31 & t)) & 4294967295
  813. }
  814. xor(t) {
  815. if (this.width !== t.getWidth() || this.height !== t.getHeight() || this.rowSize !== t.getRowSize()) throw new a('input matrix dimensions do not match')
  816. const e = new A(Math.floor(this.width / 32) + 1),
  817. r = this.rowSize,
  818. n = this.bits
  819. for (let i = 0, o = this.height; i < o; i++) {
  820. const o = i * r,
  821. s = t.getRow(i, e).getBitArray()
  822. for (let t = 0; t < r; t++) n[o + t] ^= s[t]
  823. }
  824. }
  825. clear() {
  826. const t = this.bits,
  827. e = t.length
  828. for (let r = 0; r < e; r++) t[r] = 0
  829. }
  830. setRegion(t, e, r, n) {
  831. if (e < 0 || t < 0) throw new a('Left and top must be nonnegative')
  832. if (n < 1 || r < 1) throw new a('Height and width must be at least 1')
  833. const i = t + r,
  834. o = e + n
  835. if (o > this.height || i > this.width) throw new a('The region must fit inside the matrix')
  836. const s = this.rowSize,
  837. l = this.bits
  838. for (let r = e; r < o; r++) {
  839. const e = r * s
  840. for (let r = t; r < i; r++) l[e + Math.floor(r / 32)] |= (1 << (31 & r)) & 4294967295
  841. }
  842. }
  843. getRow(t, e) {
  844. null == e || e.getSize() < this.width ? (e = new A(this.width)) : e.clear()
  845. const r = this.rowSize,
  846. n = this.bits,
  847. i = t * r
  848. for (let t = 0; t < r; t++) e.setBulk(32 * t, n[i + t])
  849. return e
  850. }
  851. setRow(t, e) {
  852. u.arraycopy(e.getBitArray(), 0, this.bits, t * this.rowSize, this.rowSize)
  853. }
  854. rotate180() {
  855. const t = this.getWidth(),
  856. e = this.getHeight()
  857. let r = new A(t),
  858. n = new A(t)
  859. for (let t = 0, i = Math.floor((e + 1) / 2); t < i; t++)
  860. (r = this.getRow(t, r)), (n = this.getRow(e - 1 - t, n)), r.reverse(), n.reverse(), this.setRow(t, n), this.setRow(e - 1 - t, r)
  861. }
  862. getEnclosingRectangle() {
  863. const t = this.width,
  864. e = this.height,
  865. r = this.rowSize,
  866. n = this.bits
  867. let i = t,
  868. o = e,
  869. s = -1,
  870. a = -1
  871. for (let t = 0; t < e; t++)
  872. for (let e = 0; e < r; e++) {
  873. const l = n[t * r + e]
  874. if (0 !== l) {
  875. if ((t < o && (o = t), t > a && (a = t), 32 * e < i)) {
  876. let t = 0
  877. for (; 0 == ((l << (31 - t)) & 4294967295); ) t++
  878. 32 * e + t < i && (i = 32 * e + t)
  879. }
  880. if (32 * e + 31 > s) {
  881. let t = 31
  882. for (; l >>> t == 0; ) t--
  883. 32 * e + t > s && (s = 32 * e + t)
  884. }
  885. }
  886. }
  887. return s < i || a < o ? null : Int32Array.from([i, o, s - i + 1, a - o + 1])
  888. }
  889. getTopLeftOnBit() {
  890. const t = this.rowSize,
  891. e = this.bits
  892. let r = 0
  893. for (; r < e.length && 0 === e[r]; ) r++
  894. if (r === e.length) return null
  895. const n = r / t
  896. let i = (r % t) * 32
  897. const o = e[r]
  898. let s = 0
  899. for (; 0 == ((o << (31 - s)) & 4294967295); ) s++
  900. return (i += s), Int32Array.from([i, n])
  901. }
  902. getBottomRightOnBit() {
  903. const t = this.rowSize,
  904. e = this.bits
  905. let r = e.length - 1
  906. for (; r >= 0 && 0 === e[r]; ) r--
  907. if (r < 0) return null
  908. const n = Math.floor(r / t)
  909. let i = 32 * Math.floor(r % t)
  910. const o = e[r]
  911. let s = 31
  912. for (; o >>> s == 0; ) s--
  913. return (i += s), Int32Array.from([i, n])
  914. }
  915. getWidth() {
  916. return this.width
  917. }
  918. getHeight() {
  919. return this.height
  920. }
  921. getRowSize() {
  922. return this.rowSize
  923. }
  924. equals(t) {
  925. if (!(t instanceof y)) return !1
  926. const e = t
  927. return this.width === e.width && this.height === e.height && this.rowSize === e.rowSize && f.equals(this.bits, e.bits)
  928. }
  929. hashCode() {
  930. let t = this.width
  931. return (t = 31 * t + this.width), (t = 31 * t + this.height), (t = 31 * t + this.rowSize), (t = 31 * t + f.hashCode(this.bits)), t
  932. }
  933. toString(t = 'X ', e = ' ', r = '\n') {
  934. return this.buildToString(t, e, r)
  935. }
  936. buildToString(t, e, r) {
  937. let n = new T()
  938. for (let i = 0, o = this.height; i < o; i++) {
  939. for (let r = 0, o = this.width; r < o; r++) n.append(this.get(r, i) ? t : e)
  940. n.append(r)
  941. }
  942. return n.toString()
  943. }
  944. clone() {
  945. return new y(this.width, this.height, this.rowSize, this.bits.slice())
  946. }
  947. }
  948. class N extends o {
  949. static getNotFoundInstance() {
  950. return new N()
  951. }
  952. }
  953. N.kind = 'NotFoundException'
  954. class M extends h {
  955. constructor(t) {
  956. super(t), (this.luminances = M.EMPTY), (this.buckets = new Int32Array(M.LUMINANCE_BUCKETS))
  957. }
  958. getBlackRow(t, e) {
  959. const r = this.getLuminanceSource(),
  960. n = r.getWidth()
  961. null == e || e.getSize() < n ? (e = new A(n)) : e.clear(), this.initArrays(n)
  962. const i = r.getRow(t, this.luminances),
  963. o = this.buckets
  964. for (let t = 0; t < n; t++) o[(255 & i[t]) >> M.LUMINANCE_SHIFT]++
  965. const s = M.estimateBlackPoint(o)
  966. if (n < 3) for (let t = 0; t < n; t++) (255 & i[t]) < s && e.set(t)
  967. else {
  968. let t = 255 & i[0],
  969. r = 255 & i[1]
  970. for (let o = 1; o < n - 1; o++) {
  971. const n = 255 & i[o + 1]
  972. ;(4 * r - t - n) / 2 < s && e.set(o), (t = r), (r = n)
  973. }
  974. }
  975. return e
  976. }
  977. getBlackMatrix() {
  978. const t = this.getLuminanceSource(),
  979. e = t.getWidth(),
  980. r = t.getHeight(),
  981. n = new y(e, r)
  982. this.initArrays(e)
  983. const i = this.buckets
  984. for (let n = 1; n < 5; n++) {
  985. const o = Math.floor((r * n) / 5),
  986. s = t.getRow(o, this.luminances),
  987. a = Math.floor((4 * e) / 5)
  988. for (let t = Math.floor(e / 5); t < a; t++) i[(255 & s[t]) >> M.LUMINANCE_SHIFT]++
  989. }
  990. const o = M.estimateBlackPoint(i),
  991. s = t.getMatrix()
  992. for (let t = 0; t < r; t++) {
  993. const r = t * e
  994. for (let i = 0; i < e; i++) (255 & s[r + i]) < o && n.set(i, t)
  995. }
  996. return n
  997. }
  998. createBinarizer(t) {
  999. return new M(t)
  1000. }
  1001. initArrays(t) {
  1002. this.luminances.length < t && (this.luminances = new Uint8ClampedArray(t))
  1003. const e = this.buckets
  1004. for (let t = 0; t < M.LUMINANCE_BUCKETS; t++) e[t] = 0
  1005. }
  1006. static estimateBlackPoint(t) {
  1007. const e = t.length
  1008. let r = 0,
  1009. n = 0,
  1010. i = 0
  1011. for (let o = 0; o < e; o++) t[o] > i && ((n = o), (i = t[o])), t[o] > r && (r = t[o])
  1012. let o = 0,
  1013. s = 0
  1014. for (let r = 0; r < e; r++) {
  1015. const e = r - n,
  1016. i = t[r] * e * e
  1017. i > s && ((o = r), (s = i))
  1018. }
  1019. if (n > o) {
  1020. const t = n
  1021. ;(n = o), (o = t)
  1022. }
  1023. if (o - n <= e / 16) throw new N()
  1024. let a = o - 1,
  1025. l = -1
  1026. for (let e = o - 1; e > n; e--) {
  1027. const i = e - n,
  1028. s = i * i * (o - e) * (r - t[e])
  1029. s > l && ((a = e), (l = s))
  1030. }
  1031. return a << M.LUMINANCE_SHIFT
  1032. }
  1033. }
  1034. ;(M.LUMINANCE_BITS = 5), (M.LUMINANCE_SHIFT = 8 - M.LUMINANCE_BITS), (M.LUMINANCE_BUCKETS = 1 << M.LUMINANCE_BITS), (M.EMPTY = Uint8ClampedArray.from([0]))
  1035. class D extends M {
  1036. constructor(t) {
  1037. super(t), (this.matrix = null)
  1038. }
  1039. getBlackMatrix() {
  1040. if (null !== this.matrix) return this.matrix
  1041. const t = this.getLuminanceSource(),
  1042. e = t.getWidth(),
  1043. r = t.getHeight()
  1044. if (e >= D.MINIMUM_DIMENSION && r >= D.MINIMUM_DIMENSION) {
  1045. const n = t.getMatrix()
  1046. let i = e >> D.BLOCK_SIZE_POWER
  1047. 0 != (e & D.BLOCK_SIZE_MASK) && i++
  1048. let o = r >> D.BLOCK_SIZE_POWER
  1049. 0 != (r & D.BLOCK_SIZE_MASK) && o++
  1050. const s = D.calculateBlackPoints(n, i, o, e, r),
  1051. a = new y(e, r)
  1052. D.calculateThresholdForBlock(n, i, o, e, r, s, a), (this.matrix = a)
  1053. } else this.matrix = super.getBlackMatrix()
  1054. return this.matrix
  1055. }
  1056. createBinarizer(t) {
  1057. return new D(t)
  1058. }
  1059. static calculateThresholdForBlock(t, e, r, n, i, o, s) {
  1060. const a = i - D.BLOCK_SIZE,
  1061. l = n - D.BLOCK_SIZE
  1062. for (let i = 0; i < r; i++) {
  1063. let c = i << D.BLOCK_SIZE_POWER
  1064. c > a && (c = a)
  1065. const h = D.cap(i, 2, r - 3)
  1066. for (let r = 0; r < e; r++) {
  1067. let i = r << D.BLOCK_SIZE_POWER
  1068. i > l && (i = l)
  1069. const a = D.cap(r, 2, e - 3)
  1070. let u = 0
  1071. for (let t = -2; t <= 2; t++) {
  1072. const e = o[h + t]
  1073. u += e[a - 2] + e[a - 1] + e[a] + e[a + 1] + e[a + 2]
  1074. }
  1075. const d = u / 25
  1076. D.thresholdBlock(t, i, c, d, n, s)
  1077. }
  1078. }
  1079. }
  1080. static cap(t, e, r) {
  1081. return t < e ? e : t > r ? r : t
  1082. }
  1083. static thresholdBlock(t, e, r, n, i, o) {
  1084. for (let s = 0, a = r * i + e; s < D.BLOCK_SIZE; s++, a += i) for (let i = 0; i < D.BLOCK_SIZE; i++) (255 & t[a + i]) <= n && o.set(e + i, r + s)
  1085. }
  1086. static calculateBlackPoints(t, e, r, n, i) {
  1087. const o = i - D.BLOCK_SIZE,
  1088. s = n - D.BLOCK_SIZE,
  1089. a = new Array(r)
  1090. for (let i = 0; i < r; i++) {
  1091. a[i] = new Int32Array(e)
  1092. let r = i << D.BLOCK_SIZE_POWER
  1093. r > o && (r = o)
  1094. for (let o = 0; o < e; o++) {
  1095. let e = o << D.BLOCK_SIZE_POWER
  1096. e > s && (e = s)
  1097. let l = 0,
  1098. c = 255,
  1099. h = 0
  1100. for (let i = 0, o = r * n + e; i < D.BLOCK_SIZE; i++, o += n) {
  1101. for (let e = 0; e < D.BLOCK_SIZE; e++) {
  1102. const r = 255 & t[o + e]
  1103. ;(l += r), r < c && (c = r), r > h && (h = r)
  1104. }
  1105. if (h - c > D.MIN_DYNAMIC_RANGE) for (i++, o += n; i < D.BLOCK_SIZE; i++, o += n) for (let e = 0; e < D.BLOCK_SIZE; e++) l += 255 & t[o + e]
  1106. }
  1107. let u = l >> (2 * D.BLOCK_SIZE_POWER)
  1108. if (h - c <= D.MIN_DYNAMIC_RANGE && ((u = c / 2), i > 0 && o > 0)) {
  1109. const t = (a[i - 1][o] + 2 * a[i][o - 1] + a[i - 1][o - 1]) / 4
  1110. c < t && (u = t)
  1111. }
  1112. a[i][o] = u
  1113. }
  1114. }
  1115. return a
  1116. }
  1117. }
  1118. ;(D.BLOCK_SIZE_POWER = 3), (D.BLOCK_SIZE = 1 << D.BLOCK_SIZE_POWER), (D.BLOCK_SIZE_MASK = D.BLOCK_SIZE - 1), (D.MINIMUM_DIMENSION = 5 * D.BLOCK_SIZE), (D.MIN_DYNAMIC_RANGE = 24)
  1119. class R {
  1120. constructor(t, e) {
  1121. ;(this.width = t), (this.height = e)
  1122. }
  1123. getWidth() {
  1124. return this.width
  1125. }
  1126. getHeight() {
  1127. return this.height
  1128. }
  1129. isCropSupported() {
  1130. return !1
  1131. }
  1132. crop(t, e, r, n) {
  1133. throw new p('This luminance source does not support cropping.')
  1134. }
  1135. isRotateSupported() {
  1136. return !1
  1137. }
  1138. rotateCounterClockwise() {
  1139. throw new p('This luminance source does not support rotation by 90 degrees.')
  1140. }
  1141. rotateCounterClockwise45() {
  1142. throw new p('This luminance source does not support rotation by 45 degrees.')
  1143. }
  1144. toString() {
  1145. const t = new Uint8ClampedArray(this.width)
  1146. let e = new T()
  1147. for (let r = 0; r < this.height; r++) {
  1148. const n = this.getRow(r, t)
  1149. for (let t = 0; t < this.width; t++) {
  1150. const r = 255 & n[t]
  1151. let i
  1152. ;(i = r < 64 ? '#' : r < 128 ? '+' : r < 192 ? '.' : ' '), e.append(i)
  1153. }
  1154. e.append('\n')
  1155. }
  1156. return e.toString()
  1157. }
  1158. }
  1159. class O extends R {
  1160. constructor(t) {
  1161. super(t.getWidth(), t.getHeight()), (this.delegate = t)
  1162. }
  1163. getRow(t, e) {
  1164. const r = this.delegate.getRow(t, e),
  1165. n = this.getWidth()
  1166. for (let t = 0; t < n; t++) r[t] = 255 - (255 & r[t])
  1167. return r
  1168. }
  1169. getMatrix() {
  1170. const t = this.delegate.getMatrix(),
  1171. e = this.getWidth() * this.getHeight(),
  1172. r = new Uint8ClampedArray(e)
  1173. for (let n = 0; n < e; n++) r[n] = 255 - (255 & t[n])
  1174. return r
  1175. }
  1176. isCropSupported() {
  1177. return this.delegate.isCropSupported()
  1178. }
  1179. crop(t, e, r, n) {
  1180. return new O(this.delegate.crop(t, e, r, n))
  1181. }
  1182. isRotateSupported() {
  1183. return this.delegate.isRotateSupported()
  1184. }
  1185. invert() {
  1186. return this.delegate
  1187. }
  1188. rotateCounterClockwise() {
  1189. return new O(this.delegate.rotateCounterClockwise())
  1190. }
  1191. rotateCounterClockwise45() {
  1192. return new O(this.delegate.rotateCounterClockwise45())
  1193. }
  1194. }
  1195. class b extends R {
  1196. constructor(t) {
  1197. super(t.width, t.height), (this.canvas = t), (this.tempCanvasElement = null), (this.buffer = b.makeBufferFromCanvasImageData(t))
  1198. }
  1199. static makeBufferFromCanvasImageData(t) {
  1200. const e = t.getContext('2d').getImageData(0, 0, t.width, t.height)
  1201. return b.toGrayscaleBuffer(e.data, t.width, t.height)
  1202. }
  1203. static toGrayscaleBuffer(t, e, r) {
  1204. const n = new Uint8ClampedArray(e * r)
  1205. for (let e = 0, r = 0, i = t.length; e < i; e += 4, r++) {
  1206. let i
  1207. ;(i = 0 === t[e + 3] ? 255 : (306 * t[e] + 601 * t[e + 1] + 117 * t[e + 2] + 512) >> 10), (n[r] = i)
  1208. }
  1209. return n
  1210. }
  1211. getRow(t, e) {
  1212. if (t < 0 || t >= this.getHeight()) throw new a('Requested row is outside the image: ' + t)
  1213. const r = this.getWidth(),
  1214. n = t * r
  1215. return null === e ? (e = this.buffer.slice(n, n + r)) : (e.length < r && (e = new Uint8ClampedArray(r)), e.set(this.buffer.slice(n, n + r))), e
  1216. }
  1217. getMatrix() {
  1218. return this.buffer
  1219. }
  1220. isCropSupported() {
  1221. return !0
  1222. }
  1223. crop(t, e, r, n) {
  1224. return super.crop(t, e, r, n), this
  1225. }
  1226. isRotateSupported() {
  1227. return !0
  1228. }
  1229. rotateCounterClockwise() {
  1230. return this.rotate(-90), this
  1231. }
  1232. rotateCounterClockwise45() {
  1233. return this.rotate(-45), this
  1234. }
  1235. getTempCanvasElement() {
  1236. if (null === this.tempCanvasElement) {
  1237. const t = this.canvas.ownerDocument.createElement('canvas')
  1238. ;(t.width = this.canvas.width), (t.height = this.canvas.height), (this.tempCanvasElement = t)
  1239. }
  1240. return this.tempCanvasElement
  1241. }
  1242. rotate(t) {
  1243. const e = this.getTempCanvasElement(),
  1244. r = e.getContext('2d'),
  1245. n = t * b.DEGREE_TO_RADIANS,
  1246. i = this.canvas.width,
  1247. o = this.canvas.height,
  1248. s = Math.ceil(Math.abs(Math.cos(n)) * i + Math.abs(Math.sin(n)) * o),
  1249. a = Math.ceil(Math.abs(Math.sin(n)) * i + Math.abs(Math.cos(n)) * o)
  1250. return (
  1251. (e.width = s),
  1252. (e.height = a),
  1253. r.translate(s / 2, a / 2),
  1254. r.rotate(n),
  1255. r.drawImage(this.canvas, i / -2, o / -2),
  1256. (this.buffer = b.makeBufferFromCanvasImageData(e)),
  1257. this
  1258. )
  1259. }
  1260. invert() {
  1261. return new O(this)
  1262. }
  1263. }
  1264. b.DEGREE_TO_RADIANS = Math.PI / 180
  1265. class L {
  1266. constructor(t, e, r) {
  1267. ;(this.deviceId = t), (this.label = e), (this.kind = 'videoinput'), (this.groupId = r || void 0)
  1268. }
  1269. toJSON() {
  1270. return { kind: this.kind, groupId: this.groupId, deviceId: this.deviceId, label: this.label }
  1271. }
  1272. }
  1273. var B,
  1274. P =
  1275. (globalThis || r.g || self || window ? (globalThis || r.g || self || window || void 0).__awaiter : void 0) ||
  1276. function(t, e, r, n) {
  1277. return new (r || (r = Promise))(function(i, o) {
  1278. function s(t) {
  1279. try {
  1280. l(n.next(t))
  1281. } catch (t) {
  1282. o(t)
  1283. }
  1284. }
  1285. function a(t) {
  1286. try {
  1287. l(n.throw(t))
  1288. } catch (t) {
  1289. o(t)
  1290. }
  1291. }
  1292. function l(t) {
  1293. var e
  1294. t.done
  1295. ? i(t.value)
  1296. : ((e = t.value),
  1297. e instanceof r
  1298. ? e
  1299. : new r(function(t) {
  1300. t(e)
  1301. })).then(s, a)
  1302. }
  1303. l((n = n.apply(t, e || [])).next())
  1304. })
  1305. }
  1306. class v {
  1307. constructor(t, e = 500, r) {
  1308. ;(this.reader = t),
  1309. (this.timeBetweenScansMillis = e),
  1310. (this._hints = r),
  1311. (this._stopContinuousDecode = !1),
  1312. (this._stopAsyncDecode = !1),
  1313. (this._timeBetweenDecodingAttempts = 0)
  1314. }
  1315. get hasNavigator() {
  1316. return 'undefined' != typeof navigator
  1317. }
  1318. get isMediaDevicesSuported() {
  1319. return this.hasNavigator && !!navigator.mediaDevices
  1320. }
  1321. get canEnumerateDevices() {
  1322. return !(!this.isMediaDevicesSuported || !navigator.mediaDevices.enumerateDevices)
  1323. }
  1324. get timeBetweenDecodingAttempts() {
  1325. return this._timeBetweenDecodingAttempts
  1326. }
  1327. set timeBetweenDecodingAttempts(t) {
  1328. this._timeBetweenDecodingAttempts = t < 0 ? 0 : t
  1329. }
  1330. set hints(t) {
  1331. this._hints = t || null
  1332. }
  1333. get hints() {
  1334. return this._hints
  1335. }
  1336. listVideoInputDevices() {
  1337. return P(this, void 0, void 0, function*() {
  1338. if (!this.hasNavigator) throw new Error("Can't enumerate devices, navigator is not present.")
  1339. if (!this.canEnumerateDevices) throw new Error("Can't enumerate devices, method not supported.")
  1340. const t = yield navigator.mediaDevices.enumerateDevices(),
  1341. e = []
  1342. for (const r of t) {
  1343. const t = 'video' === r.kind ? 'videoinput' : r.kind
  1344. if ('videoinput' !== t) continue
  1345. const n = { deviceId: r.deviceId || r.id, label: r.label || `Video device ${e.length + 1}`, kind: t, groupId: r.groupId }
  1346. e.push(n)
  1347. }
  1348. return e
  1349. })
  1350. }
  1351. getVideoInputDevices() {
  1352. return P(this, void 0, void 0, function*() {
  1353. return (yield this.listVideoInputDevices()).map(t => new L(t.deviceId, t.label))
  1354. })
  1355. }
  1356. findDeviceById(t) {
  1357. return P(this, void 0, void 0, function*() {
  1358. const e = yield this.listVideoInputDevices()
  1359. return e ? e.find(e => e.deviceId === t) : null
  1360. })
  1361. }
  1362. decodeFromInputVideoDevice(t, e) {
  1363. return P(this, void 0, void 0, function*() {
  1364. return yield this.decodeOnceFromVideoDevice(t, e)
  1365. })
  1366. }
  1367. decodeOnceFromVideoDevice(t, e) {
  1368. return P(this, void 0, void 0, function*() {
  1369. let r
  1370. this.reset(), (r = t ? { deviceId: { exact: t } } : { facingMode: 'environment' })
  1371. const n = { video: r }
  1372. return yield this.decodeOnceFromConstraints(n, e)
  1373. })
  1374. }
  1375. decodeOnceFromConstraints(t, e) {
  1376. return P(this, void 0, void 0, function*() {
  1377. const r = yield navigator.mediaDevices.getUserMedia(t)
  1378. return yield this.decodeOnceFromStream(r, e)
  1379. })
  1380. }
  1381. decodeOnceFromStream(t, e) {
  1382. return P(this, void 0, void 0, function*() {
  1383. this.reset()
  1384. const r = yield this.attachStreamToVideo(t, e)
  1385. return yield this.decodeOnce(r)
  1386. })
  1387. }
  1388. decodeFromInputVideoDeviceContinuously(t, e, r) {
  1389. return P(this, void 0, void 0, function*() {
  1390. return yield this.decodeFromVideoDevice(t, e, r)
  1391. })
  1392. }
  1393. decodeFromVideoDevice(t, e, r) {
  1394. return P(this, void 0, void 0, function*() {
  1395. let n
  1396. n = t ? { deviceId: { exact: t } } : { facingMode: 'environment' }
  1397. const i = { video: n }
  1398. return yield this.decodeFromConstraints(i, e, r)
  1399. })
  1400. }
  1401. decodeFromConstraints(t, e, r) {
  1402. return P(this, void 0, void 0, function*() {
  1403. const n = yield navigator.mediaDevices.getUserMedia(t)
  1404. return yield this.decodeFromStream(n, e, r)
  1405. })
  1406. }
  1407. decodeFromStream(t, e, r) {
  1408. return P(this, void 0, void 0, function*() {
  1409. this.reset()
  1410. const n = yield this.attachStreamToVideo(t, e)
  1411. return yield this.decodeContinuously(n, r)
  1412. })
  1413. }
  1414. stopAsyncDecode() {
  1415. this._stopAsyncDecode = !0
  1416. }
  1417. stopContinuousDecode() {
  1418. this._stopContinuousDecode = !0
  1419. }
  1420. attachStreamToVideo(t, e) {
  1421. return P(this, void 0, void 0, function*() {
  1422. const r = this.prepareVideoElement(e)
  1423. return this.addVideoSource(r, t), (this.videoElement = r), (this.stream = t), yield this.playVideoOnLoadAsync(r), r
  1424. })
  1425. }
  1426. playVideoOnLoadAsync(t) {
  1427. return new Promise((e, r) => this.playVideoOnLoad(t, () => e()))
  1428. }
  1429. playVideoOnLoad(t, e) {
  1430. ;(this.videoEndedListener = () => this.stopStreams()),
  1431. (this.videoCanPlayListener = () => this.tryPlayVideo(t)),
  1432. t.addEventListener('ended', this.videoEndedListener),
  1433. t.addEventListener('canplay', this.videoCanPlayListener),
  1434. t.addEventListener('playing', e),
  1435. this.tryPlayVideo(t)
  1436. }
  1437. isVideoPlaying(t) {
  1438. return t.currentTime > 0 && !t.paused && !t.ended && t.readyState > 2
  1439. }
  1440. tryPlayVideo(t) {
  1441. return P(this, void 0, void 0, function*() {
  1442. if (this.isVideoPlaying(t)) console.warn('Trying to play video that is already playing.')
  1443. else
  1444. try {
  1445. yield t.play()
  1446. } catch (t) {
  1447. console.warn('It was not possible to play the video.')
  1448. }
  1449. })
  1450. }
  1451. getMediaElement(t, e) {
  1452. const r = document.getElementById(t)
  1453. if (!r) throw new s(`element with id '${t}' not found`)
  1454. if (r.nodeName.toLowerCase() !== e.toLowerCase()) throw new s(`element with id '${t}' must be an ${e} element`)
  1455. return r
  1456. }
  1457. decodeFromImage(t, e) {
  1458. if (!t && !e) throw new s('either imageElement with a src set or an url must be provided')
  1459. return e && !t ? this.decodeFromImageUrl(e) : this.decodeFromImageElement(t)
  1460. }
  1461. decodeFromVideo(t, e) {
  1462. if (!t && !e) throw new s('Either an element with a src set or an URL must be provided')
  1463. return e && !t ? this.decodeFromVideoUrl(e) : this.decodeFromVideoElement(t)
  1464. }
  1465. decodeFromVideoContinuously(t, e, r) {
  1466. if (void 0 === t && void 0 === e) throw new s('Either an element with a src set or an URL must be provided')
  1467. return e && !t ? this.decodeFromVideoUrlContinuously(e, r) : this.decodeFromVideoElementContinuously(t, r)
  1468. }
  1469. decodeFromImageElement(t) {
  1470. if (!t) throw new s('An image element must be provided.')
  1471. this.reset()
  1472. const e = this.prepareImageElement(t)
  1473. let r
  1474. return (this.imageElement = e), (r = this.isImageLoaded(e) ? this.decodeOnce(e, !1, !0) : this._decodeOnLoadImage(e)), r
  1475. }
  1476. decodeFromVideoElement(t) {
  1477. const e = this._decodeFromVideoElementSetup(t)
  1478. return this._decodeOnLoadVideo(e)
  1479. }
  1480. decodeFromVideoElementContinuously(t, e) {
  1481. const r = this._decodeFromVideoElementSetup(t)
  1482. return this._decodeOnLoadVideoContinuously(r, e)
  1483. }
  1484. _decodeFromVideoElementSetup(t) {
  1485. if (!t) throw new s('A video element must be provided.')
  1486. this.reset()
  1487. const e = this.prepareVideoElement(t)
  1488. return (this.videoElement = e), e
  1489. }
  1490. decodeFromImageUrl(t) {
  1491. if (!t) throw new s('An URL must be provided.')
  1492. this.reset()
  1493. const e = this.prepareImageElement()
  1494. this.imageElement = e
  1495. const r = this._decodeOnLoadImage(e)
  1496. return (e.src = t), r
  1497. }
  1498. decodeFromVideoUrl(t) {
  1499. if (!t) throw new s('An URL must be provided.')
  1500. this.reset()
  1501. const e = this.prepareVideoElement(),
  1502. r = this.decodeFromVideoElement(e)
  1503. return (e.src = t), r
  1504. }
  1505. decodeFromVideoUrlContinuously(t, e) {
  1506. if (!t) throw new s('An URL must be provided.')
  1507. this.reset()
  1508. const r = this.prepareVideoElement(),
  1509. n = this.decodeFromVideoElementContinuously(r, e)
  1510. return (r.src = t), n
  1511. }
  1512. _decodeOnLoadImage(t) {
  1513. return new Promise((e, r) => {
  1514. ;(this.imageLoadedListener = () => this.decodeOnce(t, !1, !0).then(e, r)), t.addEventListener('load', this.imageLoadedListener)
  1515. })
  1516. }
  1517. _decodeOnLoadVideo(t) {
  1518. return P(this, void 0, void 0, function*() {
  1519. return yield this.playVideoOnLoadAsync(t), yield this.decodeOnce(t)
  1520. })
  1521. }
  1522. _decodeOnLoadVideoContinuously(t, e) {
  1523. return P(this, void 0, void 0, function*() {
  1524. yield this.playVideoOnLoadAsync(t), this.decodeContinuously(t, e)
  1525. })
  1526. }
  1527. isImageLoaded(t) {
  1528. return !!t.complete && 0 !== t.naturalWidth
  1529. }
  1530. prepareImageElement(t) {
  1531. let e
  1532. return (
  1533. void 0 === t && ((e = document.createElement('img')), (e.width = 200), (e.height = 200)),
  1534. 'string' == typeof t && (e = this.getMediaElement(t, 'img')),
  1535. t instanceof HTMLImageElement && (e = t),
  1536. e
  1537. )
  1538. }
  1539. prepareVideoElement(t) {
  1540. let e
  1541. return (
  1542. t || 'undefined' == typeof document || ((e = document.createElement('video')), (e.width = 200), (e.height = 200)),
  1543. 'string' == typeof t && (e = this.getMediaElement(t, 'video')),
  1544. t instanceof HTMLVideoElement && (e = t),
  1545. e.setAttribute('autoplay', 'true'),
  1546. e.setAttribute('muted', 'true'),
  1547. e.setAttribute('playsinline', 'true'),
  1548. e
  1549. )
  1550. }
  1551. decodeOnce(t, e = !0, r = !0) {
  1552. this._stopAsyncDecode = !1
  1553. const n = (i, o) => {
  1554. if (this._stopAsyncDecode) return o(new N('Video stream has ended before any code could be detected.')), void (this._stopAsyncDecode = void 0)
  1555. try {
  1556. i(this.decode(t))
  1557. } catch (t) {
  1558. const s = (t instanceof c || t instanceof C) && r
  1559. if ((e && t instanceof N) || s) return setTimeout(n, this._timeBetweenDecodingAttempts, i, o)
  1560. o(t)
  1561. }
  1562. }
  1563. return new Promise((t, e) => n(t, e))
  1564. }
  1565. decodeContinuously(t, e) {
  1566. this._stopContinuousDecode = !1
  1567. const r = () => {
  1568. if (this._stopContinuousDecode) this._stopContinuousDecode = void 0
  1569. else
  1570. try {
  1571. const n = this.decode(t)
  1572. e(n, null), setTimeout(r, this.timeBetweenScansMillis)
  1573. } catch (t) {
  1574. e(null, t)
  1575. const n = t instanceof N
  1576. ;(t instanceof c || t instanceof C || n) && setTimeout(r, this._timeBetweenDecodingAttempts)
  1577. }
  1578. }
  1579. r()
  1580. }
  1581. decode(t) {
  1582. const e = this.createBinaryBitmap(t)
  1583. return this.decodeBitmap(e)
  1584. }
  1585. createBinaryBitmap(t) {
  1586. const e = this.getCaptureCanvasContext(t)
  1587. this.drawImageOnCanvas(e, t)
  1588. const r = this.getCaptureCanvas(t),
  1589. n = new b(r),
  1590. i = new D(n)
  1591. return new l(i)
  1592. }
  1593. getCaptureCanvasContext(t) {
  1594. if (!this.captureCanvasContext) {
  1595. const e = this.getCaptureCanvas(t).getContext('2d')
  1596. this.captureCanvasContext = e
  1597. }
  1598. return this.captureCanvasContext
  1599. }
  1600. getCaptureCanvas(t) {
  1601. if (!this.captureCanvas) {
  1602. const e = this.createCaptureCanvas(t)
  1603. this.captureCanvas = e
  1604. }
  1605. return this.captureCanvas
  1606. }
  1607. drawImageOnCanvas(t, e) {
  1608. t.drawImage(e, 0, 0)
  1609. }
  1610. decodeBitmap(t) {
  1611. return this.reader.decode(t, this._hints)
  1612. }
  1613. createCaptureCanvas(t) {
  1614. if ('undefined' == typeof document) return this._destroyCaptureCanvas(), null
  1615. const e = document.createElement('canvas')
  1616. let r, n
  1617. return (
  1618. void 0 !== t &&
  1619. (t instanceof HTMLVideoElement
  1620. ? ((r = t.videoWidth), (n = t.videoHeight))
  1621. : t instanceof HTMLImageElement && ((r = t.naturalWidth || t.width), (n = t.naturalHeight || t.height))),
  1622. (e.style.width = r + 'px'),
  1623. (e.style.height = n + 'px'),
  1624. (e.width = r),
  1625. (e.height = n),
  1626. e
  1627. )
  1628. }
  1629. stopStreams() {
  1630. this.stream && (this.stream.getVideoTracks().forEach(t => t.stop()), (this.stream = void 0)),
  1631. !1 === this._stopAsyncDecode && this.stopAsyncDecode(),
  1632. !1 === this._stopContinuousDecode && this.stopContinuousDecode()
  1633. }
  1634. reset() {
  1635. this.stopStreams(), this._destroyVideoElement(), this._destroyImageElement(), this._destroyCaptureCanvas()
  1636. }
  1637. _destroyVideoElement() {
  1638. this.videoElement &&
  1639. (void 0 !== this.videoEndedListener && this.videoElement.removeEventListener('ended', this.videoEndedListener),
  1640. void 0 !== this.videoPlayingEventListener && this.videoElement.removeEventListener('playing', this.videoPlayingEventListener),
  1641. void 0 !== this.videoCanPlayListener && this.videoElement.removeEventListener('loadedmetadata', this.videoCanPlayListener),
  1642. this.cleanVideoSource(this.videoElement),
  1643. (this.videoElement = void 0))
  1644. }
  1645. _destroyImageElement() {
  1646. this.imageElement &&
  1647. (void 0 !== this.imageLoadedListener && this.imageElement.removeEventListener('load', this.imageLoadedListener),
  1648. (this.imageElement.src = void 0),
  1649. this.imageElement.removeAttribute('src'),
  1650. (this.imageElement = void 0))
  1651. }
  1652. _destroyCaptureCanvas() {
  1653. ;(this.captureCanvasContext = void 0), (this.captureCanvas = void 0)
  1654. }
  1655. addVideoSource(t, e) {
  1656. try {
  1657. t.srcObject = e
  1658. } catch (r) {
  1659. t.src = URL.createObjectURL(e)
  1660. }
  1661. }
  1662. cleanVideoSource(t) {
  1663. try {
  1664. t.srcObject = null
  1665. } catch (e) {
  1666. t.src = ''
  1667. }
  1668. this.videoElement.removeAttribute('src')
  1669. }
  1670. }
  1671. class F {
  1672. constructor(t, e, r = null == e ? 0 : 8 * e.length, n, i, o = u.currentTimeMillis()) {
  1673. ;(this.text = t),
  1674. (this.rawBytes = e),
  1675. (this.numBits = r),
  1676. (this.resultPoints = n),
  1677. (this.format = i),
  1678. (this.timestamp = o),
  1679. (this.text = t),
  1680. (this.rawBytes = e),
  1681. (this.numBits = null == r ? (null == e ? 0 : 8 * e.length) : r),
  1682. (this.resultPoints = n),
  1683. (this.format = i),
  1684. (this.resultMetadata = null),
  1685. (this.timestamp = null == o ? u.currentTimeMillis() : o)
  1686. }
  1687. getText() {
  1688. return this.text
  1689. }
  1690. getRawBytes() {
  1691. return this.rawBytes
  1692. }
  1693. getNumBits() {
  1694. return this.numBits
  1695. }
  1696. getResultPoints() {
  1697. return this.resultPoints
  1698. }
  1699. getBarcodeFormat() {
  1700. return this.format
  1701. }
  1702. getResultMetadata() {
  1703. return this.resultMetadata
  1704. }
  1705. putMetadata(t, e) {
  1706. null === this.resultMetadata && (this.resultMetadata = new Map()), this.resultMetadata.set(t, e)
  1707. }
  1708. putAllMetadata(t) {
  1709. null !== t && (null === this.resultMetadata ? (this.resultMetadata = t) : (this.resultMetadata = new Map(t)))
  1710. }
  1711. addResultPoints(t) {
  1712. const e = this.resultPoints
  1713. if (null === e) this.resultPoints = t
  1714. else if (null !== t && t.length > 0) {
  1715. const r = new Array(e.length + t.length)
  1716. u.arraycopy(e, 0, r, 0, e.length), u.arraycopy(t, 0, r, e.length, t.length), (this.resultPoints = r)
  1717. }
  1718. }
  1719. getTimestamp() {
  1720. return this.timestamp
  1721. }
  1722. toString() {
  1723. return this.text
  1724. }
  1725. }
  1726. !(function(t) {
  1727. ;(t[(t.AZTEC = 0)] = 'AZTEC'),
  1728. (t[(t.CODABAR = 1)] = 'CODABAR'),
  1729. (t[(t.CODE_39 = 2)] = 'CODE_39'),
  1730. (t[(t.CODE_93 = 3)] = 'CODE_93'),
  1731. (t[(t.CODE_128 = 4)] = 'CODE_128'),
  1732. (t[(t.DATA_MATRIX = 5)] = 'DATA_MATRIX'),
  1733. (t[(t.EAN_8 = 6)] = 'EAN_8'),
  1734. (t[(t.EAN_13 = 7)] = 'EAN_13'),
  1735. (t[(t.ITF = 8)] = 'ITF'),
  1736. (t[(t.MAXICODE = 9)] = 'MAXICODE'),
  1737. (t[(t.PDF_417 = 10)] = 'PDF_417'),
  1738. (t[(t.QR_CODE = 11)] = 'QR_CODE'),
  1739. (t[(t.RSS_14 = 12)] = 'RSS_14'),
  1740. (t[(t.RSS_EXPANDED = 13)] = 'RSS_EXPANDED'),
  1741. (t[(t.UPC_A = 14)] = 'UPC_A'),
  1742. (t[(t.UPC_E = 15)] = 'UPC_E'),
  1743. (t[(t.UPC_EAN_EXTENSION = 16)] = 'UPC_EAN_EXTENSION')
  1744. })(B || (B = {}))
  1745. var x,
  1746. k = B
  1747. !(function(t) {
  1748. ;(t[(t.OTHER = 0)] = 'OTHER'),
  1749. (t[(t.ORIENTATION = 1)] = 'ORIENTATION'),
  1750. (t[(t.BYTE_SEGMENTS = 2)] = 'BYTE_SEGMENTS'),
  1751. (t[(t.ERROR_CORRECTION_LEVEL = 3)] = 'ERROR_CORRECTION_LEVEL'),
  1752. (t[(t.ISSUE_NUMBER = 4)] = 'ISSUE_NUMBER'),
  1753. (t[(t.SUGGESTED_PRICE = 5)] = 'SUGGESTED_PRICE'),
  1754. (t[(t.POSSIBLE_COUNTRY = 6)] = 'POSSIBLE_COUNTRY'),
  1755. (t[(t.UPC_EAN_EXTENSION = 7)] = 'UPC_EAN_EXTENSION'),
  1756. (t[(t.PDF417_EXTRA_METADATA = 8)] = 'PDF417_EXTRA_METADATA'),
  1757. (t[(t.STRUCTURED_APPEND_SEQUENCE = 9)] = 'STRUCTURED_APPEND_SEQUENCE'),
  1758. (t[(t.STRUCTURED_APPEND_PARITY = 10)] = 'STRUCTURED_APPEND_PARITY')
  1759. })(x || (x = {}))
  1760. var U,
  1761. H,
  1762. V,
  1763. z,
  1764. G,
  1765. Y,
  1766. X = x
  1767. class W {
  1768. constructor(t, e, r, n, i = -1, o = -1) {
  1769. ;(this.rawBytes = t),
  1770. (this.text = e),
  1771. (this.byteSegments = r),
  1772. (this.ecLevel = n),
  1773. (this.structuredAppendSequenceNumber = i),
  1774. (this.structuredAppendParity = o),
  1775. (this.numBits = null == t ? 0 : 8 * t.length)
  1776. }
  1777. getRawBytes() {
  1778. return this.rawBytes
  1779. }
  1780. getNumBits() {
  1781. return this.numBits
  1782. }
  1783. setNumBits(t) {
  1784. this.numBits = t
  1785. }
  1786. getText() {
  1787. return this.text
  1788. }
  1789. getByteSegments() {
  1790. return this.byteSegments
  1791. }
  1792. getECLevel() {
  1793. return this.ecLevel
  1794. }
  1795. getErrorsCorrected() {
  1796. return this.errorsCorrected
  1797. }
  1798. setErrorsCorrected(t) {
  1799. this.errorsCorrected = t
  1800. }
  1801. getErasures() {
  1802. return this.erasures
  1803. }
  1804. setErasures(t) {
  1805. this.erasures = t
  1806. }
  1807. getOther() {
  1808. return this.other
  1809. }
  1810. setOther(t) {
  1811. this.other = t
  1812. }
  1813. hasStructuredAppend() {
  1814. return this.structuredAppendParity >= 0 && this.structuredAppendSequenceNumber >= 0
  1815. }
  1816. getStructuredAppendParity() {
  1817. return this.structuredAppendParity
  1818. }
  1819. getStructuredAppendSequenceNumber() {
  1820. return this.structuredAppendSequenceNumber
  1821. }
  1822. }
  1823. class j {
  1824. exp(t) {
  1825. return this.expTable[t]
  1826. }
  1827. log(t) {
  1828. if (0 === t) throw new a()
  1829. return this.logTable[t]
  1830. }
  1831. static addOrSubtract(t, e) {
  1832. return t ^ e
  1833. }
  1834. }
  1835. class Z {
  1836. constructor(t, e) {
  1837. if (0 === e.length) throw new a()
  1838. this.field = t
  1839. const r = e.length
  1840. if (r > 1 && 0 === e[0]) {
  1841. let t = 1
  1842. for (; t < r && 0 === e[t]; ) t++
  1843. t === r ? (this.coefficients = Int32Array.from([0])) : ((this.coefficients = new Int32Array(r - t)), u.arraycopy(e, t, this.coefficients, 0, this.coefficients.length))
  1844. } else this.coefficients = e
  1845. }
  1846. getCoefficients() {
  1847. return this.coefficients
  1848. }
  1849. getDegree() {
  1850. return this.coefficients.length - 1
  1851. }
  1852. isZero() {
  1853. return 0 === this.coefficients[0]
  1854. }
  1855. getCoefficient(t) {
  1856. return this.coefficients[this.coefficients.length - 1 - t]
  1857. }
  1858. evaluateAt(t) {
  1859. if (0 === t) return this.getCoefficient(0)
  1860. const e = this.coefficients
  1861. let r
  1862. if (1 === t) {
  1863. r = 0
  1864. for (let t = 0, n = e.length; t !== n; t++) {
  1865. const n = e[t]
  1866. r = j.addOrSubtract(r, n)
  1867. }
  1868. return r
  1869. }
  1870. r = e[0]
  1871. const n = e.length,
  1872. i = this.field
  1873. for (let o = 1; o < n; o++) r = j.addOrSubtract(i.multiply(t, r), e[o])
  1874. return r
  1875. }
  1876. addOrSubtract(t) {
  1877. if (!this.field.equals(t.field)) throw new a('GenericGFPolys do not have same GenericGF field')
  1878. if (this.isZero()) return t
  1879. if (t.isZero()) return this
  1880. let e = this.coefficients,
  1881. r = t.coefficients
  1882. if (e.length > r.length) {
  1883. const t = e
  1884. ;(e = r), (r = t)
  1885. }
  1886. let n = new Int32Array(r.length)
  1887. const i = r.length - e.length
  1888. u.arraycopy(r, 0, n, 0, i)
  1889. for (let t = i; t < r.length; t++) n[t] = j.addOrSubtract(e[t - i], r[t])
  1890. return new Z(this.field, n)
  1891. }
  1892. multiply(t) {
  1893. if (!this.field.equals(t.field)) throw new a('GenericGFPolys do not have same GenericGF field')
  1894. if (this.isZero() || t.isZero()) return this.field.getZero()
  1895. const e = this.coefficients,
  1896. r = e.length,
  1897. n = t.coefficients,
  1898. i = n.length,
  1899. o = new Int32Array(r + i - 1),
  1900. s = this.field
  1901. for (let t = 0; t < r; t++) {
  1902. const r = e[t]
  1903. for (let e = 0; e < i; e++) o[t + e] = j.addOrSubtract(o[t + e], s.multiply(r, n[e]))
  1904. }
  1905. return new Z(s, o)
  1906. }
  1907. multiplyScalar(t) {
  1908. if (0 === t) return this.field.getZero()
  1909. if (1 === t) return this
  1910. const e = this.coefficients.length,
  1911. r = this.field,
  1912. n = new Int32Array(e),
  1913. i = this.coefficients
  1914. for (let o = 0; o < e; o++) n[o] = r.multiply(i[o], t)
  1915. return new Z(r, n)
  1916. }
  1917. multiplyByMonomial(t, e) {
  1918. if (t < 0) throw new a()
  1919. if (0 === e) return this.field.getZero()
  1920. const r = this.coefficients,
  1921. n = r.length,
  1922. i = new Int32Array(n + t),
  1923. o = this.field
  1924. for (let t = 0; t < n; t++) i[t] = o.multiply(r[t], e)
  1925. return new Z(o, i)
  1926. }
  1927. divide(t) {
  1928. if (!this.field.equals(t.field)) throw new a('GenericGFPolys do not have same GenericGF field')
  1929. if (t.isZero()) throw new a('Divide by 0')
  1930. const e = this.field
  1931. let r = e.getZero(),
  1932. n = this
  1933. const i = t.getCoefficient(t.getDegree()),
  1934. o = e.inverse(i)
  1935. for (; n.getDegree() >= t.getDegree() && !n.isZero(); ) {
  1936. const i = n.getDegree() - t.getDegree(),
  1937. s = e.multiply(n.getCoefficient(n.getDegree()), o),
  1938. a = t.multiplyByMonomial(i, s),
  1939. l = e.buildMonomial(i, s)
  1940. ;(r = r.addOrSubtract(l)), (n = n.addOrSubtract(a))
  1941. }
  1942. return [r, n]
  1943. }
  1944. toString() {
  1945. let t = ''
  1946. for (let e = this.getDegree(); e >= 0; e--) {
  1947. let r = this.getCoefficient(e)
  1948. if (0 !== r) {
  1949. if ((r < 0 ? ((t += ' - '), (r = -r)) : t.length > 0 && (t += ' + '), 0 === e || 1 !== r)) {
  1950. const e = this.field.log(r)
  1951. 0 === e ? (t += '1') : 1 === e ? (t += 'a') : ((t += 'a^'), (t += e))
  1952. }
  1953. 0 !== e && (1 === e ? (t += 'x') : ((t += 'x^'), (t += e)))
  1954. }
  1955. }
  1956. return t
  1957. }
  1958. }
  1959. class Q extends o {}
  1960. Q.kind = 'ArithmeticException'
  1961. class K extends j {
  1962. constructor(t, e, r) {
  1963. super(), (this.primitive = t), (this.size = e), (this.generatorBase = r)
  1964. const n = new Int32Array(e)
  1965. let i = 1
  1966. for (let r = 0; r < e; r++) (n[r] = i), (i *= 2), i >= e && ((i ^= t), (i &= e - 1))
  1967. this.expTable = n
  1968. const o = new Int32Array(e)
  1969. for (let t = 0; t < e - 1; t++) o[n[t]] = t
  1970. ;(this.logTable = o), (this.zero = new Z(this, Int32Array.from([0]))), (this.one = new Z(this, Int32Array.from([1])))
  1971. }
  1972. getZero() {
  1973. return this.zero
  1974. }
  1975. getOne() {
  1976. return this.one
  1977. }
  1978. buildMonomial(t, e) {
  1979. if (t < 0) throw new a()
  1980. if (0 === e) return this.zero
  1981. const r = new Int32Array(t + 1)
  1982. return (r[0] = e), new Z(this, r)
  1983. }
  1984. inverse(t) {
  1985. if (0 === t) throw new Q()
  1986. return this.expTable[this.size - this.logTable[t] - 1]
  1987. }
  1988. multiply(t, e) {
  1989. return 0 === t || 0 === e ? 0 : this.expTable[(this.logTable[t] + this.logTable[e]) % (this.size - 1)]
  1990. }
  1991. getSize() {
  1992. return this.size
  1993. }
  1994. getGeneratorBase() {
  1995. return this.generatorBase
  1996. }
  1997. toString() {
  1998. return 'GF(0x' + w.toHexString(this.primitive) + ',' + this.size + ')'
  1999. }
  2000. equals(t) {
  2001. return t === this
  2002. }
  2003. }
  2004. ;(K.AZTEC_DATA_12 = new K(4201, 4096, 1)),
  2005. (K.AZTEC_DATA_10 = new K(1033, 1024, 1)),
  2006. (K.AZTEC_DATA_6 = new K(67, 64, 1)),
  2007. (K.AZTEC_PARAM = new K(19, 16, 1)),
  2008. (K.QR_CODE_FIELD_256 = new K(285, 256, 0)),
  2009. (K.DATA_MATRIX_FIELD_256 = new K(301, 256, 1)),
  2010. (K.AZTEC_DATA_8 = K.DATA_MATRIX_FIELD_256),
  2011. (K.MAXICODE_FIELD_64 = K.AZTEC_DATA_6)
  2012. class q extends o {}
  2013. q.kind = 'ReedSolomonException'
  2014. class J extends o {}
  2015. J.kind = 'IllegalStateException'
  2016. class $ {
  2017. constructor(t) {
  2018. this.field = t
  2019. }
  2020. decode(t, e) {
  2021. const r = this.field,
  2022. n = new Z(r, t),
  2023. i = new Int32Array(e)
  2024. let o = !0
  2025. for (let t = 0; t < e; t++) {
  2026. const e = n.evaluateAt(r.exp(t + r.getGeneratorBase()))
  2027. ;(i[i.length - 1 - t] = e), 0 !== e && (o = !1)
  2028. }
  2029. if (o) return
  2030. const s = new Z(r, i),
  2031. a = this.runEuclideanAlgorithm(r.buildMonomial(e, 1), s, e),
  2032. l = a[0],
  2033. c = a[1],
  2034. h = this.findErrorLocations(l),
  2035. u = this.findErrorMagnitudes(c, h)
  2036. for (let e = 0; e < h.length; e++) {
  2037. const n = t.length - 1 - r.log(h[e])
  2038. if (n < 0) throw new q('Bad error location')
  2039. t[n] = K.addOrSubtract(t[n], u[e])
  2040. }
  2041. }
  2042. runEuclideanAlgorithm(t, e, r) {
  2043. if (t.getDegree() < e.getDegree()) {
  2044. const r = t
  2045. ;(t = e), (e = r)
  2046. }
  2047. const n = this.field
  2048. let i = t,
  2049. o = e,
  2050. s = n.getZero(),
  2051. a = n.getOne()
  2052. for (; o.getDegree() >= ((r / 2) | 0); ) {
  2053. let t = i,
  2054. e = s
  2055. if (((i = o), (s = a), i.isZero())) throw new q('r_{i-1} was zero')
  2056. o = t
  2057. let r = n.getZero()
  2058. const l = i.getCoefficient(i.getDegree()),
  2059. c = n.inverse(l)
  2060. for (; o.getDegree() >= i.getDegree() && !o.isZero(); ) {
  2061. const t = o.getDegree() - i.getDegree(),
  2062. e = n.multiply(o.getCoefficient(o.getDegree()), c)
  2063. ;(r = r.addOrSubtract(n.buildMonomial(t, e))), (o = o.addOrSubtract(i.multiplyByMonomial(t, e)))
  2064. }
  2065. if (((a = r.multiply(s).addOrSubtract(e)), o.getDegree() >= i.getDegree())) throw new J('Division algorithm failed to reduce polynomial?')
  2066. }
  2067. const l = a.getCoefficient(0)
  2068. if (0 === l) throw new q('sigmaTilde(0) was zero')
  2069. const c = n.inverse(l)
  2070. return [a.multiplyScalar(c), o.multiplyScalar(c)]
  2071. }
  2072. findErrorLocations(t) {
  2073. const e = t.getDegree()
  2074. if (1 === e) return Int32Array.from([t.getCoefficient(1)])
  2075. const r = new Int32Array(e)
  2076. let n = 0
  2077. const i = this.field
  2078. for (let o = 1; o < i.getSize() && n < e; o++) 0 === t.evaluateAt(o) && ((r[n] = i.inverse(o)), n++)
  2079. if (n !== e) throw new q('Error locator degree does not match number of roots')
  2080. return r
  2081. }
  2082. findErrorMagnitudes(t, e) {
  2083. const r = e.length,
  2084. n = new Int32Array(r),
  2085. i = this.field
  2086. for (let o = 0; o < r; o++) {
  2087. const s = i.inverse(e[o])
  2088. let a = 1
  2089. for (let t = 0; t < r; t++)
  2090. if (o !== t) {
  2091. const r = i.multiply(e[t], s),
  2092. n = 0 == (1 & r) ? 1 | r : -2 & r
  2093. a = i.multiply(a, n)
  2094. }
  2095. ;(n[o] = i.multiply(t.evaluateAt(s), i.inverse(a))), 0 !== i.getGeneratorBase() && (n[o] = i.multiply(n[o], s))
  2096. }
  2097. return n
  2098. }
  2099. }
  2100. !(function(t) {
  2101. ;(t[(t.UPPER = 0)] = 'UPPER'),
  2102. (t[(t.LOWER = 1)] = 'LOWER'),
  2103. (t[(t.MIXED = 2)] = 'MIXED'),
  2104. (t[(t.DIGIT = 3)] = 'DIGIT'),
  2105. (t[(t.PUNCT = 4)] = 'PUNCT'),
  2106. (t[(t.BINARY = 5)] = 'BINARY')
  2107. })(U || (U = {}))
  2108. class tt {
  2109. decode(t) {
  2110. this.ddata = t
  2111. let e = t.getBits(),
  2112. r = this.extractBits(e),
  2113. n = this.correctBits(r),
  2114. i = tt.convertBoolArrayToByteArray(n),
  2115. o = tt.getEncodedData(n),
  2116. s = new W(i, o, null, null)
  2117. return s.setNumBits(n.length), s
  2118. }
  2119. static highLevelDecode(t) {
  2120. return this.getEncodedData(t)
  2121. }
  2122. static getEncodedData(t) {
  2123. let e = t.length,
  2124. r = U.UPPER,
  2125. n = U.UPPER,
  2126. i = '',
  2127. o = 0
  2128. for (; o < e; )
  2129. if (n === U.BINARY) {
  2130. if (e - o < 5) break
  2131. let s = tt.readCode(t, o, 5)
  2132. if (((o += 5), 0 === s)) {
  2133. if (e - o < 11) break
  2134. ;(s = tt.readCode(t, o, 11) + 31), (o += 11)
  2135. }
  2136. for (let r = 0; r < s; r++) {
  2137. if (e - o < 8) {
  2138. o = e
  2139. break
  2140. }
  2141. const r = tt.readCode(t, o, 8)
  2142. ;(i += _.castAsNonUtf8Char(r)), (o += 8)
  2143. }
  2144. n = r
  2145. } else {
  2146. let s = n === U.DIGIT ? 4 : 5
  2147. if (e - o < s) break
  2148. let a = tt.readCode(t, o, s)
  2149. o += s
  2150. let l = tt.getCharacter(n, a)
  2151. l.startsWith('CTRL_') ? ((r = n), (n = tt.getTable(l.charAt(5))), 'L' === l.charAt(6) && (r = n)) : ((i += l), (n = r))
  2152. }
  2153. return i
  2154. }
  2155. static getTable(t) {
  2156. switch (t) {
  2157. case 'L':
  2158. return U.LOWER
  2159. case 'P':
  2160. return U.PUNCT
  2161. case 'M':
  2162. return U.MIXED
  2163. case 'D':
  2164. return U.DIGIT
  2165. case 'B':
  2166. return U.BINARY
  2167. case 'U':
  2168. default:
  2169. return U.UPPER
  2170. }
  2171. }
  2172. static getCharacter(t, e) {
  2173. switch (t) {
  2174. case U.UPPER:
  2175. return tt.UPPER_TABLE[e]
  2176. case U.LOWER:
  2177. return tt.LOWER_TABLE[e]
  2178. case U.MIXED:
  2179. return tt.MIXED_TABLE[e]
  2180. case U.PUNCT:
  2181. return tt.PUNCT_TABLE[e]
  2182. case U.DIGIT:
  2183. return tt.DIGIT_TABLE[e]
  2184. default:
  2185. throw new J('Bad table')
  2186. }
  2187. }
  2188. correctBits(t) {
  2189. let e, r
  2190. this.ddata.getNbLayers() <= 2
  2191. ? ((r = 6), (e = K.AZTEC_DATA_6))
  2192. : this.ddata.getNbLayers() <= 8
  2193. ? ((r = 8), (e = K.AZTEC_DATA_8))
  2194. : this.ddata.getNbLayers() <= 22
  2195. ? ((r = 10), (e = K.AZTEC_DATA_10))
  2196. : ((r = 12), (e = K.AZTEC_DATA_12))
  2197. let n = this.ddata.getNbDatablocks(),
  2198. i = t.length / r
  2199. if (i < n) throw new C()
  2200. let o = t.length % r,
  2201. s = new Int32Array(i)
  2202. for (let e = 0; e < i; e++, o += r) s[e] = tt.readCode(t, o, r)
  2203. try {
  2204. new $(e).decode(s, i - n)
  2205. } catch (t) {
  2206. throw new C(t)
  2207. }
  2208. let a = (1 << r) - 1,
  2209. l = 0
  2210. for (let t = 0; t < n; t++) {
  2211. let e = s[t]
  2212. if (0 === e || e === a) throw new C()
  2213. ;(1 !== e && e !== a - 1) || l++
  2214. }
  2215. let c = new Array(n * r - l),
  2216. h = 0
  2217. for (let t = 0; t < n; t++) {
  2218. let e = s[t]
  2219. if (1 === e || e === a - 1) c.fill(e > 1, h, h + r - 1), (h += r - 1)
  2220. else for (let t = r - 1; t >= 0; --t) c[h++] = 0 != (e & (1 << t))
  2221. }
  2222. return c
  2223. }
  2224. extractBits(t) {
  2225. let e = this.ddata.isCompact(),
  2226. r = this.ddata.getNbLayers(),
  2227. n = (e ? 11 : 14) + 4 * r,
  2228. i = new Int32Array(n),
  2229. o = new Array(this.totalBitsInLayer(r, e))
  2230. if (e) for (let t = 0; t < i.length; t++) i[t] = t
  2231. else {
  2232. let t = n + 1 + 2 * w.truncDivision(w.truncDivision(n, 2) - 1, 15),
  2233. e = n / 2,
  2234. r = w.truncDivision(t, 2)
  2235. for (let t = 0; t < e; t++) {
  2236. let n = t + w.truncDivision(t, 15)
  2237. ;(i[e - t - 1] = r - n - 1), (i[e + t] = r + n + 1)
  2238. }
  2239. }
  2240. for (let s = 0, a = 0; s < r; s++) {
  2241. let l = 4 * (r - s) + (e ? 9 : 12),
  2242. c = 2 * s,
  2243. h = n - 1 - c
  2244. for (let e = 0; e < l; e++) {
  2245. let r = 2 * e
  2246. for (let n = 0; n < 2; n++)
  2247. (o[a + r + n] = t.get(i[c + n], i[c + e])),
  2248. (o[a + 2 * l + r + n] = t.get(i[c + e], i[h - n])),
  2249. (o[a + 4 * l + r + n] = t.get(i[h - n], i[h - e])),
  2250. (o[a + 6 * l + r + n] = t.get(i[h - e], i[c + n]))
  2251. }
  2252. a += 8 * l
  2253. }
  2254. return o
  2255. }
  2256. static readCode(t, e, r) {
  2257. let n = 0
  2258. for (let i = e; i < e + r; i++) (n <<= 1), t[i] && (n |= 1)
  2259. return n
  2260. }
  2261. static readByte(t, e) {
  2262. let r = t.length - e
  2263. return r >= 8 ? tt.readCode(t, e, 8) : tt.readCode(t, e, r) << (8 - r)
  2264. }
  2265. static convertBoolArrayToByteArray(t) {
  2266. let e = new Uint8Array((t.length + 7) / 8)
  2267. for (let r = 0; r < e.length; r++) e[r] = tt.readByte(t, 8 * r)
  2268. return e
  2269. }
  2270. totalBitsInLayer(t, e) {
  2271. return ((e ? 88 : 112) + 16 * t) * t
  2272. }
  2273. }
  2274. ;(tt.UPPER_TABLE = [
  2275. 'CTRL_PS',
  2276. ' ',
  2277. 'A',
  2278. 'B',
  2279. 'C',
  2280. 'D',
  2281. 'E',
  2282. 'F',
  2283. 'G',
  2284. 'H',
  2285. 'I',
  2286. 'J',
  2287. 'K',
  2288. 'L',
  2289. 'M',
  2290. 'N',
  2291. 'O',
  2292. 'P',
  2293. 'Q',
  2294. 'R',
  2295. 'S',
  2296. 'T',
  2297. 'U',
  2298. 'V',
  2299. 'W',
  2300. 'X',
  2301. 'Y',
  2302. 'Z',
  2303. 'CTRL_LL',
  2304. 'CTRL_ML',
  2305. 'CTRL_DL',
  2306. 'CTRL_BS'
  2307. ]),
  2308. (tt.LOWER_TABLE = [
  2309. 'CTRL_PS',
  2310. ' ',
  2311. 'a',
  2312. 'b',
  2313. 'c',
  2314. 'd',
  2315. 'e',
  2316. 'f',
  2317. 'g',
  2318. 'h',
  2319. 'i',
  2320. 'j',
  2321. 'k',
  2322. 'l',
  2323. 'm',
  2324. 'n',
  2325. 'o',
  2326. 'p',
  2327. 'q',
  2328. 'r',
  2329. 's',
  2330. 't',
  2331. 'u',
  2332. 'v',
  2333. 'w',
  2334. 'x',
  2335. 'y',
  2336. 'z',
  2337. 'CTRL_US',
  2338. 'CTRL_ML',
  2339. 'CTRL_DL',
  2340. 'CTRL_BS'
  2341. ]),
  2342. (tt.MIXED_TABLE = [
  2343. 'CTRL_PS',
  2344. ' ',
  2345. '\\1',
  2346. '\\2',
  2347. '\\3',
  2348. '\\4',
  2349. '\\5',
  2350. '\\6',
  2351. '\\7',
  2352. '\b',
  2353. '\t',
  2354. '\n',
  2355. '\\13',
  2356. '\f',
  2357. '\r',
  2358. '\\33',
  2359. '\\34',
  2360. '\\35',
  2361. '\\36',
  2362. '\\37',
  2363. '@',
  2364. '\\',
  2365. '^',
  2366. '_',
  2367. '`',
  2368. '|',
  2369. '~',
  2370. '\\177',
  2371. 'CTRL_LL',
  2372. 'CTRL_UL',
  2373. 'CTRL_PL',
  2374. 'CTRL_BS'
  2375. ]),
  2376. (tt.PUNCT_TABLE = [
  2377. '',
  2378. '\r',
  2379. '\r\n',
  2380. '. ',
  2381. ', ',
  2382. ': ',
  2383. '!',
  2384. '"',
  2385. '#',
  2386. '$',
  2387. '%',
  2388. '&',
  2389. "'",
  2390. '(',
  2391. ')',
  2392. '*',
  2393. '+',
  2394. ',',
  2395. '-',
  2396. '.',
  2397. '/',
  2398. ':',
  2399. ';',
  2400. '<',
  2401. '=',
  2402. '>',
  2403. '?',
  2404. '[',
  2405. ']',
  2406. '{',
  2407. '}',
  2408. 'CTRL_UL'
  2409. ]),
  2410. (tt.DIGIT_TABLE = ['CTRL_PS', ' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ',', '.', 'CTRL_UL', 'CTRL_US'])
  2411. class et {
  2412. constructor() {}
  2413. static round(t) {
  2414. return NaN === t ? 0 : t <= Number.MIN_SAFE_INTEGER ? Number.MIN_SAFE_INTEGER : t >= Number.MAX_SAFE_INTEGER ? Number.MAX_SAFE_INTEGER : (t + (t < 0 ? -0.5 : 0.5)) | 0
  2415. }
  2416. static distance(t, e, r, n) {
  2417. const i = t - r,
  2418. o = e - n
  2419. return Math.sqrt(i * i + o * o)
  2420. }
  2421. static sum(t) {
  2422. let e = 0
  2423. for (let r = 0, n = t.length; r !== n; r++) e += t[r]
  2424. return e
  2425. }
  2426. }
  2427. class rt {
  2428. static floatToIntBits(t) {
  2429. return t
  2430. }
  2431. }
  2432. rt.MAX_VALUE = Number.MAX_SAFE_INTEGER
  2433. class nt {
  2434. constructor(t, e) {
  2435. ;(this.x = t), (this.y = e)
  2436. }
  2437. getX() {
  2438. return this.x
  2439. }
  2440. getY() {
  2441. return this.y
  2442. }
  2443. equals(t) {
  2444. if (t instanceof nt) {
  2445. const e = t
  2446. return this.x === e.x && this.y === e.y
  2447. }
  2448. return !1
  2449. }
  2450. hashCode() {
  2451. return 31 * rt.floatToIntBits(this.x) + rt.floatToIntBits(this.y)
  2452. }
  2453. toString() {
  2454. return '(' + this.x + ',' + this.y + ')'
  2455. }
  2456. static orderBestPatterns(t) {
  2457. const e = this.distance(t[0], t[1]),
  2458. r = this.distance(t[1], t[2]),
  2459. n = this.distance(t[0], t[2])
  2460. let i, o, s
  2461. if (
  2462. (r >= e && r >= n ? ((o = t[0]), (i = t[1]), (s = t[2])) : n >= r && n >= e ? ((o = t[1]), (i = t[0]), (s = t[2])) : ((o = t[2]), (i = t[0]), (s = t[1])),
  2463. this.crossProductZ(i, o, s) < 0)
  2464. ) {
  2465. const t = i
  2466. ;(i = s), (s = t)
  2467. }
  2468. ;(t[0] = i), (t[1] = o), (t[2] = s)
  2469. }
  2470. static distance(t, e) {
  2471. return et.distance(t.x, t.y, e.x, e.y)
  2472. }
  2473. static crossProductZ(t, e, r) {
  2474. const n = e.x,
  2475. i = e.y
  2476. return (r.x - n) * (t.y - i) - (r.y - i) * (t.x - n)
  2477. }
  2478. }
  2479. class it {
  2480. constructor(t, e) {
  2481. ;(this.bits = t), (this.points = e)
  2482. }
  2483. getBits() {
  2484. return this.bits
  2485. }
  2486. getPoints() {
  2487. return this.points
  2488. }
  2489. }
  2490. class ot extends it {
  2491. constructor(t, e, r, n, i) {
  2492. super(t, e), (this.compact = r), (this.nbDatablocks = n), (this.nbLayers = i)
  2493. }
  2494. getNbLayers() {
  2495. return this.nbLayers
  2496. }
  2497. getNbDatablocks() {
  2498. return this.nbDatablocks
  2499. }
  2500. isCompact() {
  2501. return this.compact
  2502. }
  2503. }
  2504. class st {
  2505. constructor(t, e, r, n) {
  2506. ;(this.image = t),
  2507. (this.height = t.getHeight()),
  2508. (this.width = t.getWidth()),
  2509. null == e && (e = st.INIT_SIZE),
  2510. null == r && (r = (t.getWidth() / 2) | 0),
  2511. null == n && (n = (t.getHeight() / 2) | 0)
  2512. const i = (e / 2) | 0
  2513. if (
  2514. ((this.leftInit = r - i),
  2515. (this.rightInit = r + i),
  2516. (this.upInit = n - i),
  2517. (this.downInit = n + i),
  2518. this.upInit < 0 || this.leftInit < 0 || this.downInit >= this.height || this.rightInit >= this.width)
  2519. )
  2520. throw new N()
  2521. }
  2522. detect() {
  2523. let t = this.leftInit,
  2524. e = this.rightInit,
  2525. r = this.upInit,
  2526. n = this.downInit,
  2527. i = !1,
  2528. o = !0,
  2529. s = !1,
  2530. a = !1,
  2531. l = !1,
  2532. c = !1,
  2533. h = !1
  2534. const u = this.width,
  2535. d = this.height
  2536. for (; o; ) {
  2537. o = !1
  2538. let g = !0
  2539. for (; (g || !a) && e < u; ) (g = this.containsBlackPoint(r, n, e, !1)), g ? (e++, (o = !0), (a = !0)) : a || e++
  2540. if (e >= u) {
  2541. i = !0
  2542. break
  2543. }
  2544. let f = !0
  2545. for (; (f || !l) && n < d; ) (f = this.containsBlackPoint(t, e, n, !0)), f ? (n++, (o = !0), (l = !0)) : l || n++
  2546. if (n >= d) {
  2547. i = !0
  2548. break
  2549. }
  2550. let w = !0
  2551. for (; (w || !c) && t >= 0; ) (w = this.containsBlackPoint(r, n, t, !1)), w ? (t--, (o = !0), (c = !0)) : c || t--
  2552. if (t < 0) {
  2553. i = !0
  2554. break
  2555. }
  2556. let A = !0
  2557. for (; (A || !h) && r >= 0; ) (A = this.containsBlackPoint(t, e, r, !0)), A ? (r--, (o = !0), (h = !0)) : h || r--
  2558. if (r < 0) {
  2559. i = !0
  2560. break
  2561. }
  2562. o && (s = !0)
  2563. }
  2564. if (!i && s) {
  2565. const i = e - t
  2566. let o = null
  2567. for (let e = 1; null === o && e < i; e++) o = this.getBlackPointOnSegment(t, n - e, t + e, n)
  2568. if (null == o) throw new N()
  2569. let s = null
  2570. for (let e = 1; null === s && e < i; e++) s = this.getBlackPointOnSegment(t, r + e, t + e, r)
  2571. if (null == s) throw new N()
  2572. let a = null
  2573. for (let t = 1; null === a && t < i; t++) a = this.getBlackPointOnSegment(e, r + t, e - t, r)
  2574. if (null == a) throw new N()
  2575. let l = null
  2576. for (let t = 1; null === l && t < i; t++) l = this.getBlackPointOnSegment(e, n - t, e - t, n)
  2577. if (null == l) throw new N()
  2578. return this.centerEdges(l, o, a, s)
  2579. }
  2580. throw new N()
  2581. }
  2582. getBlackPointOnSegment(t, e, r, n) {
  2583. const i = et.round(et.distance(t, e, r, n)),
  2584. o = (r - t) / i,
  2585. s = (n - e) / i,
  2586. a = this.image
  2587. for (let r = 0; r < i; r++) {
  2588. const n = et.round(t + r * o),
  2589. i = et.round(e + r * s)
  2590. if (a.get(n, i)) return new nt(n, i)
  2591. }
  2592. return null
  2593. }
  2594. centerEdges(t, e, r, n) {
  2595. const i = t.getX(),
  2596. o = t.getY(),
  2597. s = e.getX(),
  2598. a = e.getY(),
  2599. l = r.getX(),
  2600. c = r.getY(),
  2601. h = n.getX(),
  2602. u = n.getY(),
  2603. d = st.CORR
  2604. return i < this.width / 2
  2605. ? [new nt(h - d, u + d), new nt(s + d, a + d), new nt(l - d, c - d), new nt(i + d, o - d)]
  2606. : [new nt(h + d, u + d), new nt(s + d, a - d), new nt(l - d, c + d), new nt(i - d, o - d)]
  2607. }
  2608. containsBlackPoint(t, e, r, n) {
  2609. const i = this.image
  2610. if (n) {
  2611. for (let n = t; n <= e; n++) if (i.get(n, r)) return !0
  2612. } else for (let n = t; n <= e; n++) if (i.get(r, n)) return !0
  2613. return !1
  2614. }
  2615. }
  2616. ;(st.INIT_SIZE = 10), (st.CORR = 1)
  2617. class at {
  2618. static checkAndNudgePoints(t, e) {
  2619. const r = t.getWidth(),
  2620. n = t.getHeight()
  2621. let i = !0
  2622. for (let t = 0; t < e.length && i; t += 2) {
  2623. const o = Math.floor(e[t]),
  2624. s = Math.floor(e[t + 1])
  2625. if (o < -1 || o > r || s < -1 || s > n) throw new N()
  2626. ;(i = !1), -1 === o ? ((e[t] = 0), (i = !0)) : o === r && ((e[t] = r - 1), (i = !0)), -1 === s ? ((e[t + 1] = 0), (i = !0)) : s === n && ((e[t + 1] = n - 1), (i = !0))
  2627. }
  2628. i = !0
  2629. for (let t = e.length - 2; t >= 0 && i; t -= 2) {
  2630. const o = Math.floor(e[t]),
  2631. s = Math.floor(e[t + 1])
  2632. if (o < -1 || o > r || s < -1 || s > n) throw new N()
  2633. ;(i = !1), -1 === o ? ((e[t] = 0), (i = !0)) : o === r && ((e[t] = r - 1), (i = !0)), -1 === s ? ((e[t + 1] = 0), (i = !0)) : s === n && ((e[t + 1] = n - 1), (i = !0))
  2634. }
  2635. }
  2636. }
  2637. class lt {
  2638. constructor(t, e, r, n, i, o, s, a, l) {
  2639. ;(this.a11 = t), (this.a21 = e), (this.a31 = r), (this.a12 = n), (this.a22 = i), (this.a32 = o), (this.a13 = s), (this.a23 = a), (this.a33 = l)
  2640. }
  2641. static quadrilateralToQuadrilateral(t, e, r, n, i, o, s, a, l, c, h, u, d, g, f, w) {
  2642. const A = lt.quadrilateralToSquare(t, e, r, n, i, o, s, a)
  2643. return lt.squareToQuadrilateral(l, c, h, u, d, g, f, w).times(A)
  2644. }
  2645. transformPoints(t) {
  2646. const e = t.length,
  2647. r = this.a11,
  2648. n = this.a12,
  2649. i = this.a13,
  2650. o = this.a21,
  2651. s = this.a22,
  2652. a = this.a23,
  2653. l = this.a31,
  2654. c = this.a32,
  2655. h = this.a33
  2656. for (let u = 0; u < e; u += 2) {
  2657. const e = t[u],
  2658. d = t[u + 1],
  2659. g = i * e + a * d + h
  2660. ;(t[u] = (r * e + o * d + l) / g), (t[u + 1] = (n * e + s * d + c) / g)
  2661. }
  2662. }
  2663. transformPointsWithValues(t, e) {
  2664. const r = this.a11,
  2665. n = this.a12,
  2666. i = this.a13,
  2667. o = this.a21,
  2668. s = this.a22,
  2669. a = this.a23,
  2670. l = this.a31,
  2671. c = this.a32,
  2672. h = this.a33,
  2673. u = t.length
  2674. for (let d = 0; d < u; d++) {
  2675. const u = t[d],
  2676. g = e[d],
  2677. f = i * u + a * g + h
  2678. ;(t[d] = (r * u + o * g + l) / f), (e[d] = (n * u + s * g + c) / f)
  2679. }
  2680. }
  2681. static squareToQuadrilateral(t, e, r, n, i, o, s, a) {
  2682. const l = t - r + i - s,
  2683. c = e - n + o - a
  2684. if (0 === l && 0 === c) return new lt(r - t, i - r, t, n - e, o - n, e, 0, 0, 1)
  2685. {
  2686. const h = r - i,
  2687. u = s - i,
  2688. d = n - o,
  2689. g = a - o,
  2690. f = h * g - u * d,
  2691. w = (l * g - u * c) / f,
  2692. A = (h * c - l * d) / f
  2693. return new lt(r - t + w * r, s - t + A * s, t, n - e + w * n, a - e + A * a, e, w, A, 1)
  2694. }
  2695. }
  2696. static quadrilateralToSquare(t, e, r, n, i, o, s, a) {
  2697. return lt.squareToQuadrilateral(t, e, r, n, i, o, s, a).buildAdjoint()
  2698. }
  2699. buildAdjoint() {
  2700. return new lt(
  2701. this.a22 * this.a33 - this.a23 * this.a32,
  2702. this.a23 * this.a31 - this.a21 * this.a33,
  2703. this.a21 * this.a32 - this.a22 * this.a31,
  2704. this.a13 * this.a32 - this.a12 * this.a33,
  2705. this.a11 * this.a33 - this.a13 * this.a31,
  2706. this.a12 * this.a31 - this.a11 * this.a32,
  2707. this.a12 * this.a23 - this.a13 * this.a22,
  2708. this.a13 * this.a21 - this.a11 * this.a23,
  2709. this.a11 * this.a22 - this.a12 * this.a21
  2710. )
  2711. }
  2712. times(t) {
  2713. return new lt(
  2714. this.a11 * t.a11 + this.a21 * t.a12 + this.a31 * t.a13,
  2715. this.a11 * t.a21 + this.a21 * t.a22 + this.a31 * t.a23,
  2716. this.a11 * t.a31 + this.a21 * t.a32 + this.a31 * t.a33,
  2717. this.a12 * t.a11 + this.a22 * t.a12 + this.a32 * t.a13,
  2718. this.a12 * t.a21 + this.a22 * t.a22 + this.a32 * t.a23,
  2719. this.a12 * t.a31 + this.a22 * t.a32 + this.a32 * t.a33,
  2720. this.a13 * t.a11 + this.a23 * t.a12 + this.a33 * t.a13,
  2721. this.a13 * t.a21 + this.a23 * t.a22 + this.a33 * t.a23,
  2722. this.a13 * t.a31 + this.a23 * t.a32 + this.a33 * t.a33
  2723. )
  2724. }
  2725. }
  2726. class ct extends at {
  2727. sampleGrid(t, e, r, n, i, o, s, a, l, c, h, u, d, g, f, w, A, m, E) {
  2728. const C = lt.quadrilateralToQuadrilateral(n, i, o, s, a, l, c, h, u, d, g, f, w, A, m, E)
  2729. return this.sampleGridWithTransform(t, e, r, C)
  2730. }
  2731. sampleGridWithTransform(t, e, r, n) {
  2732. if (e <= 0 || r <= 0) throw new N()
  2733. const i = new y(e, r),
  2734. o = new Float32Array(2 * e)
  2735. for (let e = 0; e < r; e++) {
  2736. const r = o.length,
  2737. s = e + 0.5
  2738. for (let t = 0; t < r; t += 2) (o[t] = t / 2 + 0.5), (o[t + 1] = s)
  2739. n.transformPoints(o), at.checkAndNudgePoints(t, o)
  2740. try {
  2741. for (let n = 0; n < r; n += 2) t.get(Math.floor(o[n]), Math.floor(o[n + 1])) && i.set(n / 2, e)
  2742. } catch (t) {
  2743. throw new N()
  2744. }
  2745. }
  2746. return i
  2747. }
  2748. }
  2749. class ht {
  2750. static setGridSampler(t) {
  2751. ht.gridSampler = t
  2752. }
  2753. static getInstance() {
  2754. return ht.gridSampler
  2755. }
  2756. }
  2757. ht.gridSampler = new ct()
  2758. class ut {
  2759. constructor(t, e) {
  2760. ;(this.x = t), (this.y = e)
  2761. }
  2762. toResultPoint() {
  2763. return new nt(this.getX(), this.getY())
  2764. }
  2765. getX() {
  2766. return this.x
  2767. }
  2768. getY() {
  2769. return this.y
  2770. }
  2771. }
  2772. class dt {
  2773. constructor(t) {
  2774. ;(this.EXPECTED_CORNER_BITS = new Int32Array([3808, 476, 2107, 1799])), (this.image = t)
  2775. }
  2776. detect() {
  2777. return this.detectMirror(!1)
  2778. }
  2779. detectMirror(t) {
  2780. let e = this.getMatrixCenter(),
  2781. r = this.getBullsEyeCorners(e)
  2782. if (t) {
  2783. let t = r[0]
  2784. ;(r[0] = r[2]), (r[2] = t)
  2785. }
  2786. this.extractParameters(r)
  2787. let n = this.sampleGrid(this.image, r[this.shift % 4], r[(this.shift + 1) % 4], r[(this.shift + 2) % 4], r[(this.shift + 3) % 4]),
  2788. i = this.getMatrixCornerPoints(r)
  2789. return new ot(n, i, this.compact, this.nbDataBlocks, this.nbLayers)
  2790. }
  2791. extractParameters(t) {
  2792. if (!(this.isValidPoint(t[0]) && this.isValidPoint(t[1]) && this.isValidPoint(t[2]) && this.isValidPoint(t[3]))) throw new N()
  2793. let e = 2 * this.nbCenterLayers,
  2794. r = new Int32Array([this.sampleLine(t[0], t[1], e), this.sampleLine(t[1], t[2], e), this.sampleLine(t[2], t[3], e), this.sampleLine(t[3], t[0], e)])
  2795. this.shift = this.getRotation(r, e)
  2796. let n = 0
  2797. for (let t = 0; t < 4; t++) {
  2798. let e = r[(this.shift + t) % 4]
  2799. this.compact ? ((n <<= 7), (n += (e >> 1) & 127)) : ((n <<= 10), (n += ((e >> 2) & 992) + ((e >> 1) & 31)))
  2800. }
  2801. let i = this.getCorrectedParameterData(n, this.compact)
  2802. this.compact ? ((this.nbLayers = 1 + (i >> 6)), (this.nbDataBlocks = 1 + (63 & i))) : ((this.nbLayers = 1 + (i >> 11)), (this.nbDataBlocks = 1 + (2047 & i)))
  2803. }
  2804. getRotation(t, e) {
  2805. let r = 0
  2806. t.forEach((t, n, i) => {
  2807. r = ((t >> (e - 2)) << 1) + (1 & t) + (r << 3)
  2808. }),
  2809. (r = ((1 & r) << 11) + (r >> 1))
  2810. for (let t = 0; t < 4; t++) if (w.bitCount(r ^ this.EXPECTED_CORNER_BITS[t]) <= 2) return t
  2811. throw new N()
  2812. }
  2813. getCorrectedParameterData(t, e) {
  2814. let r, n
  2815. e ? ((r = 7), (n = 2)) : ((r = 10), (n = 4))
  2816. let i = r - n,
  2817. o = new Int32Array(r)
  2818. for (let e = r - 1; e >= 0; --e) (o[e] = 15 & t), (t >>= 4)
  2819. try {
  2820. new $(K.AZTEC_PARAM).decode(o, i)
  2821. } catch (t) {
  2822. throw new N()
  2823. }
  2824. let s = 0
  2825. for (let t = 0; t < n; t++) s = (s << 4) + o[t]
  2826. return s
  2827. }
  2828. getBullsEyeCorners(t) {
  2829. let e = t,
  2830. r = t,
  2831. n = t,
  2832. i = t,
  2833. o = !0
  2834. for (this.nbCenterLayers = 1; this.nbCenterLayers < 9; this.nbCenterLayers++) {
  2835. let t = this.getFirstDifferent(e, o, 1, -1),
  2836. s = this.getFirstDifferent(r, o, 1, 1),
  2837. a = this.getFirstDifferent(n, o, -1, 1),
  2838. l = this.getFirstDifferent(i, o, -1, -1)
  2839. if (this.nbCenterLayers > 2) {
  2840. let r = (this.distancePoint(l, t) * this.nbCenterLayers) / (this.distancePoint(i, e) * (this.nbCenterLayers + 2))
  2841. if (r < 0.75 || r > 1.25 || !this.isWhiteOrBlackRectangle(t, s, a, l)) break
  2842. }
  2843. ;(e = t), (r = s), (n = a), (i = l), (o = !o)
  2844. }
  2845. if (5 !== this.nbCenterLayers && 7 !== this.nbCenterLayers) throw new N()
  2846. this.compact = 5 === this.nbCenterLayers
  2847. let s = new nt(e.getX() + 0.5, e.getY() - 0.5),
  2848. a = new nt(r.getX() + 0.5, r.getY() + 0.5),
  2849. l = new nt(n.getX() - 0.5, n.getY() + 0.5),
  2850. c = new nt(i.getX() - 0.5, i.getY() - 0.5)
  2851. return this.expandSquare([s, a, l, c], 2 * this.nbCenterLayers - 3, 2 * this.nbCenterLayers)
  2852. }
  2853. getMatrixCenter() {
  2854. let t, e, r, n
  2855. try {
  2856. let i = new st(this.image).detect()
  2857. ;(t = i[0]), (e = i[1]), (r = i[2]), (n = i[3])
  2858. } catch (i) {
  2859. let o = this.image.getWidth() / 2,
  2860. s = this.image.getHeight() / 2
  2861. ;(t = this.getFirstDifferent(new ut(o + 7, s - 7), !1, 1, -1).toResultPoint()),
  2862. (e = this.getFirstDifferent(new ut(o + 7, s + 7), !1, 1, 1).toResultPoint()),
  2863. (r = this.getFirstDifferent(new ut(o - 7, s + 7), !1, -1, 1).toResultPoint()),
  2864. (n = this.getFirstDifferent(new ut(o - 7, s - 7), !1, -1, -1).toResultPoint())
  2865. }
  2866. let i = et.round((t.getX() + n.getX() + e.getX() + r.getX()) / 4),
  2867. o = et.round((t.getY() + n.getY() + e.getY() + r.getY()) / 4)
  2868. try {
  2869. let s = new st(this.image, 15, i, o).detect()
  2870. ;(t = s[0]), (e = s[1]), (r = s[2]), (n = s[3])
  2871. } catch (s) {
  2872. ;(t = this.getFirstDifferent(new ut(i + 7, o - 7), !1, 1, -1).toResultPoint()),
  2873. (e = this.getFirstDifferent(new ut(i + 7, o + 7), !1, 1, 1).toResultPoint()),
  2874. (r = this.getFirstDifferent(new ut(i - 7, o + 7), !1, -1, 1).toResultPoint()),
  2875. (n = this.getFirstDifferent(new ut(i - 7, o - 7), !1, -1, -1).toResultPoint())
  2876. }
  2877. return (i = et.round((t.getX() + n.getX() + e.getX() + r.getX()) / 4)), (o = et.round((t.getY() + n.getY() + e.getY() + r.getY()) / 4)), new ut(i, o)
  2878. }
  2879. getMatrixCornerPoints(t) {
  2880. return this.expandSquare(t, 2 * this.nbCenterLayers, this.getDimension())
  2881. }
  2882. sampleGrid(t, e, r, n, i) {
  2883. let o = ht.getInstance(),
  2884. s = this.getDimension(),
  2885. a = s / 2 - this.nbCenterLayers,
  2886. l = s / 2 + this.nbCenterLayers
  2887. return o.sampleGrid(t, s, s, a, a, l, a, l, l, a, l, e.getX(), e.getY(), r.getX(), r.getY(), n.getX(), n.getY(), i.getX(), i.getY())
  2888. }
  2889. sampleLine(t, e, r) {
  2890. let n = 0,
  2891. i = this.distanceResultPoint(t, e),
  2892. o = i / r,
  2893. s = t.getX(),
  2894. a = t.getY(),
  2895. l = (o * (e.getX() - t.getX())) / i,
  2896. c = (o * (e.getY() - t.getY())) / i
  2897. for (let t = 0; t < r; t++) this.image.get(et.round(s + t * l), et.round(a + t * c)) && (n |= 1 << (r - t - 1))
  2898. return n
  2899. }
  2900. isWhiteOrBlackRectangle(t, e, r, n) {
  2901. ;(t = new ut(t.getX() - 3, t.getY() + 3)), (e = new ut(e.getX() - 3, e.getY() - 3)), (r = new ut(r.getX() + 3, r.getY() - 3)), (n = new ut(n.getX() + 3, n.getY() + 3))
  2902. let i = this.getColor(n, t)
  2903. if (0 === i) return !1
  2904. let o = this.getColor(t, e)
  2905. return o === i && ((o = this.getColor(e, r)), o === i && ((o = this.getColor(r, n)), o === i))
  2906. }
  2907. getColor(t, e) {
  2908. let r = this.distancePoint(t, e),
  2909. n = (e.getX() - t.getX()) / r,
  2910. i = (e.getY() - t.getY()) / r,
  2911. o = 0,
  2912. s = t.getX(),
  2913. a = t.getY(),
  2914. l = this.image.get(t.getX(), t.getY()),
  2915. c = Math.ceil(r)
  2916. for (let t = 0; t < c; t++) (s += n), (a += i), this.image.get(et.round(s), et.round(a)) !== l && o++
  2917. let h = o / r
  2918. return h > 0.1 && h < 0.9 ? 0 : h <= 0.1 === l ? 1 : -1
  2919. }
  2920. getFirstDifferent(t, e, r, n) {
  2921. let i = t.getX() + r,
  2922. o = t.getY() + n
  2923. for (; this.isValid(i, o) && this.image.get(i, o) === e; ) (i += r), (o += n)
  2924. for (i -= r, o -= n; this.isValid(i, o) && this.image.get(i, o) === e; ) i += r
  2925. for (i -= r; this.isValid(i, o) && this.image.get(i, o) === e; ) o += n
  2926. return (o -= n), new ut(i, o)
  2927. }
  2928. expandSquare(t, e, r) {
  2929. let n = r / (2 * e),
  2930. i = t[0].getX() - t[2].getX(),
  2931. o = t[0].getY() - t[2].getY(),
  2932. s = (t[0].getX() + t[2].getX()) / 2,
  2933. a = (t[0].getY() + t[2].getY()) / 2,
  2934. l = new nt(s + n * i, a + n * o),
  2935. c = new nt(s - n * i, a - n * o)
  2936. return (
  2937. (i = t[1].getX() - t[3].getX()),
  2938. (o = t[1].getY() - t[3].getY()),
  2939. (s = (t[1].getX() + t[3].getX()) / 2),
  2940. (a = (t[1].getY() + t[3].getY()) / 2),
  2941. [l, new nt(s + n * i, a + n * o), c, new nt(s - n * i, a - n * o)]
  2942. )
  2943. }
  2944. isValid(t, e) {
  2945. return t >= 0 && t < this.image.getWidth() && e > 0 && e < this.image.getHeight()
  2946. }
  2947. isValidPoint(t) {
  2948. let e = et.round(t.getX()),
  2949. r = et.round(t.getY())
  2950. return this.isValid(e, r)
  2951. }
  2952. distancePoint(t, e) {
  2953. return et.distance(t.getX(), t.getY(), e.getX(), e.getY())
  2954. }
  2955. distanceResultPoint(t, e) {
  2956. return et.distance(t.getX(), t.getY(), e.getX(), e.getY())
  2957. }
  2958. getDimension() {
  2959. return this.compact ? 4 * this.nbLayers + 11 : this.nbLayers <= 4 ? 4 * this.nbLayers + 15 : 4 * this.nbLayers + 2 * (w.truncDivision(this.nbLayers - 4, 8) + 1) + 15
  2960. }
  2961. }
  2962. class gt {
  2963. decode(t, e = null) {
  2964. let r = null,
  2965. n = new dt(t.getBlackMatrix()),
  2966. i = null,
  2967. o = null
  2968. try {
  2969. let t = n.detectMirror(!1)
  2970. ;(i = t.getPoints()), this.reportFoundResultPoints(e, i), (o = new tt().decode(t))
  2971. } catch (t) {
  2972. r = t
  2973. }
  2974. if (null == o)
  2975. try {
  2976. let t = n.detectMirror(!0)
  2977. ;(i = t.getPoints()), this.reportFoundResultPoints(e, i), (o = new tt().decode(t))
  2978. } catch (t) {
  2979. if (null != r) throw r
  2980. throw t
  2981. }
  2982. let s = new F(o.getText(), o.getRawBytes(), o.getNumBits(), i, k.AZTEC, u.currentTimeMillis()),
  2983. a = o.getByteSegments()
  2984. null != a && s.putMetadata(X.BYTE_SEGMENTS, a)
  2985. let l = o.getECLevel()
  2986. return null != l && s.putMetadata(X.ERROR_CORRECTION_LEVEL, l), s
  2987. }
  2988. reportFoundResultPoints(t, e) {
  2989. if (null != t) {
  2990. let r = t.get(E.NEED_RESULT_POINT_CALLBACK)
  2991. null != r &&
  2992. e.forEach((t, e, n) => {
  2993. r.foundPossibleResultPoint(t)
  2994. })
  2995. }
  2996. }
  2997. reset() {}
  2998. }
  2999. class ft {
  3000. decode(t, e) {
  3001. try {
  3002. return this.doDecode(t, e)
  3003. } catch (r) {
  3004. if (e && !0 === e.get(E.TRY_HARDER) && t.isRotateSupported()) {
  3005. const r = t.rotateCounterClockwise(),
  3006. n = this.doDecode(r, e),
  3007. i = n.getResultMetadata()
  3008. let o = 270
  3009. null !== i && !0 === i.get(X.ORIENTATION) && (o += i.get(X.ORIENTATION) % 360), n.putMetadata(X.ORIENTATION, o)
  3010. const s = n.getResultPoints()
  3011. if (null !== s) {
  3012. const t = r.getHeight()
  3013. for (let e = 0; e < s.length; e++) s[e] = new nt(t - s[e].getY() - 1, s[e].getX())
  3014. }
  3015. return n
  3016. }
  3017. throw new N()
  3018. }
  3019. }
  3020. reset() {}
  3021. doDecode(t, e) {
  3022. const r = t.getWidth(),
  3023. n = t.getHeight()
  3024. let i = new A(r)
  3025. const o = e && !0 === e.get(E.TRY_HARDER),
  3026. s = Math.max(1, n >> (o ? 8 : 5))
  3027. let a
  3028. a = o ? n : 15
  3029. const l = Math.trunc(n / 2)
  3030. for (let o = 0; o < a; o++) {
  3031. const a = Math.trunc((o + 1) / 2),
  3032. c = l + s * (0 == (1 & o) ? a : -a)
  3033. if (c < 0 || c >= n) break
  3034. try {
  3035. i = t.getBlackRow(c, i)
  3036. } catch (t) {
  3037. continue
  3038. }
  3039. for (let t = 0; t < 2; t++) {
  3040. if (1 === t && (i.reverse(), e && !0 === e.get(E.NEED_RESULT_POINT_CALLBACK))) {
  3041. const t = new Map()
  3042. e.forEach((e, r) => t.set(r, e)), t.delete(E.NEED_RESULT_POINT_CALLBACK), (e = t)
  3043. }
  3044. try {
  3045. const n = this.decodeRow(c, i, e)
  3046. if (1 === t) {
  3047. n.putMetadata(X.ORIENTATION, 180)
  3048. const t = n.getResultPoints()
  3049. null !== t && ((t[0] = new nt(r - t[0].getX() - 1, t[0].getY())), (t[1] = new nt(r - t[1].getX() - 1, t[1].getY())))
  3050. }
  3051. return n
  3052. } catch (t) {}
  3053. }
  3054. }
  3055. throw new N()
  3056. }
  3057. static recordPattern(t, e, r) {
  3058. const n = r.length
  3059. for (let t = 0; t < n; t++) r[t] = 0
  3060. const i = t.getSize()
  3061. if (e >= i) throw new N()
  3062. let o = !t.get(e),
  3063. s = 0,
  3064. a = e
  3065. for (; a < i; ) {
  3066. if (t.get(a) !== o) r[s]++
  3067. else {
  3068. if (++s === n) break
  3069. ;(r[s] = 1), (o = !o)
  3070. }
  3071. a++
  3072. }
  3073. if (s !== n && (s !== n - 1 || a !== i)) throw new N()
  3074. }
  3075. static recordPatternInReverse(t, e, r) {
  3076. let n = r.length,
  3077. i = t.get(e)
  3078. for (; e > 0 && n >= 0; ) t.get(--e) !== i && (n--, (i = !i))
  3079. if (n >= 0) throw new N()
  3080. ft.recordPattern(t, e + 1, r)
  3081. }
  3082. static patternMatchVariance(t, e, r) {
  3083. const n = t.length
  3084. let i = 0,
  3085. o = 0
  3086. for (let r = 0; r < n; r++) (i += t[r]), (o += e[r])
  3087. if (i < o) return Number.POSITIVE_INFINITY
  3088. const s = i / o
  3089. r *= s
  3090. let a = 0
  3091. for (let i = 0; i < n; i++) {
  3092. const n = t[i],
  3093. o = e[i] * s,
  3094. l = n > o ? n - o : o - n
  3095. if (l > r) return Number.POSITIVE_INFINITY
  3096. a += l
  3097. }
  3098. return a / i
  3099. }
  3100. }
  3101. class wt extends ft {
  3102. static findStartPattern(t) {
  3103. const e = t.getSize(),
  3104. r = t.getNextSet(0)
  3105. let n = 0,
  3106. i = Int32Array.from([0, 0, 0, 0, 0, 0]),
  3107. o = r,
  3108. s = !1
  3109. for (let a = r; a < e; a++)
  3110. if (t.get(a) !== s) i[n]++
  3111. else {
  3112. if (5 === n) {
  3113. let e = wt.MAX_AVG_VARIANCE,
  3114. r = -1
  3115. for (let t = wt.CODE_START_A; t <= wt.CODE_START_C; t++) {
  3116. const n = ft.patternMatchVariance(i, wt.CODE_PATTERNS[t], wt.MAX_INDIVIDUAL_VARIANCE)
  3117. n < e && ((e = n), (r = t))
  3118. }
  3119. if (r >= 0 && t.isRange(Math.max(0, o - (a - o) / 2), o, !1)) return Int32Array.from([o, a, r])
  3120. ;(o += i[0] + i[1]), (i = i.slice(2, i.length - 1)), (i[n - 1] = 0), (i[n] = 0), n--
  3121. } else n++
  3122. ;(i[n] = 1), (s = !s)
  3123. }
  3124. throw new N()
  3125. }
  3126. static decodeCode(t, e, r) {
  3127. ft.recordPattern(t, r, e)
  3128. let n = wt.MAX_AVG_VARIANCE,
  3129. i = -1
  3130. for (let t = 0; t < wt.CODE_PATTERNS.length; t++) {
  3131. const r = wt.CODE_PATTERNS[t],
  3132. o = this.patternMatchVariance(e, r, wt.MAX_INDIVIDUAL_VARIANCE)
  3133. o < n && ((n = o), (i = t))
  3134. }
  3135. if (i >= 0) return i
  3136. throw new N()
  3137. }
  3138. decodeRow(t, e, r) {
  3139. const n = r && !0 === r.get(E.ASSUME_GS1),
  3140. i = wt.findStartPattern(e),
  3141. o = i[2]
  3142. let s = 0
  3143. const a = new Uint8Array(20)
  3144. let l
  3145. switch (((a[s++] = o), o)) {
  3146. case wt.CODE_START_A:
  3147. l = wt.CODE_CODE_A
  3148. break
  3149. case wt.CODE_START_B:
  3150. l = wt.CODE_CODE_B
  3151. break
  3152. case wt.CODE_START_C:
  3153. l = wt.CODE_CODE_C
  3154. break
  3155. default:
  3156. throw new C()
  3157. }
  3158. let h = !1,
  3159. u = !1,
  3160. d = '',
  3161. g = i[0],
  3162. f = i[1]
  3163. const w = Int32Array.from([0, 0, 0, 0, 0, 0])
  3164. let A = 0,
  3165. m = 0,
  3166. I = o,
  3167. p = 0,
  3168. S = !0,
  3169. _ = !1,
  3170. T = !1
  3171. for (; !h; ) {
  3172. const t = u
  3173. switch (
  3174. ((u = !1),
  3175. (A = m),
  3176. (m = wt.decodeCode(e, w, f)),
  3177. (a[s++] = m),
  3178. m !== wt.CODE_STOP && (S = !0),
  3179. m !== wt.CODE_STOP && (p++, (I += p * m)),
  3180. (g = f),
  3181. (f += w.reduce((t, e) => t + e, 0)),
  3182. m)
  3183. ) {
  3184. case wt.CODE_START_A:
  3185. case wt.CODE_START_B:
  3186. case wt.CODE_START_C:
  3187. throw new C()
  3188. }
  3189. switch (l) {
  3190. case wt.CODE_CODE_A:
  3191. if (m < 64) (d += T === _ ? String.fromCharCode(' '.charCodeAt(0) + m) : String.fromCharCode(' '.charCodeAt(0) + m + 128)), (T = !1)
  3192. else if (m < 96) (d += T === _ ? String.fromCharCode(m - 64) : String.fromCharCode(m + 64)), (T = !1)
  3193. else
  3194. switch ((m !== wt.CODE_STOP && (S = !1), m)) {
  3195. case wt.CODE_FNC_1:
  3196. n && (0 === d.length ? (d += ']C1') : (d += String.fromCharCode(29)))
  3197. break
  3198. case wt.CODE_FNC_2:
  3199. case wt.CODE_FNC_3:
  3200. break
  3201. case wt.CODE_FNC_4_A:
  3202. !_ && T ? ((_ = !0), (T = !1)) : _ && T ? ((_ = !1), (T = !1)) : (T = !0)
  3203. break
  3204. case wt.CODE_SHIFT:
  3205. ;(u = !0), (l = wt.CODE_CODE_B)
  3206. break
  3207. case wt.CODE_CODE_B:
  3208. l = wt.CODE_CODE_B
  3209. break
  3210. case wt.CODE_CODE_C:
  3211. l = wt.CODE_CODE_C
  3212. break
  3213. case wt.CODE_STOP:
  3214. h = !0
  3215. }
  3216. break
  3217. case wt.CODE_CODE_B:
  3218. if (m < 96) (d += T === _ ? String.fromCharCode(' '.charCodeAt(0) + m) : String.fromCharCode(' '.charCodeAt(0) + m + 128)), (T = !1)
  3219. else
  3220. switch ((m !== wt.CODE_STOP && (S = !1), m)) {
  3221. case wt.CODE_FNC_1:
  3222. n && (0 === d.length ? (d += ']C1') : (d += String.fromCharCode(29)))
  3223. break
  3224. case wt.CODE_FNC_2:
  3225. case wt.CODE_FNC_3:
  3226. break
  3227. case wt.CODE_FNC_4_B:
  3228. !_ && T ? ((_ = !0), (T = !1)) : _ && T ? ((_ = !1), (T = !1)) : (T = !0)
  3229. break
  3230. case wt.CODE_SHIFT:
  3231. ;(u = !0), (l = wt.CODE_CODE_A)
  3232. break
  3233. case wt.CODE_CODE_A:
  3234. l = wt.CODE_CODE_A
  3235. break
  3236. case wt.CODE_CODE_C:
  3237. l = wt.CODE_CODE_C
  3238. break
  3239. case wt.CODE_STOP:
  3240. h = !0
  3241. }
  3242. break
  3243. case wt.CODE_CODE_C:
  3244. if (m < 100) m < 10 && (d += '0'), (d += m)
  3245. else
  3246. switch ((m !== wt.CODE_STOP && (S = !1), m)) {
  3247. case wt.CODE_FNC_1:
  3248. n && (0 === d.length ? (d += ']C1') : (d += String.fromCharCode(29)))
  3249. break
  3250. case wt.CODE_CODE_A:
  3251. l = wt.CODE_CODE_A
  3252. break
  3253. case wt.CODE_CODE_B:
  3254. l = wt.CODE_CODE_B
  3255. break
  3256. case wt.CODE_STOP:
  3257. h = !0
  3258. }
  3259. }
  3260. t && (l = l === wt.CODE_CODE_A ? wt.CODE_CODE_B : wt.CODE_CODE_A)
  3261. }
  3262. const y = f - g
  3263. if (((f = e.getNextUnset(f)), !e.isRange(f, Math.min(e.getSize(), f + (f - g) / 2), !1))) throw new N()
  3264. if (((I -= p * A), I % 103 !== A)) throw new c()
  3265. const M = d.length
  3266. if (0 === M) throw new N()
  3267. M > 0 && S && (d = l === wt.CODE_CODE_C ? d.substring(0, M - 2) : d.substring(0, M - 1))
  3268. const D = (i[1] + i[0]) / 2,
  3269. R = g + y / 2,
  3270. O = a.length,
  3271. b = new Uint8Array(O)
  3272. for (let t = 0; t < O; t++) b[t] = a[t]
  3273. const L = [new nt(D, t), new nt(R, t)]
  3274. return new F(d, b, 0, L, k.CODE_128, new Date().getTime())
  3275. }
  3276. }
  3277. ;(wt.CODE_PATTERNS = [
  3278. Int32Array.from([2, 1, 2, 2, 2, 2]),
  3279. Int32Array.from([2, 2, 2, 1, 2, 2]),
  3280. Int32Array.from([2, 2, 2, 2, 2, 1]),
  3281. Int32Array.from([1, 2, 1, 2, 2, 3]),
  3282. Int32Array.from([1, 2, 1, 3, 2, 2]),
  3283. Int32Array.from([1, 3, 1, 2, 2, 2]),
  3284. Int32Array.from([1, 2, 2, 2, 1, 3]),
  3285. Int32Array.from([1, 2, 2, 3, 1, 2]),
  3286. Int32Array.from([1, 3, 2, 2, 1, 2]),
  3287. Int32Array.from([2, 2, 1, 2, 1, 3]),
  3288. Int32Array.from([2, 2, 1, 3, 1, 2]),
  3289. Int32Array.from([2, 3, 1, 2, 1, 2]),
  3290. Int32Array.from([1, 1, 2, 2, 3, 2]),
  3291. Int32Array.from([1, 2, 2, 1, 3, 2]),
  3292. Int32Array.from([1, 2, 2, 2, 3, 1]),
  3293. Int32Array.from([1, 1, 3, 2, 2, 2]),
  3294. Int32Array.from([1, 2, 3, 1, 2, 2]),
  3295. Int32Array.from([1, 2, 3, 2, 2, 1]),
  3296. Int32Array.from([2, 2, 3, 2, 1, 1]),
  3297. Int32Array.from([2, 2, 1, 1, 3, 2]),
  3298. Int32Array.from([2, 2, 1, 2, 3, 1]),
  3299. Int32Array.from([2, 1, 3, 2, 1, 2]),
  3300. Int32Array.from([2, 2, 3, 1, 1, 2]),
  3301. Int32Array.from([3, 1, 2, 1, 3, 1]),
  3302. Int32Array.from([3, 1, 1, 2, 2, 2]),
  3303. Int32Array.from([3, 2, 1, 1, 2, 2]),
  3304. Int32Array.from([3, 2, 1, 2, 2, 1]),
  3305. Int32Array.from([3, 1, 2, 2, 1, 2]),
  3306. Int32Array.from([3, 2, 2, 1, 1, 2]),
  3307. Int32Array.from([3, 2, 2, 2, 1, 1]),
  3308. Int32Array.from([2, 1, 2, 1, 2, 3]),
  3309. Int32Array.from([2, 1, 2, 3, 2, 1]),
  3310. Int32Array.from([2, 3, 2, 1, 2, 1]),
  3311. Int32Array.from([1, 1, 1, 3, 2, 3]),
  3312. Int32Array.from([1, 3, 1, 1, 2, 3]),
  3313. Int32Array.from([1, 3, 1, 3, 2, 1]),
  3314. Int32Array.from([1, 1, 2, 3, 1, 3]),
  3315. Int32Array.from([1, 3, 2, 1, 1, 3]),
  3316. Int32Array.from([1, 3, 2, 3, 1, 1]),
  3317. Int32Array.from([2, 1, 1, 3, 1, 3]),
  3318. Int32Array.from([2, 3, 1, 1, 1, 3]),
  3319. Int32Array.from([2, 3, 1, 3, 1, 1]),
  3320. Int32Array.from([1, 1, 2, 1, 3, 3]),
  3321. Int32Array.from([1, 1, 2, 3, 3, 1]),
  3322. Int32Array.from([1, 3, 2, 1, 3, 1]),
  3323. Int32Array.from([1, 1, 3, 1, 2, 3]),
  3324. Int32Array.from([1, 1, 3, 3, 2, 1]),
  3325. Int32Array.from([1, 3, 3, 1, 2, 1]),
  3326. Int32Array.from([3, 1, 3, 1, 2, 1]),
  3327. Int32Array.from([2, 1, 1, 3, 3, 1]),
  3328. Int32Array.from([2, 3, 1, 1, 3, 1]),
  3329. Int32Array.from([2, 1, 3, 1, 1, 3]),
  3330. Int32Array.from([2, 1, 3, 3, 1, 1]),
  3331. Int32Array.from([2, 1, 3, 1, 3, 1]),
  3332. Int32Array.from([3, 1, 1, 1, 2, 3]),
  3333. Int32Array.from([3, 1, 1, 3, 2, 1]),
  3334. Int32Array.from([3, 3, 1, 1, 2, 1]),
  3335. Int32Array.from([3, 1, 2, 1, 1, 3]),
  3336. Int32Array.from([3, 1, 2, 3, 1, 1]),
  3337. Int32Array.from([3, 3, 2, 1, 1, 1]),
  3338. Int32Array.from([3, 1, 4, 1, 1, 1]),
  3339. Int32Array.from([2, 2, 1, 4, 1, 1]),
  3340. Int32Array.from([4, 3, 1, 1, 1, 1]),
  3341. Int32Array.from([1, 1, 1, 2, 2, 4]),
  3342. Int32Array.from([1, 1, 1, 4, 2, 2]),
  3343. Int32Array.from([1, 2, 1, 1, 2, 4]),
  3344. Int32Array.from([1, 2, 1, 4, 2, 1]),
  3345. Int32Array.from([1, 4, 1, 1, 2, 2]),
  3346. Int32Array.from([1, 4, 1, 2, 2, 1]),
  3347. Int32Array.from([1, 1, 2, 2, 1, 4]),
  3348. Int32Array.from([1, 1, 2, 4, 1, 2]),
  3349. Int32Array.from([1, 2, 2, 1, 1, 4]),
  3350. Int32Array.from([1, 2, 2, 4, 1, 1]),
  3351. Int32Array.from([1, 4, 2, 1, 1, 2]),
  3352. Int32Array.from([1, 4, 2, 2, 1, 1]),
  3353. Int32Array.from([2, 4, 1, 2, 1, 1]),
  3354. Int32Array.from([2, 2, 1, 1, 1, 4]),
  3355. Int32Array.from([4, 1, 3, 1, 1, 1]),
  3356. Int32Array.from([2, 4, 1, 1, 1, 2]),
  3357. Int32Array.from([1, 3, 4, 1, 1, 1]),
  3358. Int32Array.from([1, 1, 1, 2, 4, 2]),
  3359. Int32Array.from([1, 2, 1, 1, 4, 2]),
  3360. Int32Array.from([1, 2, 1, 2, 4, 1]),
  3361. Int32Array.from([1, 1, 4, 2, 1, 2]),
  3362. Int32Array.from([1, 2, 4, 1, 1, 2]),
  3363. Int32Array.from([1, 2, 4, 2, 1, 1]),
  3364. Int32Array.from([4, 1, 1, 2, 1, 2]),
  3365. Int32Array.from([4, 2, 1, 1, 1, 2]),
  3366. Int32Array.from([4, 2, 1, 2, 1, 1]),
  3367. Int32Array.from([2, 1, 2, 1, 4, 1]),
  3368. Int32Array.from([2, 1, 4, 1, 2, 1]),
  3369. Int32Array.from([4, 1, 2, 1, 2, 1]),
  3370. Int32Array.from([1, 1, 1, 1, 4, 3]),
  3371. Int32Array.from([1, 1, 1, 3, 4, 1]),
  3372. Int32Array.from([1, 3, 1, 1, 4, 1]),
  3373. Int32Array.from([1, 1, 4, 1, 1, 3]),
  3374. Int32Array.from([1, 1, 4, 3, 1, 1]),
  3375. Int32Array.from([4, 1, 1, 1, 1, 3]),
  3376. Int32Array.from([4, 1, 1, 3, 1, 1]),
  3377. Int32Array.from([1, 1, 3, 1, 4, 1]),
  3378. Int32Array.from([1, 1, 4, 1, 3, 1]),
  3379. Int32Array.from([3, 1, 1, 1, 4, 1]),
  3380. Int32Array.from([4, 1, 1, 1, 3, 1]),
  3381. Int32Array.from([2, 1, 1, 4, 1, 2]),
  3382. Int32Array.from([2, 1, 1, 2, 1, 4]),
  3383. Int32Array.from([2, 1, 1, 2, 3, 2]),
  3384. Int32Array.from([2, 3, 3, 1, 1, 1, 2])
  3385. ]),
  3386. (wt.MAX_AVG_VARIANCE = 0.25),
  3387. (wt.MAX_INDIVIDUAL_VARIANCE = 0.7),
  3388. (wt.CODE_SHIFT = 98),
  3389. (wt.CODE_CODE_C = 99),
  3390. (wt.CODE_CODE_B = 100),
  3391. (wt.CODE_CODE_A = 101),
  3392. (wt.CODE_FNC_1 = 102),
  3393. (wt.CODE_FNC_2 = 97),
  3394. (wt.CODE_FNC_3 = 96),
  3395. (wt.CODE_FNC_4_A = 101),
  3396. (wt.CODE_FNC_4_B = 100),
  3397. (wt.CODE_START_A = 103),
  3398. (wt.CODE_START_B = 104),
  3399. (wt.CODE_START_C = 105),
  3400. (wt.CODE_STOP = 106)
  3401. class At extends ft {
  3402. constructor(t = !1, e = !1) {
  3403. super(), (this.usingCheckDigit = t), (this.extendedMode = e), (this.decodeRowResult = ''), (this.counters = new Int32Array(9))
  3404. }
  3405. decodeRow(t, e, r) {
  3406. let n = this.counters
  3407. n.fill(0), (this.decodeRowResult = '')
  3408. let i,
  3409. o,
  3410. s = At.findAsteriskPattern(e, n),
  3411. a = e.getNextSet(s[1]),
  3412. l = e.getSize()
  3413. do {
  3414. At.recordPattern(e, a, n)
  3415. let t = At.toNarrowWidePattern(n)
  3416. if (t < 0) throw new N()
  3417. ;(i = At.patternToChar(t)), (this.decodeRowResult += i), (o = a)
  3418. for (let t of n) a += t
  3419. a = e.getNextSet(a)
  3420. } while ('*' !== i)
  3421. this.decodeRowResult = this.decodeRowResult.substring(0, this.decodeRowResult.length - 1)
  3422. let h,
  3423. u = 0
  3424. for (let t of n) u += t
  3425. if (a !== l && 2 * (a - o - u) < u) throw new N()
  3426. if (this.usingCheckDigit) {
  3427. let t = this.decodeRowResult.length - 1,
  3428. e = 0
  3429. for (let r = 0; r < t; r++) e += At.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(r))
  3430. if (this.decodeRowResult.charAt(t) !== At.ALPHABET_STRING.charAt(e % 43)) throw new c()
  3431. this.decodeRowResult = this.decodeRowResult.substring(0, t)
  3432. }
  3433. if (0 === this.decodeRowResult.length) throw new N()
  3434. h = this.extendedMode ? At.decodeExtended(this.decodeRowResult) : this.decodeRowResult
  3435. let d = (s[1] + s[0]) / 2,
  3436. g = o + u / 2
  3437. return new F(h, null, 0, [new nt(d, t), new nt(g, t)], k.CODE_39, new Date().getTime())
  3438. }
  3439. static findAsteriskPattern(t, e) {
  3440. let r = t.getSize(),
  3441. n = t.getNextSet(0),
  3442. i = 0,
  3443. o = n,
  3444. s = !1,
  3445. a = e.length
  3446. for (let l = n; l < r; l++)
  3447. if (t.get(l) !== s) e[i]++
  3448. else {
  3449. if (i === a - 1) {
  3450. if (this.toNarrowWidePattern(e) === At.ASTERISK_ENCODING && t.isRange(Math.max(0, o - Math.floor((l - o) / 2)), o, !1)) return [o, l]
  3451. ;(o += e[0] + e[1]), e.copyWithin(0, 2, 2 + i - 1), (e[i - 1] = 0), (e[i] = 0), i--
  3452. } else i++
  3453. ;(e[i] = 1), (s = !s)
  3454. }
  3455. throw new N()
  3456. }
  3457. static toNarrowWidePattern(t) {
  3458. let e,
  3459. r = t.length,
  3460. n = 0
  3461. do {
  3462. let i = 2147483647
  3463. for (let e of t) e < i && e > n && (i = e)
  3464. ;(n = i), (e = 0)
  3465. let o = 0,
  3466. s = 0
  3467. for (let i = 0; i < r; i++) {
  3468. let a = t[i]
  3469. a > n && ((s |= 1 << (r - 1 - i)), e++, (o += a))
  3470. }
  3471. if (3 === e) {
  3472. for (let i = 0; i < r && e > 0; i++) {
  3473. let r = t[i]
  3474. if (r > n && (e--, 2 * r >= o)) return -1
  3475. }
  3476. return s
  3477. }
  3478. } while (e > 3)
  3479. return -1
  3480. }
  3481. static patternToChar(t) {
  3482. for (let e = 0; e < At.CHARACTER_ENCODINGS.length; e++) if (At.CHARACTER_ENCODINGS[e] === t) return At.ALPHABET_STRING.charAt(e)
  3483. if (t === At.ASTERISK_ENCODING) return '*'
  3484. throw new N()
  3485. }
  3486. static decodeExtended(t) {
  3487. let e = t.length,
  3488. r = ''
  3489. for (let n = 0; n < e; n++) {
  3490. let e = t.charAt(n)
  3491. if ('+' === e || '$' === e || '%' === e || '/' === e) {
  3492. let i = t.charAt(n + 1),
  3493. o = '\0'
  3494. switch (e) {
  3495. case '+':
  3496. if (!(i >= 'A' && i <= 'Z')) throw new C()
  3497. o = String.fromCharCode(i.charCodeAt(0) + 32)
  3498. break
  3499. case '$':
  3500. if (!(i >= 'A' && i <= 'Z')) throw new C()
  3501. o = String.fromCharCode(i.charCodeAt(0) - 64)
  3502. break
  3503. case '%':
  3504. if (i >= 'A' && i <= 'E') o = String.fromCharCode(i.charCodeAt(0) - 38)
  3505. else if (i >= 'F' && i <= 'J') o = String.fromCharCode(i.charCodeAt(0) - 11)
  3506. else if (i >= 'K' && i <= 'O') o = String.fromCharCode(i.charCodeAt(0) + 16)
  3507. else if (i >= 'P' && i <= 'T') o = String.fromCharCode(i.charCodeAt(0) + 43)
  3508. else if ('U' === i) o = '\0'
  3509. else if ('V' === i) o = '@'
  3510. else if ('W' === i) o = '`'
  3511. else {
  3512. if ('X' !== i && 'Y' !== i && 'Z' !== i) throw new C()
  3513. o = ''
  3514. }
  3515. break
  3516. case '/':
  3517. if (i >= 'A' && i <= 'O') o = String.fromCharCode(i.charCodeAt(0) - 32)
  3518. else {
  3519. if ('Z' !== i) throw new C()
  3520. o = ':'
  3521. }
  3522. }
  3523. ;(r += o), n++
  3524. } else r += e
  3525. }
  3526. return r
  3527. }
  3528. }
  3529. ;(At.ALPHABET_STRING = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%'),
  3530. (At.CHARACTER_ENCODINGS = [
  3531. 52,
  3532. 289,
  3533. 97,
  3534. 352,
  3535. 49,
  3536. 304,
  3537. 112,
  3538. 37,
  3539. 292,
  3540. 100,
  3541. 265,
  3542. 73,
  3543. 328,
  3544. 25,
  3545. 280,
  3546. 88,
  3547. 13,
  3548. 268,
  3549. 76,
  3550. 28,
  3551. 259,
  3552. 67,
  3553. 322,
  3554. 19,
  3555. 274,
  3556. 82,
  3557. 7,
  3558. 262,
  3559. 70,
  3560. 22,
  3561. 385,
  3562. 193,
  3563. 448,
  3564. 145,
  3565. 400,
  3566. 208,
  3567. 133,
  3568. 388,
  3569. 196,
  3570. 168,
  3571. 162,
  3572. 138,
  3573. 42
  3574. ]),
  3575. (At.ASTERISK_ENCODING = 148)
  3576. class mt extends ft {
  3577. constructor() {
  3578. super(...arguments), (this.narrowLineWidth = -1)
  3579. }
  3580. decodeRow(t, e, r) {
  3581. let n = this.decodeStart(e),
  3582. i = this.decodeEnd(e),
  3583. o = new T()
  3584. mt.decodeMiddle(e, n[1], i[0], o)
  3585. let s = o.toString(),
  3586. a = null
  3587. null != r && (a = r.get(E.ALLOWED_LENGTHS)), null == a && (a = mt.DEFAULT_ALLOWED_LENGTHS)
  3588. let l = s.length,
  3589. c = !1,
  3590. h = 0
  3591. for (let t of a) {
  3592. if (l === t) {
  3593. c = !0
  3594. break
  3595. }
  3596. t > h && (h = t)
  3597. }
  3598. if ((!c && l > h && (c = !0), !c)) throw new C()
  3599. const u = [new nt(n[1], t), new nt(i[0], t)]
  3600. return new F(s, null, 0, u, k.ITF, new Date().getTime())
  3601. }
  3602. static decodeMiddle(t, e, r, n) {
  3603. let i = new Int32Array(10),
  3604. o = new Int32Array(5),
  3605. s = new Int32Array(5)
  3606. for (i.fill(0), o.fill(0), s.fill(0); e < r; ) {
  3607. ft.recordPattern(t, e, i)
  3608. for (let t = 0; t < 5; t++) {
  3609. let e = 2 * t
  3610. ;(o[t] = i[e]), (s[t] = i[e + 1])
  3611. }
  3612. let r = mt.decodeDigit(o)
  3613. n.append(r.toString()),
  3614. (r = this.decodeDigit(s)),
  3615. n.append(r.toString()),
  3616. i.forEach(function(t) {
  3617. e += t
  3618. })
  3619. }
  3620. }
  3621. decodeStart(t) {
  3622. let e = mt.skipWhiteSpace(t),
  3623. r = mt.findGuardPattern(t, e, mt.START_PATTERN)
  3624. return (this.narrowLineWidth = (r[1] - r[0]) / 4), this.validateQuietZone(t, r[0]), r
  3625. }
  3626. validateQuietZone(t, e) {
  3627. let r = 10 * this.narrowLineWidth
  3628. r = r < e ? r : e
  3629. for (let n = e - 1; r > 0 && n >= 0 && !t.get(n); n--) r--
  3630. if (0 !== r) throw new N()
  3631. }
  3632. static skipWhiteSpace(t) {
  3633. const e = t.getSize(),
  3634. r = t.getNextSet(0)
  3635. if (r === e) throw new N()
  3636. return r
  3637. }
  3638. decodeEnd(t) {
  3639. t.reverse()
  3640. try {
  3641. let e,
  3642. r = mt.skipWhiteSpace(t)
  3643. try {
  3644. e = mt.findGuardPattern(t, r, mt.END_PATTERN_REVERSED[0])
  3645. } catch (n) {
  3646. n instanceof N && (e = mt.findGuardPattern(t, r, mt.END_PATTERN_REVERSED[1]))
  3647. }
  3648. this.validateQuietZone(t, e[0])
  3649. let n = e[0]
  3650. return (e[0] = t.getSize() - e[1]), (e[1] = t.getSize() - n), e
  3651. } finally {
  3652. t.reverse()
  3653. }
  3654. }
  3655. static findGuardPattern(t, e, r) {
  3656. let n = r.length,
  3657. i = new Int32Array(n),
  3658. o = t.getSize(),
  3659. s = !1,
  3660. a = 0,
  3661. l = e
  3662. i.fill(0)
  3663. for (let c = e; c < o; c++)
  3664. if (t.get(c) !== s) i[a]++
  3665. else {
  3666. if (a === n - 1) {
  3667. if (ft.patternMatchVariance(i, r, mt.MAX_INDIVIDUAL_VARIANCE) < mt.MAX_AVG_VARIANCE) return [l, c]
  3668. ;(l += i[0] + i[1]), u.arraycopy(i, 2, i, 0, a - 1), (i[a - 1] = 0), (i[a] = 0), a--
  3669. } else a++
  3670. ;(i[a] = 1), (s = !s)
  3671. }
  3672. throw new N()
  3673. }
  3674. static decodeDigit(t) {
  3675. let e = mt.MAX_AVG_VARIANCE,
  3676. r = -1,
  3677. n = mt.PATTERNS.length
  3678. for (let i = 0; i < n; i++) {
  3679. let n = mt.PATTERNS[i],
  3680. o = ft.patternMatchVariance(t, n, mt.MAX_INDIVIDUAL_VARIANCE)
  3681. o < e ? ((e = o), (r = i)) : o === e && (r = -1)
  3682. }
  3683. if (r >= 0) return r % 10
  3684. throw new N()
  3685. }
  3686. }
  3687. ;(mt.PATTERNS = [
  3688. Int32Array.from([1, 1, 2, 2, 1]),
  3689. Int32Array.from([2, 1, 1, 1, 2]),
  3690. Int32Array.from([1, 2, 1, 1, 2]),
  3691. Int32Array.from([2, 2, 1, 1, 1]),
  3692. Int32Array.from([1, 1, 2, 1, 2]),
  3693. Int32Array.from([2, 1, 2, 1, 1]),
  3694. Int32Array.from([1, 2, 2, 1, 1]),
  3695. Int32Array.from([1, 1, 1, 2, 2]),
  3696. Int32Array.from([2, 1, 1, 2, 1]),
  3697. Int32Array.from([1, 2, 1, 2, 1]),
  3698. Int32Array.from([1, 1, 3, 3, 1]),
  3699. Int32Array.from([3, 1, 1, 1, 3]),
  3700. Int32Array.from([1, 3, 1, 1, 3]),
  3701. Int32Array.from([3, 3, 1, 1, 1]),
  3702. Int32Array.from([1, 1, 3, 1, 3]),
  3703. Int32Array.from([3, 1, 3, 1, 1]),
  3704. Int32Array.from([1, 3, 3, 1, 1]),
  3705. Int32Array.from([1, 1, 1, 3, 3]),
  3706. Int32Array.from([3, 1, 1, 3, 1]),
  3707. Int32Array.from([1, 3, 1, 3, 1])
  3708. ]),
  3709. (mt.MAX_AVG_VARIANCE = 0.38),
  3710. (mt.MAX_INDIVIDUAL_VARIANCE = 0.5),
  3711. (mt.DEFAULT_ALLOWED_LENGTHS = [6, 8, 10, 12, 14]),
  3712. (mt.START_PATTERN = Int32Array.from([1, 1, 1, 1])),
  3713. (mt.END_PATTERN_REVERSED = [Int32Array.from([1, 1, 2]), Int32Array.from([1, 1, 3])])
  3714. class Et extends ft {
  3715. constructor() {
  3716. super(...arguments), (this.decodeRowStringBuffer = '')
  3717. }
  3718. static findStartGuardPattern(t) {
  3719. let e,
  3720. r = !1,
  3721. n = 0,
  3722. i = Int32Array.from([0, 0, 0])
  3723. for (; !r; ) {
  3724. ;(i = Int32Array.from([0, 0, 0])), (e = Et.findGuardPattern(t, n, !1, this.START_END_PATTERN, i))
  3725. let o = e[0]
  3726. n = e[1]
  3727. let s = o - (n - o)
  3728. s >= 0 && (r = t.isRange(s, o, !1))
  3729. }
  3730. return e
  3731. }
  3732. static checkChecksum(t) {
  3733. return Et.checkStandardUPCEANChecksum(t)
  3734. }
  3735. static checkStandardUPCEANChecksum(t) {
  3736. let e = t.length
  3737. if (0 === e) return !1
  3738. let r = parseInt(t.charAt(e - 1), 10)
  3739. return Et.getStandardUPCEANChecksum(t.substring(0, e - 1)) === r
  3740. }
  3741. static getStandardUPCEANChecksum(t) {
  3742. let e = t.length,
  3743. r = 0
  3744. for (let n = e - 1; n >= 0; n -= 2) {
  3745. let e = t.charAt(n).charCodeAt(0) - '0'.charCodeAt(0)
  3746. if (e < 0 || e > 9) throw new C()
  3747. r += e
  3748. }
  3749. r *= 3
  3750. for (let n = e - 2; n >= 0; n -= 2) {
  3751. let e = t.charAt(n).charCodeAt(0) - '0'.charCodeAt(0)
  3752. if (e < 0 || e > 9) throw new C()
  3753. r += e
  3754. }
  3755. return (1e3 - r) % 10
  3756. }
  3757. static decodeEnd(t, e) {
  3758. return Et.findGuardPattern(t, e, !1, Et.START_END_PATTERN, new Int32Array(Et.START_END_PATTERN.length).fill(0))
  3759. }
  3760. static findGuardPatternWithoutCounters(t, e, r, n) {
  3761. return this.findGuardPattern(t, e, r, n, new Int32Array(n.length))
  3762. }
  3763. static findGuardPattern(t, e, r, n, i) {
  3764. let o = t.getSize(),
  3765. s = 0,
  3766. a = (e = r ? t.getNextUnset(e) : t.getNextSet(e)),
  3767. l = n.length,
  3768. c = r
  3769. for (let r = e; r < o; r++)
  3770. if (t.get(r) !== c) i[s]++
  3771. else {
  3772. if (s === l - 1) {
  3773. if (ft.patternMatchVariance(i, n, Et.MAX_INDIVIDUAL_VARIANCE) < Et.MAX_AVG_VARIANCE) return Int32Array.from([a, r])
  3774. a += i[0] + i[1]
  3775. let t = i.slice(2, i.length - 1)
  3776. for (let e = 0; e < s - 1; e++) i[e] = t[e]
  3777. ;(i[s - 1] = 0), (i[s] = 0), s--
  3778. } else s++
  3779. ;(i[s] = 1), (c = !c)
  3780. }
  3781. throw new N()
  3782. }
  3783. static decodeDigit(t, e, r, n) {
  3784. this.recordPattern(t, r, e)
  3785. let i = this.MAX_AVG_VARIANCE,
  3786. o = -1,
  3787. s = n.length
  3788. for (let t = 0; t < s; t++) {
  3789. let r = n[t],
  3790. s = ft.patternMatchVariance(e, r, Et.MAX_INDIVIDUAL_VARIANCE)
  3791. s < i && ((i = s), (o = t))
  3792. }
  3793. if (o >= 0) return o
  3794. throw new N()
  3795. }
  3796. }
  3797. ;(Et.MAX_AVG_VARIANCE = 0.48),
  3798. (Et.MAX_INDIVIDUAL_VARIANCE = 0.7),
  3799. (Et.START_END_PATTERN = Int32Array.from([1, 1, 1])),
  3800. (Et.MIDDLE_PATTERN = Int32Array.from([1, 1, 1, 1, 1])),
  3801. (Et.END_PATTERN = Int32Array.from([1, 1, 1, 1, 1, 1])),
  3802. (Et.L_PATTERNS = [
  3803. Int32Array.from([3, 2, 1, 1]),
  3804. Int32Array.from([2, 2, 2, 1]),
  3805. Int32Array.from([2, 1, 2, 2]),
  3806. Int32Array.from([1, 4, 1, 1]),
  3807. Int32Array.from([1, 1, 3, 2]),
  3808. Int32Array.from([1, 2, 3, 1]),
  3809. Int32Array.from([1, 1, 1, 4]),
  3810. Int32Array.from([1, 3, 1, 2]),
  3811. Int32Array.from([1, 2, 1, 3]),
  3812. Int32Array.from([3, 1, 1, 2])
  3813. ])
  3814. class Ct {
  3815. constructor() {
  3816. ;(this.CHECK_DIGIT_ENCODINGS = [24, 20, 18, 17, 12, 6, 3, 10, 9, 5]), (this.decodeMiddleCounters = Int32Array.from([0, 0, 0, 0])), (this.decodeRowStringBuffer = '')
  3817. }
  3818. decodeRow(t, e, r) {
  3819. let n = this.decodeRowStringBuffer,
  3820. i = this.decodeMiddle(e, r, n),
  3821. o = n.toString(),
  3822. s = Ct.parseExtensionString(o),
  3823. a = [new nt((r[0] + r[1]) / 2, t), new nt(i, t)],
  3824. l = new F(o, null, 0, a, k.UPC_EAN_EXTENSION, new Date().getTime())
  3825. return null != s && l.putAllMetadata(s), l
  3826. }
  3827. decodeMiddle(t, e, r) {
  3828. let n = this.decodeMiddleCounters
  3829. ;(n[0] = 0), (n[1] = 0), (n[2] = 0), (n[3] = 0)
  3830. let i = t.getSize(),
  3831. o = e[1],
  3832. s = 0
  3833. for (let e = 0; e < 5 && o < i; e++) {
  3834. let i = Et.decodeDigit(t, n, o, Et.L_AND_G_PATTERNS)
  3835. r += String.fromCharCode('0'.charCodeAt(0) + (i % 10))
  3836. for (let t of n) o += t
  3837. i >= 10 && (s |= 1 << (4 - e)), 4 !== e && ((o = t.getNextSet(o)), (o = t.getNextUnset(o)))
  3838. }
  3839. if (5 !== r.length) throw new N()
  3840. let a = this.determineCheckDigit(s)
  3841. if (Ct.extensionChecksum(r.toString()) !== a) throw new N()
  3842. return o
  3843. }
  3844. static extensionChecksum(t) {
  3845. let e = t.length,
  3846. r = 0
  3847. for (let n = e - 2; n >= 0; n -= 2) r += t.charAt(n).charCodeAt(0) - '0'.charCodeAt(0)
  3848. r *= 3
  3849. for (let n = e - 1; n >= 0; n -= 2) r += t.charAt(n).charCodeAt(0) - '0'.charCodeAt(0)
  3850. return (r *= 3), r % 10
  3851. }
  3852. determineCheckDigit(t) {
  3853. for (let e = 0; e < 10; e++) if (t === this.CHECK_DIGIT_ENCODINGS[e]) return e
  3854. throw new N()
  3855. }
  3856. static parseExtensionString(t) {
  3857. if (5 !== t.length) return null
  3858. let e = Ct.parseExtension5String(t)
  3859. return null == e ? null : new Map([[X.SUGGESTED_PRICE, e]])
  3860. }
  3861. static parseExtension5String(t) {
  3862. let e
  3863. switch (t.charAt(0)) {
  3864. case '0':
  3865. e = '£'
  3866. break
  3867. case '5':
  3868. e = '$'
  3869. break
  3870. case '9':
  3871. switch (t) {
  3872. case '90000':
  3873. return null
  3874. case '99991':
  3875. return '0.00'
  3876. case '99990':
  3877. return 'Used'
  3878. }
  3879. e = ''
  3880. break
  3881. default:
  3882. e = ''
  3883. }
  3884. let r = parseInt(t.substring(1)),
  3885. n = r % 100
  3886. return e + (r / 100).toString() + '.' + (n < 10 ? '0' + n : n.toString())
  3887. }
  3888. }
  3889. class It {
  3890. constructor() {
  3891. ;(this.decodeMiddleCounters = Int32Array.from([0, 0, 0, 0])), (this.decodeRowStringBuffer = '')
  3892. }
  3893. decodeRow(t, e, r) {
  3894. let n = this.decodeRowStringBuffer,
  3895. i = this.decodeMiddle(e, r, n),
  3896. o = n.toString(),
  3897. s = It.parseExtensionString(o),
  3898. a = [new nt((r[0] + r[1]) / 2, t), new nt(i, t)],
  3899. l = new F(o, null, 0, a, k.UPC_EAN_EXTENSION, new Date().getTime())
  3900. return null != s && l.putAllMetadata(s), l
  3901. }
  3902. decodeMiddle(t, e, r) {
  3903. let n = this.decodeMiddleCounters
  3904. ;(n[0] = 0), (n[1] = 0), (n[2] = 0), (n[3] = 0)
  3905. let i = t.getSize(),
  3906. o = e[1],
  3907. s = 0
  3908. for (let e = 0; e < 2 && o < i; e++) {
  3909. let i = Et.decodeDigit(t, n, o, Et.L_AND_G_PATTERNS)
  3910. r += String.fromCharCode('0'.charCodeAt(0) + (i % 10))
  3911. for (let t of n) o += t
  3912. i >= 10 && (s |= 1 << (1 - e)), 1 !== e && ((o = t.getNextSet(o)), (o = t.getNextUnset(o)))
  3913. }
  3914. if (2 !== r.length) throw new N()
  3915. if (parseInt(r.toString()) % 4 !== s) throw new N()
  3916. return o
  3917. }
  3918. static parseExtensionString(t) {
  3919. return 2 !== t.length ? null : new Map([[X.ISSUE_NUMBER, parseInt(t)]])
  3920. }
  3921. }
  3922. class pt {
  3923. static decodeRow(t, e, r) {
  3924. let n = Et.findGuardPattern(e, r, !1, this.EXTENSION_START_PATTERN, new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0))
  3925. try {
  3926. return new Ct().decodeRow(t, e, n)
  3927. } catch (r) {
  3928. return new It().decodeRow(t, e, n)
  3929. }
  3930. }
  3931. }
  3932. pt.EXTENSION_START_PATTERN = Int32Array.from([1, 1, 2])
  3933. class St extends Et {
  3934. constructor() {
  3935. super(), (this.decodeRowStringBuffer = ''), (St.L_AND_G_PATTERNS = St.L_PATTERNS.map(t => Int32Array.from(t)))
  3936. for (let t = 10; t < 20; t++) {
  3937. let e = St.L_PATTERNS[t - 10],
  3938. r = new Int32Array(e.length)
  3939. for (let t = 0; t < e.length; t++) r[t] = e[e.length - t - 1]
  3940. St.L_AND_G_PATTERNS[t] = r
  3941. }
  3942. }
  3943. decodeRow(t, e, r) {
  3944. let n = St.findStartGuardPattern(e),
  3945. i = null == r ? null : r.get(E.NEED_RESULT_POINT_CALLBACK)
  3946. if (null != i) {
  3947. const e = new nt((n[0] + n[1]) / 2, t)
  3948. i.foundPossibleResultPoint(e)
  3949. }
  3950. let o = this.decodeMiddle(e, n, this.decodeRowStringBuffer),
  3951. s = o.rowOffset,
  3952. a = o.resultString
  3953. if (null != i) {
  3954. const e = new nt(s, t)
  3955. i.foundPossibleResultPoint(e)
  3956. }
  3957. let l = St.decodeEnd(e, s)
  3958. if (null != i) {
  3959. const e = new nt((l[0] + l[1]) / 2, t)
  3960. i.foundPossibleResultPoint(e)
  3961. }
  3962. let h = l[1],
  3963. u = h + (h - l[0])
  3964. if (u >= e.getSize() || !e.isRange(h, u, !1)) throw new N()
  3965. let d = a.toString()
  3966. if (d.length < 8) throw new C()
  3967. if (!St.checkChecksum(d)) throw new c()
  3968. let g = (n[1] + n[0]) / 2,
  3969. f = (l[1] + l[0]) / 2,
  3970. w = this.getBarcodeFormat(),
  3971. A = [new nt(g, t), new nt(f, t)],
  3972. m = new F(d, null, 0, A, w, new Date().getTime()),
  3973. I = 0
  3974. try {
  3975. let r = pt.decodeRow(t, e, l[1])
  3976. m.putMetadata(X.UPC_EAN_EXTENSION, r.getText()), m.putAllMetadata(r.getResultMetadata()), m.addResultPoints(r.getResultPoints()), (I = r.getText().length)
  3977. } catch (t) {}
  3978. let p = null == r ? null : r.get(E.ALLOWED_EAN_EXTENSIONS)
  3979. if (null != p) {
  3980. let t = !1
  3981. for (let e in p)
  3982. if (I.toString() === e) {
  3983. t = !0
  3984. break
  3985. }
  3986. if (!t) throw new N()
  3987. }
  3988. return w === k.EAN_13 || k.UPC_A, m
  3989. }
  3990. static checkChecksum(t) {
  3991. return St.checkStandardUPCEANChecksum(t)
  3992. }
  3993. static checkStandardUPCEANChecksum(t) {
  3994. let e = t.length
  3995. if (0 === e) return !1
  3996. let r = parseInt(t.charAt(e - 1), 10)
  3997. return St.getStandardUPCEANChecksum(t.substring(0, e - 1)) === r
  3998. }
  3999. static getStandardUPCEANChecksum(t) {
  4000. let e = t.length,
  4001. r = 0
  4002. for (let n = e - 1; n >= 0; n -= 2) {
  4003. let e = t.charAt(n).charCodeAt(0) - '0'.charCodeAt(0)
  4004. if (e < 0 || e > 9) throw new C()
  4005. r += e
  4006. }
  4007. r *= 3
  4008. for (let n = e - 2; n >= 0; n -= 2) {
  4009. let e = t.charAt(n).charCodeAt(0) - '0'.charCodeAt(0)
  4010. if (e < 0 || e > 9) throw new C()
  4011. r += e
  4012. }
  4013. return (1e3 - r) % 10
  4014. }
  4015. static decodeEnd(t, e) {
  4016. return St.findGuardPattern(t, e, !1, St.START_END_PATTERN, new Int32Array(St.START_END_PATTERN.length).fill(0))
  4017. }
  4018. }
  4019. class _t extends St {
  4020. constructor() {
  4021. super(), (this.decodeMiddleCounters = Int32Array.from([0, 0, 0, 0]))
  4022. }
  4023. decodeMiddle(t, e, r) {
  4024. let n = this.decodeMiddleCounters
  4025. ;(n[0] = 0), (n[1] = 0), (n[2] = 0), (n[3] = 0)
  4026. let i = t.getSize(),
  4027. o = e[1],
  4028. s = 0
  4029. for (let e = 0; e < 6 && o < i; e++) {
  4030. let i = St.decodeDigit(t, n, o, St.L_AND_G_PATTERNS)
  4031. r += String.fromCharCode('0'.charCodeAt(0) + (i % 10))
  4032. for (let t of n) o += t
  4033. i >= 10 && (s |= 1 << (5 - e))
  4034. }
  4035. ;(r = _t.determineFirstDigit(r, s)), (o = St.findGuardPattern(t, o, !0, St.MIDDLE_PATTERN, new Int32Array(St.MIDDLE_PATTERN.length).fill(0))[1])
  4036. for (let e = 0; e < 6 && o < i; e++) {
  4037. let e = St.decodeDigit(t, n, o, St.L_PATTERNS)
  4038. r += String.fromCharCode('0'.charCodeAt(0) + e)
  4039. for (let t of n) o += t
  4040. }
  4041. return { rowOffset: o, resultString: r }
  4042. }
  4043. getBarcodeFormat() {
  4044. return k.EAN_13
  4045. }
  4046. static determineFirstDigit(t, e) {
  4047. for (let r = 0; r < 10; r++) if (e === this.FIRST_DIGIT_ENCODINGS[r]) return String.fromCharCode('0'.charCodeAt(0) + r) + t
  4048. throw new N()
  4049. }
  4050. }
  4051. _t.FIRST_DIGIT_ENCODINGS = [0, 11, 13, 14, 19, 25, 28, 21, 22, 26]
  4052. class Tt extends St {
  4053. constructor() {
  4054. super(), (this.decodeMiddleCounters = Int32Array.from([0, 0, 0, 0]))
  4055. }
  4056. decodeMiddle(t, e, r) {
  4057. const n = this.decodeMiddleCounters
  4058. ;(n[0] = 0), (n[1] = 0), (n[2] = 0), (n[3] = 0)
  4059. let i = t.getSize(),
  4060. o = e[1]
  4061. for (let e = 0; e < 4 && o < i; e++) {
  4062. let e = St.decodeDigit(t, n, o, St.L_PATTERNS)
  4063. r += String.fromCharCode('0'.charCodeAt(0) + e)
  4064. for (let t of n) o += t
  4065. }
  4066. o = St.findGuardPattern(t, o, !0, St.MIDDLE_PATTERN, new Int32Array(St.MIDDLE_PATTERN.length).fill(0))[1]
  4067. for (let e = 0; e < 4 && o < i; e++) {
  4068. let e = St.decodeDigit(t, n, o, St.L_PATTERNS)
  4069. r += String.fromCharCode('0'.charCodeAt(0) + e)
  4070. for (let t of n) o += t
  4071. }
  4072. return { rowOffset: o, resultString: r }
  4073. }
  4074. getBarcodeFormat() {
  4075. return k.EAN_8
  4076. }
  4077. }
  4078. class yt extends St {
  4079. constructor() {
  4080. super(...arguments), (this.ean13Reader = new _t())
  4081. }
  4082. getBarcodeFormat() {
  4083. return k.UPC_A
  4084. }
  4085. decode(t, e) {
  4086. return this.maybeReturnResult(this.ean13Reader.decode(t))
  4087. }
  4088. decodeRow(t, e, r) {
  4089. return this.maybeReturnResult(this.ean13Reader.decodeRow(t, e, r))
  4090. }
  4091. decodeMiddle(t, e, r) {
  4092. return this.ean13Reader.decodeMiddle(t, e, r)
  4093. }
  4094. maybeReturnResult(t) {
  4095. let e = t.getText()
  4096. if ('0' === e.charAt(0)) {
  4097. let r = new F(e.substring(1), null, null, t.getResultPoints(), k.UPC_A)
  4098. return null != t.getResultMetadata() && r.putAllMetadata(t.getResultMetadata()), r
  4099. }
  4100. throw new N()
  4101. }
  4102. reset() {
  4103. this.ean13Reader.reset()
  4104. }
  4105. }
  4106. class Nt extends St {
  4107. constructor() {
  4108. super(), (this.decodeMiddleCounters = new Int32Array(4))
  4109. }
  4110. decodeMiddle(t, e, r) {
  4111. const n = this.decodeMiddleCounters.map(t => t)
  4112. ;(n[0] = 0), (n[1] = 0), (n[2] = 0), (n[3] = 0)
  4113. const i = t.getSize()
  4114. let o = e[1],
  4115. s = 0
  4116. for (let e = 0; e < 6 && o < i; e++) {
  4117. const i = Nt.decodeDigit(t, n, o, Nt.L_AND_G_PATTERNS)
  4118. r += String.fromCharCode('0'.charCodeAt(0) + (i % 10))
  4119. for (let t of n) o += t
  4120. i >= 10 && (s |= 1 << (5 - e))
  4121. }
  4122. return Nt.determineNumSysAndCheckDigit(new T(r), s), o
  4123. }
  4124. decodeEnd(t, e) {
  4125. return Nt.findGuardPatternWithoutCounters(t, e, !0, Nt.MIDDLE_END_PATTERN)
  4126. }
  4127. checkChecksum(t) {
  4128. return St.checkChecksum(Nt.convertUPCEtoUPCA(t))
  4129. }
  4130. static determineNumSysAndCheckDigit(t, e) {
  4131. for (let r = 0; r <= 1; r++) for (let n = 0; n < 10; n++) if (e === this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[r][n]) return t.insert(0, '0' + r), void t.append('0' + n)
  4132. throw N.getNotFoundInstance()
  4133. }
  4134. getBarcodeFormat() {
  4135. return k.UPC_E
  4136. }
  4137. static convertUPCEtoUPCA(t) {
  4138. const e = t
  4139. .slice(1, 7)
  4140. .split('')
  4141. .map(t => t.charCodeAt(0)),
  4142. r = new T()
  4143. r.append(t.charAt(0))
  4144. let n = e[5]
  4145. switch (n) {
  4146. case 0:
  4147. case 1:
  4148. case 2:
  4149. r.appendChars(e, 0, 2), r.append(n), r.append('0000'), r.appendChars(e, 2, 3)
  4150. break
  4151. case 3:
  4152. r.appendChars(e, 0, 3), r.append('00000'), r.appendChars(e, 3, 2)
  4153. break
  4154. case 4:
  4155. r.appendChars(e, 0, 4), r.append('00000'), r.append(e[4])
  4156. break
  4157. default:
  4158. r.appendChars(e, 0, 5), r.append('0000'), r.append(n)
  4159. }
  4160. return t.length >= 8 && r.append(t.charAt(7)), r.toString()
  4161. }
  4162. }
  4163. ;(Nt.MIDDLE_END_PATTERN = Int32Array.from([1, 1, 1, 1, 1, 1])),
  4164. (Nt.NUMSYS_AND_CHECK_DIGIT_PATTERNS = [Int32Array.from([56, 52, 50, 49, 44, 38, 35, 42, 41, 37]), Int32Array.from([7, 11, 13, 14, 19, 25, 28, 21, 22, 1])])
  4165. class Mt extends ft {
  4166. constructor(t) {
  4167. super()
  4168. let e = null == t ? null : t.get(E.POSSIBLE_FORMATS),
  4169. r = []
  4170. null != e &&
  4171. (e.indexOf(k.EAN_13) > -1 ? r.push(new _t()) : e.indexOf(k.UPC_A) > -1 && r.push(new yt()),
  4172. e.indexOf(k.EAN_8) > -1 && r.push(new Tt()),
  4173. e.indexOf(k.UPC_E) > -1 && r.push(new Nt())),
  4174. 0 === r.length && (r.push(new _t()), r.push(new Tt()), r.push(new Nt())),
  4175. (this.readers = r)
  4176. }
  4177. decodeRow(t, e, r) {
  4178. for (let n of this.readers)
  4179. try {
  4180. const i = n.decodeRow(t, e, r),
  4181. o = i.getBarcodeFormat() === k.EAN_13 && '0' === i.getText().charAt(0),
  4182. s = null == r ? null : r.get(E.POSSIBLE_FORMATS),
  4183. a = null == s || s.includes(k.UPC_A)
  4184. if (o && a) {
  4185. const t = i.getRawBytes(),
  4186. e = new F(i.getText().substring(1), t, t.length, i.getResultPoints(), k.UPC_A)
  4187. return e.putAllMetadata(i.getResultMetadata()), e
  4188. }
  4189. return i
  4190. } catch (t) {}
  4191. throw new N()
  4192. }
  4193. reset() {
  4194. for (let t of this.readers) t.reset()
  4195. }
  4196. }
  4197. class Dt extends ft {
  4198. constructor() {
  4199. super(),
  4200. (this.decodeFinderCounters = new Int32Array(4)),
  4201. (this.dataCharacterCounters = new Int32Array(8)),
  4202. (this.oddRoundingErrors = new Array(4)),
  4203. (this.evenRoundingErrors = new Array(4)),
  4204. (this.oddCounts = new Array(this.dataCharacterCounters.length / 2)),
  4205. (this.evenCounts = new Array(this.dataCharacterCounters.length / 2))
  4206. }
  4207. getDecodeFinderCounters() {
  4208. return this.decodeFinderCounters
  4209. }
  4210. getDataCharacterCounters() {
  4211. return this.dataCharacterCounters
  4212. }
  4213. getOddRoundingErrors() {
  4214. return this.oddRoundingErrors
  4215. }
  4216. getEvenRoundingErrors() {
  4217. return this.evenRoundingErrors
  4218. }
  4219. getOddCounts() {
  4220. return this.oddCounts
  4221. }
  4222. getEvenCounts() {
  4223. return this.evenCounts
  4224. }
  4225. parseFinderValue(t, e) {
  4226. for (let r = 0; r < e.length; r++) if (ft.patternMatchVariance(t, e[r], Dt.MAX_INDIVIDUAL_VARIANCE) < Dt.MAX_AVG_VARIANCE) return r
  4227. throw new N()
  4228. }
  4229. static count(t) {
  4230. return et.sum(new Int32Array(t))
  4231. }
  4232. static increment(t, e) {
  4233. let r = 0,
  4234. n = e[0]
  4235. for (let i = 1; i < t.length; i++) e[i] > n && ((n = e[i]), (r = i))
  4236. t[r]++
  4237. }
  4238. static decrement(t, e) {
  4239. let r = 0,
  4240. n = e[0]
  4241. for (let i = 1; i < t.length; i++) e[i] < n && ((n = e[i]), (r = i))
  4242. t[r]--
  4243. }
  4244. static isFinderPattern(t) {
  4245. let e = t[0] + t[1],
  4246. r = e / (e + t[2] + t[3])
  4247. if (r >= Dt.MIN_FINDER_PATTERN_RATIO && r <= Dt.MAX_FINDER_PATTERN_RATIO) {
  4248. let e = Number.MAX_SAFE_INTEGER,
  4249. r = Number.MIN_SAFE_INTEGER
  4250. for (let n of t) n > r && (r = n), n < e && (e = n)
  4251. return r < 10 * e
  4252. }
  4253. return !1
  4254. }
  4255. }
  4256. ;(Dt.MAX_AVG_VARIANCE = 0.2), (Dt.MAX_INDIVIDUAL_VARIANCE = 0.45), (Dt.MIN_FINDER_PATTERN_RATIO = 9.5 / 12), (Dt.MAX_FINDER_PATTERN_RATIO = 12.5 / 14)
  4257. class Rt {
  4258. constructor(t, e) {
  4259. ;(this.value = t), (this.checksumPortion = e)
  4260. }
  4261. getValue() {
  4262. return this.value
  4263. }
  4264. getChecksumPortion() {
  4265. return this.checksumPortion
  4266. }
  4267. toString() {
  4268. return this.value + '(' + this.checksumPortion + ')'
  4269. }
  4270. equals(t) {
  4271. if (!(t instanceof Rt)) return !1
  4272. const e = t
  4273. return this.value === e.value && this.checksumPortion === e.checksumPortion
  4274. }
  4275. hashCode() {
  4276. return this.value ^ this.checksumPortion
  4277. }
  4278. }
  4279. class Ot {
  4280. constructor(t, e, r, n, i) {
  4281. ;(this.value = t),
  4282. (this.startEnd = e),
  4283. (this.value = t),
  4284. (this.startEnd = e),
  4285. (this.resultPoints = new Array()),
  4286. this.resultPoints.push(new nt(r, i)),
  4287. this.resultPoints.push(new nt(n, i))
  4288. }
  4289. getValue() {
  4290. return this.value
  4291. }
  4292. getStartEnd() {
  4293. return this.startEnd
  4294. }
  4295. getResultPoints() {
  4296. return this.resultPoints
  4297. }
  4298. equals(t) {
  4299. if (!(t instanceof Ot)) return !1
  4300. const e = t
  4301. return this.value === e.value
  4302. }
  4303. hashCode() {
  4304. return this.value
  4305. }
  4306. }
  4307. class bt {
  4308. constructor() {}
  4309. static getRSSvalue(t, e, r) {
  4310. let n = 0
  4311. for (let e of t) n += e
  4312. let i = 0,
  4313. o = 0,
  4314. s = t.length
  4315. for (let a = 0; a < s - 1; a++) {
  4316. let l
  4317. for (l = 1, o |= 1 << a; l < t[a]; l++, o &= ~(1 << a)) {
  4318. let t = bt.combins(n - l - 1, s - a - 2)
  4319. if ((r && 0 === o && n - l - (s - a - 1) >= s - a - 1 && (t -= bt.combins(n - l - (s - a), s - a - 2)), s - a - 1 > 1)) {
  4320. let r = 0
  4321. for (let t = n - l - (s - a - 2); t > e; t--) r += bt.combins(n - l - t - 1, s - a - 3)
  4322. t -= r * (s - 1 - a)
  4323. } else n - l > e && t--
  4324. i += t
  4325. }
  4326. n -= l
  4327. }
  4328. return i
  4329. }
  4330. static combins(t, e) {
  4331. let r, n
  4332. t - e > e ? ((n = e), (r = t - e)) : ((n = t - e), (r = e))
  4333. let i = 1,
  4334. o = 1
  4335. for (let e = t; e > r; e--) (i *= e), o <= n && ((i /= o), o++)
  4336. for (; o <= n; ) (i /= o), o++
  4337. return i
  4338. }
  4339. }
  4340. class Lt {
  4341. constructor(t, e) {
  4342. e ? (this.decodedInformation = null) : ((this.finished = t), (this.decodedInformation = e))
  4343. }
  4344. getDecodedInformation() {
  4345. return this.decodedInformation
  4346. }
  4347. isFinished() {
  4348. return this.finished
  4349. }
  4350. }
  4351. class Bt {
  4352. constructor(t) {
  4353. this.newPosition = t
  4354. }
  4355. getNewPosition() {
  4356. return this.newPosition
  4357. }
  4358. }
  4359. class Pt extends Bt {
  4360. constructor(t, e) {
  4361. super(t), (this.value = e)
  4362. }
  4363. getValue() {
  4364. return this.value
  4365. }
  4366. isFNC1() {
  4367. return this.value === Pt.FNC1
  4368. }
  4369. }
  4370. Pt.FNC1 = '$'
  4371. class vt extends Bt {
  4372. constructor(t, e, r) {
  4373. super(t), r ? ((this.remaining = !0), (this.remainingValue = this.remainingValue)) : ((this.remaining = !1), (this.remainingValue = 0)), (this.newString = e)
  4374. }
  4375. getNewString() {
  4376. return this.newString
  4377. }
  4378. isRemaining() {
  4379. return this.remaining
  4380. }
  4381. getRemainingValue() {
  4382. return this.remainingValue
  4383. }
  4384. }
  4385. class Ft extends Bt {
  4386. constructor(t, e, r) {
  4387. if ((super(t), e < 0 || e > 10 || r < 0 || r > 10)) throw new C()
  4388. ;(this.firstDigit = e), (this.secondDigit = r)
  4389. }
  4390. getFirstDigit() {
  4391. return this.firstDigit
  4392. }
  4393. getSecondDigit() {
  4394. return this.secondDigit
  4395. }
  4396. getValue() {
  4397. return 10 * this.firstDigit + this.secondDigit
  4398. }
  4399. isFirstDigitFNC1() {
  4400. return this.firstDigit === Ft.FNC1
  4401. }
  4402. isSecondDigitFNC1() {
  4403. return this.secondDigit === Ft.FNC1
  4404. }
  4405. isAnyFNC1() {
  4406. return this.firstDigit === Ft.FNC1 || this.secondDigit === Ft.FNC1
  4407. }
  4408. }
  4409. Ft.FNC1 = 10
  4410. class xt {
  4411. constructor() {}
  4412. static parseFieldsInGeneralPurpose(t) {
  4413. if (!t) return null
  4414. if (t.length < 2) throw new N()
  4415. let e = t.substring(0, 2)
  4416. for (let r of xt.TWO_DIGIT_DATA_LENGTH) if (r[0] === e) return r[1] === xt.VARIABLE_LENGTH ? xt.processVariableAI(2, r[2], t) : xt.processFixedAI(2, r[1], t)
  4417. if (t.length < 3) throw new N()
  4418. let r = t.substring(0, 3)
  4419. for (let e of xt.THREE_DIGIT_DATA_LENGTH) if (e[0] === r) return e[1] === xt.VARIABLE_LENGTH ? xt.processVariableAI(3, e[2], t) : xt.processFixedAI(3, e[1], t)
  4420. for (let e of xt.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH) if (e[0] === r) return e[1] === xt.VARIABLE_LENGTH ? xt.processVariableAI(4, e[2], t) : xt.processFixedAI(4, e[1], t)
  4421. if (t.length < 4) throw new N()
  4422. let n = t.substring(0, 4)
  4423. for (let e of xt.FOUR_DIGIT_DATA_LENGTH) if (e[0] === n) return e[1] === xt.VARIABLE_LENGTH ? xt.processVariableAI(4, e[2], t) : xt.processFixedAI(4, e[1], t)
  4424. throw new N()
  4425. }
  4426. static processFixedAI(t, e, r) {
  4427. if (r.length < t) throw new N()
  4428. let n = r.substring(0, t)
  4429. if (r.length < t + e) throw new N()
  4430. let i = r.substring(t, t + e),
  4431. o = r.substring(t + e),
  4432. s = '(' + n + ')' + i,
  4433. a = xt.parseFieldsInGeneralPurpose(o)
  4434. return null == a ? s : s + a
  4435. }
  4436. static processVariableAI(t, e, r) {
  4437. let n,
  4438. i = r.substring(0, t)
  4439. n = r.length < t + e ? r.length : t + e
  4440. let o = r.substring(t, n),
  4441. s = r.substring(n),
  4442. a = '(' + i + ')' + o,
  4443. l = xt.parseFieldsInGeneralPurpose(s)
  4444. return null == l ? a : a + l
  4445. }
  4446. }
  4447. ;(xt.VARIABLE_LENGTH = []),
  4448. (xt.TWO_DIGIT_DATA_LENGTH = [
  4449. ['00', 18],
  4450. ['01', 14],
  4451. ['02', 14],
  4452. ['10', xt.VARIABLE_LENGTH, 20],
  4453. ['11', 6],
  4454. ['12', 6],
  4455. ['13', 6],
  4456. ['15', 6],
  4457. ['17', 6],
  4458. ['20', 2],
  4459. ['21', xt.VARIABLE_LENGTH, 20],
  4460. ['22', xt.VARIABLE_LENGTH, 29],
  4461. ['30', xt.VARIABLE_LENGTH, 8],
  4462. ['37', xt.VARIABLE_LENGTH, 8],
  4463. ['90', xt.VARIABLE_LENGTH, 30],
  4464. ['91', xt.VARIABLE_LENGTH, 30],
  4465. ['92', xt.VARIABLE_LENGTH, 30],
  4466. ['93', xt.VARIABLE_LENGTH, 30],
  4467. ['94', xt.VARIABLE_LENGTH, 30],
  4468. ['95', xt.VARIABLE_LENGTH, 30],
  4469. ['96', xt.VARIABLE_LENGTH, 30],
  4470. ['97', xt.VARIABLE_LENGTH, 3],
  4471. ['98', xt.VARIABLE_LENGTH, 30],
  4472. ['99', xt.VARIABLE_LENGTH, 30]
  4473. ]),
  4474. (xt.THREE_DIGIT_DATA_LENGTH = [
  4475. ['240', xt.VARIABLE_LENGTH, 30],
  4476. ['241', xt.VARIABLE_LENGTH, 30],
  4477. ['242', xt.VARIABLE_LENGTH, 6],
  4478. ['250', xt.VARIABLE_LENGTH, 30],
  4479. ['251', xt.VARIABLE_LENGTH, 30],
  4480. ['253', xt.VARIABLE_LENGTH, 17],
  4481. ['254', xt.VARIABLE_LENGTH, 20],
  4482. ['400', xt.VARIABLE_LENGTH, 30],
  4483. ['401', xt.VARIABLE_LENGTH, 30],
  4484. ['402', 17],
  4485. ['403', xt.VARIABLE_LENGTH, 30],
  4486. ['410', 13],
  4487. ['411', 13],
  4488. ['412', 13],
  4489. ['413', 13],
  4490. ['414', 13],
  4491. ['420', xt.VARIABLE_LENGTH, 20],
  4492. ['421', xt.VARIABLE_LENGTH, 15],
  4493. ['422', 3],
  4494. ['423', xt.VARIABLE_LENGTH, 15],
  4495. ['424', 3],
  4496. ['425', 3],
  4497. ['426', 3]
  4498. ]),
  4499. (xt.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH = [
  4500. ['310', 6],
  4501. ['311', 6],
  4502. ['312', 6],
  4503. ['313', 6],
  4504. ['314', 6],
  4505. ['315', 6],
  4506. ['316', 6],
  4507. ['320', 6],
  4508. ['321', 6],
  4509. ['322', 6],
  4510. ['323', 6],
  4511. ['324', 6],
  4512. ['325', 6],
  4513. ['326', 6],
  4514. ['327', 6],
  4515. ['328', 6],
  4516. ['329', 6],
  4517. ['330', 6],
  4518. ['331', 6],
  4519. ['332', 6],
  4520. ['333', 6],
  4521. ['334', 6],
  4522. ['335', 6],
  4523. ['336', 6],
  4524. ['340', 6],
  4525. ['341', 6],
  4526. ['342', 6],
  4527. ['343', 6],
  4528. ['344', 6],
  4529. ['345', 6],
  4530. ['346', 6],
  4531. ['347', 6],
  4532. ['348', 6],
  4533. ['349', 6],
  4534. ['350', 6],
  4535. ['351', 6],
  4536. ['352', 6],
  4537. ['353', 6],
  4538. ['354', 6],
  4539. ['355', 6],
  4540. ['356', 6],
  4541. ['357', 6],
  4542. ['360', 6],
  4543. ['361', 6],
  4544. ['362', 6],
  4545. ['363', 6],
  4546. ['364', 6],
  4547. ['365', 6],
  4548. ['366', 6],
  4549. ['367', 6],
  4550. ['368', 6],
  4551. ['369', 6],
  4552. ['390', xt.VARIABLE_LENGTH, 15],
  4553. ['391', xt.VARIABLE_LENGTH, 18],
  4554. ['392', xt.VARIABLE_LENGTH, 15],
  4555. ['393', xt.VARIABLE_LENGTH, 18],
  4556. ['703', xt.VARIABLE_LENGTH, 30]
  4557. ]),
  4558. (xt.FOUR_DIGIT_DATA_LENGTH = [
  4559. ['7001', 13],
  4560. ['7002', xt.VARIABLE_LENGTH, 30],
  4561. ['7003', 10],
  4562. ['8001', 14],
  4563. ['8002', xt.VARIABLE_LENGTH, 20],
  4564. ['8003', xt.VARIABLE_LENGTH, 30],
  4565. ['8004', xt.VARIABLE_LENGTH, 30],
  4566. ['8005', 6],
  4567. ['8006', 18],
  4568. ['8007', xt.VARIABLE_LENGTH, 30],
  4569. ['8008', xt.VARIABLE_LENGTH, 12],
  4570. ['8018', 18],
  4571. ['8020', xt.VARIABLE_LENGTH, 25],
  4572. ['8100', 6],
  4573. ['8101', 10],
  4574. ['8102', 2],
  4575. ['8110', xt.VARIABLE_LENGTH, 70],
  4576. ['8200', xt.VARIABLE_LENGTH, 70]
  4577. ])
  4578. class kt {
  4579. constructor(t) {
  4580. ;(this.buffer = new T()), (this.information = t)
  4581. }
  4582. decodeAllCodes(t, e) {
  4583. let r = e,
  4584. n = null
  4585. for (;;) {
  4586. let e = this.decodeGeneralPurposeField(r, n),
  4587. i = xt.parseFieldsInGeneralPurpose(e.getNewString())
  4588. if ((null != i && t.append(i), (n = e.isRemaining() ? '' + e.getRemainingValue() : null), r === e.getNewPosition())) break
  4589. r = e.getNewPosition()
  4590. }
  4591. return t.toString()
  4592. }
  4593. isStillNumeric(t) {
  4594. if (t + 7 > this.information.getSize()) return t + 4 <= this.information.getSize()
  4595. for (let e = t; e < t + 3; ++e) if (this.information.get(e)) return !0
  4596. return this.information.get(t + 3)
  4597. }
  4598. decodeNumeric(t) {
  4599. if (t + 7 > this.information.getSize()) {
  4600. let e = this.extractNumericValueFromBitArray(t, 4)
  4601. return new Ft(this.information.getSize(), 0 === e ? Ft.FNC1 : e - 1, Ft.FNC1)
  4602. }
  4603. let e = this.extractNumericValueFromBitArray(t, 7)
  4604. return new Ft(t + 7, (e - 8) / 11, (e - 8) % 11)
  4605. }
  4606. extractNumericValueFromBitArray(t, e) {
  4607. return kt.extractNumericValueFromBitArray(this.information, t, e)
  4608. }
  4609. static extractNumericValueFromBitArray(t, e, r) {
  4610. let n = 0
  4611. for (let i = 0; i < r; ++i) t.get(e + i) && (n |= 1 << (r - i - 1))
  4612. return n
  4613. }
  4614. decodeGeneralPurposeField(t, e) {
  4615. this.buffer.setLengthToZero(), null != e && this.buffer.append(e), this.current.setPosition(t)
  4616. let r = this.parseBlocks()
  4617. return null != r && r.isRemaining()
  4618. ? new vt(this.current.getPosition(), this.buffer.toString(), r.getRemainingValue())
  4619. : new vt(this.current.getPosition(), this.buffer.toString())
  4620. }
  4621. parseBlocks() {
  4622. let t, e
  4623. do {
  4624. let r = this.current.getPosition()
  4625. if (
  4626. (this.current.isAlpha()
  4627. ? ((e = this.parseAlphaBlock()), (t = e.isFinished()))
  4628. : this.current.isIsoIec646()
  4629. ? ((e = this.parseIsoIec646Block()), (t = e.isFinished()))
  4630. : ((e = this.parseNumericBlock()), (t = e.isFinished())),
  4631. r === this.current.getPosition() && !t)
  4632. )
  4633. break
  4634. } while (!t)
  4635. return e.getDecodedInformation()
  4636. }
  4637. parseNumericBlock() {
  4638. for (; this.isStillNumeric(this.current.getPosition()); ) {
  4639. let t = this.decodeNumeric(this.current.getPosition())
  4640. if ((this.current.setPosition(t.getNewPosition()), t.isFirstDigitFNC1())) {
  4641. let e
  4642. return (
  4643. (e = t.isSecondDigitFNC1()
  4644. ? new vt(this.current.getPosition(), this.buffer.toString())
  4645. : new vt(this.current.getPosition(), this.buffer.toString(), t.getSecondDigit())),
  4646. new Lt(!0, e)
  4647. )
  4648. }
  4649. if ((this.buffer.append(t.getFirstDigit()), t.isSecondDigitFNC1())) {
  4650. let t = new vt(this.current.getPosition(), this.buffer.toString())
  4651. return new Lt(!0, t)
  4652. }
  4653. this.buffer.append(t.getSecondDigit())
  4654. }
  4655. return this.isNumericToAlphaNumericLatch(this.current.getPosition()) && (this.current.setAlpha(), this.current.incrementPosition(4)), new Lt(!1)
  4656. }
  4657. parseIsoIec646Block() {
  4658. for (; this.isStillIsoIec646(this.current.getPosition()); ) {
  4659. let t = this.decodeIsoIec646(this.current.getPosition())
  4660. if ((this.current.setPosition(t.getNewPosition()), t.isFNC1())) {
  4661. let t = new vt(this.current.getPosition(), this.buffer.toString())
  4662. return new Lt(!0, t)
  4663. }
  4664. this.buffer.append(t.getValue())
  4665. }
  4666. return (
  4667. this.isAlphaOr646ToNumericLatch(this.current.getPosition())
  4668. ? (this.current.incrementPosition(3), this.current.setNumeric())
  4669. : this.isAlphaTo646ToAlphaLatch(this.current.getPosition()) &&
  4670. (this.current.getPosition() + 5 < this.information.getSize() ? this.current.incrementPosition(5) : this.current.setPosition(this.information.getSize()),
  4671. this.current.setAlpha()),
  4672. new Lt(!1)
  4673. )
  4674. }
  4675. parseAlphaBlock() {
  4676. for (; this.isStillAlpha(this.current.getPosition()); ) {
  4677. let t = this.decodeAlphanumeric(this.current.getPosition())
  4678. if ((this.current.setPosition(t.getNewPosition()), t.isFNC1())) {
  4679. let t = new vt(this.current.getPosition(), this.buffer.toString())
  4680. return new Lt(!0, t)
  4681. }
  4682. this.buffer.append(t.getValue())
  4683. }
  4684. return (
  4685. this.isAlphaOr646ToNumericLatch(this.current.getPosition())
  4686. ? (this.current.incrementPosition(3), this.current.setNumeric())
  4687. : this.isAlphaTo646ToAlphaLatch(this.current.getPosition()) &&
  4688. (this.current.getPosition() + 5 < this.information.getSize() ? this.current.incrementPosition(5) : this.current.setPosition(this.information.getSize()),
  4689. this.current.setIsoIec646()),
  4690. new Lt(!1)
  4691. )
  4692. }
  4693. isStillIsoIec646(t) {
  4694. if (t + 5 > this.information.getSize()) return !1
  4695. let e = this.extractNumericValueFromBitArray(t, 5)
  4696. if (e >= 5 && e < 16) return !0
  4697. if (t + 7 > this.information.getSize()) return !1
  4698. let r = this.extractNumericValueFromBitArray(t, 7)
  4699. if (r >= 64 && r < 116) return !0
  4700. if (t + 8 > this.information.getSize()) return !1
  4701. let n = this.extractNumericValueFromBitArray(t, 8)
  4702. return n >= 232 && n < 253
  4703. }
  4704. decodeIsoIec646(t) {
  4705. let e = this.extractNumericValueFromBitArray(t, 5)
  4706. if (15 === e) return new Pt(t + 5, Pt.FNC1)
  4707. if (e >= 5 && e < 15) return new Pt(t + 5, '0' + (e - 5))
  4708. let r,
  4709. n = this.extractNumericValueFromBitArray(t, 7)
  4710. if (n >= 64 && n < 90) return new Pt(t + 7, '' + (n + 1))
  4711. if (n >= 90 && n < 116) return new Pt(t + 7, '' + (n + 7))
  4712. switch (this.extractNumericValueFromBitArray(t, 8)) {
  4713. case 232:
  4714. r = '!'
  4715. break
  4716. case 233:
  4717. r = '"'
  4718. break
  4719. case 234:
  4720. r = '%'
  4721. break
  4722. case 235:
  4723. r = '&'
  4724. break
  4725. case 236:
  4726. r = "'"
  4727. break
  4728. case 237:
  4729. r = '('
  4730. break
  4731. case 238:
  4732. r = ')'
  4733. break
  4734. case 239:
  4735. r = '*'
  4736. break
  4737. case 240:
  4738. r = '+'
  4739. break
  4740. case 241:
  4741. r = ','
  4742. break
  4743. case 242:
  4744. r = '-'
  4745. break
  4746. case 243:
  4747. r = '.'
  4748. break
  4749. case 244:
  4750. r = '/'
  4751. break
  4752. case 245:
  4753. r = ':'
  4754. break
  4755. case 246:
  4756. r = ';'
  4757. break
  4758. case 247:
  4759. r = '<'
  4760. break
  4761. case 248:
  4762. r = '='
  4763. break
  4764. case 249:
  4765. r = '>'
  4766. break
  4767. case 250:
  4768. r = '?'
  4769. break
  4770. case 251:
  4771. r = '_'
  4772. break
  4773. case 252:
  4774. r = ' '
  4775. break
  4776. default:
  4777. throw new C()
  4778. }
  4779. return new Pt(t + 8, r)
  4780. }
  4781. isStillAlpha(t) {
  4782. if (t + 5 > this.information.getSize()) return !1
  4783. let e = this.extractNumericValueFromBitArray(t, 5)
  4784. if (e >= 5 && e < 16) return !0
  4785. if (t + 6 > this.information.getSize()) return !1
  4786. let r = this.extractNumericValueFromBitArray(t, 6)
  4787. return r >= 16 && r < 63
  4788. }
  4789. decodeAlphanumeric(t) {
  4790. let e = this.extractNumericValueFromBitArray(t, 5)
  4791. if (15 === e) return new Pt(t + 5, Pt.FNC1)
  4792. if (e >= 5 && e < 15) return new Pt(t + 5, '0' + (e - 5))
  4793. let r,
  4794. n = this.extractNumericValueFromBitArray(t, 6)
  4795. if (n >= 32 && n < 58) return new Pt(t + 6, '' + (n + 33))
  4796. switch (n) {
  4797. case 58:
  4798. r = '*'
  4799. break
  4800. case 59:
  4801. r = ','
  4802. break
  4803. case 60:
  4804. r = '-'
  4805. break
  4806. case 61:
  4807. r = '.'
  4808. break
  4809. case 62:
  4810. r = '/'
  4811. break
  4812. default:
  4813. throw new J('Decoding invalid alphanumeric value: ' + n)
  4814. }
  4815. return new Pt(t + 6, r)
  4816. }
  4817. isAlphaTo646ToAlphaLatch(t) {
  4818. if (t + 1 > this.information.getSize()) return !1
  4819. for (let e = 0; e < 5 && e + t < this.information.getSize(); ++e)
  4820. if (2 === e) {
  4821. if (!this.information.get(t + 2)) return !1
  4822. } else if (this.information.get(t + e)) return !1
  4823. return !0
  4824. }
  4825. isAlphaOr646ToNumericLatch(t) {
  4826. if (t + 3 > this.information.getSize()) return !1
  4827. for (let e = t; e < t + 3; ++e) if (this.information.get(e)) return !1
  4828. return !0
  4829. }
  4830. isNumericToAlphaNumericLatch(t) {
  4831. if (t + 1 > this.information.getSize()) return !1
  4832. for (let e = 0; e < 4 && e + t < this.information.getSize(); ++e) if (this.information.get(t + e)) return !1
  4833. return !0
  4834. }
  4835. }
  4836. class Ut {
  4837. constructor(t) {
  4838. ;(this.information = t), (this.generalDecoder = new kt(t))
  4839. }
  4840. getInformation() {
  4841. return this.information
  4842. }
  4843. getGeneralDecoder() {
  4844. return this.generalDecoder
  4845. }
  4846. }
  4847. class Ht extends Ut {
  4848. constructor(t) {
  4849. super(t)
  4850. }
  4851. encodeCompressedGtin(t, e) {
  4852. t.append('(01)')
  4853. let r = t.length()
  4854. t.append('9'), this.encodeCompressedGtinWithoutAI(t, e, r)
  4855. }
  4856. encodeCompressedGtinWithoutAI(t, e, r) {
  4857. for (let r = 0; r < 4; ++r) {
  4858. let n = this.getGeneralDecoder().extractNumericValueFromBitArray(e + 10 * r, 10)
  4859. n / 100 == 0 && t.append('0'), n / 10 == 0 && t.append('0'), t.append(n)
  4860. }
  4861. Ht.appendCheckDigit(t, r)
  4862. }
  4863. static appendCheckDigit(t, e) {
  4864. let r = 0
  4865. for (let n = 0; n < 13; n++) {
  4866. let i = t.charAt(n + e).charCodeAt(0) - '0'.charCodeAt(0)
  4867. r += 0 == (1 & n) ? 3 * i : i
  4868. }
  4869. ;(r = 10 - (r % 10)), 10 === r && (r = 0), t.append(r)
  4870. }
  4871. }
  4872. Ht.GTIN_SIZE = 40
  4873. class Vt extends Ht {
  4874. constructor(t) {
  4875. super(t)
  4876. }
  4877. parseInformation() {
  4878. let t = new T()
  4879. t.append('(01)')
  4880. let e = t.length(),
  4881. r = this.getGeneralDecoder().extractNumericValueFromBitArray(Vt.HEADER_SIZE, 4)
  4882. return t.append(r), this.encodeCompressedGtinWithoutAI(t, Vt.HEADER_SIZE + 4, e), this.getGeneralDecoder().decodeAllCodes(t, Vt.HEADER_SIZE + 44)
  4883. }
  4884. }
  4885. Vt.HEADER_SIZE = 4
  4886. class zt extends Ut {
  4887. constructor(t) {
  4888. super(t)
  4889. }
  4890. parseInformation() {
  4891. let t = new T()
  4892. return this.getGeneralDecoder().decodeAllCodes(t, zt.HEADER_SIZE)
  4893. }
  4894. }
  4895. zt.HEADER_SIZE = 5
  4896. class Gt extends Ht {
  4897. constructor(t) {
  4898. super(t)
  4899. }
  4900. encodeCompressedWeight(t, e, r) {
  4901. let n = this.getGeneralDecoder().extractNumericValueFromBitArray(e, r)
  4902. this.addWeightCode(t, n)
  4903. let i = this.checkWeight(n),
  4904. o = 1e5
  4905. for (let e = 0; e < 5; ++e) i / o == 0 && t.append('0'), (o /= 10)
  4906. t.append(i)
  4907. }
  4908. }
  4909. class Yt extends Gt {
  4910. constructor(t) {
  4911. super(t)
  4912. }
  4913. parseInformation() {
  4914. if (this.getInformation().getSize() != Yt.HEADER_SIZE + Gt.GTIN_SIZE + Yt.WEIGHT_SIZE) throw new N()
  4915. let t = new T()
  4916. return this.encodeCompressedGtin(t, Yt.HEADER_SIZE), this.encodeCompressedWeight(t, Yt.HEADER_SIZE + Gt.GTIN_SIZE, Yt.WEIGHT_SIZE), t.toString()
  4917. }
  4918. }
  4919. ;(Yt.HEADER_SIZE = 5), (Yt.WEIGHT_SIZE = 15)
  4920. class Xt extends Yt {
  4921. constructor(t) {
  4922. super(t)
  4923. }
  4924. addWeightCode(t, e) {
  4925. t.append('(3103)')
  4926. }
  4927. checkWeight(t) {
  4928. return t
  4929. }
  4930. }
  4931. class Wt extends Yt {
  4932. constructor(t) {
  4933. super(t)
  4934. }
  4935. addWeightCode(t, e) {
  4936. e < 1e4 ? t.append('(3202)') : t.append('(3203)')
  4937. }
  4938. checkWeight(t) {
  4939. return t < 1e4 ? t : t - 1e4
  4940. }
  4941. }
  4942. class jt extends Ht {
  4943. constructor(t) {
  4944. super(t)
  4945. }
  4946. parseInformation() {
  4947. if (this.getInformation().getSize() < jt.HEADER_SIZE + Ht.GTIN_SIZE) throw new N()
  4948. let t = new T()
  4949. this.encodeCompressedGtin(t, jt.HEADER_SIZE)
  4950. let e = this.getGeneralDecoder().extractNumericValueFromBitArray(jt.HEADER_SIZE + Ht.GTIN_SIZE, jt.LAST_DIGIT_SIZE)
  4951. t.append('(392'), t.append(e), t.append(')')
  4952. let r = this.getGeneralDecoder().decodeGeneralPurposeField(jt.HEADER_SIZE + Ht.GTIN_SIZE + jt.LAST_DIGIT_SIZE, null)
  4953. return t.append(r.getNewString()), t.toString()
  4954. }
  4955. }
  4956. ;(jt.HEADER_SIZE = 8), (jt.LAST_DIGIT_SIZE = 2)
  4957. class Zt extends Ht {
  4958. constructor(t) {
  4959. super(t)
  4960. }
  4961. parseInformation() {
  4962. if (this.getInformation().getSize() < Zt.HEADER_SIZE + Ht.GTIN_SIZE) throw new N()
  4963. let t = new T()
  4964. this.encodeCompressedGtin(t, Zt.HEADER_SIZE)
  4965. let e = this.getGeneralDecoder().extractNumericValueFromBitArray(Zt.HEADER_SIZE + Ht.GTIN_SIZE, Zt.LAST_DIGIT_SIZE)
  4966. t.append('(393'), t.append(e), t.append(')')
  4967. let r = this.getGeneralDecoder().extractNumericValueFromBitArray(Zt.HEADER_SIZE + Ht.GTIN_SIZE + Zt.LAST_DIGIT_SIZE, Zt.FIRST_THREE_DIGITS_SIZE)
  4968. r / 100 == 0 && t.append('0'), r / 10 == 0 && t.append('0'), t.append(r)
  4969. let n = this.getGeneralDecoder().decodeGeneralPurposeField(Zt.HEADER_SIZE + Ht.GTIN_SIZE + Zt.LAST_DIGIT_SIZE + Zt.FIRST_THREE_DIGITS_SIZE, null)
  4970. return t.append(n.getNewString()), t.toString()
  4971. }
  4972. }
  4973. ;(Zt.HEADER_SIZE = 8), (Zt.LAST_DIGIT_SIZE = 2), (Zt.FIRST_THREE_DIGITS_SIZE = 10)
  4974. class Qt extends Gt {
  4975. constructor(t, e, r) {
  4976. super(t), (this.dateCode = r), (this.firstAIdigits = e)
  4977. }
  4978. parseInformation() {
  4979. if (this.getInformation().getSize() != Qt.HEADER_SIZE + Qt.GTIN_SIZE + Qt.WEIGHT_SIZE + Qt.DATE_SIZE) throw new N()
  4980. let t = new T()
  4981. return (
  4982. this.encodeCompressedGtin(t, Qt.HEADER_SIZE),
  4983. this.encodeCompressedWeight(t, Qt.HEADER_SIZE + Qt.GTIN_SIZE, Qt.WEIGHT_SIZE),
  4984. this.encodeCompressedDate(t, Qt.HEADER_SIZE + Qt.GTIN_SIZE + Qt.WEIGHT_SIZE),
  4985. t.toString()
  4986. )
  4987. }
  4988. encodeCompressedDate(t, e) {
  4989. let r = this.getGeneralDecoder().extractNumericValueFromBitArray(e, Qt.DATE_SIZE)
  4990. if (38400 == r) return
  4991. t.append('('), t.append(this.dateCode), t.append(')')
  4992. let n = r % 32
  4993. r /= 32
  4994. let i = (r % 12) + 1
  4995. r /= 12
  4996. let o = r
  4997. o / 10 == 0 && t.append('0'), t.append(o), i / 10 == 0 && t.append('0'), t.append(i), n / 10 == 0 && t.append('0'), t.append(n)
  4998. }
  4999. addWeightCode(t, e) {
  5000. t.append('('), t.append(this.firstAIdigits), t.append(e / 1e5), t.append(')')
  5001. }
  5002. checkWeight(t) {
  5003. return t % 1e5
  5004. }
  5005. }
  5006. ;(Qt.HEADER_SIZE = 8), (Qt.WEIGHT_SIZE = 20), (Qt.DATE_SIZE = 16)
  5007. class Kt {
  5008. constructor(t, e, r, n) {
  5009. ;(this.leftchar = t), (this.rightchar = e), (this.finderpattern = r), (this.maybeLast = n)
  5010. }
  5011. mayBeLast() {
  5012. return this.maybeLast
  5013. }
  5014. getLeftChar() {
  5015. return this.leftchar
  5016. }
  5017. getRightChar() {
  5018. return this.rightchar
  5019. }
  5020. getFinderPattern() {
  5021. return this.finderpattern
  5022. }
  5023. mustBeLast() {
  5024. return null == this.rightchar
  5025. }
  5026. toString() {
  5027. return '[ ' + this.leftchar + ', ' + this.rightchar + ' : ' + (null == this.finderpattern ? 'null' : this.finderpattern.getValue()) + ' ]'
  5028. }
  5029. static equals(t, e) {
  5030. return t instanceof Kt && Kt.equalsOrNull(t.leftchar, e.leftchar) && Kt.equalsOrNull(t.rightchar, e.rightchar) && Kt.equalsOrNull(t.finderpattern, e.finderpattern)
  5031. }
  5032. static equalsOrNull(t, e) {
  5033. return null === t ? null === e : Kt.equals(t, e)
  5034. }
  5035. hashCode() {
  5036. return this.leftchar.getValue() ^ this.rightchar.getValue() ^ this.finderpattern.getValue()
  5037. }
  5038. }
  5039. class qt {
  5040. constructor(t, e, r) {
  5041. ;(this.pairs = t), (this.rowNumber = e), (this.wasReversed = r)
  5042. }
  5043. getPairs() {
  5044. return this.pairs
  5045. }
  5046. getRowNumber() {
  5047. return this.rowNumber
  5048. }
  5049. isReversed() {
  5050. return this.wasReversed
  5051. }
  5052. isEquivalent(t) {
  5053. return this.checkEqualitity(this, t)
  5054. }
  5055. toString() {
  5056. return '{ ' + this.pairs + ' }'
  5057. }
  5058. equals(t, e) {
  5059. return t instanceof qt && this.checkEqualitity(t, e) && t.wasReversed === e.wasReversed
  5060. }
  5061. checkEqualitity(t, e) {
  5062. if (!t || !e) return
  5063. let r
  5064. return (
  5065. t.forEach((t, n) => {
  5066. e.forEach(e => {
  5067. t.getLeftChar().getValue() === e.getLeftChar().getValue() &&
  5068. t.getRightChar().getValue() === e.getRightChar().getValue() &&
  5069. t.getFinderPatter().getValue() === e.getFinderPatter().getValue() &&
  5070. (r = !0)
  5071. })
  5072. }),
  5073. r
  5074. )
  5075. }
  5076. }
  5077. class Jt extends Dt {
  5078. constructor(t) {
  5079. super(...arguments), (this.pairs = new Array(Jt.MAX_PAIRS)), (this.rows = new Array()), (this.startEnd = [2]), (this.verbose = !0 === t)
  5080. }
  5081. decodeRow(t, e, r) {
  5082. ;(this.pairs.length = 0), (this.startFromEven = !1)
  5083. try {
  5084. return Jt.constructResult(this.decodeRow2pairs(t, e))
  5085. } catch (t) {
  5086. this.verbose && console.log(t)
  5087. }
  5088. return (this.pairs.length = 0), (this.startFromEven = !0), Jt.constructResult(this.decodeRow2pairs(t, e))
  5089. }
  5090. reset() {
  5091. ;(this.pairs.length = 0), (this.rows.length = 0)
  5092. }
  5093. decodeRow2pairs(t, e) {
  5094. let r,
  5095. n = !1
  5096. for (; !n; )
  5097. try {
  5098. this.pairs.push(this.retrieveNextPair(e, this.pairs, t))
  5099. } catch (t) {
  5100. if (t instanceof N) {
  5101. if (!this.pairs.length) throw new N()
  5102. n = !0
  5103. }
  5104. }
  5105. if (this.checkChecksum()) return this.pairs
  5106. if (((r = !!this.rows.length), this.storeRow(t, !1), r)) {
  5107. let t = this.checkRowsBoolean(!1)
  5108. if (null != t) return t
  5109. if (((t = this.checkRowsBoolean(!0)), null != t)) return t
  5110. }
  5111. throw new N()
  5112. }
  5113. checkRowsBoolean(t) {
  5114. if (this.rows.length > 25) return (this.rows.length = 0), null
  5115. ;(this.pairs.length = 0), t && (this.rows = this.rows.reverse())
  5116. let e = null
  5117. try {
  5118. e = this.checkRows(new Array(), 0)
  5119. } catch (t) {
  5120. this.verbose && console.log(t)
  5121. }
  5122. return t && (this.rows = this.rows.reverse()), e
  5123. }
  5124. checkRows(t, e) {
  5125. for (let r = e; r < this.rows.length; r++) {
  5126. let e = this.rows[r]
  5127. this.pairs.length = 0
  5128. for (let e of t) this.pairs.push(e.getPairs())
  5129. if ((this.pairs.push(e.getPairs()), !Jt.isValidSequence(this.pairs))) continue
  5130. if (this.checkChecksum()) return this.pairs
  5131. let n = new Array(t)
  5132. n.push(e)
  5133. try {
  5134. return this.checkRows(n, r + 1)
  5135. } catch (t) {
  5136. this.verbose && console.log(t)
  5137. }
  5138. }
  5139. throw new N()
  5140. }
  5141. static isValidSequence(t) {
  5142. for (let e of Jt.FINDER_PATTERN_SEQUENCES) {
  5143. if (t.length > e.length) continue
  5144. let r = !0
  5145. for (let n = 0; n < t.length; n++)
  5146. if (t[n].getFinderPattern().getValue() != e[n]) {
  5147. r = !1
  5148. break
  5149. }
  5150. if (r) return !0
  5151. }
  5152. return !1
  5153. }
  5154. storeRow(t, e) {
  5155. let r = 0,
  5156. n = !1,
  5157. i = !1
  5158. for (; r < this.rows.length; ) {
  5159. let e = this.rows[r]
  5160. if (e.getRowNumber() > t) {
  5161. i = e.isEquivalent(this.pairs)
  5162. break
  5163. }
  5164. ;(n = e.isEquivalent(this.pairs)), r++
  5165. }
  5166. i || n || Jt.isPartialRow(this.pairs, this.rows) || (this.rows.push(r, new qt(this.pairs, t, e)), this.removePartialRows(this.pairs, this.rows))
  5167. }
  5168. removePartialRows(t, e) {
  5169. for (let r of e) if (r.getPairs().length !== t.length) for (let e of r.getPairs()) for (let r of t) if (Kt.equals(e, r)) break
  5170. }
  5171. static isPartialRow(t, e) {
  5172. for (let r of e) {
  5173. let e = !0
  5174. for (let n of t) {
  5175. let t = !1
  5176. for (let e of r.getPairs())
  5177. if (n.equals(e)) {
  5178. t = !0
  5179. break
  5180. }
  5181. if (!t) {
  5182. e = !1
  5183. break
  5184. }
  5185. }
  5186. if (e) return !0
  5187. }
  5188. return !1
  5189. }
  5190. getRows() {
  5191. return this.rows
  5192. }
  5193. static constructResult(t) {
  5194. let e = (function(t) {
  5195. try {
  5196. if (t.get(1)) return new Vt(t)
  5197. if (!t.get(2)) return new zt(t)
  5198. switch (kt.extractNumericValueFromBitArray(t, 1, 4)) {
  5199. case 4:
  5200. return new Xt(t)
  5201. case 5:
  5202. return new Wt(t)
  5203. }
  5204. switch (kt.extractNumericValueFromBitArray(t, 1, 5)) {
  5205. case 12:
  5206. return new jt(t)
  5207. case 13:
  5208. return new Zt(t)
  5209. }
  5210. switch (kt.extractNumericValueFromBitArray(t, 1, 7)) {
  5211. case 56:
  5212. return new Qt(t, '310', '11')
  5213. case 57:
  5214. return new Qt(t, '320', '11')
  5215. case 58:
  5216. return new Qt(t, '310', '13')
  5217. case 59:
  5218. return new Qt(t, '320', '13')
  5219. case 60:
  5220. return new Qt(t, '310', '15')
  5221. case 61:
  5222. return new Qt(t, '320', '15')
  5223. case 62:
  5224. return new Qt(t, '310', '17')
  5225. case 63:
  5226. return new Qt(t, '320', '17')
  5227. }
  5228. } catch (e) {
  5229. throw (console.log(e), new J('unknown decoder: ' + t))
  5230. }
  5231. })(
  5232. class {
  5233. static buildBitArray(t) {
  5234. let e = 2 * t.length - 1
  5235. null == t[t.length - 1].getRightChar() && (e -= 1)
  5236. let r = new A(12 * e),
  5237. n = 0,
  5238. i = t[0].getRightChar().getValue()
  5239. for (let t = 11; t >= 0; --t) 0 != (i & (1 << t)) && r.set(n), n++
  5240. for (let e = 1; e < t.length; ++e) {
  5241. let i = t[e],
  5242. o = i.getLeftChar().getValue()
  5243. for (let t = 11; t >= 0; --t) 0 != (o & (1 << t)) && r.set(n), n++
  5244. if (null != i.getRightChar()) {
  5245. let t = i.getRightChar().getValue()
  5246. for (let e = 11; e >= 0; --e) 0 != (t & (1 << e)) && r.set(n), n++
  5247. }
  5248. }
  5249. return r
  5250. }
  5251. }.buildBitArray(t)
  5252. ).parseInformation(),
  5253. r = t[0].getFinderPattern().getResultPoints(),
  5254. n = t[t.length - 1].getFinderPattern().getResultPoints(),
  5255. i = [r[0], r[1], n[0], n[1]]
  5256. return new F(e, null, null, i, k.RSS_EXPANDED, null)
  5257. }
  5258. checkChecksum() {
  5259. let t = this.pairs.get(0),
  5260. e = t.getLeftChar(),
  5261. r = t.getRightChar()
  5262. if (null == r) return !1
  5263. let n = r.getChecksumPortion(),
  5264. i = 2
  5265. for (let t = 1; t < this.pairs.size(); ++t) {
  5266. let e = this.pairs.get(t)
  5267. ;(n += e.getLeftChar().getChecksumPortion()), i++
  5268. let r = e.getRightChar()
  5269. null != r && ((n += r.getChecksumPortion()), i++)
  5270. }
  5271. return (n %= 211), 211 * (i - 4) + n == e.getValue()
  5272. }
  5273. static getNextSecondBar(t, e) {
  5274. let r
  5275. return t.get(e) ? ((r = t.getNextUnset(e)), (r = t.getNextSet(r))) : ((r = t.getNextSet(e)), (r = t.getNextUnset(r))), r
  5276. }
  5277. retrieveNextPair(t, e, r) {
  5278. let n,
  5279. i = e.length % 2 == 0
  5280. this.startFromEven && (i = !i)
  5281. let o = !0,
  5282. s = -1
  5283. do {
  5284. this.findNextPair(t, e, s), (n = this.parseFoundFinderPattern(t, r, i)), null == n ? (s = Jt.getNextSecondBar(t, this.startEnd[0])) : (o = !1)
  5285. } while (o)
  5286. let a,
  5287. l = this.decodeDataCharacter(t, n, i, !0)
  5288. if (!this.isEmptyPair(e) && e[e.length - 1].mustBeLast()) throw new N()
  5289. try {
  5290. a = this.decodeDataCharacter(t, n, i, !1)
  5291. } catch (t) {
  5292. ;(a = null), this.verbose && console.log(t)
  5293. }
  5294. return new Kt(l, a, n, !0)
  5295. }
  5296. isEmptyPair(t) {
  5297. return 0 === t.length
  5298. }
  5299. findNextPair(t, e, r) {
  5300. let n = this.getDecodeFinderCounters()
  5301. ;(n[0] = 0), (n[1] = 0), (n[2] = 0), (n[3] = 0)
  5302. let i,
  5303. o = t.getSize()
  5304. i = r >= 0 ? r : this.isEmptyPair(e) ? 0 : e[e.length - 1].getFinderPattern().getStartEnd()[1]
  5305. let s = e.length % 2 != 0
  5306. this.startFromEven && (s = !s)
  5307. let a = !1
  5308. for (; i < o && ((a = !t.get(i)), a); ) i++
  5309. let l = 0,
  5310. c = i
  5311. for (let e = i; e < o; e++)
  5312. if (t.get(e) != a) n[l]++
  5313. else {
  5314. if (3 == l) {
  5315. if ((s && Jt.reverseCounters(n), Jt.isFinderPattern(n))) return (this.startEnd[0] = c), void (this.startEnd[1] = e)
  5316. s && Jt.reverseCounters(n), (c += n[0] + n[1]), (n[0] = n[2]), (n[1] = n[3]), (n[2] = 0), (n[3] = 0), l--
  5317. } else l++
  5318. ;(n[l] = 1), (a = !a)
  5319. }
  5320. throw new N()
  5321. }
  5322. static reverseCounters(t) {
  5323. let e = t.length
  5324. for (let r = 0; r < e / 2; ++r) {
  5325. let n = t[r]
  5326. ;(t[r] = t[e - r - 1]), (t[e - r - 1] = n)
  5327. }
  5328. }
  5329. parseFoundFinderPattern(t, e, r) {
  5330. let n, i, o
  5331. if (r) {
  5332. let e = this.startEnd[0] - 1
  5333. for (; e >= 0 && !t.get(e); ) e--
  5334. e++, (n = this.startEnd[0] - e), (i = e), (o = this.startEnd[1])
  5335. } else (i = this.startEnd[0]), (o = t.getNextUnset(this.startEnd[1] + 1)), (n = o - this.startEnd[1])
  5336. let s,
  5337. a = this.getDecodeFinderCounters()
  5338. u.arraycopy(a, 0, a, 1, a.length - 1), (a[0] = n)
  5339. try {
  5340. s = this.parseFinderValue(a, Jt.FINDER_PATTERNS)
  5341. } catch (t) {
  5342. return null
  5343. }
  5344. return new Ot(s, [i, o], i, o, e)
  5345. }
  5346. decodeDataCharacter(t, e, r, n) {
  5347. let i = this.getDataCharacterCounters()
  5348. for (let t = 0; t < i.length; t++) i[t] = 0
  5349. if (n) Jt.recordPatternInReverse(t, e.getStartEnd()[0], i)
  5350. else {
  5351. Jt.recordPattern(t, e.getStartEnd()[1], i)
  5352. for (let t = 0, e = i.length - 1; t < e; t++, e--) {
  5353. let r = i[t]
  5354. ;(i[t] = i[e]), (i[e] = r)
  5355. }
  5356. }
  5357. let o = et.sum(new Int32Array(i)) / 17,
  5358. s = (e.getStartEnd()[1] - e.getStartEnd()[0]) / 15
  5359. if (Math.abs(o - s) / s > 0.3) throw new N()
  5360. let a = this.getOddCounts(),
  5361. l = this.getEvenCounts(),
  5362. c = this.getOddRoundingErrors(),
  5363. h = this.getEvenRoundingErrors()
  5364. for (let t = 0; t < i.length; t++) {
  5365. let e = (1 * i[t]) / o,
  5366. r = e + 0.5
  5367. if (r < 1) {
  5368. if (e < 0.3) throw new N()
  5369. r = 1
  5370. } else if (r > 8) {
  5371. if (e > 8.7) throw new N()
  5372. r = 8
  5373. }
  5374. let n = t / 2
  5375. 0 == (1 & t) ? ((a[n] = r), (c[n] = e - r)) : ((l[n] = r), (h[n] = e - r))
  5376. }
  5377. this.adjustOddEvenCounts(17)
  5378. let u = 4 * e.getValue() + (r ? 0 : 2) + (n ? 0 : 1) - 1,
  5379. d = 0,
  5380. g = 0
  5381. for (let t = a.length - 1; t >= 0; t--) {
  5382. if (Jt.isNotA1left(e, r, n)) {
  5383. let e = Jt.WEIGHTS[u][2 * t]
  5384. g += a[t] * e
  5385. }
  5386. d += a[t]
  5387. }
  5388. let f = 0
  5389. for (let t = l.length - 1; t >= 0; t--)
  5390. if (Jt.isNotA1left(e, r, n)) {
  5391. let e = Jt.WEIGHTS[u][2 * t + 1]
  5392. f += l[t] * e
  5393. }
  5394. let w = g + f
  5395. if (0 != (1 & d) || d > 13 || d < 4) throw new N()
  5396. let A = (13 - d) / 2,
  5397. m = Jt.SYMBOL_WIDEST[A],
  5398. E = 9 - m,
  5399. C = bt.getRSSvalue(a, m, !0),
  5400. I = bt.getRSSvalue(l, E, !1),
  5401. p = Jt.EVEN_TOTAL_SUBSET[A],
  5402. S = Jt.GSUM[A]
  5403. return new Rt(C * p + I + S, w)
  5404. }
  5405. static isNotA1left(t, e, r) {
  5406. return !(0 == t.getValue() && e && r)
  5407. }
  5408. adjustOddEvenCounts(t) {
  5409. let e = et.sum(new Int32Array(this.getOddCounts())),
  5410. r = et.sum(new Int32Array(this.getEvenCounts())),
  5411. n = !1,
  5412. i = !1
  5413. e > 13 ? (i = !0) : e < 4 && (n = !0)
  5414. let o = !1,
  5415. s = !1
  5416. r > 13 ? (s = !0) : r < 4 && (o = !0)
  5417. let a = e + r - t,
  5418. l = 1 == (1 & e),
  5419. c = 0 == (1 & r)
  5420. if (1 == a)
  5421. if (l) {
  5422. if (c) throw new N()
  5423. i = !0
  5424. } else {
  5425. if (!c) throw new N()
  5426. s = !0
  5427. }
  5428. else if (-1 == a)
  5429. if (l) {
  5430. if (c) throw new N()
  5431. n = !0
  5432. } else {
  5433. if (!c) throw new N()
  5434. o = !0
  5435. }
  5436. else {
  5437. if (0 != a) throw new N()
  5438. if (l) {
  5439. if (!c) throw new N()
  5440. e < r ? ((n = !0), (s = !0)) : ((i = !0), (o = !0))
  5441. } else if (c) throw new N()
  5442. }
  5443. if (n) {
  5444. if (i) throw new N()
  5445. Jt.increment(this.getOddCounts(), this.getOddRoundingErrors())
  5446. }
  5447. if ((i && Jt.decrement(this.getOddCounts(), this.getOddRoundingErrors()), o)) {
  5448. if (s) throw new N()
  5449. Jt.increment(this.getEvenCounts(), this.getOddRoundingErrors())
  5450. }
  5451. s && Jt.decrement(this.getEvenCounts(), this.getEvenRoundingErrors())
  5452. }
  5453. }
  5454. ;(Jt.SYMBOL_WIDEST = [7, 5, 4, 3, 1]),
  5455. (Jt.EVEN_TOTAL_SUBSET = [4, 20, 52, 104, 204]),
  5456. (Jt.GSUM = [0, 348, 1388, 2948, 3988]),
  5457. (Jt.FINDER_PATTERNS = [
  5458. Int32Array.from([1, 8, 4, 1]),
  5459. Int32Array.from([3, 6, 4, 1]),
  5460. Int32Array.from([3, 4, 6, 1]),
  5461. Int32Array.from([3, 2, 8, 1]),
  5462. Int32Array.from([2, 6, 5, 1]),
  5463. Int32Array.from([2, 2, 9, 1])
  5464. ]),
  5465. (Jt.WEIGHTS = [
  5466. [1, 3, 9, 27, 81, 32, 96, 77],
  5467. [20, 60, 180, 118, 143, 7, 21, 63],
  5468. [189, 145, 13, 39, 117, 140, 209, 205],
  5469. [193, 157, 49, 147, 19, 57, 171, 91],
  5470. [62, 186, 136, 197, 169, 85, 44, 132],
  5471. [185, 133, 188, 142, 4, 12, 36, 108],
  5472. [113, 128, 173, 97, 80, 29, 87, 50],
  5473. [150, 28, 84, 41, 123, 158, 52, 156],
  5474. [46, 138, 203, 187, 139, 206, 196, 166],
  5475. [76, 17, 51, 153, 37, 111, 122, 155],
  5476. [43, 129, 176, 106, 107, 110, 119, 146],
  5477. [16, 48, 144, 10, 30, 90, 59, 177],
  5478. [109, 116, 137, 200, 178, 112, 125, 164],
  5479. [70, 210, 208, 202, 184, 130, 179, 115],
  5480. [134, 191, 151, 31, 93, 68, 204, 190],
  5481. [148, 22, 66, 198, 172, 94, 71, 2],
  5482. [6, 18, 54, 162, 64, 192, 154, 40],
  5483. [120, 149, 25, 75, 14, 42, 126, 167],
  5484. [79, 26, 78, 23, 69, 207, 199, 175],
  5485. [103, 98, 83, 38, 114, 131, 182, 124],
  5486. [161, 61, 183, 127, 170, 88, 53, 159],
  5487. [55, 165, 73, 8, 24, 72, 5, 15],
  5488. [45, 135, 194, 160, 58, 174, 100, 89]
  5489. ]),
  5490. (Jt.FINDER_PAT_A = 0),
  5491. (Jt.FINDER_PAT_B = 1),
  5492. (Jt.FINDER_PAT_C = 2),
  5493. (Jt.FINDER_PAT_D = 3),
  5494. (Jt.FINDER_PAT_E = 4),
  5495. (Jt.FINDER_PAT_F = 5),
  5496. (Jt.FINDER_PATTERN_SEQUENCES = [
  5497. [Jt.FINDER_PAT_A, Jt.FINDER_PAT_A],
  5498. [Jt.FINDER_PAT_A, Jt.FINDER_PAT_B, Jt.FINDER_PAT_B],
  5499. [Jt.FINDER_PAT_A, Jt.FINDER_PAT_C, Jt.FINDER_PAT_B, Jt.FINDER_PAT_D],
  5500. [Jt.FINDER_PAT_A, Jt.FINDER_PAT_E, Jt.FINDER_PAT_B, Jt.FINDER_PAT_D, Jt.FINDER_PAT_C],
  5501. [Jt.FINDER_PAT_A, Jt.FINDER_PAT_E, Jt.FINDER_PAT_B, Jt.FINDER_PAT_D, Jt.FINDER_PAT_D, Jt.FINDER_PAT_F],
  5502. [Jt.FINDER_PAT_A, Jt.FINDER_PAT_E, Jt.FINDER_PAT_B, Jt.FINDER_PAT_D, Jt.FINDER_PAT_E, Jt.FINDER_PAT_F, Jt.FINDER_PAT_F],
  5503. [Jt.FINDER_PAT_A, Jt.FINDER_PAT_A, Jt.FINDER_PAT_B, Jt.FINDER_PAT_B, Jt.FINDER_PAT_C, Jt.FINDER_PAT_C, Jt.FINDER_PAT_D, Jt.FINDER_PAT_D],
  5504. [Jt.FINDER_PAT_A, Jt.FINDER_PAT_A, Jt.FINDER_PAT_B, Jt.FINDER_PAT_B, Jt.FINDER_PAT_C, Jt.FINDER_PAT_C, Jt.FINDER_PAT_D, Jt.FINDER_PAT_E, Jt.FINDER_PAT_E],
  5505. [Jt.FINDER_PAT_A, Jt.FINDER_PAT_A, Jt.FINDER_PAT_B, Jt.FINDER_PAT_B, Jt.FINDER_PAT_C, Jt.FINDER_PAT_C, Jt.FINDER_PAT_D, Jt.FINDER_PAT_E, Jt.FINDER_PAT_F, Jt.FINDER_PAT_F],
  5506. [
  5507. Jt.FINDER_PAT_A,
  5508. Jt.FINDER_PAT_A,
  5509. Jt.FINDER_PAT_B,
  5510. Jt.FINDER_PAT_B,
  5511. Jt.FINDER_PAT_C,
  5512. Jt.FINDER_PAT_D,
  5513. Jt.FINDER_PAT_D,
  5514. Jt.FINDER_PAT_E,
  5515. Jt.FINDER_PAT_E,
  5516. Jt.FINDER_PAT_F,
  5517. Jt.FINDER_PAT_F
  5518. ]
  5519. ]),
  5520. (Jt.MAX_PAIRS = 11)
  5521. class $t extends Rt {
  5522. constructor(t, e, r) {
  5523. super(t, e), (this.count = 0), (this.finderPattern = r)
  5524. }
  5525. getFinderPattern() {
  5526. return this.finderPattern
  5527. }
  5528. getCount() {
  5529. return this.count
  5530. }
  5531. incrementCount() {
  5532. this.count++
  5533. }
  5534. }
  5535. class te extends Dt {
  5536. constructor() {
  5537. super(...arguments), (this.possibleLeftPairs = []), (this.possibleRightPairs = [])
  5538. }
  5539. decodeRow(t, e, r) {
  5540. const n = this.decodePair(e, !1, t, r)
  5541. te.addOrTally(this.possibleLeftPairs, n), e.reverse()
  5542. let i = this.decodePair(e, !0, t, r)
  5543. te.addOrTally(this.possibleRightPairs, i), e.reverse()
  5544. for (let t of this.possibleLeftPairs)
  5545. if (t.getCount() > 1) for (let e of this.possibleRightPairs) if (e.getCount() > 1 && te.checkChecksum(t, e)) return te.constructResult(t, e)
  5546. throw new N()
  5547. }
  5548. static addOrTally(t, e) {
  5549. if (null == e) return
  5550. let r = !1
  5551. for (let n of t)
  5552. if (n.getValue() === e.getValue()) {
  5553. n.incrementCount(), (r = !0)
  5554. break
  5555. }
  5556. r || t.push(e)
  5557. }
  5558. reset() {
  5559. ;(this.possibleLeftPairs.length = 0), (this.possibleRightPairs.length = 0)
  5560. }
  5561. static constructResult(t, e) {
  5562. let r = 4537077 * t.getValue() + e.getValue(),
  5563. n = new String(r).toString(),
  5564. i = new T()
  5565. for (let t = 13 - n.length; t > 0; t--) i.append('0')
  5566. i.append(n)
  5567. let o = 0
  5568. for (let t = 0; t < 13; t++) {
  5569. let e = i.charAt(t).charCodeAt(0) - '0'.charCodeAt(0)
  5570. o += 0 == (1 & t) ? 3 * e : e
  5571. }
  5572. ;(o = 10 - (o % 10)), 10 === o && (o = 0), i.append(o.toString())
  5573. let s = t.getFinderPattern().getResultPoints(),
  5574. a = e.getFinderPattern().getResultPoints()
  5575. return new F(i.toString(), null, 0, [s[0], s[1], a[0], a[1]], k.RSS_14, new Date().getTime())
  5576. }
  5577. static checkChecksum(t, e) {
  5578. let r = (t.getChecksumPortion() + 16 * e.getChecksumPortion()) % 79,
  5579. n = 9 * t.getFinderPattern().getValue() + e.getFinderPattern().getValue()
  5580. return n > 72 && n--, n > 8 && n--, r === n
  5581. }
  5582. decodePair(t, e, r, n) {
  5583. try {
  5584. let i = this.findFinderPattern(t, e),
  5585. o = this.parseFoundFinderPattern(t, r, e, i),
  5586. s = null == n ? null : n.get(E.NEED_RESULT_POINT_CALLBACK)
  5587. if (null != s) {
  5588. let n = (i[0] + i[1]) / 2
  5589. e && (n = t.getSize() - 1 - n), s.foundPossibleResultPoint(new nt(n, r))
  5590. }
  5591. let a = this.decodeDataCharacter(t, o, !0),
  5592. l = this.decodeDataCharacter(t, o, !1)
  5593. return new $t(1597 * a.getValue() + l.getValue(), a.getChecksumPortion() + 4 * l.getChecksumPortion(), o)
  5594. } catch (t) {
  5595. return null
  5596. }
  5597. }
  5598. decodeDataCharacter(t, e, r) {
  5599. let n = this.getDataCharacterCounters()
  5600. for (let t = 0; t < n.length; t++) n[t] = 0
  5601. if (r) ft.recordPatternInReverse(t, e.getStartEnd()[0], n)
  5602. else {
  5603. ft.recordPattern(t, e.getStartEnd()[1] + 1, n)
  5604. for (let t = 0, e = n.length - 1; t < e; t++, e--) {
  5605. let r = n[t]
  5606. ;(n[t] = n[e]), (n[e] = r)
  5607. }
  5608. }
  5609. let i = r ? 16 : 15,
  5610. o = et.sum(new Int32Array(n)) / i,
  5611. s = this.getOddCounts(),
  5612. a = this.getEvenCounts(),
  5613. l = this.getOddRoundingErrors(),
  5614. c = this.getEvenRoundingErrors()
  5615. for (let t = 0; t < n.length; t++) {
  5616. let e = n[t] / o,
  5617. r = Math.floor(e + 0.5)
  5618. r < 1 ? (r = 1) : r > 8 && (r = 8)
  5619. let i = Math.floor(t / 2)
  5620. 0 == (1 & t) ? ((s[i] = r), (l[i] = e - r)) : ((a[i] = r), (c[i] = e - r))
  5621. }
  5622. this.adjustOddEvenCounts(r, i)
  5623. let h = 0,
  5624. u = 0
  5625. for (let t = s.length - 1; t >= 0; t--) (u *= 9), (u += s[t]), (h += s[t])
  5626. let d = 0,
  5627. g = 0
  5628. for (let t = a.length - 1; t >= 0; t--) (d *= 9), (d += a[t]), (g += a[t])
  5629. let f = u + 3 * d
  5630. if (r) {
  5631. if (0 != (1 & h) || h > 12 || h < 4) throw new N()
  5632. let t = (12 - h) / 2,
  5633. e = te.OUTSIDE_ODD_WIDEST[t],
  5634. r = 9 - e,
  5635. n = bt.getRSSvalue(s, e, !1),
  5636. i = bt.getRSSvalue(a, r, !0),
  5637. o = te.OUTSIDE_EVEN_TOTAL_SUBSET[t],
  5638. l = te.OUTSIDE_GSUM[t]
  5639. return new Rt(n * o + i + l, f)
  5640. }
  5641. {
  5642. if (0 != (1 & g) || g > 10 || g < 4) throw new N()
  5643. let t = (10 - g) / 2,
  5644. e = te.INSIDE_ODD_WIDEST[t],
  5645. r = 9 - e,
  5646. n = bt.getRSSvalue(s, e, !0),
  5647. i = bt.getRSSvalue(a, r, !1),
  5648. o = te.INSIDE_ODD_TOTAL_SUBSET[t],
  5649. l = te.INSIDE_GSUM[t]
  5650. return new Rt(i * o + n + l, f)
  5651. }
  5652. }
  5653. findFinderPattern(t, e) {
  5654. let r = this.getDecodeFinderCounters()
  5655. ;(r[0] = 0), (r[1] = 0), (r[2] = 0), (r[3] = 0)
  5656. let n = t.getSize(),
  5657. i = !1,
  5658. o = 0
  5659. for (; o < n && ((i = !t.get(o)), e !== i); ) o++
  5660. let s = 0,
  5661. a = o
  5662. for (let e = o; e < n; e++)
  5663. if (t.get(e) !== i) r[s]++
  5664. else {
  5665. if (3 === s) {
  5666. if (Dt.isFinderPattern(r)) return [a, e]
  5667. ;(a += r[0] + r[1]), (r[0] = r[2]), (r[1] = r[3]), (r[2] = 0), (r[3] = 0), s--
  5668. } else s++
  5669. ;(r[s] = 1), (i = !i)
  5670. }
  5671. throw new N()
  5672. }
  5673. parseFoundFinderPattern(t, e, r, n) {
  5674. let i = t.get(n[0]),
  5675. o = n[0] - 1
  5676. for (; o >= 0 && i !== t.get(o); ) o--
  5677. o++
  5678. const s = n[0] - o,
  5679. a = this.getDecodeFinderCounters(),
  5680. l = new Int32Array(a.length)
  5681. u.arraycopy(a, 0, l, 1, a.length - 1), (l[0] = s)
  5682. const c = this.parseFinderValue(l, te.FINDER_PATTERNS)
  5683. let h = o,
  5684. d = n[1]
  5685. return r && ((h = t.getSize() - 1 - h), (d = t.getSize() - 1 - d)), new Ot(c, [o, n[1]], h, d, e)
  5686. }
  5687. adjustOddEvenCounts(t, e) {
  5688. let r = et.sum(new Int32Array(this.getOddCounts())),
  5689. n = et.sum(new Int32Array(this.getEvenCounts())),
  5690. i = !1,
  5691. o = !1,
  5692. s = !1,
  5693. a = !1
  5694. t ? (r > 12 ? (o = !0) : r < 4 && (i = !0), n > 12 ? (a = !0) : n < 4 && (s = !0)) : (r > 11 ? (o = !0) : r < 5 && (i = !0), n > 10 ? (a = !0) : n < 4 && (s = !0))
  5695. let l = r + n - e,
  5696. c = (1 & r) == (t ? 1 : 0),
  5697. h = 1 == (1 & n)
  5698. if (1 === l)
  5699. if (c) {
  5700. if (h) throw new N()
  5701. o = !0
  5702. } else {
  5703. if (!h) throw new N()
  5704. a = !0
  5705. }
  5706. else if (-1 === l)
  5707. if (c) {
  5708. if (h) throw new N()
  5709. i = !0
  5710. } else {
  5711. if (!h) throw new N()
  5712. s = !0
  5713. }
  5714. else {
  5715. if (0 !== l) throw new N()
  5716. if (c) {
  5717. if (!h) throw new N()
  5718. r < n ? ((i = !0), (a = !0)) : ((o = !0), (s = !0))
  5719. } else if (h) throw new N()
  5720. }
  5721. if (i) {
  5722. if (o) throw new N()
  5723. Dt.increment(this.getOddCounts(), this.getOddRoundingErrors())
  5724. }
  5725. if ((o && Dt.decrement(this.getOddCounts(), this.getOddRoundingErrors()), s)) {
  5726. if (a) throw new N()
  5727. Dt.increment(this.getEvenCounts(), this.getOddRoundingErrors())
  5728. }
  5729. a && Dt.decrement(this.getEvenCounts(), this.getEvenRoundingErrors())
  5730. }
  5731. }
  5732. ;(te.OUTSIDE_EVEN_TOTAL_SUBSET = [1, 10, 34, 70, 126]),
  5733. (te.INSIDE_ODD_TOTAL_SUBSET = [4, 20, 48, 81]),
  5734. (te.OUTSIDE_GSUM = [0, 161, 961, 2015, 2715]),
  5735. (te.INSIDE_GSUM = [0, 336, 1036, 1516]),
  5736. (te.OUTSIDE_ODD_WIDEST = [8, 6, 4, 3, 1]),
  5737. (te.INSIDE_ODD_WIDEST = [2, 4, 6, 8]),
  5738. (te.FINDER_PATTERNS = [
  5739. Int32Array.from([3, 8, 2, 1]),
  5740. Int32Array.from([3, 5, 5, 1]),
  5741. Int32Array.from([3, 3, 7, 1]),
  5742. Int32Array.from([3, 1, 9, 1]),
  5743. Int32Array.from([2, 7, 4, 1]),
  5744. Int32Array.from([2, 5, 6, 1]),
  5745. Int32Array.from([2, 3, 8, 1]),
  5746. Int32Array.from([1, 5, 7, 1]),
  5747. Int32Array.from([1, 3, 9, 1])
  5748. ])
  5749. class ee extends ft {
  5750. constructor(t, e) {
  5751. super(), (this.readers = []), (this.verbose = !0 === e)
  5752. const r = t ? t.get(E.POSSIBLE_FORMATS) : null,
  5753. n = t && void 0 !== t.get(E.ASSUME_CODE_39_CHECK_DIGIT)
  5754. r &&
  5755. ((r.includes(k.EAN_13) || r.includes(k.UPC_A) || r.includes(k.EAN_8) || r.includes(k.UPC_E)) && this.readers.push(new Mt(t)),
  5756. r.includes(k.CODE_39) && this.readers.push(new At(n)),
  5757. r.includes(k.CODE_128) && this.readers.push(new wt()),
  5758. r.includes(k.ITF) && this.readers.push(new mt()),
  5759. r.includes(k.RSS_14) && this.readers.push(new te()),
  5760. r.includes(k.RSS_EXPANDED) && this.readers.push(new Jt(this.verbose))),
  5761. 0 === this.readers.length &&
  5762. (this.readers.push(new Mt(t)),
  5763. this.readers.push(new At()),
  5764. this.readers.push(new Mt(t)),
  5765. this.readers.push(new wt()),
  5766. this.readers.push(new mt()),
  5767. this.readers.push(new te()),
  5768. this.readers.push(new Jt(this.verbose)))
  5769. }
  5770. decodeRow(t, e, r) {
  5771. for (let n = 0; n < this.readers.length; n++)
  5772. try {
  5773. return this.readers[n].decodeRow(t, e, r)
  5774. } catch (t) {}
  5775. throw new N()
  5776. }
  5777. reset() {
  5778. this.readers.forEach(t => t.reset())
  5779. }
  5780. }
  5781. class re {
  5782. constructor(t, e, r) {
  5783. ;(this.ecCodewords = t), (this.ecBlocks = [e]), r && this.ecBlocks.push(r)
  5784. }
  5785. getECCodewords() {
  5786. return this.ecCodewords
  5787. }
  5788. getECBlocks() {
  5789. return this.ecBlocks
  5790. }
  5791. }
  5792. class ne {
  5793. constructor(t, e) {
  5794. ;(this.count = t), (this.dataCodewords = e)
  5795. }
  5796. getCount() {
  5797. return this.count
  5798. }
  5799. getDataCodewords() {
  5800. return this.dataCodewords
  5801. }
  5802. }
  5803. class ie {
  5804. constructor(t, e, r, n, i, o) {
  5805. ;(this.versionNumber = t), (this.symbolSizeRows = e), (this.symbolSizeColumns = r), (this.dataRegionSizeRows = n), (this.dataRegionSizeColumns = i), (this.ecBlocks = o)
  5806. let s = 0
  5807. const a = o.getECCodewords(),
  5808. l = o.getECBlocks()
  5809. for (let t of l) s += t.getCount() * (t.getDataCodewords() + a)
  5810. this.totalCodewords = s
  5811. }
  5812. getVersionNumber() {
  5813. return this.versionNumber
  5814. }
  5815. getSymbolSizeRows() {
  5816. return this.symbolSizeRows
  5817. }
  5818. getSymbolSizeColumns() {
  5819. return this.symbolSizeColumns
  5820. }
  5821. getDataRegionSizeRows() {
  5822. return this.dataRegionSizeRows
  5823. }
  5824. getDataRegionSizeColumns() {
  5825. return this.dataRegionSizeColumns
  5826. }
  5827. getTotalCodewords() {
  5828. return this.totalCodewords
  5829. }
  5830. getECBlocks() {
  5831. return this.ecBlocks
  5832. }
  5833. static getVersionForDimensions(t, e) {
  5834. if (0 != (1 & t) || 0 != (1 & e)) throw new C()
  5835. for (let r of ie.VERSIONS) if (r.symbolSizeRows === t && r.symbolSizeColumns === e) return r
  5836. throw new C()
  5837. }
  5838. toString() {
  5839. return '' + this.versionNumber
  5840. }
  5841. static buildVersions() {
  5842. return [
  5843. new ie(1, 10, 10, 8, 8, new re(5, new ne(1, 3))),
  5844. new ie(2, 12, 12, 10, 10, new re(7, new ne(1, 5))),
  5845. new ie(3, 14, 14, 12, 12, new re(10, new ne(1, 8))),
  5846. new ie(4, 16, 16, 14, 14, new re(12, new ne(1, 12))),
  5847. new ie(5, 18, 18, 16, 16, new re(14, new ne(1, 18))),
  5848. new ie(6, 20, 20, 18, 18, new re(18, new ne(1, 22))),
  5849. new ie(7, 22, 22, 20, 20, new re(20, new ne(1, 30))),
  5850. new ie(8, 24, 24, 22, 22, new re(24, new ne(1, 36))),
  5851. new ie(9, 26, 26, 24, 24, new re(28, new ne(1, 44))),
  5852. new ie(10, 32, 32, 14, 14, new re(36, new ne(1, 62))),
  5853. new ie(11, 36, 36, 16, 16, new re(42, new ne(1, 86))),
  5854. new ie(12, 40, 40, 18, 18, new re(48, new ne(1, 114))),
  5855. new ie(13, 44, 44, 20, 20, new re(56, new ne(1, 144))),
  5856. new ie(14, 48, 48, 22, 22, new re(68, new ne(1, 174))),
  5857. new ie(15, 52, 52, 24, 24, new re(42, new ne(2, 102))),
  5858. new ie(16, 64, 64, 14, 14, new re(56, new ne(2, 140))),
  5859. new ie(17, 72, 72, 16, 16, new re(36, new ne(4, 92))),
  5860. new ie(18, 80, 80, 18, 18, new re(48, new ne(4, 114))),
  5861. new ie(19, 88, 88, 20, 20, new re(56, new ne(4, 144))),
  5862. new ie(20, 96, 96, 22, 22, new re(68, new ne(4, 174))),
  5863. new ie(21, 104, 104, 24, 24, new re(56, new ne(6, 136))),
  5864. new ie(22, 120, 120, 18, 18, new re(68, new ne(6, 175))),
  5865. new ie(23, 132, 132, 20, 20, new re(62, new ne(8, 163))),
  5866. new ie(24, 144, 144, 22, 22, new re(62, new ne(8, 156), new ne(2, 155))),
  5867. new ie(25, 8, 18, 6, 16, new re(7, new ne(1, 5))),
  5868. new ie(26, 8, 32, 6, 14, new re(11, new ne(1, 10))),
  5869. new ie(27, 12, 26, 10, 24, new re(14, new ne(1, 16))),
  5870. new ie(28, 12, 36, 10, 16, new re(18, new ne(1, 22))),
  5871. new ie(29, 16, 36, 14, 16, new re(24, new ne(1, 32))),
  5872. new ie(30, 16, 48, 14, 22, new re(28, new ne(1, 49)))
  5873. ]
  5874. }
  5875. }
  5876. ie.VERSIONS = ie.buildVersions()
  5877. class oe {
  5878. constructor(t) {
  5879. const e = t.getHeight()
  5880. if (e < 8 || e > 144 || 0 != (1 & e)) throw new C()
  5881. ;(this.version = oe.readVersion(t)),
  5882. (this.mappingBitMatrix = this.extractDataRegion(t)),
  5883. (this.readMappingMatrix = new y(this.mappingBitMatrix.getWidth(), this.mappingBitMatrix.getHeight()))
  5884. }
  5885. getVersion() {
  5886. return this.version
  5887. }
  5888. static readVersion(t) {
  5889. const e = t.getHeight(),
  5890. r = t.getWidth()
  5891. return ie.getVersionForDimensions(e, r)
  5892. }
  5893. readCodewords() {
  5894. const t = new Int8Array(this.version.getTotalCodewords())
  5895. let e = 0,
  5896. r = 4,
  5897. n = 0
  5898. const i = this.mappingBitMatrix.getHeight(),
  5899. o = this.mappingBitMatrix.getWidth()
  5900. let s = !1,
  5901. a = !1,
  5902. l = !1,
  5903. c = !1
  5904. do {
  5905. if (r !== i || 0 !== n || s)
  5906. if (r !== i - 2 || 0 !== n || 0 == (3 & o) || a)
  5907. if (r !== i + 4 || 2 !== n || 0 != (7 & o) || l)
  5908. if (r !== i - 2 || 0 !== n || 4 != (7 & o) || c) {
  5909. do {
  5910. r < i && n >= 0 && !this.readMappingMatrix.get(n, r) && (t[e++] = 255 & this.readUtah(r, n, i, o)), (r -= 2), (n += 2)
  5911. } while (r >= 0 && n < o)
  5912. ;(r += 1), (n += 3)
  5913. do {
  5914. r >= 0 && n < o && !this.readMappingMatrix.get(n, r) && (t[e++] = 255 & this.readUtah(r, n, i, o)), (r += 2), (n -= 2)
  5915. } while (r < i && n >= 0)
  5916. ;(r += 3), (n += 1)
  5917. } else (t[e++] = 255 & this.readCorner4(i, o)), (r -= 2), (n += 2), (c = !0)
  5918. else (t[e++] = 255 & this.readCorner3(i, o)), (r -= 2), (n += 2), (l = !0)
  5919. else (t[e++] = 255 & this.readCorner2(i, o)), (r -= 2), (n += 2), (a = !0)
  5920. else (t[e++] = 255 & this.readCorner1(i, o)), (r -= 2), (n += 2), (s = !0)
  5921. } while (r < i || n < o)
  5922. if (e !== this.version.getTotalCodewords()) throw new C()
  5923. return t
  5924. }
  5925. readModule(t, e, r, n) {
  5926. return t < 0 && ((t += r), (e += 4 - ((r + 4) & 7))), e < 0 && ((e += n), (t += 4 - ((n + 4) & 7))), this.readMappingMatrix.set(e, t), this.mappingBitMatrix.get(e, t)
  5927. }
  5928. readUtah(t, e, r, n) {
  5929. let i = 0
  5930. return (
  5931. this.readModule(t - 2, e - 2, r, n) && (i |= 1),
  5932. (i <<= 1),
  5933. this.readModule(t - 2, e - 1, r, n) && (i |= 1),
  5934. (i <<= 1),
  5935. this.readModule(t - 1, e - 2, r, n) && (i |= 1),
  5936. (i <<= 1),
  5937. this.readModule(t - 1, e - 1, r, n) && (i |= 1),
  5938. (i <<= 1),
  5939. this.readModule(t - 1, e, r, n) && (i |= 1),
  5940. (i <<= 1),
  5941. this.readModule(t, e - 2, r, n) && (i |= 1),
  5942. (i <<= 1),
  5943. this.readModule(t, e - 1, r, n) && (i |= 1),
  5944. (i <<= 1),
  5945. this.readModule(t, e, r, n) && (i |= 1),
  5946. i
  5947. )
  5948. }
  5949. readCorner1(t, e) {
  5950. let r = 0
  5951. return (
  5952. this.readModule(t - 1, 0, t, e) && (r |= 1),
  5953. (r <<= 1),
  5954. this.readModule(t - 1, 1, t, e) && (r |= 1),
  5955. (r <<= 1),
  5956. this.readModule(t - 1, 2, t, e) && (r |= 1),
  5957. (r <<= 1),
  5958. this.readModule(0, e - 2, t, e) && (r |= 1),
  5959. (r <<= 1),
  5960. this.readModule(0, e - 1, t, e) && (r |= 1),
  5961. (r <<= 1),
  5962. this.readModule(1, e - 1, t, e) && (r |= 1),
  5963. (r <<= 1),
  5964. this.readModule(2, e - 1, t, e) && (r |= 1),
  5965. (r <<= 1),
  5966. this.readModule(3, e - 1, t, e) && (r |= 1),
  5967. r
  5968. )
  5969. }
  5970. readCorner2(t, e) {
  5971. let r = 0
  5972. return (
  5973. this.readModule(t - 3, 0, t, e) && (r |= 1),
  5974. (r <<= 1),
  5975. this.readModule(t - 2, 0, t, e) && (r |= 1),
  5976. (r <<= 1),
  5977. this.readModule(t - 1, 0, t, e) && (r |= 1),
  5978. (r <<= 1),
  5979. this.readModule(0, e - 4, t, e) && (r |= 1),
  5980. (r <<= 1),
  5981. this.readModule(0, e - 3, t, e) && (r |= 1),
  5982. (r <<= 1),
  5983. this.readModule(0, e - 2, t, e) && (r |= 1),
  5984. (r <<= 1),
  5985. this.readModule(0, e - 1, t, e) && (r |= 1),
  5986. (r <<= 1),
  5987. this.readModule(1, e - 1, t, e) && (r |= 1),
  5988. r
  5989. )
  5990. }
  5991. readCorner3(t, e) {
  5992. let r = 0
  5993. return (
  5994. this.readModule(t - 1, 0, t, e) && (r |= 1),
  5995. (r <<= 1),
  5996. this.readModule(t - 1, e - 1, t, e) && (r |= 1),
  5997. (r <<= 1),
  5998. this.readModule(0, e - 3, t, e) && (r |= 1),
  5999. (r <<= 1),
  6000. this.readModule(0, e - 2, t, e) && (r |= 1),
  6001. (r <<= 1),
  6002. this.readModule(0, e - 1, t, e) && (r |= 1),
  6003. (r <<= 1),
  6004. this.readModule(1, e - 3, t, e) && (r |= 1),
  6005. (r <<= 1),
  6006. this.readModule(1, e - 2, t, e) && (r |= 1),
  6007. (r <<= 1),
  6008. this.readModule(1, e - 1, t, e) && (r |= 1),
  6009. r
  6010. )
  6011. }
  6012. readCorner4(t, e) {
  6013. let r = 0
  6014. return (
  6015. this.readModule(t - 3, 0, t, e) && (r |= 1),
  6016. (r <<= 1),
  6017. this.readModule(t - 2, 0, t, e) && (r |= 1),
  6018. (r <<= 1),
  6019. this.readModule(t - 1, 0, t, e) && (r |= 1),
  6020. (r <<= 1),
  6021. this.readModule(0, e - 2, t, e) && (r |= 1),
  6022. (r <<= 1),
  6023. this.readModule(0, e - 1, t, e) && (r |= 1),
  6024. (r <<= 1),
  6025. this.readModule(1, e - 1, t, e) && (r |= 1),
  6026. (r <<= 1),
  6027. this.readModule(2, e - 1, t, e) && (r |= 1),
  6028. (r <<= 1),
  6029. this.readModule(3, e - 1, t, e) && (r |= 1),
  6030. r
  6031. )
  6032. }
  6033. extractDataRegion(t) {
  6034. const e = this.version.getSymbolSizeRows(),
  6035. r = this.version.getSymbolSizeColumns()
  6036. if (t.getHeight() !== e) throw new a('Dimension of bitMatrix must match the version size')
  6037. const n = this.version.getDataRegionSizeRows(),
  6038. i = this.version.getDataRegionSizeColumns(),
  6039. o = (e / n) | 0,
  6040. s = (r / i) | 0,
  6041. l = new y(s * i, o * n)
  6042. for (let e = 0; e < o; ++e) {
  6043. const r = e * n
  6044. for (let o = 0; o < s; ++o) {
  6045. const s = o * i
  6046. for (let a = 0; a < n; ++a) {
  6047. const c = e * (n + 2) + 1 + a,
  6048. h = r + a
  6049. for (let e = 0; e < i; ++e) {
  6050. const r = o * (i + 2) + 1 + e
  6051. if (t.get(r, c)) {
  6052. const t = s + e
  6053. l.set(t, h)
  6054. }
  6055. }
  6056. }
  6057. }
  6058. }
  6059. return l
  6060. }
  6061. }
  6062. class se {
  6063. constructor(t, e) {
  6064. ;(this.numDataCodewords = t), (this.codewords = e)
  6065. }
  6066. static getDataBlocks(t, e) {
  6067. const r = e.getECBlocks()
  6068. let n = 0
  6069. const i = r.getECBlocks()
  6070. for (let t of i) n += t.getCount()
  6071. const o = new Array(n)
  6072. let s = 0
  6073. for (let t of i)
  6074. for (let e = 0; e < t.getCount(); e++) {
  6075. const e = t.getDataCodewords(),
  6076. n = r.getECCodewords() + e
  6077. o[s++] = new se(e, new Uint8Array(n))
  6078. }
  6079. const l = o[0].codewords.length - r.getECCodewords(),
  6080. c = l - 1
  6081. let h = 0
  6082. for (let e = 0; e < c; e++) for (let r = 0; r < s; r++) o[r].codewords[e] = t[h++]
  6083. const u = 24 === e.getVersionNumber(),
  6084. d = u ? 8 : s
  6085. for (let e = 0; e < d; e++) o[e].codewords[l - 1] = t[h++]
  6086. const g = o[0].codewords.length
  6087. for (let e = l; e < g; e++)
  6088. for (let r = 0; r < s; r++) {
  6089. const n = u ? (r + 8) % s : r,
  6090. i = u && n > 7 ? e - 1 : e
  6091. o[n].codewords[i] = t[h++]
  6092. }
  6093. if (h !== t.length) throw new a()
  6094. return o
  6095. }
  6096. getNumDataCodewords() {
  6097. return this.numDataCodewords
  6098. }
  6099. getCodewords() {
  6100. return this.codewords
  6101. }
  6102. }
  6103. class ae {
  6104. constructor(t) {
  6105. ;(this.bytes = t), (this.byteOffset = 0), (this.bitOffset = 0)
  6106. }
  6107. getBitOffset() {
  6108. return this.bitOffset
  6109. }
  6110. getByteOffset() {
  6111. return this.byteOffset
  6112. }
  6113. readBits(t) {
  6114. if (t < 1 || t > 32 || t > this.available()) throw new a('' + t)
  6115. let e = 0,
  6116. r = this.bitOffset,
  6117. n = this.byteOffset
  6118. const i = this.bytes
  6119. if (r > 0) {
  6120. const o = 8 - r,
  6121. s = t < o ? t : o,
  6122. a = o - s,
  6123. l = (255 >> (8 - s)) << a
  6124. ;(e = (i[n] & l) >> a), (t -= s), (r += s), 8 === r && ((r = 0), n++)
  6125. }
  6126. if (t > 0) {
  6127. for (; t >= 8; ) (e = (e << 8) | (255 & i[n])), n++, (t -= 8)
  6128. if (t > 0) {
  6129. const o = 8 - t,
  6130. s = (255 >> o) << o
  6131. ;(e = (e << t) | ((i[n] & s) >> o)), (r += t)
  6132. }
  6133. }
  6134. return (this.bitOffset = r), (this.byteOffset = n), e
  6135. }
  6136. available() {
  6137. return 8 * (this.bytes.length - this.byteOffset) - this.bitOffset
  6138. }
  6139. }
  6140. !(function(t) {
  6141. ;(t[(t.PAD_ENCODE = 0)] = 'PAD_ENCODE'),
  6142. (t[(t.ASCII_ENCODE = 1)] = 'ASCII_ENCODE'),
  6143. (t[(t.C40_ENCODE = 2)] = 'C40_ENCODE'),
  6144. (t[(t.TEXT_ENCODE = 3)] = 'TEXT_ENCODE'),
  6145. (t[(t.ANSIX12_ENCODE = 4)] = 'ANSIX12_ENCODE'),
  6146. (t[(t.EDIFACT_ENCODE = 5)] = 'EDIFACT_ENCODE'),
  6147. (t[(t.BASE256_ENCODE = 6)] = 'BASE256_ENCODE')
  6148. })(H || (H = {}))
  6149. class le {
  6150. static decode(t) {
  6151. const e = new ae(t),
  6152. r = new T(),
  6153. n = new T(),
  6154. i = new Array()
  6155. let o = H.ASCII_ENCODE
  6156. do {
  6157. if (o === H.ASCII_ENCODE) o = this.decodeAsciiSegment(e, r, n)
  6158. else {
  6159. switch (o) {
  6160. case H.C40_ENCODE:
  6161. this.decodeC40Segment(e, r)
  6162. break
  6163. case H.TEXT_ENCODE:
  6164. this.decodeTextSegment(e, r)
  6165. break
  6166. case H.ANSIX12_ENCODE:
  6167. this.decodeAnsiX12Segment(e, r)
  6168. break
  6169. case H.EDIFACT_ENCODE:
  6170. this.decodeEdifactSegment(e, r)
  6171. break
  6172. case H.BASE256_ENCODE:
  6173. this.decodeBase256Segment(e, r, i)
  6174. break
  6175. default:
  6176. throw new C()
  6177. }
  6178. o = H.ASCII_ENCODE
  6179. }
  6180. } while (o !== H.PAD_ENCODE && e.available() > 0)
  6181. return n.length() > 0 && r.append(n.toString()), new W(t, r.toString(), 0 === i.length ? null : i, null)
  6182. }
  6183. static decodeAsciiSegment(t, e, r) {
  6184. let n = !1
  6185. do {
  6186. let i = t.readBits(8)
  6187. if (0 === i) throw new C()
  6188. if (i <= 128) return n && (i += 128), e.append(String.fromCharCode(i - 1)), H.ASCII_ENCODE
  6189. if (129 === i) return H.PAD_ENCODE
  6190. if (i <= 229) {
  6191. const t = i - 130
  6192. t < 10 && e.append('0'), e.append('' + t)
  6193. } else
  6194. switch (i) {
  6195. case 230:
  6196. return H.C40_ENCODE
  6197. case 231:
  6198. return H.BASE256_ENCODE
  6199. case 232:
  6200. e.append(String.fromCharCode(29))
  6201. break
  6202. case 233:
  6203. case 234:
  6204. break
  6205. case 235:
  6206. n = !0
  6207. break
  6208. case 236:
  6209. e.append('[)>05'), r.insert(0, '')
  6210. break
  6211. case 237:
  6212. e.append('[)>06'), r.insert(0, '')
  6213. break
  6214. case 238:
  6215. return H.ANSIX12_ENCODE
  6216. case 239:
  6217. return H.TEXT_ENCODE
  6218. case 240:
  6219. return H.EDIFACT_ENCODE
  6220. case 241:
  6221. break
  6222. default:
  6223. if (254 !== i || 0 !== t.available()) throw new C()
  6224. }
  6225. } while (t.available() > 0)
  6226. return H.ASCII_ENCODE
  6227. }
  6228. static decodeC40Segment(t, e) {
  6229. let r = !1
  6230. const n = []
  6231. let i = 0
  6232. do {
  6233. if (8 === t.available()) return
  6234. const o = t.readBits(8)
  6235. if (254 === o) return
  6236. this.parseTwoBytes(o, t.readBits(8), n)
  6237. for (let t = 0; t < 3; t++) {
  6238. const o = n[t]
  6239. switch (i) {
  6240. case 0:
  6241. if (o < 3) i = o + 1
  6242. else {
  6243. if (!(o < this.C40_BASIC_SET_CHARS.length)) throw new C()
  6244. {
  6245. const t = this.C40_BASIC_SET_CHARS[o]
  6246. r ? (e.append(String.fromCharCode(t.charCodeAt(0) + 128)), (r = !1)) : e.append(t)
  6247. }
  6248. }
  6249. break
  6250. case 1:
  6251. r ? (e.append(String.fromCharCode(o + 128)), (r = !1)) : e.append(String.fromCharCode(o)), (i = 0)
  6252. break
  6253. case 2:
  6254. if (o < this.C40_SHIFT2_SET_CHARS.length) {
  6255. const t = this.C40_SHIFT2_SET_CHARS[o]
  6256. r ? (e.append(String.fromCharCode(t.charCodeAt(0) + 128)), (r = !1)) : e.append(t)
  6257. } else
  6258. switch (o) {
  6259. case 27:
  6260. e.append(String.fromCharCode(29))
  6261. break
  6262. case 30:
  6263. r = !0
  6264. break
  6265. default:
  6266. throw new C()
  6267. }
  6268. i = 0
  6269. break
  6270. case 3:
  6271. r ? (e.append(String.fromCharCode(o + 224)), (r = !1)) : e.append(String.fromCharCode(o + 96)), (i = 0)
  6272. break
  6273. default:
  6274. throw new C()
  6275. }
  6276. }
  6277. } while (t.available() > 0)
  6278. }
  6279. static decodeTextSegment(t, e) {
  6280. let r = !1,
  6281. n = [],
  6282. i = 0
  6283. do {
  6284. if (8 === t.available()) return
  6285. const o = t.readBits(8)
  6286. if (254 === o) return
  6287. this.parseTwoBytes(o, t.readBits(8), n)
  6288. for (let t = 0; t < 3; t++) {
  6289. const o = n[t]
  6290. switch (i) {
  6291. case 0:
  6292. if (o < 3) i = o + 1
  6293. else {
  6294. if (!(o < this.TEXT_BASIC_SET_CHARS.length)) throw new C()
  6295. {
  6296. const t = this.TEXT_BASIC_SET_CHARS[o]
  6297. r ? (e.append(String.fromCharCode(t.charCodeAt(0) + 128)), (r = !1)) : e.append(t)
  6298. }
  6299. }
  6300. break
  6301. case 1:
  6302. r ? (e.append(String.fromCharCode(o + 128)), (r = !1)) : e.append(String.fromCharCode(o)), (i = 0)
  6303. break
  6304. case 2:
  6305. if (o < this.TEXT_SHIFT2_SET_CHARS.length) {
  6306. const t = this.TEXT_SHIFT2_SET_CHARS[o]
  6307. r ? (e.append(String.fromCharCode(t.charCodeAt(0) + 128)), (r = !1)) : e.append(t)
  6308. } else
  6309. switch (o) {
  6310. case 27:
  6311. e.append(String.fromCharCode(29))
  6312. break
  6313. case 30:
  6314. r = !0
  6315. break
  6316. default:
  6317. throw new C()
  6318. }
  6319. i = 0
  6320. break
  6321. case 3:
  6322. if (!(o < this.TEXT_SHIFT3_SET_CHARS.length)) throw new C()
  6323. {
  6324. const t = this.TEXT_SHIFT3_SET_CHARS[o]
  6325. r ? (e.append(String.fromCharCode(t.charCodeAt(0) + 128)), (r = !1)) : e.append(t), (i = 0)
  6326. }
  6327. break
  6328. default:
  6329. throw new C()
  6330. }
  6331. }
  6332. } while (t.available() > 0)
  6333. }
  6334. static decodeAnsiX12Segment(t, e) {
  6335. const r = []
  6336. do {
  6337. if (8 === t.available()) return
  6338. const n = t.readBits(8)
  6339. if (254 === n) return
  6340. this.parseTwoBytes(n, t.readBits(8), r)
  6341. for (let t = 0; t < 3; t++) {
  6342. const n = r[t]
  6343. switch (n) {
  6344. case 0:
  6345. e.append('\r')
  6346. break
  6347. case 1:
  6348. e.append('*')
  6349. break
  6350. case 2:
  6351. e.append('>')
  6352. break
  6353. case 3:
  6354. e.append(' ')
  6355. break
  6356. default:
  6357. if (n < 14) e.append(String.fromCharCode(n + 44))
  6358. else {
  6359. if (!(n < 40)) throw new C()
  6360. e.append(String.fromCharCode(n + 51))
  6361. }
  6362. }
  6363. }
  6364. } while (t.available() > 0)
  6365. }
  6366. static parseTwoBytes(t, e, r) {
  6367. let n = (t << 8) + e - 1,
  6368. i = Math.floor(n / 1600)
  6369. ;(r[0] = i), (n -= 1600 * i), (i = Math.floor(n / 40)), (r[1] = i), (r[2] = n - 40 * i)
  6370. }
  6371. static decodeEdifactSegment(t, e) {
  6372. do {
  6373. if (t.available() <= 16) return
  6374. for (let r = 0; r < 4; r++) {
  6375. let r = t.readBits(6)
  6376. if (31 === r) {
  6377. const e = 8 - t.getBitOffset()
  6378. return void (8 !== e && t.readBits(e))
  6379. }
  6380. 0 == (32 & r) && (r |= 64), e.append(String.fromCharCode(r))
  6381. }
  6382. } while (t.available() > 0)
  6383. }
  6384. static decodeBase256Segment(t, e, r) {
  6385. let n = 1 + t.getByteOffset()
  6386. const i = this.unrandomize255State(t.readBits(8), n++)
  6387. let o
  6388. if (((o = 0 === i ? (t.available() / 8) | 0 : i < 250 ? i : 250 * (i - 249) + this.unrandomize255State(t.readBits(8), n++)), o < 0)) throw new C()
  6389. const s = new Uint8Array(o)
  6390. for (let e = 0; e < o; e++) {
  6391. if (t.available() < 8) throw new C()
  6392. s[e] = this.unrandomize255State(t.readBits(8), n++)
  6393. }
  6394. r.push(s)
  6395. try {
  6396. e.append(S.decode(s, _.ISO88591))
  6397. } catch (t) {
  6398. throw new J('Platform does not support required encoding: ' + t.message)
  6399. }
  6400. }
  6401. static unrandomize255State(t, e) {
  6402. const r = t - (((149 * e) % 255) + 1)
  6403. return r >= 0 ? r : r + 256
  6404. }
  6405. }
  6406. ;(le.C40_BASIC_SET_CHARS = [
  6407. '*',
  6408. '*',
  6409. '*',
  6410. ' ',
  6411. '0',
  6412. '1',
  6413. '2',
  6414. '3',
  6415. '4',
  6416. '5',
  6417. '6',
  6418. '7',
  6419. '8',
  6420. '9',
  6421. 'A',
  6422. 'B',
  6423. 'C',
  6424. 'D',
  6425. 'E',
  6426. 'F',
  6427. 'G',
  6428. 'H',
  6429. 'I',
  6430. 'J',
  6431. 'K',
  6432. 'L',
  6433. 'M',
  6434. 'N',
  6435. 'O',
  6436. 'P',
  6437. 'Q',
  6438. 'R',
  6439. 'S',
  6440. 'T',
  6441. 'U',
  6442. 'V',
  6443. 'W',
  6444. 'X',
  6445. 'Y',
  6446. 'Z'
  6447. ]),
  6448. (le.C40_SHIFT2_SET_CHARS = ['!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_']),
  6449. (le.TEXT_BASIC_SET_CHARS = [
  6450. '*',
  6451. '*',
  6452. '*',
  6453. ' ',
  6454. '0',
  6455. '1',
  6456. '2',
  6457. '3',
  6458. '4',
  6459. '5',
  6460. '6',
  6461. '7',
  6462. '8',
  6463. '9',
  6464. 'a',
  6465. 'b',
  6466. 'c',
  6467. 'd',
  6468. 'e',
  6469. 'f',
  6470. 'g',
  6471. 'h',
  6472. 'i',
  6473. 'j',
  6474. 'k',
  6475. 'l',
  6476. 'm',
  6477. 'n',
  6478. 'o',
  6479. 'p',
  6480. 'q',
  6481. 'r',
  6482. 's',
  6483. 't',
  6484. 'u',
  6485. 'v',
  6486. 'w',
  6487. 'x',
  6488. 'y',
  6489. 'z'
  6490. ]),
  6491. (le.TEXT_SHIFT2_SET_CHARS = le.C40_SHIFT2_SET_CHARS),
  6492. (le.TEXT_SHIFT3_SET_CHARS = [
  6493. '`',
  6494. 'A',
  6495. 'B',
  6496. 'C',
  6497. 'D',
  6498. 'E',
  6499. 'F',
  6500. 'G',
  6501. 'H',
  6502. 'I',
  6503. 'J',
  6504. 'K',
  6505. 'L',
  6506. 'M',
  6507. 'N',
  6508. 'O',
  6509. 'P',
  6510. 'Q',
  6511. 'R',
  6512. 'S',
  6513. 'T',
  6514. 'U',
  6515. 'V',
  6516. 'W',
  6517. 'X',
  6518. 'Y',
  6519. 'Z',
  6520. '{',
  6521. '|',
  6522. '}',
  6523. '~',
  6524. String.fromCharCode(127)
  6525. ])
  6526. class ce {
  6527. constructor() {
  6528. this.rsDecoder = new $(K.DATA_MATRIX_FIELD_256)
  6529. }
  6530. decode(t) {
  6531. const e = new oe(t),
  6532. r = e.getVersion(),
  6533. n = e.readCodewords(),
  6534. i = se.getDataBlocks(n, r)
  6535. let o = 0
  6536. for (let t of i) o += t.getNumDataCodewords()
  6537. const s = new Uint8Array(o),
  6538. a = i.length
  6539. for (let t = 0; t < a; t++) {
  6540. const e = i[t],
  6541. r = e.getCodewords(),
  6542. n = e.getNumDataCodewords()
  6543. this.correctErrors(r, n)
  6544. for (let e = 0; e < n; e++) s[e * a + t] = r[e]
  6545. }
  6546. return le.decode(s)
  6547. }
  6548. correctErrors(t, e) {
  6549. const r = new Int32Array(t)
  6550. try {
  6551. this.rsDecoder.decode(r, t.length - e)
  6552. } catch (t) {
  6553. throw new c()
  6554. }
  6555. for (let n = 0; n < e; n++) t[n] = r[n]
  6556. }
  6557. }
  6558. class he {
  6559. constructor(t) {
  6560. ;(this.image = t), (this.rectangleDetector = new st(this.image))
  6561. }
  6562. detect() {
  6563. const t = this.rectangleDetector.detect()
  6564. let e = this.detectSolid1(t)
  6565. if (((e = this.detectSolid2(e)), (e[3] = this.correctTopRight(e)), !e[3])) throw new N()
  6566. e = this.shiftToModuleCenter(e)
  6567. const r = e[0],
  6568. n = e[1],
  6569. i = e[2],
  6570. o = e[3]
  6571. let s = this.transitionsBetween(r, o) + 1,
  6572. a = this.transitionsBetween(i, o) + 1
  6573. 1 == (1 & s) && (s += 1), 1 == (1 & a) && (a += 1), 4 * s < 7 * a && 4 * a < 7 * s && (s = a = Math.max(s, a))
  6574. let l = he.sampleGrid(this.image, r, n, i, o, s, a)
  6575. return new it(l, [r, n, i, o])
  6576. }
  6577. static shiftPoint(t, e, r) {
  6578. let n = (e.getX() - t.getX()) / (r + 1),
  6579. i = (e.getY() - t.getY()) / (r + 1)
  6580. return new nt(t.getX() + n, t.getY() + i)
  6581. }
  6582. static moveAway(t, e, r) {
  6583. let n = t.getX(),
  6584. i = t.getY()
  6585. return n < e ? (n -= 1) : (n += 1), i < r ? (i -= 1) : (i += 1), new nt(n, i)
  6586. }
  6587. detectSolid1(t) {
  6588. let e = t[0],
  6589. r = t[1],
  6590. n = t[3],
  6591. i = t[2],
  6592. o = this.transitionsBetween(e, r),
  6593. s = this.transitionsBetween(r, n),
  6594. a = this.transitionsBetween(n, i),
  6595. l = this.transitionsBetween(i, e),
  6596. c = o,
  6597. h = [i, e, r, n]
  6598. return (
  6599. c > s && ((c = s), (h[0] = e), (h[1] = r), (h[2] = n), (h[3] = i)),
  6600. c > a && ((c = a), (h[0] = r), (h[1] = n), (h[2] = i), (h[3] = e)),
  6601. c > l && ((h[0] = n), (h[1] = i), (h[2] = e), (h[3] = r)),
  6602. h
  6603. )
  6604. }
  6605. detectSolid2(t) {
  6606. let e = t[0],
  6607. r = t[1],
  6608. n = t[2],
  6609. i = t[3],
  6610. o = this.transitionsBetween(e, i),
  6611. s = he.shiftPoint(r, n, 4 * (o + 1)),
  6612. a = he.shiftPoint(n, r, 4 * (o + 1))
  6613. return (
  6614. this.transitionsBetween(s, e) < this.transitionsBetween(a, i) ? ((t[0] = e), (t[1] = r), (t[2] = n), (t[3] = i)) : ((t[0] = r), (t[1] = n), (t[2] = i), (t[3] = e)), t
  6615. )
  6616. }
  6617. correctTopRight(t) {
  6618. let e = t[0],
  6619. r = t[1],
  6620. n = t[2],
  6621. i = t[3],
  6622. o = this.transitionsBetween(e, i),
  6623. s = this.transitionsBetween(r, i),
  6624. a = he.shiftPoint(e, r, 4 * (s + 1)),
  6625. l = he.shiftPoint(n, r, 4 * (o + 1))
  6626. ;(o = this.transitionsBetween(a, i)), (s = this.transitionsBetween(l, i))
  6627. let c = new nt(i.getX() + (n.getX() - r.getX()) / (o + 1), i.getY() + (n.getY() - r.getY()) / (o + 1)),
  6628. h = new nt(i.getX() + (e.getX() - r.getX()) / (s + 1), i.getY() + (e.getY() - r.getY()) / (s + 1))
  6629. return this.isValid(c)
  6630. ? this.isValid(h)
  6631. ? this.transitionsBetween(a, c) + this.transitionsBetween(l, c) > this.transitionsBetween(a, h) + this.transitionsBetween(l, h)
  6632. ? c
  6633. : h
  6634. : c
  6635. : this.isValid(h)
  6636. ? h
  6637. : null
  6638. }
  6639. shiftToModuleCenter(t) {
  6640. let e = t[0],
  6641. r = t[1],
  6642. n = t[2],
  6643. i = t[3],
  6644. o = this.transitionsBetween(e, i) + 1,
  6645. s = this.transitionsBetween(n, i) + 1,
  6646. a = he.shiftPoint(e, r, 4 * s),
  6647. l = he.shiftPoint(n, r, 4 * o)
  6648. ;(o = this.transitionsBetween(a, i) + 1), (s = this.transitionsBetween(l, i) + 1), 1 == (1 & o) && (o += 1), 1 == (1 & s) && (s += 1)
  6649. let c,
  6650. h,
  6651. u = (e.getX() + r.getX() + n.getX() + i.getX()) / 4,
  6652. d = (e.getY() + r.getY() + n.getY() + i.getY()) / 4
  6653. return (
  6654. (e = he.moveAway(e, u, d)),
  6655. (r = he.moveAway(r, u, d)),
  6656. (n = he.moveAway(n, u, d)),
  6657. (i = he.moveAway(i, u, d)),
  6658. (a = he.shiftPoint(e, r, 4 * s)),
  6659. (a = he.shiftPoint(a, i, 4 * o)),
  6660. (c = he.shiftPoint(r, e, 4 * s)),
  6661. (c = he.shiftPoint(c, n, 4 * o)),
  6662. (l = he.shiftPoint(n, i, 4 * s)),
  6663. (l = he.shiftPoint(l, r, 4 * o)),
  6664. (h = he.shiftPoint(i, n, 4 * s)),
  6665. (h = he.shiftPoint(h, e, 4 * o)),
  6666. [a, c, l, h]
  6667. )
  6668. }
  6669. isValid(t) {
  6670. return t.getX() >= 0 && t.getX() < this.image.getWidth() && t.getY() > 0 && t.getY() < this.image.getHeight()
  6671. }
  6672. static sampleGrid(t, e, r, n, i, o, s) {
  6673. return ht
  6674. .getInstance()
  6675. .sampleGrid(t, o, s, 0.5, 0.5, o - 0.5, 0.5, o - 0.5, s - 0.5, 0.5, s - 0.5, e.getX(), e.getY(), i.getX(), i.getY(), n.getX(), n.getY(), r.getX(), r.getY())
  6676. }
  6677. transitionsBetween(t, e) {
  6678. let r = Math.trunc(t.getX()),
  6679. n = Math.trunc(t.getY()),
  6680. i = Math.trunc(e.getX()),
  6681. o = Math.trunc(e.getY()),
  6682. s = Math.abs(o - n) > Math.abs(i - r)
  6683. if (s) {
  6684. let t = r
  6685. ;(r = n), (n = t), (t = i), (i = o), (o = t)
  6686. }
  6687. let a = Math.abs(i - r),
  6688. l = Math.abs(o - n),
  6689. c = -a / 2,
  6690. h = n < o ? 1 : -1,
  6691. u = r < i ? 1 : -1,
  6692. d = 0,
  6693. g = this.image.get(s ? n : r, s ? r : n)
  6694. for (let t = r, e = n; t !== i; t += u) {
  6695. let r = this.image.get(s ? e : t, s ? t : e)
  6696. if ((r !== g && (d++, (g = r)), (c += l), c > 0)) {
  6697. if (e === o) break
  6698. ;(e += h), (c -= a)
  6699. }
  6700. }
  6701. return d
  6702. }
  6703. }
  6704. class ue {
  6705. constructor() {
  6706. this.decoder = new ce()
  6707. }
  6708. decode(t, e = null) {
  6709. let r, n
  6710. if (null != e && e.has(E.PURE_BARCODE)) {
  6711. const e = ue.extractPureBits(t.getBlackMatrix())
  6712. ;(r = this.decoder.decode(e)), (n = ue.NO_POINTS)
  6713. } else {
  6714. const e = new he(t.getBlackMatrix()).detect()
  6715. ;(r = this.decoder.decode(e.getBits())), (n = e.getPoints())
  6716. }
  6717. const i = r.getRawBytes(),
  6718. o = new F(r.getText(), i, 8 * i.length, n, k.DATA_MATRIX, u.currentTimeMillis()),
  6719. s = r.getByteSegments()
  6720. null != s && o.putMetadata(X.BYTE_SEGMENTS, s)
  6721. const a = r.getECLevel()
  6722. return null != a && o.putMetadata(X.ERROR_CORRECTION_LEVEL, a), o
  6723. }
  6724. reset() {}
  6725. static extractPureBits(t) {
  6726. const e = t.getTopLeftOnBit(),
  6727. r = t.getBottomRightOnBit()
  6728. if (null == e || null == r) throw new N()
  6729. const n = this.moduleSize(e, t)
  6730. let i = e[1]
  6731. const o = r[1]
  6732. let s = e[0]
  6733. const a = (r[0] - s + 1) / n,
  6734. l = (o - i + 1) / n
  6735. if (a <= 0 || l <= 0) throw new N()
  6736. const c = n / 2
  6737. ;(i += c), (s += c)
  6738. const h = new y(a, l)
  6739. for (let e = 0; e < l; e++) {
  6740. const r = i + e * n
  6741. for (let i = 0; i < a; i++) t.get(s + i * n, r) && h.set(i, e)
  6742. }
  6743. return h
  6744. }
  6745. static moduleSize(t, e) {
  6746. const r = e.getWidth()
  6747. let n = t[0]
  6748. const i = t[1]
  6749. for (; n < r && e.get(n, i); ) n++
  6750. if (n === r) throw new N()
  6751. const o = n - t[0]
  6752. if (0 === o) throw new N()
  6753. return o
  6754. }
  6755. }
  6756. ue.NO_POINTS = []
  6757. !(function(t) {
  6758. ;(t[(t.L = 0)] = 'L'), (t[(t.M = 1)] = 'M'), (t[(t.Q = 2)] = 'Q'), (t[(t.H = 3)] = 'H')
  6759. })(V || (V = {}))
  6760. class de {
  6761. constructor(t, e, r) {
  6762. ;(this.value = t), (this.stringValue = e), (this.bits = r), de.FOR_BITS.set(r, this), de.FOR_VALUE.set(t, this)
  6763. }
  6764. getValue() {
  6765. return this.value
  6766. }
  6767. getBits() {
  6768. return this.bits
  6769. }
  6770. static fromString(t) {
  6771. switch (t) {
  6772. case 'L':
  6773. return de.L
  6774. case 'M':
  6775. return de.M
  6776. case 'Q':
  6777. return de.Q
  6778. case 'H':
  6779. return de.H
  6780. default:
  6781. throw new s(t + 'not available')
  6782. }
  6783. }
  6784. toString() {
  6785. return this.stringValue
  6786. }
  6787. equals(t) {
  6788. if (!(t instanceof de)) return !1
  6789. const e = t
  6790. return this.value === e.value
  6791. }
  6792. static forBits(t) {
  6793. if (t < 0 || t >= de.FOR_BITS.size) throw new a()
  6794. return de.FOR_BITS.get(t)
  6795. }
  6796. }
  6797. ;(de.FOR_BITS = new Map()), (de.FOR_VALUE = new Map()), (de.L = new de(V.L, 'L', 1)), (de.M = new de(V.M, 'M', 0)), (de.Q = new de(V.Q, 'Q', 3)), (de.H = new de(V.H, 'H', 2))
  6798. class ge {
  6799. constructor(t) {
  6800. ;(this.errorCorrectionLevel = de.forBits((t >> 3) & 3)), (this.dataMask = 7 & t)
  6801. }
  6802. static numBitsDiffering(t, e) {
  6803. return w.bitCount(t ^ e)
  6804. }
  6805. static decodeFormatInformation(t, e) {
  6806. const r = ge.doDecodeFormatInformation(t, e)
  6807. return null !== r ? r : ge.doDecodeFormatInformation(t ^ ge.FORMAT_INFO_MASK_QR, e ^ ge.FORMAT_INFO_MASK_QR)
  6808. }
  6809. static doDecodeFormatInformation(t, e) {
  6810. let r = Number.MAX_SAFE_INTEGER,
  6811. n = 0
  6812. for (const i of ge.FORMAT_INFO_DECODE_LOOKUP) {
  6813. const o = i[0]
  6814. if (o === t || o === e) return new ge(i[1])
  6815. let s = ge.numBitsDiffering(t, o)
  6816. s < r && ((n = i[1]), (r = s)), t !== e && ((s = ge.numBitsDiffering(e, o)), s < r && ((n = i[1]), (r = s)))
  6817. }
  6818. return r <= 3 ? new ge(n) : null
  6819. }
  6820. getErrorCorrectionLevel() {
  6821. return this.errorCorrectionLevel
  6822. }
  6823. getDataMask() {
  6824. return this.dataMask
  6825. }
  6826. hashCode() {
  6827. return (this.errorCorrectionLevel.getBits() << 3) | this.dataMask
  6828. }
  6829. equals(t) {
  6830. if (!(t instanceof ge)) return !1
  6831. const e = t
  6832. return this.errorCorrectionLevel === e.errorCorrectionLevel && this.dataMask === e.dataMask
  6833. }
  6834. }
  6835. ;(ge.FORMAT_INFO_MASK_QR = 21522),
  6836. (ge.FORMAT_INFO_DECODE_LOOKUP = [
  6837. Int32Array.from([21522, 0]),
  6838. Int32Array.from([20773, 1]),
  6839. Int32Array.from([24188, 2]),
  6840. Int32Array.from([23371, 3]),
  6841. Int32Array.from([17913, 4]),
  6842. Int32Array.from([16590, 5]),
  6843. Int32Array.from([20375, 6]),
  6844. Int32Array.from([19104, 7]),
  6845. Int32Array.from([30660, 8]),
  6846. Int32Array.from([29427, 9]),
  6847. Int32Array.from([32170, 10]),
  6848. Int32Array.from([30877, 11]),
  6849. Int32Array.from([26159, 12]),
  6850. Int32Array.from([25368, 13]),
  6851. Int32Array.from([27713, 14]),
  6852. Int32Array.from([26998, 15]),
  6853. Int32Array.from([5769, 16]),
  6854. Int32Array.from([5054, 17]),
  6855. Int32Array.from([7399, 18]),
  6856. Int32Array.from([6608, 19]),
  6857. Int32Array.from([1890, 20]),
  6858. Int32Array.from([597, 21]),
  6859. Int32Array.from([3340, 22]),
  6860. Int32Array.from([2107, 23]),
  6861. Int32Array.from([13663, 24]),
  6862. Int32Array.from([12392, 25]),
  6863. Int32Array.from([16177, 26]),
  6864. Int32Array.from([14854, 27]),
  6865. Int32Array.from([9396, 28]),
  6866. Int32Array.from([8579, 29]),
  6867. Int32Array.from([11994, 30]),
  6868. Int32Array.from([11245, 31])
  6869. ])
  6870. class fe {
  6871. constructor(t, ...e) {
  6872. ;(this.ecCodewordsPerBlock = t), (this.ecBlocks = e)
  6873. }
  6874. getECCodewordsPerBlock() {
  6875. return this.ecCodewordsPerBlock
  6876. }
  6877. getNumBlocks() {
  6878. let t = 0
  6879. const e = this.ecBlocks
  6880. for (const r of e) t += r.getCount()
  6881. return t
  6882. }
  6883. getTotalECCodewords() {
  6884. return this.ecCodewordsPerBlock * this.getNumBlocks()
  6885. }
  6886. getECBlocks() {
  6887. return this.ecBlocks
  6888. }
  6889. }
  6890. class we {
  6891. constructor(t, e) {
  6892. ;(this.count = t), (this.dataCodewords = e)
  6893. }
  6894. getCount() {
  6895. return this.count
  6896. }
  6897. getDataCodewords() {
  6898. return this.dataCodewords
  6899. }
  6900. }
  6901. class Ae {
  6902. constructor(t, e, ...r) {
  6903. ;(this.versionNumber = t), (this.alignmentPatternCenters = e), (this.ecBlocks = r)
  6904. let n = 0
  6905. const i = r[0].getECCodewordsPerBlock(),
  6906. o = r[0].getECBlocks()
  6907. for (const t of o) n += t.getCount() * (t.getDataCodewords() + i)
  6908. this.totalCodewords = n
  6909. }
  6910. getVersionNumber() {
  6911. return this.versionNumber
  6912. }
  6913. getAlignmentPatternCenters() {
  6914. return this.alignmentPatternCenters
  6915. }
  6916. getTotalCodewords() {
  6917. return this.totalCodewords
  6918. }
  6919. getDimensionForVersion() {
  6920. return 17 + 4 * this.versionNumber
  6921. }
  6922. getECBlocksForLevel(t) {
  6923. return this.ecBlocks[t.getValue()]
  6924. }
  6925. static getProvisionalVersionForDimension(t) {
  6926. if (t % 4 != 1) throw new C()
  6927. try {
  6928. return this.getVersionForNumber((t - 17) / 4)
  6929. } catch (t) {
  6930. throw new C()
  6931. }
  6932. }
  6933. static getVersionForNumber(t) {
  6934. if (t < 1 || t > 40) throw new a()
  6935. return Ae.VERSIONS[t - 1]
  6936. }
  6937. static decodeVersionInformation(t) {
  6938. let e = Number.MAX_SAFE_INTEGER,
  6939. r = 0
  6940. for (let n = 0; n < Ae.VERSION_DECODE_INFO.length; n++) {
  6941. const i = Ae.VERSION_DECODE_INFO[n]
  6942. if (i === t) return Ae.getVersionForNumber(n + 7)
  6943. const o = ge.numBitsDiffering(t, i)
  6944. o < e && ((r = n + 7), (e = o))
  6945. }
  6946. return e <= 3 ? Ae.getVersionForNumber(r) : null
  6947. }
  6948. buildFunctionPattern() {
  6949. const t = this.getDimensionForVersion(),
  6950. e = new y(t)
  6951. e.setRegion(0, 0, 9, 9), e.setRegion(t - 8, 0, 8, 9), e.setRegion(0, t - 8, 9, 8)
  6952. const r = this.alignmentPatternCenters.length
  6953. for (let t = 0; t < r; t++) {
  6954. const n = this.alignmentPatternCenters[t] - 2
  6955. for (let i = 0; i < r; i++) (0 === t && (0 === i || i === r - 1)) || (t === r - 1 && 0 === i) || e.setRegion(this.alignmentPatternCenters[i] - 2, n, 5, 5)
  6956. }
  6957. return e.setRegion(6, 9, 1, t - 17), e.setRegion(9, 6, t - 17, 1), this.versionNumber > 6 && (e.setRegion(t - 11, 0, 3, 6), e.setRegion(0, t - 11, 6, 3)), e
  6958. }
  6959. toString() {
  6960. return '' + this.versionNumber
  6961. }
  6962. }
  6963. ;(Ae.VERSION_DECODE_INFO = Int32Array.from([
  6964. 31892,
  6965. 34236,
  6966. 39577,
  6967. 42195,
  6968. 48118,
  6969. 51042,
  6970. 55367,
  6971. 58893,
  6972. 63784,
  6973. 68472,
  6974. 70749,
  6975. 76311,
  6976. 79154,
  6977. 84390,
  6978. 87683,
  6979. 92361,
  6980. 96236,
  6981. 102084,
  6982. 102881,
  6983. 110507,
  6984. 110734,
  6985. 117786,
  6986. 119615,
  6987. 126325,
  6988. 127568,
  6989. 133589,
  6990. 136944,
  6991. 141498,
  6992. 145311,
  6993. 150283,
  6994. 152622,
  6995. 158308,
  6996. 161089,
  6997. 167017
  6998. ])),
  6999. (Ae.VERSIONS = [
  7000. new Ae(1, new Int32Array(0), new fe(7, new we(1, 19)), new fe(10, new we(1, 16)), new fe(13, new we(1, 13)), new fe(17, new we(1, 9))),
  7001. new Ae(2, Int32Array.from([6, 18]), new fe(10, new we(1, 34)), new fe(16, new we(1, 28)), new fe(22, new we(1, 22)), new fe(28, new we(1, 16))),
  7002. new Ae(3, Int32Array.from([6, 22]), new fe(15, new we(1, 55)), new fe(26, new we(1, 44)), new fe(18, new we(2, 17)), new fe(22, new we(2, 13))),
  7003. new Ae(4, Int32Array.from([6, 26]), new fe(20, new we(1, 80)), new fe(18, new we(2, 32)), new fe(26, new we(2, 24)), new fe(16, new we(4, 9))),
  7004. new Ae(
  7005. 5,
  7006. Int32Array.from([6, 30]),
  7007. new fe(26, new we(1, 108)),
  7008. new fe(24, new we(2, 43)),
  7009. new fe(18, new we(2, 15), new we(2, 16)),
  7010. new fe(22, new we(2, 11), new we(2, 12))
  7011. ),
  7012. new Ae(6, Int32Array.from([6, 34]), new fe(18, new we(2, 68)), new fe(16, new we(4, 27)), new fe(24, new we(4, 19)), new fe(28, new we(4, 15))),
  7013. new Ae(
  7014. 7,
  7015. Int32Array.from([6, 22, 38]),
  7016. new fe(20, new we(2, 78)),
  7017. new fe(18, new we(4, 31)),
  7018. new fe(18, new we(2, 14), new we(4, 15)),
  7019. new fe(26, new we(4, 13), new we(1, 14))
  7020. ),
  7021. new Ae(
  7022. 8,
  7023. Int32Array.from([6, 24, 42]),
  7024. new fe(24, new we(2, 97)),
  7025. new fe(22, new we(2, 38), new we(2, 39)),
  7026. new fe(22, new we(4, 18), new we(2, 19)),
  7027. new fe(26, new we(4, 14), new we(2, 15))
  7028. ),
  7029. new Ae(
  7030. 9,
  7031. Int32Array.from([6, 26, 46]),
  7032. new fe(30, new we(2, 116)),
  7033. new fe(22, new we(3, 36), new we(2, 37)),
  7034. new fe(20, new we(4, 16), new we(4, 17)),
  7035. new fe(24, new we(4, 12), new we(4, 13))
  7036. ),
  7037. new Ae(
  7038. 10,
  7039. Int32Array.from([6, 28, 50]),
  7040. new fe(18, new we(2, 68), new we(2, 69)),
  7041. new fe(26, new we(4, 43), new we(1, 44)),
  7042. new fe(24, new we(6, 19), new we(2, 20)),
  7043. new fe(28, new we(6, 15), new we(2, 16))
  7044. ),
  7045. new Ae(
  7046. 11,
  7047. Int32Array.from([6, 30, 54]),
  7048. new fe(20, new we(4, 81)),
  7049. new fe(30, new we(1, 50), new we(4, 51)),
  7050. new fe(28, new we(4, 22), new we(4, 23)),
  7051. new fe(24, new we(3, 12), new we(8, 13))
  7052. ),
  7053. new Ae(
  7054. 12,
  7055. Int32Array.from([6, 32, 58]),
  7056. new fe(24, new we(2, 92), new we(2, 93)),
  7057. new fe(22, new we(6, 36), new we(2, 37)),
  7058. new fe(26, new we(4, 20), new we(6, 21)),
  7059. new fe(28, new we(7, 14), new we(4, 15))
  7060. ),
  7061. new Ae(
  7062. 13,
  7063. Int32Array.from([6, 34, 62]),
  7064. new fe(26, new we(4, 107)),
  7065. new fe(22, new we(8, 37), new we(1, 38)),
  7066. new fe(24, new we(8, 20), new we(4, 21)),
  7067. new fe(22, new we(12, 11), new we(4, 12))
  7068. ),
  7069. new Ae(
  7070. 14,
  7071. Int32Array.from([6, 26, 46, 66]),
  7072. new fe(30, new we(3, 115), new we(1, 116)),
  7073. new fe(24, new we(4, 40), new we(5, 41)),
  7074. new fe(20, new we(11, 16), new we(5, 17)),
  7075. new fe(24, new we(11, 12), new we(5, 13))
  7076. ),
  7077. new Ae(
  7078. 15,
  7079. Int32Array.from([6, 26, 48, 70]),
  7080. new fe(22, new we(5, 87), new we(1, 88)),
  7081. new fe(24, new we(5, 41), new we(5, 42)),
  7082. new fe(30, new we(5, 24), new we(7, 25)),
  7083. new fe(24, new we(11, 12), new we(7, 13))
  7084. ),
  7085. new Ae(
  7086. 16,
  7087. Int32Array.from([6, 26, 50, 74]),
  7088. new fe(24, new we(5, 98), new we(1, 99)),
  7089. new fe(28, new we(7, 45), new we(3, 46)),
  7090. new fe(24, new we(15, 19), new we(2, 20)),
  7091. new fe(30, new we(3, 15), new we(13, 16))
  7092. ),
  7093. new Ae(
  7094. 17,
  7095. Int32Array.from([6, 30, 54, 78]),
  7096. new fe(28, new we(1, 107), new we(5, 108)),
  7097. new fe(28, new we(10, 46), new we(1, 47)),
  7098. new fe(28, new we(1, 22), new we(15, 23)),
  7099. new fe(28, new we(2, 14), new we(17, 15))
  7100. ),
  7101. new Ae(
  7102. 18,
  7103. Int32Array.from([6, 30, 56, 82]),
  7104. new fe(30, new we(5, 120), new we(1, 121)),
  7105. new fe(26, new we(9, 43), new we(4, 44)),
  7106. new fe(28, new we(17, 22), new we(1, 23)),
  7107. new fe(28, new we(2, 14), new we(19, 15))
  7108. ),
  7109. new Ae(
  7110. 19,
  7111. Int32Array.from([6, 30, 58, 86]),
  7112. new fe(28, new we(3, 113), new we(4, 114)),
  7113. new fe(26, new we(3, 44), new we(11, 45)),
  7114. new fe(26, new we(17, 21), new we(4, 22)),
  7115. new fe(26, new we(9, 13), new we(16, 14))
  7116. ),
  7117. new Ae(
  7118. 20,
  7119. Int32Array.from([6, 34, 62, 90]),
  7120. new fe(28, new we(3, 107), new we(5, 108)),
  7121. new fe(26, new we(3, 41), new we(13, 42)),
  7122. new fe(30, new we(15, 24), new we(5, 25)),
  7123. new fe(28, new we(15, 15), new we(10, 16))
  7124. ),
  7125. new Ae(
  7126. 21,
  7127. Int32Array.from([6, 28, 50, 72, 94]),
  7128. new fe(28, new we(4, 116), new we(4, 117)),
  7129. new fe(26, new we(17, 42)),
  7130. new fe(28, new we(17, 22), new we(6, 23)),
  7131. new fe(30, new we(19, 16), new we(6, 17))
  7132. ),
  7133. new Ae(
  7134. 22,
  7135. Int32Array.from([6, 26, 50, 74, 98]),
  7136. new fe(28, new we(2, 111), new we(7, 112)),
  7137. new fe(28, new we(17, 46)),
  7138. new fe(30, new we(7, 24), new we(16, 25)),
  7139. new fe(24, new we(34, 13))
  7140. ),
  7141. new Ae(
  7142. 23,
  7143. Int32Array.from([6, 30, 54, 78, 102]),
  7144. new fe(30, new we(4, 121), new we(5, 122)),
  7145. new fe(28, new we(4, 47), new we(14, 48)),
  7146. new fe(30, new we(11, 24), new we(14, 25)),
  7147. new fe(30, new we(16, 15), new we(14, 16))
  7148. ),
  7149. new Ae(
  7150. 24,
  7151. Int32Array.from([6, 28, 54, 80, 106]),
  7152. new fe(30, new we(6, 117), new we(4, 118)),
  7153. new fe(28, new we(6, 45), new we(14, 46)),
  7154. new fe(30, new we(11, 24), new we(16, 25)),
  7155. new fe(30, new we(30, 16), new we(2, 17))
  7156. ),
  7157. new Ae(
  7158. 25,
  7159. Int32Array.from([6, 32, 58, 84, 110]),
  7160. new fe(26, new we(8, 106), new we(4, 107)),
  7161. new fe(28, new we(8, 47), new we(13, 48)),
  7162. new fe(30, new we(7, 24), new we(22, 25)),
  7163. new fe(30, new we(22, 15), new we(13, 16))
  7164. ),
  7165. new Ae(
  7166. 26,
  7167. Int32Array.from([6, 30, 58, 86, 114]),
  7168. new fe(28, new we(10, 114), new we(2, 115)),
  7169. new fe(28, new we(19, 46), new we(4, 47)),
  7170. new fe(28, new we(28, 22), new we(6, 23)),
  7171. new fe(30, new we(33, 16), new we(4, 17))
  7172. ),
  7173. new Ae(
  7174. 27,
  7175. Int32Array.from([6, 34, 62, 90, 118]),
  7176. new fe(30, new we(8, 122), new we(4, 123)),
  7177. new fe(28, new we(22, 45), new we(3, 46)),
  7178. new fe(30, new we(8, 23), new we(26, 24)),
  7179. new fe(30, new we(12, 15), new we(28, 16))
  7180. ),
  7181. new Ae(
  7182. 28,
  7183. Int32Array.from([6, 26, 50, 74, 98, 122]),
  7184. new fe(30, new we(3, 117), new we(10, 118)),
  7185. new fe(28, new we(3, 45), new we(23, 46)),
  7186. new fe(30, new we(4, 24), new we(31, 25)),
  7187. new fe(30, new we(11, 15), new we(31, 16))
  7188. ),
  7189. new Ae(
  7190. 29,
  7191. Int32Array.from([6, 30, 54, 78, 102, 126]),
  7192. new fe(30, new we(7, 116), new we(7, 117)),
  7193. new fe(28, new we(21, 45), new we(7, 46)),
  7194. new fe(30, new we(1, 23), new we(37, 24)),
  7195. new fe(30, new we(19, 15), new we(26, 16))
  7196. ),
  7197. new Ae(
  7198. 30,
  7199. Int32Array.from([6, 26, 52, 78, 104, 130]),
  7200. new fe(30, new we(5, 115), new we(10, 116)),
  7201. new fe(28, new we(19, 47), new we(10, 48)),
  7202. new fe(30, new we(15, 24), new we(25, 25)),
  7203. new fe(30, new we(23, 15), new we(25, 16))
  7204. ),
  7205. new Ae(
  7206. 31,
  7207. Int32Array.from([6, 30, 56, 82, 108, 134]),
  7208. new fe(30, new we(13, 115), new we(3, 116)),
  7209. new fe(28, new we(2, 46), new we(29, 47)),
  7210. new fe(30, new we(42, 24), new we(1, 25)),
  7211. new fe(30, new we(23, 15), new we(28, 16))
  7212. ),
  7213. new Ae(
  7214. 32,
  7215. Int32Array.from([6, 34, 60, 86, 112, 138]),
  7216. new fe(30, new we(17, 115)),
  7217. new fe(28, new we(10, 46), new we(23, 47)),
  7218. new fe(30, new we(10, 24), new we(35, 25)),
  7219. new fe(30, new we(19, 15), new we(35, 16))
  7220. ),
  7221. new Ae(
  7222. 33,
  7223. Int32Array.from([6, 30, 58, 86, 114, 142]),
  7224. new fe(30, new we(17, 115), new we(1, 116)),
  7225. new fe(28, new we(14, 46), new we(21, 47)),
  7226. new fe(30, new we(29, 24), new we(19, 25)),
  7227. new fe(30, new we(11, 15), new we(46, 16))
  7228. ),
  7229. new Ae(
  7230. 34,
  7231. Int32Array.from([6, 34, 62, 90, 118, 146]),
  7232. new fe(30, new we(13, 115), new we(6, 116)),
  7233. new fe(28, new we(14, 46), new we(23, 47)),
  7234. new fe(30, new we(44, 24), new we(7, 25)),
  7235. new fe(30, new we(59, 16), new we(1, 17))
  7236. ),
  7237. new Ae(
  7238. 35,
  7239. Int32Array.from([6, 30, 54, 78, 102, 126, 150]),
  7240. new fe(30, new we(12, 121), new we(7, 122)),
  7241. new fe(28, new we(12, 47), new we(26, 48)),
  7242. new fe(30, new we(39, 24), new we(14, 25)),
  7243. new fe(30, new we(22, 15), new we(41, 16))
  7244. ),
  7245. new Ae(
  7246. 36,
  7247. Int32Array.from([6, 24, 50, 76, 102, 128, 154]),
  7248. new fe(30, new we(6, 121), new we(14, 122)),
  7249. new fe(28, new we(6, 47), new we(34, 48)),
  7250. new fe(30, new we(46, 24), new we(10, 25)),
  7251. new fe(30, new we(2, 15), new we(64, 16))
  7252. ),
  7253. new Ae(
  7254. 37,
  7255. Int32Array.from([6, 28, 54, 80, 106, 132, 158]),
  7256. new fe(30, new we(17, 122), new we(4, 123)),
  7257. new fe(28, new we(29, 46), new we(14, 47)),
  7258. new fe(30, new we(49, 24), new we(10, 25)),
  7259. new fe(30, new we(24, 15), new we(46, 16))
  7260. ),
  7261. new Ae(
  7262. 38,
  7263. Int32Array.from([6, 32, 58, 84, 110, 136, 162]),
  7264. new fe(30, new we(4, 122), new we(18, 123)),
  7265. new fe(28, new we(13, 46), new we(32, 47)),
  7266. new fe(30, new we(48, 24), new we(14, 25)),
  7267. new fe(30, new we(42, 15), new we(32, 16))
  7268. ),
  7269. new Ae(
  7270. 39,
  7271. Int32Array.from([6, 26, 54, 82, 110, 138, 166]),
  7272. new fe(30, new we(20, 117), new we(4, 118)),
  7273. new fe(28, new we(40, 47), new we(7, 48)),
  7274. new fe(30, new we(43, 24), new we(22, 25)),
  7275. new fe(30, new we(10, 15), new we(67, 16))
  7276. ),
  7277. new Ae(
  7278. 40,
  7279. Int32Array.from([6, 30, 58, 86, 114, 142, 170]),
  7280. new fe(30, new we(19, 118), new we(6, 119)),
  7281. new fe(28, new we(18, 47), new we(31, 48)),
  7282. new fe(30, new we(34, 24), new we(34, 25)),
  7283. new fe(30, new we(20, 15), new we(61, 16))
  7284. )
  7285. ]),
  7286. (function(t) {
  7287. ;(t[(t.DATA_MASK_000 = 0)] = 'DATA_MASK_000'),
  7288. (t[(t.DATA_MASK_001 = 1)] = 'DATA_MASK_001'),
  7289. (t[(t.DATA_MASK_010 = 2)] = 'DATA_MASK_010'),
  7290. (t[(t.DATA_MASK_011 = 3)] = 'DATA_MASK_011'),
  7291. (t[(t.DATA_MASK_100 = 4)] = 'DATA_MASK_100'),
  7292. (t[(t.DATA_MASK_101 = 5)] = 'DATA_MASK_101'),
  7293. (t[(t.DATA_MASK_110 = 6)] = 'DATA_MASK_110'),
  7294. (t[(t.DATA_MASK_111 = 7)] = 'DATA_MASK_111')
  7295. })(z || (z = {}))
  7296. class me {
  7297. constructor(t, e) {
  7298. ;(this.value = t), (this.isMasked = e)
  7299. }
  7300. unmaskBitMatrix(t, e) {
  7301. for (let r = 0; r < e; r++) for (let n = 0; n < e; n++) this.isMasked(r, n) && t.flip(n, r)
  7302. }
  7303. }
  7304. me.values = new Map([
  7305. [z.DATA_MASK_000, new me(z.DATA_MASK_000, (t, e) => 0 == ((t + e) & 1))],
  7306. [z.DATA_MASK_001, new me(z.DATA_MASK_001, (t, e) => 0 == (1 & t))],
  7307. [z.DATA_MASK_010, new me(z.DATA_MASK_010, (t, e) => e % 3 == 0)],
  7308. [z.DATA_MASK_011, new me(z.DATA_MASK_011, (t, e) => (t + e) % 3 == 0)],
  7309. [z.DATA_MASK_100, new me(z.DATA_MASK_100, (t, e) => 0 == ((Math.floor(t / 2) + Math.floor(e / 3)) & 1))],
  7310. [z.DATA_MASK_101, new me(z.DATA_MASK_101, (t, e) => (t * e) % 6 == 0)],
  7311. [z.DATA_MASK_110, new me(z.DATA_MASK_110, (t, e) => (t * e) % 6 < 3)],
  7312. [z.DATA_MASK_111, new me(z.DATA_MASK_111, (t, e) => 0 == ((t + e + ((t * e) % 3)) & 1))]
  7313. ])
  7314. class Ee {
  7315. constructor(t) {
  7316. const e = t.getHeight()
  7317. if (e < 21 || 1 != (3 & e)) throw new C()
  7318. this.bitMatrix = t
  7319. }
  7320. readFormatInformation() {
  7321. if (null !== this.parsedFormatInfo && void 0 !== this.parsedFormatInfo) return this.parsedFormatInfo
  7322. let t = 0
  7323. for (let e = 0; e < 6; e++) t = this.copyBit(e, 8, t)
  7324. ;(t = this.copyBit(7, 8, t)), (t = this.copyBit(8, 8, t)), (t = this.copyBit(8, 7, t))
  7325. for (let e = 5; e >= 0; e--) t = this.copyBit(8, e, t)
  7326. const e = this.bitMatrix.getHeight()
  7327. let r = 0
  7328. const n = e - 7
  7329. for (let t = e - 1; t >= n; t--) r = this.copyBit(8, t, r)
  7330. for (let t = e - 8; t < e; t++) r = this.copyBit(t, 8, r)
  7331. if (((this.parsedFormatInfo = ge.decodeFormatInformation(t, r)), null !== this.parsedFormatInfo)) return this.parsedFormatInfo
  7332. throw new C()
  7333. }
  7334. readVersion() {
  7335. if (null !== this.parsedVersion && void 0 !== this.parsedVersion) return this.parsedVersion
  7336. const t = this.bitMatrix.getHeight(),
  7337. e = Math.floor((t - 17) / 4)
  7338. if (e <= 6) return Ae.getVersionForNumber(e)
  7339. let r = 0
  7340. const n = t - 11
  7341. for (let e = 5; e >= 0; e--) for (let i = t - 9; i >= n; i--) r = this.copyBit(i, e, r)
  7342. let i = Ae.decodeVersionInformation(r)
  7343. if (null !== i && i.getDimensionForVersion() === t) return (this.parsedVersion = i), i
  7344. r = 0
  7345. for (let e = 5; e >= 0; e--) for (let i = t - 9; i >= n; i--) r = this.copyBit(e, i, r)
  7346. if (((i = Ae.decodeVersionInformation(r)), null !== i && i.getDimensionForVersion() === t)) return (this.parsedVersion = i), i
  7347. throw new C()
  7348. }
  7349. copyBit(t, e, r) {
  7350. return (this.isMirror ? this.bitMatrix.get(e, t) : this.bitMatrix.get(t, e)) ? (r << 1) | 1 : r << 1
  7351. }
  7352. readCodewords() {
  7353. const t = this.readFormatInformation(),
  7354. e = this.readVersion(),
  7355. r = me.values.get(t.getDataMask()),
  7356. n = this.bitMatrix.getHeight()
  7357. r.unmaskBitMatrix(this.bitMatrix, n)
  7358. const i = e.buildFunctionPattern()
  7359. let o = !0
  7360. const s = new Uint8Array(e.getTotalCodewords())
  7361. let a = 0,
  7362. l = 0,
  7363. c = 0
  7364. for (let t = n - 1; t > 0; t -= 2) {
  7365. 6 === t && t--
  7366. for (let e = 0; e < n; e++) {
  7367. const r = o ? n - 1 - e : e
  7368. for (let e = 0; e < 2; e++) i.get(t - e, r) || (c++, (l <<= 1), this.bitMatrix.get(t - e, r) && (l |= 1), 8 === c && ((s[a++] = l), (c = 0), (l = 0)))
  7369. }
  7370. o = !o
  7371. }
  7372. if (a !== e.getTotalCodewords()) throw new C()
  7373. return s
  7374. }
  7375. remask() {
  7376. if (null === this.parsedFormatInfo) return
  7377. const t = me.values[this.parsedFormatInfo.getDataMask()],
  7378. e = this.bitMatrix.getHeight()
  7379. t.unmaskBitMatrix(this.bitMatrix, e)
  7380. }
  7381. setMirror(t) {
  7382. ;(this.parsedVersion = null), (this.parsedFormatInfo = null), (this.isMirror = t)
  7383. }
  7384. mirror() {
  7385. const t = this.bitMatrix
  7386. for (let e = 0, r = t.getWidth(); e < r; e++) for (let r = e + 1, n = t.getHeight(); r < n; r++) t.get(e, r) !== t.get(r, e) && (t.flip(r, e), t.flip(e, r))
  7387. }
  7388. }
  7389. class Ce {
  7390. constructor(t, e) {
  7391. ;(this.numDataCodewords = t), (this.codewords = e)
  7392. }
  7393. static getDataBlocks(t, e, r) {
  7394. if (t.length !== e.getTotalCodewords()) throw new a()
  7395. const n = e.getECBlocksForLevel(r)
  7396. let i = 0
  7397. const o = n.getECBlocks()
  7398. for (const t of o) i += t.getCount()
  7399. const s = new Array(i)
  7400. let l = 0
  7401. for (const t of o)
  7402. for (let e = 0; e < t.getCount(); e++) {
  7403. const e = t.getDataCodewords(),
  7404. r = n.getECCodewordsPerBlock() + e
  7405. s[l++] = new Ce(e, new Uint8Array(r))
  7406. }
  7407. const c = s[0].codewords.length
  7408. let h = s.length - 1
  7409. for (; h >= 0 && s[h].codewords.length !== c; ) h--
  7410. h++
  7411. const u = c - n.getECCodewordsPerBlock()
  7412. let d = 0
  7413. for (let e = 0; e < u; e++) for (let r = 0; r < l; r++) s[r].codewords[e] = t[d++]
  7414. for (let e = h; e < l; e++) s[e].codewords[u] = t[d++]
  7415. const g = s[0].codewords.length
  7416. for (let e = u; e < g; e++)
  7417. for (let r = 0; r < l; r++) {
  7418. const n = r < h ? e : e + 1
  7419. s[r].codewords[n] = t[d++]
  7420. }
  7421. return s
  7422. }
  7423. getNumDataCodewords() {
  7424. return this.numDataCodewords
  7425. }
  7426. getCodewords() {
  7427. return this.codewords
  7428. }
  7429. }
  7430. !(function(t) {
  7431. ;(t[(t.TERMINATOR = 0)] = 'TERMINATOR'),
  7432. (t[(t.NUMERIC = 1)] = 'NUMERIC'),
  7433. (t[(t.ALPHANUMERIC = 2)] = 'ALPHANUMERIC'),
  7434. (t[(t.STRUCTURED_APPEND = 3)] = 'STRUCTURED_APPEND'),
  7435. (t[(t.BYTE = 4)] = 'BYTE'),
  7436. (t[(t.ECI = 5)] = 'ECI'),
  7437. (t[(t.KANJI = 6)] = 'KANJI'),
  7438. (t[(t.FNC1_FIRST_POSITION = 7)] = 'FNC1_FIRST_POSITION'),
  7439. (t[(t.FNC1_SECOND_POSITION = 8)] = 'FNC1_SECOND_POSITION'),
  7440. (t[(t.HANZI = 9)] = 'HANZI')
  7441. })(G || (G = {}))
  7442. class Ie {
  7443. constructor(t, e, r, n) {
  7444. ;(this.value = t), (this.stringValue = e), (this.characterCountBitsForVersions = r), (this.bits = n), Ie.FOR_BITS.set(n, this), Ie.FOR_VALUE.set(t, this)
  7445. }
  7446. static forBits(t) {
  7447. const e = Ie.FOR_BITS.get(t)
  7448. if (void 0 === e) throw new a()
  7449. return e
  7450. }
  7451. getCharacterCountBits(t) {
  7452. const e = t.getVersionNumber()
  7453. let r
  7454. return (r = e <= 9 ? 0 : e <= 26 ? 1 : 2), this.characterCountBitsForVersions[r]
  7455. }
  7456. getValue() {
  7457. return this.value
  7458. }
  7459. getBits() {
  7460. return this.bits
  7461. }
  7462. equals(t) {
  7463. if (!(t instanceof Ie)) return !1
  7464. const e = t
  7465. return this.value === e.value
  7466. }
  7467. toString() {
  7468. return this.stringValue
  7469. }
  7470. }
  7471. ;(Ie.FOR_BITS = new Map()),
  7472. (Ie.FOR_VALUE = new Map()),
  7473. (Ie.TERMINATOR = new Ie(G.TERMINATOR, 'TERMINATOR', Int32Array.from([0, 0, 0]), 0)),
  7474. (Ie.NUMERIC = new Ie(G.NUMERIC, 'NUMERIC', Int32Array.from([10, 12, 14]), 1)),
  7475. (Ie.ALPHANUMERIC = new Ie(G.ALPHANUMERIC, 'ALPHANUMERIC', Int32Array.from([9, 11, 13]), 2)),
  7476. (Ie.STRUCTURED_APPEND = new Ie(G.STRUCTURED_APPEND, 'STRUCTURED_APPEND', Int32Array.from([0, 0, 0]), 3)),
  7477. (Ie.BYTE = new Ie(G.BYTE, 'BYTE', Int32Array.from([8, 16, 16]), 4)),
  7478. (Ie.ECI = new Ie(G.ECI, 'ECI', Int32Array.from([0, 0, 0]), 7)),
  7479. (Ie.KANJI = new Ie(G.KANJI, 'KANJI', Int32Array.from([8, 10, 12]), 8)),
  7480. (Ie.FNC1_FIRST_POSITION = new Ie(G.FNC1_FIRST_POSITION, 'FNC1_FIRST_POSITION', Int32Array.from([0, 0, 0]), 5)),
  7481. (Ie.FNC1_SECOND_POSITION = new Ie(G.FNC1_SECOND_POSITION, 'FNC1_SECOND_POSITION', Int32Array.from([0, 0, 0]), 9)),
  7482. (Ie.HANZI = new Ie(G.HANZI, 'HANZI', Int32Array.from([8, 10, 12]), 13))
  7483. class pe {
  7484. static decode(t, e, r, n) {
  7485. const i = new ae(t)
  7486. let o = new T()
  7487. const s = new Array()
  7488. let a = -1,
  7489. l = -1
  7490. try {
  7491. let t,
  7492. r = null,
  7493. c = !1
  7494. do {
  7495. if (i.available() < 4) t = Ie.TERMINATOR
  7496. else {
  7497. const e = i.readBits(4)
  7498. t = Ie.forBits(e)
  7499. }
  7500. switch (t) {
  7501. case Ie.TERMINATOR:
  7502. break
  7503. case Ie.FNC1_FIRST_POSITION:
  7504. case Ie.FNC1_SECOND_POSITION:
  7505. c = !0
  7506. break
  7507. case Ie.STRUCTURED_APPEND:
  7508. if (i.available() < 16) throw new C()
  7509. ;(a = i.readBits(8)), (l = i.readBits(8))
  7510. break
  7511. case Ie.ECI:
  7512. const h = pe.parseECIValue(i)
  7513. if (((r = I.getCharacterSetECIByValue(h)), null === r)) throw new C()
  7514. break
  7515. case Ie.HANZI:
  7516. const u = i.readBits(4),
  7517. d = i.readBits(t.getCharacterCountBits(e))
  7518. u === pe.GB2312_SUBSET && pe.decodeHanziSegment(i, o, d)
  7519. break
  7520. default:
  7521. const g = i.readBits(t.getCharacterCountBits(e))
  7522. switch (t) {
  7523. case Ie.NUMERIC:
  7524. pe.decodeNumericSegment(i, o, g)
  7525. break
  7526. case Ie.ALPHANUMERIC:
  7527. pe.decodeAlphanumericSegment(i, o, g, c)
  7528. break
  7529. case Ie.BYTE:
  7530. pe.decodeByteSegment(i, o, g, r, s, n)
  7531. break
  7532. case Ie.KANJI:
  7533. pe.decodeKanjiSegment(i, o, g)
  7534. break
  7535. default:
  7536. throw new C()
  7537. }
  7538. }
  7539. } while (t !== Ie.TERMINATOR)
  7540. } catch (t) {
  7541. throw new C()
  7542. }
  7543. return new W(t, o.toString(), 0 === s.length ? null : s, null === r ? null : r.toString(), a, l)
  7544. }
  7545. static decodeHanziSegment(t, e, r) {
  7546. if (13 * r > t.available()) throw new C()
  7547. const n = new Uint8Array(2 * r)
  7548. let i = 0
  7549. for (; r > 0; ) {
  7550. const e = t.readBits(13)
  7551. let o = (((e / 96) << 8) & 4294967295) | e % 96
  7552. ;(o += o < 959 ? 41377 : 42657), (n[i] = (o >> 8) & 255), (n[i + 1] = 255 & o), (i += 2), r--
  7553. }
  7554. try {
  7555. e.append(S.decode(n, _.GB2312))
  7556. } catch (t) {
  7557. throw new C(t)
  7558. }
  7559. }
  7560. static decodeKanjiSegment(t, e, r) {
  7561. if (13 * r > t.available()) throw new C()
  7562. const n = new Uint8Array(2 * r)
  7563. let i = 0
  7564. for (; r > 0; ) {
  7565. const e = t.readBits(13)
  7566. let o = (((e / 192) << 8) & 4294967295) | e % 192
  7567. ;(o += o < 7936 ? 33088 : 49472), (n[i] = o >> 8), (n[i + 1] = o), (i += 2), r--
  7568. }
  7569. try {
  7570. e.append(S.decode(n, _.SHIFT_JIS))
  7571. } catch (t) {
  7572. throw new C(t)
  7573. }
  7574. }
  7575. static decodeByteSegment(t, e, r, n, i, o) {
  7576. if (8 * r > t.available()) throw new C()
  7577. const s = new Uint8Array(r)
  7578. for (let e = 0; e < r; e++) s[e] = t.readBits(8)
  7579. let a
  7580. a = null === n ? _.guessEncoding(s, o) : n.getName()
  7581. try {
  7582. e.append(S.decode(s, a))
  7583. } catch (t) {
  7584. throw new C(t)
  7585. }
  7586. i.push(s)
  7587. }
  7588. static toAlphaNumericChar(t) {
  7589. if (t >= pe.ALPHANUMERIC_CHARS.length) throw new C()
  7590. return pe.ALPHANUMERIC_CHARS[t]
  7591. }
  7592. static decodeAlphanumericSegment(t, e, r, n) {
  7593. const i = e.length()
  7594. for (; r > 1; ) {
  7595. if (t.available() < 11) throw new C()
  7596. const n = t.readBits(11)
  7597. e.append(pe.toAlphaNumericChar(Math.floor(n / 45))), e.append(pe.toAlphaNumericChar(n % 45)), (r -= 2)
  7598. }
  7599. if (1 === r) {
  7600. if (t.available() < 6) throw new C()
  7601. e.append(pe.toAlphaNumericChar(t.readBits(6)))
  7602. }
  7603. if (n)
  7604. for (let t = i; t < e.length(); t++)
  7605. '%' === e.charAt(t) && (t < e.length() - 1 && '%' === e.charAt(t + 1) ? e.deleteCharAt(t + 1) : e.setCharAt(t, String.fromCharCode(29)))
  7606. }
  7607. static decodeNumericSegment(t, e, r) {
  7608. for (; r >= 3; ) {
  7609. if (t.available() < 10) throw new C()
  7610. const n = t.readBits(10)
  7611. if (n >= 1e3) throw new C()
  7612. e.append(pe.toAlphaNumericChar(Math.floor(n / 100))), e.append(pe.toAlphaNumericChar(Math.floor(n / 10) % 10)), e.append(pe.toAlphaNumericChar(n % 10)), (r -= 3)
  7613. }
  7614. if (2 === r) {
  7615. if (t.available() < 7) throw new C()
  7616. const r = t.readBits(7)
  7617. if (r >= 100) throw new C()
  7618. e.append(pe.toAlphaNumericChar(Math.floor(r / 10))), e.append(pe.toAlphaNumericChar(r % 10))
  7619. } else if (1 === r) {
  7620. if (t.available() < 4) throw new C()
  7621. const r = t.readBits(4)
  7622. if (r >= 10) throw new C()
  7623. e.append(pe.toAlphaNumericChar(r))
  7624. }
  7625. }
  7626. static parseECIValue(t) {
  7627. const e = t.readBits(8)
  7628. if (0 == (128 & e)) return 127 & e
  7629. if (128 == (192 & e)) return (((63 & e) << 8) & 4294967295) | t.readBits(8)
  7630. if (192 == (224 & e)) return (((31 & e) << 16) & 4294967295) | t.readBits(16)
  7631. throw new C()
  7632. }
  7633. }
  7634. ;(pe.ALPHANUMERIC_CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:'), (pe.GB2312_SUBSET = 1)
  7635. class Se {
  7636. constructor(t) {
  7637. this.mirrored = t
  7638. }
  7639. isMirrored() {
  7640. return this.mirrored
  7641. }
  7642. applyMirroredCorrection(t) {
  7643. if (!this.mirrored || null === t || t.length < 3) return
  7644. const e = t[0]
  7645. ;(t[0] = t[2]), (t[2] = e)
  7646. }
  7647. }
  7648. class _e {
  7649. constructor() {
  7650. this.rsDecoder = new $(K.QR_CODE_FIELD_256)
  7651. }
  7652. decodeBooleanArray(t, e) {
  7653. return this.decodeBitMatrix(y.parseFromBooleanArray(t), e)
  7654. }
  7655. decodeBitMatrix(t, e) {
  7656. const r = new Ee(t)
  7657. let n = null
  7658. try {
  7659. return this.decodeBitMatrixParser(r, e)
  7660. } catch (t) {
  7661. n = t
  7662. }
  7663. try {
  7664. r.remask(), r.setMirror(!0), r.readVersion(), r.readFormatInformation(), r.mirror()
  7665. const t = this.decodeBitMatrixParser(r, e)
  7666. return t.setOther(new Se(!0)), t
  7667. } catch (t) {
  7668. if (null !== n) throw n
  7669. throw t
  7670. }
  7671. }
  7672. decodeBitMatrixParser(t, e) {
  7673. const r = t.readVersion(),
  7674. n = t.readFormatInformation().getErrorCorrectionLevel(),
  7675. i = t.readCodewords(),
  7676. o = Ce.getDataBlocks(i, r, n)
  7677. let s = 0
  7678. for (const t of o) s += t.getNumDataCodewords()
  7679. const a = new Uint8Array(s)
  7680. let l = 0
  7681. for (const t of o) {
  7682. const e = t.getCodewords(),
  7683. r = t.getNumDataCodewords()
  7684. this.correctErrors(e, r)
  7685. for (let t = 0; t < r; t++) a[l++] = e[t]
  7686. }
  7687. return pe.decode(a, r, n, e)
  7688. }
  7689. correctErrors(t, e) {
  7690. const r = new Int32Array(t)
  7691. try {
  7692. this.rsDecoder.decode(r, t.length - e)
  7693. } catch (t) {
  7694. throw new c()
  7695. }
  7696. for (let n = 0; n < e; n++) t[n] = r[n]
  7697. }
  7698. }
  7699. class Te extends nt {
  7700. constructor(t, e, r) {
  7701. super(t, e), (this.estimatedModuleSize = r)
  7702. }
  7703. aboutEquals(t, e, r) {
  7704. if (Math.abs(e - this.getY()) <= t && Math.abs(r - this.getX()) <= t) {
  7705. const e = Math.abs(t - this.estimatedModuleSize)
  7706. return e <= 1 || e <= this.estimatedModuleSize
  7707. }
  7708. return !1
  7709. }
  7710. combineEstimate(t, e, r) {
  7711. const n = (this.getX() + e) / 2,
  7712. i = (this.getY() + t) / 2,
  7713. o = (this.estimatedModuleSize + r) / 2
  7714. return new Te(n, i, o)
  7715. }
  7716. }
  7717. class ye {
  7718. constructor(t, e, r, n, i, o, s) {
  7719. ;(this.image = t),
  7720. (this.startX = e),
  7721. (this.startY = r),
  7722. (this.width = n),
  7723. (this.height = i),
  7724. (this.moduleSize = o),
  7725. (this.resultPointCallback = s),
  7726. (this.possibleCenters = []),
  7727. (this.crossCheckStateCount = new Int32Array(3))
  7728. }
  7729. find() {
  7730. const t = this.startX,
  7731. e = this.height,
  7732. r = t + this.width,
  7733. n = this.startY + e / 2,
  7734. i = new Int32Array(3),
  7735. o = this.image
  7736. for (let s = 0; s < e; s++) {
  7737. const e = n + (0 == (1 & s) ? Math.floor((s + 1) / 2) : -Math.floor((s + 1) / 2))
  7738. ;(i[0] = 0), (i[1] = 0), (i[2] = 0)
  7739. let a = t
  7740. for (; a < r && !o.get(a, e); ) a++
  7741. let l = 0
  7742. for (; a < r; ) {
  7743. if (o.get(a, e))
  7744. if (1 === l) i[1]++
  7745. else if (2 === l) {
  7746. if (this.foundPatternCross(i)) {
  7747. const t = this.handlePossibleCenter(i, e, a)
  7748. if (null !== t) return t
  7749. }
  7750. ;(i[0] = i[2]), (i[1] = 1), (i[2] = 0), (l = 1)
  7751. } else i[++l]++
  7752. else 1 === l && l++, i[l]++
  7753. a++
  7754. }
  7755. if (this.foundPatternCross(i)) {
  7756. const t = this.handlePossibleCenter(i, e, r)
  7757. if (null !== t) return t
  7758. }
  7759. }
  7760. if (0 !== this.possibleCenters.length) return this.possibleCenters[0]
  7761. throw new N()
  7762. }
  7763. static centerFromEnd(t, e) {
  7764. return e - t[2] - t[1] / 2
  7765. }
  7766. foundPatternCross(t) {
  7767. const e = this.moduleSize,
  7768. r = e / 2
  7769. for (let n = 0; n < 3; n++) if (Math.abs(e - t[n]) >= r) return !1
  7770. return !0
  7771. }
  7772. crossCheckVertical(t, e, r, n) {
  7773. const i = this.image,
  7774. o = i.getHeight(),
  7775. s = this.crossCheckStateCount
  7776. ;(s[0] = 0), (s[1] = 0), (s[2] = 0)
  7777. let a = t
  7778. for (; a >= 0 && i.get(e, a) && s[1] <= r; ) s[1]++, a--
  7779. if (a < 0 || s[1] > r) return NaN
  7780. for (; a >= 0 && !i.get(e, a) && s[0] <= r; ) s[0]++, a--
  7781. if (s[0] > r) return NaN
  7782. for (a = t + 1; a < o && i.get(e, a) && s[1] <= r; ) s[1]++, a++
  7783. if (a === o || s[1] > r) return NaN
  7784. for (; a < o && !i.get(e, a) && s[2] <= r; ) s[2]++, a++
  7785. if (s[2] > r) return NaN
  7786. const l = s[0] + s[1] + s[2]
  7787. return 5 * Math.abs(l - n) >= 2 * n ? NaN : this.foundPatternCross(s) ? ye.centerFromEnd(s, a) : NaN
  7788. }
  7789. handlePossibleCenter(t, e, r) {
  7790. const n = t[0] + t[1] + t[2],
  7791. i = ye.centerFromEnd(t, r),
  7792. o = this.crossCheckVertical(e, i, 2 * t[1], n)
  7793. if (!isNaN(o)) {
  7794. const e = (t[0] + t[1] + t[2]) / 3
  7795. for (const t of this.possibleCenters) if (t.aboutEquals(e, o, i)) return t.combineEstimate(o, i, e)
  7796. const r = new Te(i, o, e)
  7797. this.possibleCenters.push(r), null !== this.resultPointCallback && void 0 !== this.resultPointCallback && this.resultPointCallback.foundPossibleResultPoint(r)
  7798. }
  7799. return null
  7800. }
  7801. }
  7802. class Ne extends nt {
  7803. constructor(t, e, r, n) {
  7804. super(t, e), (this.estimatedModuleSize = r), (this.count = n), void 0 === n && (this.count = 1)
  7805. }
  7806. getEstimatedModuleSize() {
  7807. return this.estimatedModuleSize
  7808. }
  7809. getCount() {
  7810. return this.count
  7811. }
  7812. aboutEquals(t, e, r) {
  7813. if (Math.abs(e - this.getY()) <= t && Math.abs(r - this.getX()) <= t) {
  7814. const e = Math.abs(t - this.estimatedModuleSize)
  7815. return e <= 1 || e <= this.estimatedModuleSize
  7816. }
  7817. return !1
  7818. }
  7819. combineEstimate(t, e, r) {
  7820. const n = this.count + 1,
  7821. i = (this.count * this.getX() + e) / n,
  7822. o = (this.count * this.getY() + t) / n,
  7823. s = (this.count * this.estimatedModuleSize + r) / n
  7824. return new Ne(i, o, s, n)
  7825. }
  7826. }
  7827. class Me {
  7828. constructor(t) {
  7829. ;(this.bottomLeft = t[0]), (this.topLeft = t[1]), (this.topRight = t[2])
  7830. }
  7831. getBottomLeft() {
  7832. return this.bottomLeft
  7833. }
  7834. getTopLeft() {
  7835. return this.topLeft
  7836. }
  7837. getTopRight() {
  7838. return this.topRight
  7839. }
  7840. }
  7841. class De {
  7842. constructor(t, e) {
  7843. ;(this.image = t), (this.resultPointCallback = e), (this.possibleCenters = []), (this.crossCheckStateCount = new Int32Array(5)), (this.resultPointCallback = e)
  7844. }
  7845. getImage() {
  7846. return this.image
  7847. }
  7848. getPossibleCenters() {
  7849. return this.possibleCenters
  7850. }
  7851. find(t) {
  7852. const e = null != t && void 0 !== t.get(E.TRY_HARDER),
  7853. r = null != t && void 0 !== t.get(E.PURE_BARCODE),
  7854. n = this.image,
  7855. i = n.getHeight(),
  7856. o = n.getWidth()
  7857. let s = Math.floor((3 * i) / (4 * De.MAX_MODULES))
  7858. ;(s < De.MIN_SKIP || e) && (s = De.MIN_SKIP)
  7859. let a = !1
  7860. const l = new Int32Array(5)
  7861. for (let t = s - 1; t < i && !a; t += s) {
  7862. ;(l[0] = 0), (l[1] = 0), (l[2] = 0), (l[3] = 0), (l[4] = 0)
  7863. let e = 0
  7864. for (let i = 0; i < o; i++)
  7865. if (n.get(i, t)) 1 == (1 & e) && e++, l[e]++
  7866. else if (0 == (1 & e))
  7867. if (4 === e)
  7868. if (De.foundPatternCross(l)) {
  7869. if (!0 !== this.handlePossibleCenter(l, t, i, r)) {
  7870. ;(l[0] = l[2]), (l[1] = l[3]), (l[2] = l[4]), (l[3] = 1), (l[4] = 0), (e = 3)
  7871. continue
  7872. }
  7873. if (((s = 2), !0 === this.hasSkipped)) a = this.haveMultiplyConfirmedCenters()
  7874. else {
  7875. const e = this.findRowSkip()
  7876. e > l[2] && ((t += e - l[2] - s), (i = o - 1))
  7877. }
  7878. ;(e = 0), (l[0] = 0), (l[1] = 0), (l[2] = 0), (l[3] = 0), (l[4] = 0)
  7879. } else (l[0] = l[2]), (l[1] = l[3]), (l[2] = l[4]), (l[3] = 1), (l[4] = 0), (e = 3)
  7880. else l[++e]++
  7881. else l[e]++
  7882. De.foundPatternCross(l) && !0 === this.handlePossibleCenter(l, t, o, r) && ((s = l[0]), this.hasSkipped && (a = this.haveMultiplyConfirmedCenters()))
  7883. }
  7884. const c = this.selectBestPatterns()
  7885. return nt.orderBestPatterns(c), new Me(c)
  7886. }
  7887. static centerFromEnd(t, e) {
  7888. return e - t[4] - t[3] - t[2] / 2
  7889. }
  7890. static foundPatternCross(t) {
  7891. let e = 0
  7892. for (let r = 0; r < 5; r++) {
  7893. const n = t[r]
  7894. if (0 === n) return !1
  7895. e += n
  7896. }
  7897. if (e < 7) return !1
  7898. const r = e / 7,
  7899. n = r / 2
  7900. return Math.abs(r - t[0]) < n && Math.abs(r - t[1]) < n && Math.abs(3 * r - t[2]) < 3 * n && Math.abs(r - t[3]) < n && Math.abs(r - t[4]) < n
  7901. }
  7902. getCrossCheckStateCount() {
  7903. const t = this.crossCheckStateCount
  7904. return (t[0] = 0), (t[1] = 0), (t[2] = 0), (t[3] = 0), (t[4] = 0), t
  7905. }
  7906. crossCheckDiagonal(t, e, r, n) {
  7907. const i = this.getCrossCheckStateCount()
  7908. let o = 0
  7909. const s = this.image
  7910. for (; t >= o && e >= o && s.get(e - o, t - o); ) i[2]++, o++
  7911. if (t < o || e < o) return !1
  7912. for (; t >= o && e >= o && !s.get(e - o, t - o) && i[1] <= r; ) i[1]++, o++
  7913. if (t < o || e < o || i[1] > r) return !1
  7914. for (; t >= o && e >= o && s.get(e - o, t - o) && i[0] <= r; ) i[0]++, o++
  7915. if (i[0] > r) return !1
  7916. const a = s.getHeight(),
  7917. l = s.getWidth()
  7918. for (o = 1; t + o < a && e + o < l && s.get(e + o, t + o); ) i[2]++, o++
  7919. if (t + o >= a || e + o >= l) return !1
  7920. for (; t + o < a && e + o < l && !s.get(e + o, t + o) && i[3] < r; ) i[3]++, o++
  7921. if (t + o >= a || e + o >= l || i[3] >= r) return !1
  7922. for (; t + o < a && e + o < l && s.get(e + o, t + o) && i[4] < r; ) i[4]++, o++
  7923. if (i[4] >= r) return !1
  7924. const c = i[0] + i[1] + i[2] + i[3] + i[4]
  7925. return Math.abs(c - n) < 2 * n && De.foundPatternCross(i)
  7926. }
  7927. crossCheckVertical(t, e, r, n) {
  7928. const i = this.image,
  7929. o = i.getHeight(),
  7930. s = this.getCrossCheckStateCount()
  7931. let a = t
  7932. for (; a >= 0 && i.get(e, a); ) s[2]++, a--
  7933. if (a < 0) return NaN
  7934. for (; a >= 0 && !i.get(e, a) && s[1] <= r; ) s[1]++, a--
  7935. if (a < 0 || s[1] > r) return NaN
  7936. for (; a >= 0 && i.get(e, a) && s[0] <= r; ) s[0]++, a--
  7937. if (s[0] > r) return NaN
  7938. for (a = t + 1; a < o && i.get(e, a); ) s[2]++, a++
  7939. if (a === o) return NaN
  7940. for (; a < o && !i.get(e, a) && s[3] < r; ) s[3]++, a++
  7941. if (a === o || s[3] >= r) return NaN
  7942. for (; a < o && i.get(e, a) && s[4] < r; ) s[4]++, a++
  7943. if (s[4] >= r) return NaN
  7944. const l = s[0] + s[1] + s[2] + s[3] + s[4]
  7945. return 5 * Math.abs(l - n) >= 2 * n ? NaN : De.foundPatternCross(s) ? De.centerFromEnd(s, a) : NaN
  7946. }
  7947. crossCheckHorizontal(t, e, r, n) {
  7948. const i = this.image,
  7949. o = i.getWidth(),
  7950. s = this.getCrossCheckStateCount()
  7951. let a = t
  7952. for (; a >= 0 && i.get(a, e); ) s[2]++, a--
  7953. if (a < 0) return NaN
  7954. for (; a >= 0 && !i.get(a, e) && s[1] <= r; ) s[1]++, a--
  7955. if (a < 0 || s[1] > r) return NaN
  7956. for (; a >= 0 && i.get(a, e) && s[0] <= r; ) s[0]++, a--
  7957. if (s[0] > r) return NaN
  7958. for (a = t + 1; a < o && i.get(a, e); ) s[2]++, a++
  7959. if (a === o) return NaN
  7960. for (; a < o && !i.get(a, e) && s[3] < r; ) s[3]++, a++
  7961. if (a === o || s[3] >= r) return NaN
  7962. for (; a < o && i.get(a, e) && s[4] < r; ) s[4]++, a++
  7963. if (s[4] >= r) return NaN
  7964. const l = s[0] + s[1] + s[2] + s[3] + s[4]
  7965. return 5 * Math.abs(l - n) >= n ? NaN : De.foundPatternCross(s) ? De.centerFromEnd(s, a) : NaN
  7966. }
  7967. handlePossibleCenter(t, e, r, n) {
  7968. const i = t[0] + t[1] + t[2] + t[3] + t[4]
  7969. let o = De.centerFromEnd(t, r),
  7970. s = this.crossCheckVertical(e, Math.floor(o), t[2], i)
  7971. if (
  7972. !isNaN(s) &&
  7973. ((o = this.crossCheckHorizontal(Math.floor(o), Math.floor(s), t[2], i)), !isNaN(o) && (!n || this.crossCheckDiagonal(Math.floor(s), Math.floor(o), t[2], i)))
  7974. ) {
  7975. const t = i / 7
  7976. let e = !1
  7977. const r = this.possibleCenters
  7978. for (let n = 0, i = r.length; n < i; n++) {
  7979. const i = r[n]
  7980. if (i.aboutEquals(t, s, o)) {
  7981. ;(r[n] = i.combineEstimate(s, o, t)), (e = !0)
  7982. break
  7983. }
  7984. }
  7985. if (!e) {
  7986. const e = new Ne(o, s, t)
  7987. r.push(e), null !== this.resultPointCallback && void 0 !== this.resultPointCallback && this.resultPointCallback.foundPossibleResultPoint(e)
  7988. }
  7989. return !0
  7990. }
  7991. return !1
  7992. }
  7993. findRowSkip() {
  7994. if (this.possibleCenters.length <= 1) return 0
  7995. let t = null
  7996. for (const e of this.possibleCenters)
  7997. if (e.getCount() >= De.CENTER_QUORUM) {
  7998. if (null != t) return (this.hasSkipped = !0), Math.floor((Math.abs(t.getX() - e.getX()) - Math.abs(t.getY() - e.getY())) / 2)
  7999. t = e
  8000. }
  8001. return 0
  8002. }
  8003. haveMultiplyConfirmedCenters() {
  8004. let t = 0,
  8005. e = 0
  8006. const r = this.possibleCenters.length
  8007. for (const r of this.possibleCenters) r.getCount() >= De.CENTER_QUORUM && (t++, (e += r.getEstimatedModuleSize()))
  8008. if (t < 3) return !1
  8009. const n = e / r
  8010. let i = 0
  8011. for (const t of this.possibleCenters) i += Math.abs(t.getEstimatedModuleSize() - n)
  8012. return i <= 0.05 * e
  8013. }
  8014. selectBestPatterns() {
  8015. const t = this.possibleCenters.length
  8016. if (t < 3) throw new N()
  8017. const e = this.possibleCenters
  8018. let r
  8019. if (t > 3) {
  8020. let n = 0,
  8021. i = 0
  8022. for (const t of this.possibleCenters) {
  8023. const e = t.getEstimatedModuleSize()
  8024. ;(n += e), (i += e * e)
  8025. }
  8026. r = n / t
  8027. let o = Math.sqrt(i / t - r * r)
  8028. e.sort((t, e) => {
  8029. const n = Math.abs(e.getEstimatedModuleSize() - r),
  8030. i = Math.abs(t.getEstimatedModuleSize() - r)
  8031. return n < i ? -1 : n > i ? 1 : 0
  8032. })
  8033. const s = Math.max(0.2 * r, o)
  8034. for (let t = 0; t < e.length && e.length > 3; t++) {
  8035. const n = e[t]
  8036. Math.abs(n.getEstimatedModuleSize() - r) > s && (e.splice(t, 1), t--)
  8037. }
  8038. }
  8039. if (e.length > 3) {
  8040. let t = 0
  8041. for (const r of e) t += r.getEstimatedModuleSize()
  8042. ;(r = t / e.length),
  8043. e.sort((t, e) => {
  8044. if (e.getCount() === t.getCount()) {
  8045. const n = Math.abs(e.getEstimatedModuleSize() - r),
  8046. i = Math.abs(t.getEstimatedModuleSize() - r)
  8047. return n < i ? 1 : n > i ? -1 : 0
  8048. }
  8049. return e.getCount() - t.getCount()
  8050. }),
  8051. e.splice(3)
  8052. }
  8053. return [e[0], e[1], e[2]]
  8054. }
  8055. }
  8056. ;(De.CENTER_QUORUM = 2), (De.MIN_SKIP = 3), (De.MAX_MODULES = 57)
  8057. class Re {
  8058. constructor(t) {
  8059. this.image = t
  8060. }
  8061. getImage() {
  8062. return this.image
  8063. }
  8064. getResultPointCallback() {
  8065. return this.resultPointCallback
  8066. }
  8067. detect(t) {
  8068. this.resultPointCallback = null == t ? null : t.get(E.NEED_RESULT_POINT_CALLBACK)
  8069. const e = new De(this.image, this.resultPointCallback).find(t)
  8070. return this.processFinderPatternInfo(e)
  8071. }
  8072. processFinderPatternInfo(t) {
  8073. const e = t.getTopLeft(),
  8074. r = t.getTopRight(),
  8075. n = t.getBottomLeft(),
  8076. i = this.calculateModuleSize(e, r, n)
  8077. if (i < 1) throw new N('No pattern found in proccess finder.')
  8078. const o = Re.computeDimension(e, r, n, i),
  8079. s = Ae.getProvisionalVersionForDimension(o),
  8080. a = s.getDimensionForVersion() - 7
  8081. let l = null
  8082. if (s.getAlignmentPatternCenters().length > 0) {
  8083. const t = r.getX() - e.getX() + n.getX(),
  8084. o = r.getY() - e.getY() + n.getY(),
  8085. s = 1 - 3 / a,
  8086. c = Math.floor(e.getX() + s * (t - e.getX())),
  8087. h = Math.floor(e.getY() + s * (o - e.getY()))
  8088. for (let t = 4; t <= 16; t <<= 1)
  8089. try {
  8090. l = this.findAlignmentInRegion(i, c, h, t)
  8091. break
  8092. } catch (t) {
  8093. if (!(t instanceof N)) throw t
  8094. }
  8095. }
  8096. const c = Re.createTransform(e, r, n, l, o),
  8097. h = Re.sampleGrid(this.image, c, o)
  8098. let u
  8099. return (u = null === l ? [n, e, r] : [n, e, r, l]), new it(h, u)
  8100. }
  8101. static createTransform(t, e, r, n, i) {
  8102. const o = i - 3.5
  8103. let s, a, l, c
  8104. return (
  8105. null !== n ? ((s = n.getX()), (a = n.getY()), (l = o - 3), (c = l)) : ((s = e.getX() - t.getX() + r.getX()), (a = e.getY() - t.getY() + r.getY()), (l = o), (c = o)),
  8106. lt.quadrilateralToQuadrilateral(3.5, 3.5, o, 3.5, l, c, 3.5, o, t.getX(), t.getY(), e.getX(), e.getY(), s, a, r.getX(), r.getY())
  8107. )
  8108. }
  8109. static sampleGrid(t, e, r) {
  8110. return ht.getInstance().sampleGridWithTransform(t, r, r, e)
  8111. }
  8112. static computeDimension(t, e, r, n) {
  8113. const i = et.round(nt.distance(t, e) / n),
  8114. o = et.round(nt.distance(t, r) / n)
  8115. let s = Math.floor((i + o) / 2) + 7
  8116. switch (3 & s) {
  8117. case 0:
  8118. s++
  8119. break
  8120. case 2:
  8121. s--
  8122. break
  8123. case 3:
  8124. throw new N('Dimensions could be not found.')
  8125. }
  8126. return s
  8127. }
  8128. calculateModuleSize(t, e, r) {
  8129. return (this.calculateModuleSizeOneWay(t, e) + this.calculateModuleSizeOneWay(t, r)) / 2
  8130. }
  8131. calculateModuleSizeOneWay(t, e) {
  8132. const r = this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.getX()), Math.floor(t.getY()), Math.floor(e.getX()), Math.floor(e.getY())),
  8133. n = this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.getX()), Math.floor(e.getY()), Math.floor(t.getX()), Math.floor(t.getY()))
  8134. return isNaN(r) ? n / 7 : isNaN(n) ? r / 7 : (r + n) / 14
  8135. }
  8136. sizeOfBlackWhiteBlackRunBothWays(t, e, r, n) {
  8137. let i = this.sizeOfBlackWhiteBlackRun(t, e, r, n),
  8138. o = 1,
  8139. s = t - (r - t)
  8140. s < 0 ? ((o = t / (t - s)), (s = 0)) : s >= this.image.getWidth() && ((o = (this.image.getWidth() - 1 - t) / (s - t)), (s = this.image.getWidth() - 1))
  8141. let a = Math.floor(e - (n - e) * o)
  8142. return (
  8143. (o = 1),
  8144. a < 0 ? ((o = e / (e - a)), (a = 0)) : a >= this.image.getHeight() && ((o = (this.image.getHeight() - 1 - e) / (a - e)), (a = this.image.getHeight() - 1)),
  8145. (s = Math.floor(t + (s - t) * o)),
  8146. (i += this.sizeOfBlackWhiteBlackRun(t, e, s, a)),
  8147. i - 1
  8148. )
  8149. }
  8150. sizeOfBlackWhiteBlackRun(t, e, r, n) {
  8151. const i = Math.abs(n - e) > Math.abs(r - t)
  8152. if (i) {
  8153. let i = t
  8154. ;(t = e), (e = i), (i = r), (r = n), (n = i)
  8155. }
  8156. const o = Math.abs(r - t),
  8157. s = Math.abs(n - e)
  8158. let a = -o / 2
  8159. const l = t < r ? 1 : -1,
  8160. c = e < n ? 1 : -1
  8161. let h = 0
  8162. const u = r + l
  8163. for (let r = t, d = e; r !== u; r += l) {
  8164. const l = i ? d : r,
  8165. u = i ? r : d
  8166. if ((1 === h) === this.image.get(l, u)) {
  8167. if (2 === h) return et.distance(r, d, t, e)
  8168. h++
  8169. }
  8170. if (((a += s), a > 0)) {
  8171. if (d === n) break
  8172. ;(d += c), (a -= o)
  8173. }
  8174. }
  8175. return 2 === h ? et.distance(r + l, n, t, e) : NaN
  8176. }
  8177. findAlignmentInRegion(t, e, r, n) {
  8178. const i = Math.floor(n * t),
  8179. o = Math.max(0, e - i),
  8180. s = Math.min(this.image.getWidth() - 1, e + i)
  8181. if (s - o < 3 * t) throw new N('Alignment top exceeds estimated module size.')
  8182. const a = Math.max(0, r - i),
  8183. l = Math.min(this.image.getHeight() - 1, r + i)
  8184. if (l - a < 3 * t) throw new N('Alignment bottom exceeds estimated module size.')
  8185. return new ye(this.image, o, a, s - o, l - a, t, this.resultPointCallback).find()
  8186. }
  8187. }
  8188. class Oe {
  8189. constructor() {
  8190. this.decoder = new _e()
  8191. }
  8192. getDecoder() {
  8193. return this.decoder
  8194. }
  8195. decode(t, e) {
  8196. let r, n
  8197. if (null != e && void 0 !== e.get(E.PURE_BARCODE)) {
  8198. const i = Oe.extractPureBits(t.getBlackMatrix())
  8199. ;(r = this.decoder.decodeBitMatrix(i, e)), (n = Oe.NO_POINTS)
  8200. } else {
  8201. const i = new Re(t.getBlackMatrix()).detect(e)
  8202. ;(r = this.decoder.decodeBitMatrix(i.getBits(), e)), (n = i.getPoints())
  8203. }
  8204. r.getOther() instanceof Se && r.getOther().applyMirroredCorrection(n)
  8205. const i = new F(r.getText(), r.getRawBytes(), void 0, n, k.QR_CODE, void 0),
  8206. o = r.getByteSegments()
  8207. null !== o && i.putMetadata(X.BYTE_SEGMENTS, o)
  8208. const s = r.getECLevel()
  8209. return (
  8210. null !== s && i.putMetadata(X.ERROR_CORRECTION_LEVEL, s),
  8211. r.hasStructuredAppend() &&
  8212. (i.putMetadata(X.STRUCTURED_APPEND_SEQUENCE, r.getStructuredAppendSequenceNumber()), i.putMetadata(X.STRUCTURED_APPEND_PARITY, r.getStructuredAppendParity())),
  8213. i
  8214. )
  8215. }
  8216. reset() {}
  8217. static extractPureBits(t) {
  8218. const e = t.getTopLeftOnBit(),
  8219. r = t.getBottomRightOnBit()
  8220. if (null === e || null === r) throw new N()
  8221. const n = this.moduleSize(e, t)
  8222. let i = e[1],
  8223. o = r[1],
  8224. s = e[0],
  8225. a = r[0]
  8226. if (s >= a || i >= o) throw new N()
  8227. if (o - i != a - s && ((a = s + (o - i)), a >= t.getWidth())) throw new N()
  8228. const l = Math.round((a - s + 1) / n),
  8229. c = Math.round((o - i + 1) / n)
  8230. if (l <= 0 || c <= 0) throw new N()
  8231. if (c !== l) throw new N()
  8232. const h = Math.floor(n / 2)
  8233. ;(i += h), (s += h)
  8234. const u = s + Math.floor((l - 1) * n) - a
  8235. if (u > 0) {
  8236. if (u > h) throw new N()
  8237. s -= u
  8238. }
  8239. const d = i + Math.floor((c - 1) * n) - o
  8240. if (d > 0) {
  8241. if (d > h) throw new N()
  8242. i -= d
  8243. }
  8244. const g = new y(l, c)
  8245. for (let e = 0; e < c; e++) {
  8246. const r = i + Math.floor(e * n)
  8247. for (let i = 0; i < l; i++) t.get(s + Math.floor(i * n), r) && g.set(i, e)
  8248. }
  8249. return g
  8250. }
  8251. static moduleSize(t, e) {
  8252. const r = e.getHeight(),
  8253. n = e.getWidth()
  8254. let i = t[0],
  8255. o = t[1],
  8256. s = !0,
  8257. a = 0
  8258. for (; i < n && o < r; ) {
  8259. if (s !== e.get(i, o)) {
  8260. if (5 == ++a) break
  8261. s = !s
  8262. }
  8263. i++, o++
  8264. }
  8265. if (i === n || o === r) throw new N()
  8266. return (i - t[0]) / 7
  8267. }
  8268. }
  8269. Oe.NO_POINTS = new Array()
  8270. class be {
  8271. PDF417Common() {}
  8272. static getBitCountSum(t) {
  8273. return et.sum(t)
  8274. }
  8275. static toIntArray(t) {
  8276. if (null == t || !t.length) return be.EMPTY_INT_ARRAY
  8277. const e = new Int32Array(t.length)
  8278. let r = 0
  8279. for (const n of t) e[r++] = n
  8280. return e
  8281. }
  8282. static getCodeword(t) {
  8283. const e = f.binarySearch(be.SYMBOL_TABLE, 262143 & t)
  8284. return e < 0 ? -1 : (be.CODEWORD_TABLE[e] - 1) % be.NUMBER_OF_CODEWORDS
  8285. }
  8286. }
  8287. ;(be.NUMBER_OF_CODEWORDS = 929),
  8288. (be.MAX_CODEWORDS_IN_BARCODE = be.NUMBER_OF_CODEWORDS - 1),
  8289. (be.MIN_ROWS_IN_BARCODE = 3),
  8290. (be.MAX_ROWS_IN_BARCODE = 90),
  8291. (be.MODULES_IN_CODEWORD = 17),
  8292. (be.MODULES_IN_STOP_PATTERN = 18),
  8293. (be.BARS_IN_MODULE = 8),
  8294. (be.EMPTY_INT_ARRAY = new Int32Array([])),
  8295. (be.SYMBOL_TABLE = Int32Array.from([
  8296. 66142,
  8297. 66170,
  8298. 66206,
  8299. 66236,
  8300. 66290,
  8301. 66292,
  8302. 66350,
  8303. 66382,
  8304. 66396,
  8305. 66454,
  8306. 66470,
  8307. 66476,
  8308. 66594,
  8309. 66600,
  8310. 66614,
  8311. 66626,
  8312. 66628,
  8313. 66632,
  8314. 66640,
  8315. 66654,
  8316. 66662,
  8317. 66668,
  8318. 66682,
  8319. 66690,
  8320. 66718,
  8321. 66720,
  8322. 66748,
  8323. 66758,
  8324. 66776,
  8325. 66798,
  8326. 66802,
  8327. 66804,
  8328. 66820,
  8329. 66824,
  8330. 66832,
  8331. 66846,
  8332. 66848,
  8333. 66876,
  8334. 66880,
  8335. 66936,
  8336. 66950,
  8337. 66956,
  8338. 66968,
  8339. 66992,
  8340. 67006,
  8341. 67022,
  8342. 67036,
  8343. 67042,
  8344. 67044,
  8345. 67048,
  8346. 67062,
  8347. 67118,
  8348. 67150,
  8349. 67164,
  8350. 67214,
  8351. 67228,
  8352. 67256,
  8353. 67294,
  8354. 67322,
  8355. 67350,
  8356. 67366,
  8357. 67372,
  8358. 67398,
  8359. 67404,
  8360. 67416,
  8361. 67438,
  8362. 67474,
  8363. 67476,
  8364. 67490,
  8365. 67492,
  8366. 67496,
  8367. 67510,
  8368. 67618,
  8369. 67624,
  8370. 67650,
  8371. 67656,
  8372. 67664,
  8373. 67678,
  8374. 67686,
  8375. 67692,
  8376. 67706,
  8377. 67714,
  8378. 67716,
  8379. 67728,
  8380. 67742,
  8381. 67744,
  8382. 67772,
  8383. 67782,
  8384. 67788,
  8385. 67800,
  8386. 67822,
  8387. 67826,
  8388. 67828,
  8389. 67842,
  8390. 67848,
  8391. 67870,
  8392. 67872,
  8393. 67900,
  8394. 67904,
  8395. 67960,
  8396. 67974,
  8397. 67992,
  8398. 68016,
  8399. 68030,
  8400. 68046,
  8401. 68060,
  8402. 68066,
  8403. 68068,
  8404. 68072,
  8405. 68086,
  8406. 68104,
  8407. 68112,
  8408. 68126,
  8409. 68128,
  8410. 68156,
  8411. 68160,
  8412. 68216,
  8413. 68336,
  8414. 68358,
  8415. 68364,
  8416. 68376,
  8417. 68400,
  8418. 68414,
  8419. 68448,
  8420. 68476,
  8421. 68494,
  8422. 68508,
  8423. 68536,
  8424. 68546,
  8425. 68548,
  8426. 68552,
  8427. 68560,
  8428. 68574,
  8429. 68582,
  8430. 68588,
  8431. 68654,
  8432. 68686,
  8433. 68700,
  8434. 68706,
  8435. 68708,
  8436. 68712,
  8437. 68726,
  8438. 68750,
  8439. 68764,
  8440. 68792,
  8441. 68802,
  8442. 68804,
  8443. 68808,
  8444. 68816,
  8445. 68830,
  8446. 68838,
  8447. 68844,
  8448. 68858,
  8449. 68878,
  8450. 68892,
  8451. 68920,
  8452. 68976,
  8453. 68990,
  8454. 68994,
  8455. 68996,
  8456. 69e3,
  8457. 69008,
  8458. 69022,
  8459. 69024,
  8460. 69052,
  8461. 69062,
  8462. 69068,
  8463. 69080,
  8464. 69102,
  8465. 69106,
  8466. 69108,
  8467. 69142,
  8468. 69158,
  8469. 69164,
  8470. 69190,
  8471. 69208,
  8472. 69230,
  8473. 69254,
  8474. 69260,
  8475. 69272,
  8476. 69296,
  8477. 69310,
  8478. 69326,
  8479. 69340,
  8480. 69386,
  8481. 69394,
  8482. 69396,
  8483. 69410,
  8484. 69416,
  8485. 69430,
  8486. 69442,
  8487. 69444,
  8488. 69448,
  8489. 69456,
  8490. 69470,
  8491. 69478,
  8492. 69484,
  8493. 69554,
  8494. 69556,
  8495. 69666,
  8496. 69672,
  8497. 69698,
  8498. 69704,
  8499. 69712,
  8500. 69726,
  8501. 69754,
  8502. 69762,
  8503. 69764,
  8504. 69776,
  8505. 69790,
  8506. 69792,
  8507. 69820,
  8508. 69830,
  8509. 69836,
  8510. 69848,
  8511. 69870,
  8512. 69874,
  8513. 69876,
  8514. 69890,
  8515. 69918,
  8516. 69920,
  8517. 69948,
  8518. 69952,
  8519. 70008,
  8520. 70022,
  8521. 70040,
  8522. 70064,
  8523. 70078,
  8524. 70094,
  8525. 70108,
  8526. 70114,
  8527. 70116,
  8528. 70120,
  8529. 70134,
  8530. 70152,
  8531. 70174,
  8532. 70176,
  8533. 70264,
  8534. 70384,
  8535. 70412,
  8536. 70448,
  8537. 70462,
  8538. 70496,
  8539. 70524,
  8540. 70542,
  8541. 70556,
  8542. 70584,
  8543. 70594,
  8544. 70600,
  8545. 70608,
  8546. 70622,
  8547. 70630,
  8548. 70636,
  8549. 70664,
  8550. 70672,
  8551. 70686,
  8552. 70688,
  8553. 70716,
  8554. 70720,
  8555. 70776,
  8556. 70896,
  8557. 71136,
  8558. 71180,
  8559. 71192,
  8560. 71216,
  8561. 71230,
  8562. 71264,
  8563. 71292,
  8564. 71360,
  8565. 71416,
  8566. 71452,
  8567. 71480,
  8568. 71536,
  8569. 71550,
  8570. 71554,
  8571. 71556,
  8572. 71560,
  8573. 71568,
  8574. 71582,
  8575. 71584,
  8576. 71612,
  8577. 71622,
  8578. 71628,
  8579. 71640,
  8580. 71662,
  8581. 71726,
  8582. 71732,
  8583. 71758,
  8584. 71772,
  8585. 71778,
  8586. 71780,
  8587. 71784,
  8588. 71798,
  8589. 71822,
  8590. 71836,
  8591. 71864,
  8592. 71874,
  8593. 71880,
  8594. 71888,
  8595. 71902,
  8596. 71910,
  8597. 71916,
  8598. 71930,
  8599. 71950,
  8600. 71964,
  8601. 71992,
  8602. 72048,
  8603. 72062,
  8604. 72066,
  8605. 72068,
  8606. 72080,
  8607. 72094,
  8608. 72096,
  8609. 72124,
  8610. 72134,
  8611. 72140,
  8612. 72152,
  8613. 72174,
  8614. 72178,
  8615. 72180,
  8616. 72206,
  8617. 72220,
  8618. 72248,
  8619. 72304,
  8620. 72318,
  8621. 72416,
  8622. 72444,
  8623. 72456,
  8624. 72464,
  8625. 72478,
  8626. 72480,
  8627. 72508,
  8628. 72512,
  8629. 72568,
  8630. 72588,
  8631. 72600,
  8632. 72624,
  8633. 72638,
  8634. 72654,
  8635. 72668,
  8636. 72674,
  8637. 72676,
  8638. 72680,
  8639. 72694,
  8640. 72726,
  8641. 72742,
  8642. 72748,
  8643. 72774,
  8644. 72780,
  8645. 72792,
  8646. 72814,
  8647. 72838,
  8648. 72856,
  8649. 72880,
  8650. 72894,
  8651. 72910,
  8652. 72924,
  8653. 72930,
  8654. 72932,
  8655. 72936,
  8656. 72950,
  8657. 72966,
  8658. 72972,
  8659. 72984,
  8660. 73008,
  8661. 73022,
  8662. 73056,
  8663. 73084,
  8664. 73102,
  8665. 73116,
  8666. 73144,
  8667. 73156,
  8668. 73160,
  8669. 73168,
  8670. 73182,
  8671. 73190,
  8672. 73196,
  8673. 73210,
  8674. 73226,
  8675. 73234,
  8676. 73236,
  8677. 73250,
  8678. 73252,
  8679. 73256,
  8680. 73270,
  8681. 73282,
  8682. 73284,
  8683. 73296,
  8684. 73310,
  8685. 73318,
  8686. 73324,
  8687. 73346,
  8688. 73348,
  8689. 73352,
  8690. 73360,
  8691. 73374,
  8692. 73376,
  8693. 73404,
  8694. 73414,
  8695. 73420,
  8696. 73432,
  8697. 73454,
  8698. 73498,
  8699. 73518,
  8700. 73522,
  8701. 73524,
  8702. 73550,
  8703. 73564,
  8704. 73570,
  8705. 73572,
  8706. 73576,
  8707. 73590,
  8708. 73800,
  8709. 73822,
  8710. 73858,
  8711. 73860,
  8712. 73872,
  8713. 73886,
  8714. 73888,
  8715. 73916,
  8716. 73944,
  8717. 73970,
  8718. 73972,
  8719. 73992,
  8720. 74014,
  8721. 74016,
  8722. 74044,
  8723. 74048,
  8724. 74104,
  8725. 74118,
  8726. 74136,
  8727. 74160,
  8728. 74174,
  8729. 74210,
  8730. 74212,
  8731. 74216,
  8732. 74230,
  8733. 74244,
  8734. 74256,
  8735. 74270,
  8736. 74272,
  8737. 74360,
  8738. 74480,
  8739. 74502,
  8740. 74508,
  8741. 74544,
  8742. 74558,
  8743. 74592,
  8744. 74620,
  8745. 74638,
  8746. 74652,
  8747. 74680,
  8748. 74690,
  8749. 74696,
  8750. 74704,
  8751. 74726,
  8752. 74732,
  8753. 74782,
  8754. 74784,
  8755. 74812,
  8756. 74992,
  8757. 75232,
  8758. 75288,
  8759. 75326,
  8760. 75360,
  8761. 75388,
  8762. 75456,
  8763. 75512,
  8764. 75576,
  8765. 75632,
  8766. 75646,
  8767. 75650,
  8768. 75652,
  8769. 75664,
  8770. 75678,
  8771. 75680,
  8772. 75708,
  8773. 75718,
  8774. 75724,
  8775. 75736,
  8776. 75758,
  8777. 75808,
  8778. 75836,
  8779. 75840,
  8780. 75896,
  8781. 76016,
  8782. 76256,
  8783. 76736,
  8784. 76824,
  8785. 76848,
  8786. 76862,
  8787. 76896,
  8788. 76924,
  8789. 76992,
  8790. 77048,
  8791. 77296,
  8792. 77340,
  8793. 77368,
  8794. 77424,
  8795. 77438,
  8796. 77536,
  8797. 77564,
  8798. 77572,
  8799. 77576,
  8800. 77584,
  8801. 77600,
  8802. 77628,
  8803. 77632,
  8804. 77688,
  8805. 77702,
  8806. 77708,
  8807. 77720,
  8808. 77744,
  8809. 77758,
  8810. 77774,
  8811. 77788,
  8812. 77870,
  8813. 77902,
  8814. 77916,
  8815. 77922,
  8816. 77928,
  8817. 77966,
  8818. 77980,
  8819. 78008,
  8820. 78018,
  8821. 78024,
  8822. 78032,
  8823. 78046,
  8824. 78060,
  8825. 78074,
  8826. 78094,
  8827. 78136,
  8828. 78192,
  8829. 78206,
  8830. 78210,
  8831. 78212,
  8832. 78224,
  8833. 78238,
  8834. 78240,
  8835. 78268,
  8836. 78278,
  8837. 78284,
  8838. 78296,
  8839. 78322,
  8840. 78324,
  8841. 78350,
  8842. 78364,
  8843. 78448,
  8844. 78462,
  8845. 78560,
  8846. 78588,
  8847. 78600,
  8848. 78622,
  8849. 78624,
  8850. 78652,
  8851. 78656,
  8852. 78712,
  8853. 78726,
  8854. 78744,
  8855. 78768,
  8856. 78782,
  8857. 78798,
  8858. 78812,
  8859. 78818,
  8860. 78820,
  8861. 78824,
  8862. 78838,
  8863. 78862,
  8864. 78876,
  8865. 78904,
  8866. 78960,
  8867. 78974,
  8868. 79072,
  8869. 79100,
  8870. 79296,
  8871. 79352,
  8872. 79368,
  8873. 79376,
  8874. 79390,
  8875. 79392,
  8876. 79420,
  8877. 79424,
  8878. 79480,
  8879. 79600,
  8880. 79628,
  8881. 79640,
  8882. 79664,
  8883. 79678,
  8884. 79712,
  8885. 79740,
  8886. 79772,
  8887. 79800,
  8888. 79810,
  8889. 79812,
  8890. 79816,
  8891. 79824,
  8892. 79838,
  8893. 79846,
  8894. 79852,
  8895. 79894,
  8896. 79910,
  8897. 79916,
  8898. 79942,
  8899. 79948,
  8900. 79960,
  8901. 79982,
  8902. 79988,
  8903. 80006,
  8904. 80024,
  8905. 80048,
  8906. 80062,
  8907. 80078,
  8908. 80092,
  8909. 80098,
  8910. 80100,
  8911. 80104,
  8912. 80134,
  8913. 80140,
  8914. 80176,
  8915. 80190,
  8916. 80224,
  8917. 80252,
  8918. 80270,
  8919. 80284,
  8920. 80312,
  8921. 80328,
  8922. 80336,
  8923. 80350,
  8924. 80358,
  8925. 80364,
  8926. 80378,
  8927. 80390,
  8928. 80396,
  8929. 80408,
  8930. 80432,
  8931. 80446,
  8932. 80480,
  8933. 80508,
  8934. 80576,
  8935. 80632,
  8936. 80654,
  8937. 80668,
  8938. 80696,
  8939. 80752,
  8940. 80766,
  8941. 80776,
  8942. 80784,
  8943. 80798,
  8944. 80800,
  8945. 80828,
  8946. 80844,
  8947. 80856,
  8948. 80878,
  8949. 80882,
  8950. 80884,
  8951. 80914,
  8952. 80916,
  8953. 80930,
  8954. 80932,
  8955. 80936,
  8956. 80950,
  8957. 80962,
  8958. 80968,
  8959. 80976,
  8960. 80990,
  8961. 80998,
  8962. 81004,
  8963. 81026,
  8964. 81028,
  8965. 81040,
  8966. 81054,
  8967. 81056,
  8968. 81084,
  8969. 81094,
  8970. 81100,
  8971. 81112,
  8972. 81134,
  8973. 81154,
  8974. 81156,
  8975. 81160,
  8976. 81168,
  8977. 81182,
  8978. 81184,
  8979. 81212,
  8980. 81216,
  8981. 81272,
  8982. 81286,
  8983. 81292,
  8984. 81304,
  8985. 81328,
  8986. 81342,
  8987. 81358,
  8988. 81372,
  8989. 81380,
  8990. 81384,
  8991. 81398,
  8992. 81434,
  8993. 81454,
  8994. 81458,
  8995. 81460,
  8996. 81486,
  8997. 81500,
  8998. 81506,
  8999. 81508,
  9000. 81512,
  9001. 81526,
  9002. 81550,
  9003. 81564,
  9004. 81592,
  9005. 81602,
  9006. 81604,
  9007. 81608,
  9008. 81616,
  9009. 81630,
  9010. 81638,
  9011. 81644,
  9012. 81702,
  9013. 81708,
  9014. 81722,
  9015. 81734,
  9016. 81740,
  9017. 81752,
  9018. 81774,
  9019. 81778,
  9020. 81780,
  9021. 82050,
  9022. 82078,
  9023. 82080,
  9024. 82108,
  9025. 82180,
  9026. 82184,
  9027. 82192,
  9028. 82206,
  9029. 82208,
  9030. 82236,
  9031. 82240,
  9032. 82296,
  9033. 82316,
  9034. 82328,
  9035. 82352,
  9036. 82366,
  9037. 82402,
  9038. 82404,
  9039. 82408,
  9040. 82440,
  9041. 82448,
  9042. 82462,
  9043. 82464,
  9044. 82492,
  9045. 82496,
  9046. 82552,
  9047. 82672,
  9048. 82694,
  9049. 82700,
  9050. 82712,
  9051. 82736,
  9052. 82750,
  9053. 82784,
  9054. 82812,
  9055. 82830,
  9056. 82882,
  9057. 82884,
  9058. 82888,
  9059. 82896,
  9060. 82918,
  9061. 82924,
  9062. 82952,
  9063. 82960,
  9064. 82974,
  9065. 82976,
  9066. 83004,
  9067. 83008,
  9068. 83064,
  9069. 83184,
  9070. 83424,
  9071. 83468,
  9072. 83480,
  9073. 83504,
  9074. 83518,
  9075. 83552,
  9076. 83580,
  9077. 83648,
  9078. 83704,
  9079. 83740,
  9080. 83768,
  9081. 83824,
  9082. 83838,
  9083. 83842,
  9084. 83844,
  9085. 83848,
  9086. 83856,
  9087. 83872,
  9088. 83900,
  9089. 83910,
  9090. 83916,
  9091. 83928,
  9092. 83950,
  9093. 83984,
  9094. 84e3,
  9095. 84028,
  9096. 84032,
  9097. 84088,
  9098. 84208,
  9099. 84448,
  9100. 84928,
  9101. 85040,
  9102. 85054,
  9103. 85088,
  9104. 85116,
  9105. 85184,
  9106. 85240,
  9107. 85488,
  9108. 85560,
  9109. 85616,
  9110. 85630,
  9111. 85728,
  9112. 85756,
  9113. 85764,
  9114. 85768,
  9115. 85776,
  9116. 85790,
  9117. 85792,
  9118. 85820,
  9119. 85824,
  9120. 85880,
  9121. 85894,
  9122. 85900,
  9123. 85912,
  9124. 85936,
  9125. 85966,
  9126. 85980,
  9127. 86048,
  9128. 86080,
  9129. 86136,
  9130. 86256,
  9131. 86496,
  9132. 86976,
  9133. 88160,
  9134. 88188,
  9135. 88256,
  9136. 88312,
  9137. 88560,
  9138. 89056,
  9139. 89200,
  9140. 89214,
  9141. 89312,
  9142. 89340,
  9143. 89536,
  9144. 89592,
  9145. 89608,
  9146. 89616,
  9147. 89632,
  9148. 89664,
  9149. 89720,
  9150. 89840,
  9151. 89868,
  9152. 89880,
  9153. 89904,
  9154. 89952,
  9155. 89980,
  9156. 89998,
  9157. 90012,
  9158. 90040,
  9159. 90190,
  9160. 90204,
  9161. 90254,
  9162. 90268,
  9163. 90296,
  9164. 90306,
  9165. 90308,
  9166. 90312,
  9167. 90334,
  9168. 90382,
  9169. 90396,
  9170. 90424,
  9171. 90480,
  9172. 90494,
  9173. 90500,
  9174. 90504,
  9175. 90512,
  9176. 90526,
  9177. 90528,
  9178. 90556,
  9179. 90566,
  9180. 90572,
  9181. 90584,
  9182. 90610,
  9183. 90612,
  9184. 90638,
  9185. 90652,
  9186. 90680,
  9187. 90736,
  9188. 90750,
  9189. 90848,
  9190. 90876,
  9191. 90884,
  9192. 90888,
  9193. 90896,
  9194. 90910,
  9195. 90912,
  9196. 90940,
  9197. 90944,
  9198. 91e3,
  9199. 91014,
  9200. 91020,
  9201. 91032,
  9202. 91056,
  9203. 91070,
  9204. 91086,
  9205. 91100,
  9206. 91106,
  9207. 91108,
  9208. 91112,
  9209. 91126,
  9210. 91150,
  9211. 91164,
  9212. 91192,
  9213. 91248,
  9214. 91262,
  9215. 91360,
  9216. 91388,
  9217. 91584,
  9218. 91640,
  9219. 91664,
  9220. 91678,
  9221. 91680,
  9222. 91708,
  9223. 91712,
  9224. 91768,
  9225. 91888,
  9226. 91928,
  9227. 91952,
  9228. 91966,
  9229. 92e3,
  9230. 92028,
  9231. 92046,
  9232. 92060,
  9233. 92088,
  9234. 92098,
  9235. 92100,
  9236. 92104,
  9237. 92112,
  9238. 92126,
  9239. 92134,
  9240. 92140,
  9241. 92188,
  9242. 92216,
  9243. 92272,
  9244. 92384,
  9245. 92412,
  9246. 92608,
  9247. 92664,
  9248. 93168,
  9249. 93200,
  9250. 93214,
  9251. 93216,
  9252. 93244,
  9253. 93248,
  9254. 93304,
  9255. 93424,
  9256. 93664,
  9257. 93720,
  9258. 93744,
  9259. 93758,
  9260. 93792,
  9261. 93820,
  9262. 93888,
  9263. 93944,
  9264. 93980,
  9265. 94008,
  9266. 94064,
  9267. 94078,
  9268. 94084,
  9269. 94088,
  9270. 94096,
  9271. 94110,
  9272. 94112,
  9273. 94140,
  9274. 94150,
  9275. 94156,
  9276. 94168,
  9277. 94246,
  9278. 94252,
  9279. 94278,
  9280. 94284,
  9281. 94296,
  9282. 94318,
  9283. 94342,
  9284. 94348,
  9285. 94360,
  9286. 94384,
  9287. 94398,
  9288. 94414,
  9289. 94428,
  9290. 94440,
  9291. 94470,
  9292. 94476,
  9293. 94488,
  9294. 94512,
  9295. 94526,
  9296. 94560,
  9297. 94588,
  9298. 94606,
  9299. 94620,
  9300. 94648,
  9301. 94658,
  9302. 94660,
  9303. 94664,
  9304. 94672,
  9305. 94686,
  9306. 94694,
  9307. 94700,
  9308. 94714,
  9309. 94726,
  9310. 94732,
  9311. 94744,
  9312. 94768,
  9313. 94782,
  9314. 94816,
  9315. 94844,
  9316. 94912,
  9317. 94968,
  9318. 94990,
  9319. 95004,
  9320. 95032,
  9321. 95088,
  9322. 95102,
  9323. 95112,
  9324. 95120,
  9325. 95134,
  9326. 95136,
  9327. 95164,
  9328. 95180,
  9329. 95192,
  9330. 95214,
  9331. 95218,
  9332. 95220,
  9333. 95244,
  9334. 95256,
  9335. 95280,
  9336. 95294,
  9337. 95328,
  9338. 95356,
  9339. 95424,
  9340. 95480,
  9341. 95728,
  9342. 95758,
  9343. 95772,
  9344. 95800,
  9345. 95856,
  9346. 95870,
  9347. 95968,
  9348. 95996,
  9349. 96008,
  9350. 96016,
  9351. 96030,
  9352. 96032,
  9353. 96060,
  9354. 96064,
  9355. 96120,
  9356. 96152,
  9357. 96176,
  9358. 96190,
  9359. 96220,
  9360. 96226,
  9361. 96228,
  9362. 96232,
  9363. 96290,
  9364. 96292,
  9365. 96296,
  9366. 96310,
  9367. 96322,
  9368. 96324,
  9369. 96328,
  9370. 96336,
  9371. 96350,
  9372. 96358,
  9373. 96364,
  9374. 96386,
  9375. 96388,
  9376. 96392,
  9377. 96400,
  9378. 96414,
  9379. 96416,
  9380. 96444,
  9381. 96454,
  9382. 96460,
  9383. 96472,
  9384. 96494,
  9385. 96498,
  9386. 96500,
  9387. 96514,
  9388. 96516,
  9389. 96520,
  9390. 96528,
  9391. 96542,
  9392. 96544,
  9393. 96572,
  9394. 96576,
  9395. 96632,
  9396. 96646,
  9397. 96652,
  9398. 96664,
  9399. 96688,
  9400. 96702,
  9401. 96718,
  9402. 96732,
  9403. 96738,
  9404. 96740,
  9405. 96744,
  9406. 96758,
  9407. 96772,
  9408. 96776,
  9409. 96784,
  9410. 96798,
  9411. 96800,
  9412. 96828,
  9413. 96832,
  9414. 96888,
  9415. 97008,
  9416. 97030,
  9417. 97036,
  9418. 97048,
  9419. 97072,
  9420. 97086,
  9421. 97120,
  9422. 97148,
  9423. 97166,
  9424. 97180,
  9425. 97208,
  9426. 97220,
  9427. 97224,
  9428. 97232,
  9429. 97246,
  9430. 97254,
  9431. 97260,
  9432. 97326,
  9433. 97330,
  9434. 97332,
  9435. 97358,
  9436. 97372,
  9437. 97378,
  9438. 97380,
  9439. 97384,
  9440. 97398,
  9441. 97422,
  9442. 97436,
  9443. 97464,
  9444. 97474,
  9445. 97476,
  9446. 97480,
  9447. 97488,
  9448. 97502,
  9449. 97510,
  9450. 97516,
  9451. 97550,
  9452. 97564,
  9453. 97592,
  9454. 97648,
  9455. 97666,
  9456. 97668,
  9457. 97672,
  9458. 97680,
  9459. 97694,
  9460. 97696,
  9461. 97724,
  9462. 97734,
  9463. 97740,
  9464. 97752,
  9465. 97774,
  9466. 97830,
  9467. 97836,
  9468. 97850,
  9469. 97862,
  9470. 97868,
  9471. 97880,
  9472. 97902,
  9473. 97906,
  9474. 97908,
  9475. 97926,
  9476. 97932,
  9477. 97944,
  9478. 97968,
  9479. 97998,
  9480. 98012,
  9481. 98018,
  9482. 98020,
  9483. 98024,
  9484. 98038,
  9485. 98618,
  9486. 98674,
  9487. 98676,
  9488. 98838,
  9489. 98854,
  9490. 98874,
  9491. 98892,
  9492. 98904,
  9493. 98926,
  9494. 98930,
  9495. 98932,
  9496. 98968,
  9497. 99006,
  9498. 99042,
  9499. 99044,
  9500. 99048,
  9501. 99062,
  9502. 99166,
  9503. 99194,
  9504. 99246,
  9505. 99286,
  9506. 99350,
  9507. 99366,
  9508. 99372,
  9509. 99386,
  9510. 99398,
  9511. 99416,
  9512. 99438,
  9513. 99442,
  9514. 99444,
  9515. 99462,
  9516. 99504,
  9517. 99518,
  9518. 99534,
  9519. 99548,
  9520. 99554,
  9521. 99556,
  9522. 99560,
  9523. 99574,
  9524. 99590,
  9525. 99596,
  9526. 99608,
  9527. 99632,
  9528. 99646,
  9529. 99680,
  9530. 99708,
  9531. 99726,
  9532. 99740,
  9533. 99768,
  9534. 99778,
  9535. 99780,
  9536. 99784,
  9537. 99792,
  9538. 99806,
  9539. 99814,
  9540. 99820,
  9541. 99834,
  9542. 99858,
  9543. 99860,
  9544. 99874,
  9545. 99880,
  9546. 99894,
  9547. 99906,
  9548. 99920,
  9549. 99934,
  9550. 99962,
  9551. 99970,
  9552. 99972,
  9553. 99976,
  9554. 99984,
  9555. 99998,
  9556. 1e5,
  9557. 100028,
  9558. 100038,
  9559. 100044,
  9560. 100056,
  9561. 100078,
  9562. 100082,
  9563. 100084,
  9564. 100142,
  9565. 100174,
  9566. 100188,
  9567. 100246,
  9568. 100262,
  9569. 100268,
  9570. 100306,
  9571. 100308,
  9572. 100390,
  9573. 100396,
  9574. 100410,
  9575. 100422,
  9576. 100428,
  9577. 100440,
  9578. 100462,
  9579. 100466,
  9580. 100468,
  9581. 100486,
  9582. 100504,
  9583. 100528,
  9584. 100542,
  9585. 100558,
  9586. 100572,
  9587. 100578,
  9588. 100580,
  9589. 100584,
  9590. 100598,
  9591. 100620,
  9592. 100656,
  9593. 100670,
  9594. 100704,
  9595. 100732,
  9596. 100750,
  9597. 100792,
  9598. 100802,
  9599. 100808,
  9600. 100816,
  9601. 100830,
  9602. 100838,
  9603. 100844,
  9604. 100858,
  9605. 100888,
  9606. 100912,
  9607. 100926,
  9608. 100960,
  9609. 100988,
  9610. 101056,
  9611. 101112,
  9612. 101148,
  9613. 101176,
  9614. 101232,
  9615. 101246,
  9616. 101250,
  9617. 101252,
  9618. 101256,
  9619. 101264,
  9620. 101278,
  9621. 101280,
  9622. 101308,
  9623. 101318,
  9624. 101324,
  9625. 101336,
  9626. 101358,
  9627. 101362,
  9628. 101364,
  9629. 101410,
  9630. 101412,
  9631. 101416,
  9632. 101430,
  9633. 101442,
  9634. 101448,
  9635. 101456,
  9636. 101470,
  9637. 101478,
  9638. 101498,
  9639. 101506,
  9640. 101508,
  9641. 101520,
  9642. 101534,
  9643. 101536,
  9644. 101564,
  9645. 101580,
  9646. 101618,
  9647. 101620,
  9648. 101636,
  9649. 101640,
  9650. 101648,
  9651. 101662,
  9652. 101664,
  9653. 101692,
  9654. 101696,
  9655. 101752,
  9656. 101766,
  9657. 101784,
  9658. 101838,
  9659. 101858,
  9660. 101860,
  9661. 101864,
  9662. 101934,
  9663. 101938,
  9664. 101940,
  9665. 101966,
  9666. 101980,
  9667. 101986,
  9668. 101988,
  9669. 101992,
  9670. 102030,
  9671. 102044,
  9672. 102072,
  9673. 102082,
  9674. 102084,
  9675. 102088,
  9676. 102096,
  9677. 102138,
  9678. 102166,
  9679. 102182,
  9680. 102188,
  9681. 102214,
  9682. 102220,
  9683. 102232,
  9684. 102254,
  9685. 102282,
  9686. 102290,
  9687. 102292,
  9688. 102306,
  9689. 102308,
  9690. 102312,
  9691. 102326,
  9692. 102444,
  9693. 102458,
  9694. 102470,
  9695. 102476,
  9696. 102488,
  9697. 102514,
  9698. 102516,
  9699. 102534,
  9700. 102552,
  9701. 102576,
  9702. 102590,
  9703. 102606,
  9704. 102620,
  9705. 102626,
  9706. 102632,
  9707. 102646,
  9708. 102662,
  9709. 102668,
  9710. 102704,
  9711. 102718,
  9712. 102752,
  9713. 102780,
  9714. 102798,
  9715. 102812,
  9716. 102840,
  9717. 102850,
  9718. 102856,
  9719. 102864,
  9720. 102878,
  9721. 102886,
  9722. 102892,
  9723. 102906,
  9724. 102936,
  9725. 102974,
  9726. 103008,
  9727. 103036,
  9728. 103104,
  9729. 103160,
  9730. 103224,
  9731. 103280,
  9732. 103294,
  9733. 103298,
  9734. 103300,
  9735. 103312,
  9736. 103326,
  9737. 103328,
  9738. 103356,
  9739. 103366,
  9740. 103372,
  9741. 103384,
  9742. 103406,
  9743. 103410,
  9744. 103412,
  9745. 103472,
  9746. 103486,
  9747. 103520,
  9748. 103548,
  9749. 103616,
  9750. 103672,
  9751. 103920,
  9752. 103992,
  9753. 104048,
  9754. 104062,
  9755. 104160,
  9756. 104188,
  9757. 104194,
  9758. 104196,
  9759. 104200,
  9760. 104208,
  9761. 104224,
  9762. 104252,
  9763. 104256,
  9764. 104312,
  9765. 104326,
  9766. 104332,
  9767. 104344,
  9768. 104368,
  9769. 104382,
  9770. 104398,
  9771. 104412,
  9772. 104418,
  9773. 104420,
  9774. 104424,
  9775. 104482,
  9776. 104484,
  9777. 104514,
  9778. 104520,
  9779. 104528,
  9780. 104542,
  9781. 104550,
  9782. 104570,
  9783. 104578,
  9784. 104580,
  9785. 104592,
  9786. 104606,
  9787. 104608,
  9788. 104636,
  9789. 104652,
  9790. 104690,
  9791. 104692,
  9792. 104706,
  9793. 104712,
  9794. 104734,
  9795. 104736,
  9796. 104764,
  9797. 104768,
  9798. 104824,
  9799. 104838,
  9800. 104856,
  9801. 104910,
  9802. 104930,
  9803. 104932,
  9804. 104936,
  9805. 104968,
  9806. 104976,
  9807. 104990,
  9808. 104992,
  9809. 105020,
  9810. 105024,
  9811. 105080,
  9812. 105200,
  9813. 105240,
  9814. 105278,
  9815. 105312,
  9816. 105372,
  9817. 105410,
  9818. 105412,
  9819. 105416,
  9820. 105424,
  9821. 105446,
  9822. 105518,
  9823. 105524,
  9824. 105550,
  9825. 105564,
  9826. 105570,
  9827. 105572,
  9828. 105576,
  9829. 105614,
  9830. 105628,
  9831. 105656,
  9832. 105666,
  9833. 105672,
  9834. 105680,
  9835. 105702,
  9836. 105722,
  9837. 105742,
  9838. 105756,
  9839. 105784,
  9840. 105840,
  9841. 105854,
  9842. 105858,
  9843. 105860,
  9844. 105864,
  9845. 105872,
  9846. 105888,
  9847. 105932,
  9848. 105970,
  9849. 105972,
  9850. 106006,
  9851. 106022,
  9852. 106028,
  9853. 106054,
  9854. 106060,
  9855. 106072,
  9856. 106100,
  9857. 106118,
  9858. 106124,
  9859. 106136,
  9860. 106160,
  9861. 106174,
  9862. 106190,
  9863. 106210,
  9864. 106212,
  9865. 106216,
  9866. 106250,
  9867. 106258,
  9868. 106260,
  9869. 106274,
  9870. 106276,
  9871. 106280,
  9872. 106306,
  9873. 106308,
  9874. 106312,
  9875. 106320,
  9876. 106334,
  9877. 106348,
  9878. 106394,
  9879. 106414,
  9880. 106418,
  9881. 106420,
  9882. 106566,
  9883. 106572,
  9884. 106610,
  9885. 106612,
  9886. 106630,
  9887. 106636,
  9888. 106648,
  9889. 106672,
  9890. 106686,
  9891. 106722,
  9892. 106724,
  9893. 106728,
  9894. 106742,
  9895. 106758,
  9896. 106764,
  9897. 106776,
  9898. 106800,
  9899. 106814,
  9900. 106848,
  9901. 106876,
  9902. 106894,
  9903. 106908,
  9904. 106936,
  9905. 106946,
  9906. 106948,
  9907. 106952,
  9908. 106960,
  9909. 106974,
  9910. 106982,
  9911. 106988,
  9912. 107032,
  9913. 107056,
  9914. 107070,
  9915. 107104,
  9916. 107132,
  9917. 107200,
  9918. 107256,
  9919. 107292,
  9920. 107320,
  9921. 107376,
  9922. 107390,
  9923. 107394,
  9924. 107396,
  9925. 107400,
  9926. 107408,
  9927. 107422,
  9928. 107424,
  9929. 107452,
  9930. 107462,
  9931. 107468,
  9932. 107480,
  9933. 107502,
  9934. 107506,
  9935. 107508,
  9936. 107544,
  9937. 107568,
  9938. 107582,
  9939. 107616,
  9940. 107644,
  9941. 107712,
  9942. 107768,
  9943. 108016,
  9944. 108060,
  9945. 108088,
  9946. 108144,
  9947. 108158,
  9948. 108256,
  9949. 108284,
  9950. 108290,
  9951. 108292,
  9952. 108296,
  9953. 108304,
  9954. 108318,
  9955. 108320,
  9956. 108348,
  9957. 108352,
  9958. 108408,
  9959. 108422,
  9960. 108428,
  9961. 108440,
  9962. 108464,
  9963. 108478,
  9964. 108494,
  9965. 108508,
  9966. 108514,
  9967. 108516,
  9968. 108520,
  9969. 108592,
  9970. 108640,
  9971. 108668,
  9972. 108736,
  9973. 108792,
  9974. 109040,
  9975. 109536,
  9976. 109680,
  9977. 109694,
  9978. 109792,
  9979. 109820,
  9980. 110016,
  9981. 110072,
  9982. 110084,
  9983. 110088,
  9984. 110096,
  9985. 110112,
  9986. 110140,
  9987. 110144,
  9988. 110200,
  9989. 110320,
  9990. 110342,
  9991. 110348,
  9992. 110360,
  9993. 110384,
  9994. 110398,
  9995. 110432,
  9996. 110460,
  9997. 110478,
  9998. 110492,
  9999. 110520,
  10000. 110532,
  10001. 110536,
  10002. 110544,
  10003. 110558,
  10004. 110658,
  10005. 110686,
  10006. 110714,
  10007. 110722,
  10008. 110724,
  10009. 110728,
  10010. 110736,
  10011. 110750,
  10012. 110752,
  10013. 110780,
  10014. 110796,
  10015. 110834,
  10016. 110836,
  10017. 110850,
  10018. 110852,
  10019. 110856,
  10020. 110864,
  10021. 110878,
  10022. 110880,
  10023. 110908,
  10024. 110912,
  10025. 110968,
  10026. 110982,
  10027. 111e3,
  10028. 111054,
  10029. 111074,
  10030. 111076,
  10031. 111080,
  10032. 111108,
  10033. 111112,
  10034. 111120,
  10035. 111134,
  10036. 111136,
  10037. 111164,
  10038. 111168,
  10039. 111224,
  10040. 111344,
  10041. 111372,
  10042. 111422,
  10043. 111456,
  10044. 111516,
  10045. 111554,
  10046. 111556,
  10047. 111560,
  10048. 111568,
  10049. 111590,
  10050. 111632,
  10051. 111646,
  10052. 111648,
  10053. 111676,
  10054. 111680,
  10055. 111736,
  10056. 111856,
  10057. 112096,
  10058. 112152,
  10059. 112224,
  10060. 112252,
  10061. 112320,
  10062. 112440,
  10063. 112514,
  10064. 112516,
  10065. 112520,
  10066. 112528,
  10067. 112542,
  10068. 112544,
  10069. 112588,
  10070. 112686,
  10071. 112718,
  10072. 112732,
  10073. 112782,
  10074. 112796,
  10075. 112824,
  10076. 112834,
  10077. 112836,
  10078. 112840,
  10079. 112848,
  10080. 112870,
  10081. 112890,
  10082. 112910,
  10083. 112924,
  10084. 112952,
  10085. 113008,
  10086. 113022,
  10087. 113026,
  10088. 113028,
  10089. 113032,
  10090. 113040,
  10091. 113054,
  10092. 113056,
  10093. 113100,
  10094. 113138,
  10095. 113140,
  10096. 113166,
  10097. 113180,
  10098. 113208,
  10099. 113264,
  10100. 113278,
  10101. 113376,
  10102. 113404,
  10103. 113416,
  10104. 113424,
  10105. 113440,
  10106. 113468,
  10107. 113472,
  10108. 113560,
  10109. 113614,
  10110. 113634,
  10111. 113636,
  10112. 113640,
  10113. 113686,
  10114. 113702,
  10115. 113708,
  10116. 113734,
  10117. 113740,
  10118. 113752,
  10119. 113778,
  10120. 113780,
  10121. 113798,
  10122. 113804,
  10123. 113816,
  10124. 113840,
  10125. 113854,
  10126. 113870,
  10127. 113890,
  10128. 113892,
  10129. 113896,
  10130. 113926,
  10131. 113932,
  10132. 113944,
  10133. 113968,
  10134. 113982,
  10135. 114016,
  10136. 114044,
  10137. 114076,
  10138. 114114,
  10139. 114116,
  10140. 114120,
  10141. 114128,
  10142. 114150,
  10143. 114170,
  10144. 114194,
  10145. 114196,
  10146. 114210,
  10147. 114212,
  10148. 114216,
  10149. 114242,
  10150. 114244,
  10151. 114248,
  10152. 114256,
  10153. 114270,
  10154. 114278,
  10155. 114306,
  10156. 114308,
  10157. 114312,
  10158. 114320,
  10159. 114334,
  10160. 114336,
  10161. 114364,
  10162. 114380,
  10163. 114420,
  10164. 114458,
  10165. 114478,
  10166. 114482,
  10167. 114484,
  10168. 114510,
  10169. 114524,
  10170. 114530,
  10171. 114532,
  10172. 114536,
  10173. 114842,
  10174. 114866,
  10175. 114868,
  10176. 114970,
  10177. 114994,
  10178. 114996,
  10179. 115042,
  10180. 115044,
  10181. 115048,
  10182. 115062,
  10183. 115130,
  10184. 115226,
  10185. 115250,
  10186. 115252,
  10187. 115278,
  10188. 115292,
  10189. 115298,
  10190. 115300,
  10191. 115304,
  10192. 115318,
  10193. 115342,
  10194. 115394,
  10195. 115396,
  10196. 115400,
  10197. 115408,
  10198. 115422,
  10199. 115430,
  10200. 115436,
  10201. 115450,
  10202. 115478,
  10203. 115494,
  10204. 115514,
  10205. 115526,
  10206. 115532,
  10207. 115570,
  10208. 115572,
  10209. 115738,
  10210. 115758,
  10211. 115762,
  10212. 115764,
  10213. 115790,
  10214. 115804,
  10215. 115810,
  10216. 115812,
  10217. 115816,
  10218. 115830,
  10219. 115854,
  10220. 115868,
  10221. 115896,
  10222. 115906,
  10223. 115912,
  10224. 115920,
  10225. 115934,
  10226. 115942,
  10227. 115948,
  10228. 115962,
  10229. 115996,
  10230. 116024,
  10231. 116080,
  10232. 116094,
  10233. 116098,
  10234. 116100,
  10235. 116104,
  10236. 116112,
  10237. 116126,
  10238. 116128,
  10239. 116156,
  10240. 116166,
  10241. 116172,
  10242. 116184,
  10243. 116206,
  10244. 116210,
  10245. 116212,
  10246. 116246,
  10247. 116262,
  10248. 116268,
  10249. 116282,
  10250. 116294,
  10251. 116300,
  10252. 116312,
  10253. 116334,
  10254. 116338,
  10255. 116340,
  10256. 116358,
  10257. 116364,
  10258. 116376,
  10259. 116400,
  10260. 116414,
  10261. 116430,
  10262. 116444,
  10263. 116450,
  10264. 116452,
  10265. 116456,
  10266. 116498,
  10267. 116500,
  10268. 116514,
  10269. 116520,
  10270. 116534,
  10271. 116546,
  10272. 116548,
  10273. 116552,
  10274. 116560,
  10275. 116574,
  10276. 116582,
  10277. 116588,
  10278. 116602,
  10279. 116654,
  10280. 116694,
  10281. 116714,
  10282. 116762,
  10283. 116782,
  10284. 116786,
  10285. 116788,
  10286. 116814,
  10287. 116828,
  10288. 116834,
  10289. 116836,
  10290. 116840,
  10291. 116854,
  10292. 116878,
  10293. 116892,
  10294. 116920,
  10295. 116930,
  10296. 116936,
  10297. 116944,
  10298. 116958,
  10299. 116966,
  10300. 116972,
  10301. 116986,
  10302. 117006,
  10303. 117048,
  10304. 117104,
  10305. 117118,
  10306. 117122,
  10307. 117124,
  10308. 117136,
  10309. 117150,
  10310. 117152,
  10311. 117180,
  10312. 117190,
  10313. 117196,
  10314. 117208,
  10315. 117230,
  10316. 117234,
  10317. 117236,
  10318. 117304,
  10319. 117360,
  10320. 117374,
  10321. 117472,
  10322. 117500,
  10323. 117506,
  10324. 117508,
  10325. 117512,
  10326. 117520,
  10327. 117536,
  10328. 117564,
  10329. 117568,
  10330. 117624,
  10331. 117638,
  10332. 117644,
  10333. 117656,
  10334. 117680,
  10335. 117694,
  10336. 117710,
  10337. 117724,
  10338. 117730,
  10339. 117732,
  10340. 117736,
  10341. 117750,
  10342. 117782,
  10343. 117798,
  10344. 117804,
  10345. 117818,
  10346. 117830,
  10347. 117848,
  10348. 117874,
  10349. 117876,
  10350. 117894,
  10351. 117936,
  10352. 117950,
  10353. 117966,
  10354. 117986,
  10355. 117988,
  10356. 117992,
  10357. 118022,
  10358. 118028,
  10359. 118040,
  10360. 118064,
  10361. 118078,
  10362. 118112,
  10363. 118140,
  10364. 118172,
  10365. 118210,
  10366. 118212,
  10367. 118216,
  10368. 118224,
  10369. 118238,
  10370. 118246,
  10371. 118266,
  10372. 118306,
  10373. 118312,
  10374. 118338,
  10375. 118352,
  10376. 118366,
  10377. 118374,
  10378. 118394,
  10379. 118402,
  10380. 118404,
  10381. 118408,
  10382. 118416,
  10383. 118430,
  10384. 118432,
  10385. 118460,
  10386. 118476,
  10387. 118514,
  10388. 118516,
  10389. 118574,
  10390. 118578,
  10391. 118580,
  10392. 118606,
  10393. 118620,
  10394. 118626,
  10395. 118628,
  10396. 118632,
  10397. 118678,
  10398. 118694,
  10399. 118700,
  10400. 118730,
  10401. 118738,
  10402. 118740,
  10403. 118830,
  10404. 118834,
  10405. 118836,
  10406. 118862,
  10407. 118876,
  10408. 118882,
  10409. 118884,
  10410. 118888,
  10411. 118902,
  10412. 118926,
  10413. 118940,
  10414. 118968,
  10415. 118978,
  10416. 118980,
  10417. 118984,
  10418. 118992,
  10419. 119006,
  10420. 119014,
  10421. 119020,
  10422. 119034,
  10423. 119068,
  10424. 119096,
  10425. 119152,
  10426. 119166,
  10427. 119170,
  10428. 119172,
  10429. 119176,
  10430. 119184,
  10431. 119198,
  10432. 119200,
  10433. 119228,
  10434. 119238,
  10435. 119244,
  10436. 119256,
  10437. 119278,
  10438. 119282,
  10439. 119284,
  10440. 119324,
  10441. 119352,
  10442. 119408,
  10443. 119422,
  10444. 119520,
  10445. 119548,
  10446. 119554,
  10447. 119556,
  10448. 119560,
  10449. 119568,
  10450. 119582,
  10451. 119584,
  10452. 119612,
  10453. 119616,
  10454. 119672,
  10455. 119686,
  10456. 119692,
  10457. 119704,
  10458. 119728,
  10459. 119742,
  10460. 119758,
  10461. 119772,
  10462. 119778,
  10463. 119780,
  10464. 119784,
  10465. 119798,
  10466. 119920,
  10467. 119934,
  10468. 120032,
  10469. 120060,
  10470. 120256,
  10471. 120312,
  10472. 120324,
  10473. 120328,
  10474. 120336,
  10475. 120352,
  10476. 120384,
  10477. 120440,
  10478. 120560,
  10479. 120582,
  10480. 120588,
  10481. 120600,
  10482. 120624,
  10483. 120638,
  10484. 120672,
  10485. 120700,
  10486. 120718,
  10487. 120732,
  10488. 120760,
  10489. 120770,
  10490. 120772,
  10491. 120776,
  10492. 120784,
  10493. 120798,
  10494. 120806,
  10495. 120812,
  10496. 120870,
  10497. 120876,
  10498. 120890,
  10499. 120902,
  10500. 120908,
  10501. 120920,
  10502. 120946,
  10503. 120948,
  10504. 120966,
  10505. 120972,
  10506. 120984,
  10507. 121008,
  10508. 121022,
  10509. 121038,
  10510. 121058,
  10511. 121060,
  10512. 121064,
  10513. 121078,
  10514. 121100,
  10515. 121112,
  10516. 121136,
  10517. 121150,
  10518. 121184,
  10519. 121212,
  10520. 121244,
  10521. 121282,
  10522. 121284,
  10523. 121288,
  10524. 121296,
  10525. 121318,
  10526. 121338,
  10527. 121356,
  10528. 121368,
  10529. 121392,
  10530. 121406,
  10531. 121440,
  10532. 121468,
  10533. 121536,
  10534. 121592,
  10535. 121656,
  10536. 121730,
  10537. 121732,
  10538. 121736,
  10539. 121744,
  10540. 121758,
  10541. 121760,
  10542. 121804,
  10543. 121842,
  10544. 121844,
  10545. 121890,
  10546. 121922,
  10547. 121924,
  10548. 121928,
  10549. 121936,
  10550. 121950,
  10551. 121958,
  10552. 121978,
  10553. 121986,
  10554. 121988,
  10555. 121992,
  10556. 122e3,
  10557. 122014,
  10558. 122016,
  10559. 122044,
  10560. 122060,
  10561. 122098,
  10562. 122100,
  10563. 122116,
  10564. 122120,
  10565. 122128,
  10566. 122142,
  10567. 122144,
  10568. 122172,
  10569. 122176,
  10570. 122232,
  10571. 122246,
  10572. 122264,
  10573. 122318,
  10574. 122338,
  10575. 122340,
  10576. 122344,
  10577. 122414,
  10578. 122418,
  10579. 122420,
  10580. 122446,
  10581. 122460,
  10582. 122466,
  10583. 122468,
  10584. 122472,
  10585. 122510,
  10586. 122524,
  10587. 122552,
  10588. 122562,
  10589. 122564,
  10590. 122568,
  10591. 122576,
  10592. 122598,
  10593. 122618,
  10594. 122646,
  10595. 122662,
  10596. 122668,
  10597. 122694,
  10598. 122700,
  10599. 122712,
  10600. 122738,
  10601. 122740,
  10602. 122762,
  10603. 122770,
  10604. 122772,
  10605. 122786,
  10606. 122788,
  10607. 122792,
  10608. 123018,
  10609. 123026,
  10610. 123028,
  10611. 123042,
  10612. 123044,
  10613. 123048,
  10614. 123062,
  10615. 123098,
  10616. 123146,
  10617. 123154,
  10618. 123156,
  10619. 123170,
  10620. 123172,
  10621. 123176,
  10622. 123190,
  10623. 123202,
  10624. 123204,
  10625. 123208,
  10626. 123216,
  10627. 123238,
  10628. 123244,
  10629. 123258,
  10630. 123290,
  10631. 123314,
  10632. 123316,
  10633. 123402,
  10634. 123410,
  10635. 123412,
  10636. 123426,
  10637. 123428,
  10638. 123432,
  10639. 123446,
  10640. 123458,
  10641. 123464,
  10642. 123472,
  10643. 123486,
  10644. 123494,
  10645. 123500,
  10646. 123514,
  10647. 123522,
  10648. 123524,
  10649. 123528,
  10650. 123536,
  10651. 123552,
  10652. 123580,
  10653. 123590,
  10654. 123596,
  10655. 123608,
  10656. 123630,
  10657. 123634,
  10658. 123636,
  10659. 123674,
  10660. 123698,
  10661. 123700,
  10662. 123740,
  10663. 123746,
  10664. 123748,
  10665. 123752,
  10666. 123834,
  10667. 123914,
  10668. 123922,
  10669. 123924,
  10670. 123938,
  10671. 123944,
  10672. 123958,
  10673. 123970,
  10674. 123976,
  10675. 123984,
  10676. 123998,
  10677. 124006,
  10678. 124012,
  10679. 124026,
  10680. 124034,
  10681. 124036,
  10682. 124048,
  10683. 124062,
  10684. 124064,
  10685. 124092,
  10686. 124102,
  10687. 124108,
  10688. 124120,
  10689. 124142,
  10690. 124146,
  10691. 124148,
  10692. 124162,
  10693. 124164,
  10694. 124168,
  10695. 124176,
  10696. 124190,
  10697. 124192,
  10698. 124220,
  10699. 124224,
  10700. 124280,
  10701. 124294,
  10702. 124300,
  10703. 124312,
  10704. 124336,
  10705. 124350,
  10706. 124366,
  10707. 124380,
  10708. 124386,
  10709. 124388,
  10710. 124392,
  10711. 124406,
  10712. 124442,
  10713. 124462,
  10714. 124466,
  10715. 124468,
  10716. 124494,
  10717. 124508,
  10718. 124514,
  10719. 124520,
  10720. 124558,
  10721. 124572,
  10722. 124600,
  10723. 124610,
  10724. 124612,
  10725. 124616,
  10726. 124624,
  10727. 124646,
  10728. 124666,
  10729. 124694,
  10730. 124710,
  10731. 124716,
  10732. 124730,
  10733. 124742,
  10734. 124748,
  10735. 124760,
  10736. 124786,
  10737. 124788,
  10738. 124818,
  10739. 124820,
  10740. 124834,
  10741. 124836,
  10742. 124840,
  10743. 124854,
  10744. 124946,
  10745. 124948,
  10746. 124962,
  10747. 124964,
  10748. 124968,
  10749. 124982,
  10750. 124994,
  10751. 124996,
  10752. 125e3,
  10753. 125008,
  10754. 125022,
  10755. 125030,
  10756. 125036,
  10757. 125050,
  10758. 125058,
  10759. 125060,
  10760. 125064,
  10761. 125072,
  10762. 125086,
  10763. 125088,
  10764. 125116,
  10765. 125126,
  10766. 125132,
  10767. 125144,
  10768. 125166,
  10769. 125170,
  10770. 125172,
  10771. 125186,
  10772. 125188,
  10773. 125192,
  10774. 125200,
  10775. 125216,
  10776. 125244,
  10777. 125248,
  10778. 125304,
  10779. 125318,
  10780. 125324,
  10781. 125336,
  10782. 125360,
  10783. 125374,
  10784. 125390,
  10785. 125404,
  10786. 125410,
  10787. 125412,
  10788. 125416,
  10789. 125430,
  10790. 125444,
  10791. 125448,
  10792. 125456,
  10793. 125472,
  10794. 125504,
  10795. 125560,
  10796. 125680,
  10797. 125702,
  10798. 125708,
  10799. 125720,
  10800. 125744,
  10801. 125758,
  10802. 125792,
  10803. 125820,
  10804. 125838,
  10805. 125852,
  10806. 125880,
  10807. 125890,
  10808. 125892,
  10809. 125896,
  10810. 125904,
  10811. 125918,
  10812. 125926,
  10813. 125932,
  10814. 125978,
  10815. 125998,
  10816. 126002,
  10817. 126004,
  10818. 126030,
  10819. 126044,
  10820. 126050,
  10821. 126052,
  10822. 126056,
  10823. 126094,
  10824. 126108,
  10825. 126136,
  10826. 126146,
  10827. 126148,
  10828. 126152,
  10829. 126160,
  10830. 126182,
  10831. 126202,
  10832. 126222,
  10833. 126236,
  10834. 126264,
  10835. 126320,
  10836. 126334,
  10837. 126338,
  10838. 126340,
  10839. 126344,
  10840. 126352,
  10841. 126366,
  10842. 126368,
  10843. 126412,
  10844. 126450,
  10845. 126452,
  10846. 126486,
  10847. 126502,
  10848. 126508,
  10849. 126522,
  10850. 126534,
  10851. 126540,
  10852. 126552,
  10853. 126574,
  10854. 126578,
  10855. 126580,
  10856. 126598,
  10857. 126604,
  10858. 126616,
  10859. 126640,
  10860. 126654,
  10861. 126670,
  10862. 126684,
  10863. 126690,
  10864. 126692,
  10865. 126696,
  10866. 126738,
  10867. 126754,
  10868. 126756,
  10869. 126760,
  10870. 126774,
  10871. 126786,
  10872. 126788,
  10873. 126792,
  10874. 126800,
  10875. 126814,
  10876. 126822,
  10877. 126828,
  10878. 126842,
  10879. 126894,
  10880. 126898,
  10881. 126900,
  10882. 126934,
  10883. 127126,
  10884. 127142,
  10885. 127148,
  10886. 127162,
  10887. 127178,
  10888. 127186,
  10889. 127188,
  10890. 127254,
  10891. 127270,
  10892. 127276,
  10893. 127290,
  10894. 127302,
  10895. 127308,
  10896. 127320,
  10897. 127342,
  10898. 127346,
  10899. 127348,
  10900. 127370,
  10901. 127378,
  10902. 127380,
  10903. 127394,
  10904. 127396,
  10905. 127400,
  10906. 127450,
  10907. 127510,
  10908. 127526,
  10909. 127532,
  10910. 127546,
  10911. 127558,
  10912. 127576,
  10913. 127598,
  10914. 127602,
  10915. 127604,
  10916. 127622,
  10917. 127628,
  10918. 127640,
  10919. 127664,
  10920. 127678,
  10921. 127694,
  10922. 127708,
  10923. 127714,
  10924. 127716,
  10925. 127720,
  10926. 127734,
  10927. 127754,
  10928. 127762,
  10929. 127764,
  10930. 127778,
  10931. 127784,
  10932. 127810,
  10933. 127812,
  10934. 127816,
  10935. 127824,
  10936. 127838,
  10937. 127846,
  10938. 127866,
  10939. 127898,
  10940. 127918,
  10941. 127922,
  10942. 127924,
  10943. 128022,
  10944. 128038,
  10945. 128044,
  10946. 128058,
  10947. 128070,
  10948. 128076,
  10949. 128088,
  10950. 128110,
  10951. 128114,
  10952. 128116,
  10953. 128134,
  10954. 128140,
  10955. 128152,
  10956. 128176,
  10957. 128190,
  10958. 128206,
  10959. 128220,
  10960. 128226,
  10961. 128228,
  10962. 128232,
  10963. 128246,
  10964. 128262,
  10965. 128268,
  10966. 128280,
  10967. 128304,
  10968. 128318,
  10969. 128352,
  10970. 128380,
  10971. 128398,
  10972. 128412,
  10973. 128440,
  10974. 128450,
  10975. 128452,
  10976. 128456,
  10977. 128464,
  10978. 128478,
  10979. 128486,
  10980. 128492,
  10981. 128506,
  10982. 128522,
  10983. 128530,
  10984. 128532,
  10985. 128546,
  10986. 128548,
  10987. 128552,
  10988. 128566,
  10989. 128578,
  10990. 128580,
  10991. 128584,
  10992. 128592,
  10993. 128606,
  10994. 128614,
  10995. 128634,
  10996. 128642,
  10997. 128644,
  10998. 128648,
  10999. 128656,
  11000. 128670,
  11001. 128672,
  11002. 128700,
  11003. 128716,
  11004. 128754,
  11005. 128756,
  11006. 128794,
  11007. 128814,
  11008. 128818,
  11009. 128820,
  11010. 128846,
  11011. 128860,
  11012. 128866,
  11013. 128868,
  11014. 128872,
  11015. 128886,
  11016. 128918,
  11017. 128934,
  11018. 128940,
  11019. 128954,
  11020. 128978,
  11021. 128980,
  11022. 129178,
  11023. 129198,
  11024. 129202,
  11025. 129204,
  11026. 129238,
  11027. 129258,
  11028. 129306,
  11029. 129326,
  11030. 129330,
  11031. 129332,
  11032. 129358,
  11033. 129372,
  11034. 129378,
  11035. 129380,
  11036. 129384,
  11037. 129398,
  11038. 129430,
  11039. 129446,
  11040. 129452,
  11041. 129466,
  11042. 129482,
  11043. 129490,
  11044. 129492,
  11045. 129562,
  11046. 129582,
  11047. 129586,
  11048. 129588,
  11049. 129614,
  11050. 129628,
  11051. 129634,
  11052. 129636,
  11053. 129640,
  11054. 129654,
  11055. 129678,
  11056. 129692,
  11057. 129720,
  11058. 129730,
  11059. 129732,
  11060. 129736,
  11061. 129744,
  11062. 129758,
  11063. 129766,
  11064. 129772,
  11065. 129814,
  11066. 129830,
  11067. 129836,
  11068. 129850,
  11069. 129862,
  11070. 129868,
  11071. 129880,
  11072. 129902,
  11073. 129906,
  11074. 129908,
  11075. 129930,
  11076. 129938,
  11077. 129940,
  11078. 129954,
  11079. 129956,
  11080. 129960,
  11081. 129974,
  11082. 130010
  11083. ])),
  11084. (be.CODEWORD_TABLE = Int32Array.from([
  11085. 2627,
  11086. 1819,
  11087. 2622,
  11088. 2621,
  11089. 1813,
  11090. 1812,
  11091. 2729,
  11092. 2724,
  11093. 2723,
  11094. 2779,
  11095. 2774,
  11096. 2773,
  11097. 902,
  11098. 896,
  11099. 908,
  11100. 868,
  11101. 865,
  11102. 861,
  11103. 859,
  11104. 2511,
  11105. 873,
  11106. 871,
  11107. 1780,
  11108. 835,
  11109. 2493,
  11110. 825,
  11111. 2491,
  11112. 842,
  11113. 837,
  11114. 844,
  11115. 1764,
  11116. 1762,
  11117. 811,
  11118. 810,
  11119. 809,
  11120. 2483,
  11121. 807,
  11122. 2482,
  11123. 806,
  11124. 2480,
  11125. 815,
  11126. 814,
  11127. 813,
  11128. 812,
  11129. 2484,
  11130. 817,
  11131. 816,
  11132. 1745,
  11133. 1744,
  11134. 1742,
  11135. 1746,
  11136. 2655,
  11137. 2637,
  11138. 2635,
  11139. 2626,
  11140. 2625,
  11141. 2623,
  11142. 2628,
  11143. 1820,
  11144. 2752,
  11145. 2739,
  11146. 2737,
  11147. 2728,
  11148. 2727,
  11149. 2725,
  11150. 2730,
  11151. 2785,
  11152. 2783,
  11153. 2778,
  11154. 2777,
  11155. 2775,
  11156. 2780,
  11157. 787,
  11158. 781,
  11159. 747,
  11160. 739,
  11161. 736,
  11162. 2413,
  11163. 754,
  11164. 752,
  11165. 1719,
  11166. 692,
  11167. 689,
  11168. 681,
  11169. 2371,
  11170. 678,
  11171. 2369,
  11172. 700,
  11173. 697,
  11174. 694,
  11175. 703,
  11176. 1688,
  11177. 1686,
  11178. 642,
  11179. 638,
  11180. 2343,
  11181. 631,
  11182. 2341,
  11183. 627,
  11184. 2338,
  11185. 651,
  11186. 646,
  11187. 643,
  11188. 2345,
  11189. 654,
  11190. 652,
  11191. 1652,
  11192. 1650,
  11193. 1647,
  11194. 1654,
  11195. 601,
  11196. 599,
  11197. 2322,
  11198. 596,
  11199. 2321,
  11200. 594,
  11201. 2319,
  11202. 2317,
  11203. 611,
  11204. 610,
  11205. 608,
  11206. 606,
  11207. 2324,
  11208. 603,
  11209. 2323,
  11210. 615,
  11211. 614,
  11212. 612,
  11213. 1617,
  11214. 1616,
  11215. 1614,
  11216. 1612,
  11217. 616,
  11218. 1619,
  11219. 1618,
  11220. 2575,
  11221. 2538,
  11222. 2536,
  11223. 905,
  11224. 901,
  11225. 898,
  11226. 909,
  11227. 2509,
  11228. 2507,
  11229. 2504,
  11230. 870,
  11231. 867,
  11232. 864,
  11233. 860,
  11234. 2512,
  11235. 875,
  11236. 872,
  11237. 1781,
  11238. 2490,
  11239. 2489,
  11240. 2487,
  11241. 2485,
  11242. 1748,
  11243. 836,
  11244. 834,
  11245. 832,
  11246. 830,
  11247. 2494,
  11248. 827,
  11249. 2492,
  11250. 843,
  11251. 841,
  11252. 839,
  11253. 845,
  11254. 1765,
  11255. 1763,
  11256. 2701,
  11257. 2676,
  11258. 2674,
  11259. 2653,
  11260. 2648,
  11261. 2656,
  11262. 2634,
  11263. 2633,
  11264. 2631,
  11265. 2629,
  11266. 1821,
  11267. 2638,
  11268. 2636,
  11269. 2770,
  11270. 2763,
  11271. 2761,
  11272. 2750,
  11273. 2745,
  11274. 2753,
  11275. 2736,
  11276. 2735,
  11277. 2733,
  11278. 2731,
  11279. 1848,
  11280. 2740,
  11281. 2738,
  11282. 2786,
  11283. 2784,
  11284. 591,
  11285. 588,
  11286. 576,
  11287. 569,
  11288. 566,
  11289. 2296,
  11290. 1590,
  11291. 537,
  11292. 534,
  11293. 526,
  11294. 2276,
  11295. 522,
  11296. 2274,
  11297. 545,
  11298. 542,
  11299. 539,
  11300. 548,
  11301. 1572,
  11302. 1570,
  11303. 481,
  11304. 2245,
  11305. 466,
  11306. 2242,
  11307. 462,
  11308. 2239,
  11309. 492,
  11310. 485,
  11311. 482,
  11312. 2249,
  11313. 496,
  11314. 494,
  11315. 1534,
  11316. 1531,
  11317. 1528,
  11318. 1538,
  11319. 413,
  11320. 2196,
  11321. 406,
  11322. 2191,
  11323. 2188,
  11324. 425,
  11325. 419,
  11326. 2202,
  11327. 415,
  11328. 2199,
  11329. 432,
  11330. 430,
  11331. 427,
  11332. 1472,
  11333. 1467,
  11334. 1464,
  11335. 433,
  11336. 1476,
  11337. 1474,
  11338. 368,
  11339. 367,
  11340. 2160,
  11341. 365,
  11342. 2159,
  11343. 362,
  11344. 2157,
  11345. 2155,
  11346. 2152,
  11347. 378,
  11348. 377,
  11349. 375,
  11350. 2166,
  11351. 372,
  11352. 2165,
  11353. 369,
  11354. 2162,
  11355. 383,
  11356. 381,
  11357. 379,
  11358. 2168,
  11359. 1419,
  11360. 1418,
  11361. 1416,
  11362. 1414,
  11363. 385,
  11364. 1411,
  11365. 384,
  11366. 1423,
  11367. 1422,
  11368. 1420,
  11369. 1424,
  11370. 2461,
  11371. 802,
  11372. 2441,
  11373. 2439,
  11374. 790,
  11375. 786,
  11376. 783,
  11377. 794,
  11378. 2409,
  11379. 2406,
  11380. 2403,
  11381. 750,
  11382. 742,
  11383. 738,
  11384. 2414,
  11385. 756,
  11386. 753,
  11387. 1720,
  11388. 2367,
  11389. 2365,
  11390. 2362,
  11391. 2359,
  11392. 1663,
  11393. 693,
  11394. 691,
  11395. 684,
  11396. 2373,
  11397. 680,
  11398. 2370,
  11399. 702,
  11400. 699,
  11401. 696,
  11402. 704,
  11403. 1690,
  11404. 1687,
  11405. 2337,
  11406. 2336,
  11407. 2334,
  11408. 2332,
  11409. 1624,
  11410. 2329,
  11411. 1622,
  11412. 640,
  11413. 637,
  11414. 2344,
  11415. 634,
  11416. 2342,
  11417. 630,
  11418. 2340,
  11419. 650,
  11420. 648,
  11421. 645,
  11422. 2346,
  11423. 655,
  11424. 653,
  11425. 1653,
  11426. 1651,
  11427. 1649,
  11428. 1655,
  11429. 2612,
  11430. 2597,
  11431. 2595,
  11432. 2571,
  11433. 2568,
  11434. 2565,
  11435. 2576,
  11436. 2534,
  11437. 2529,
  11438. 2526,
  11439. 1787,
  11440. 2540,
  11441. 2537,
  11442. 907,
  11443. 904,
  11444. 900,
  11445. 910,
  11446. 2503,
  11447. 2502,
  11448. 2500,
  11449. 2498,
  11450. 1768,
  11451. 2495,
  11452. 1767,
  11453. 2510,
  11454. 2508,
  11455. 2506,
  11456. 869,
  11457. 866,
  11458. 863,
  11459. 2513,
  11460. 876,
  11461. 874,
  11462. 1782,
  11463. 2720,
  11464. 2713,
  11465. 2711,
  11466. 2697,
  11467. 2694,
  11468. 2691,
  11469. 2702,
  11470. 2672,
  11471. 2670,
  11472. 2664,
  11473. 1828,
  11474. 2678,
  11475. 2675,
  11476. 2647,
  11477. 2646,
  11478. 2644,
  11479. 2642,
  11480. 1823,
  11481. 2639,
  11482. 1822,
  11483. 2654,
  11484. 2652,
  11485. 2650,
  11486. 2657,
  11487. 2771,
  11488. 1855,
  11489. 2765,
  11490. 2762,
  11491. 1850,
  11492. 1849,
  11493. 2751,
  11494. 2749,
  11495. 2747,
  11496. 2754,
  11497. 353,
  11498. 2148,
  11499. 344,
  11500. 342,
  11501. 336,
  11502. 2142,
  11503. 332,
  11504. 2140,
  11505. 345,
  11506. 1375,
  11507. 1373,
  11508. 306,
  11509. 2130,
  11510. 299,
  11511. 2128,
  11512. 295,
  11513. 2125,
  11514. 319,
  11515. 314,
  11516. 311,
  11517. 2132,
  11518. 1354,
  11519. 1352,
  11520. 1349,
  11521. 1356,
  11522. 262,
  11523. 257,
  11524. 2101,
  11525. 253,
  11526. 2096,
  11527. 2093,
  11528. 274,
  11529. 273,
  11530. 267,
  11531. 2107,
  11532. 263,
  11533. 2104,
  11534. 280,
  11535. 278,
  11536. 275,
  11537. 1316,
  11538. 1311,
  11539. 1308,
  11540. 1320,
  11541. 1318,
  11542. 2052,
  11543. 202,
  11544. 2050,
  11545. 2044,
  11546. 2040,
  11547. 219,
  11548. 2063,
  11549. 212,
  11550. 2060,
  11551. 208,
  11552. 2055,
  11553. 224,
  11554. 221,
  11555. 2066,
  11556. 1260,
  11557. 1258,
  11558. 1252,
  11559. 231,
  11560. 1248,
  11561. 229,
  11562. 1266,
  11563. 1264,
  11564. 1261,
  11565. 1268,
  11566. 155,
  11567. 1998,
  11568. 153,
  11569. 1996,
  11570. 1994,
  11571. 1991,
  11572. 1988,
  11573. 165,
  11574. 164,
  11575. 2007,
  11576. 162,
  11577. 2006,
  11578. 159,
  11579. 2003,
  11580. 2e3,
  11581. 172,
  11582. 171,
  11583. 169,
  11584. 2012,
  11585. 166,
  11586. 2010,
  11587. 1186,
  11588. 1184,
  11589. 1182,
  11590. 1179,
  11591. 175,
  11592. 1176,
  11593. 173,
  11594. 1192,
  11595. 1191,
  11596. 1189,
  11597. 1187,
  11598. 176,
  11599. 1194,
  11600. 1193,
  11601. 2313,
  11602. 2307,
  11603. 2305,
  11604. 592,
  11605. 589,
  11606. 2294,
  11607. 2292,
  11608. 2289,
  11609. 578,
  11610. 572,
  11611. 568,
  11612. 2297,
  11613. 580,
  11614. 1591,
  11615. 2272,
  11616. 2267,
  11617. 2264,
  11618. 1547,
  11619. 538,
  11620. 536,
  11621. 529,
  11622. 2278,
  11623. 525,
  11624. 2275,
  11625. 547,
  11626. 544,
  11627. 541,
  11628. 1574,
  11629. 1571,
  11630. 2237,
  11631. 2235,
  11632. 2229,
  11633. 1493,
  11634. 2225,
  11635. 1489,
  11636. 478,
  11637. 2247,
  11638. 470,
  11639. 2244,
  11640. 465,
  11641. 2241,
  11642. 493,
  11643. 488,
  11644. 484,
  11645. 2250,
  11646. 498,
  11647. 495,
  11648. 1536,
  11649. 1533,
  11650. 1530,
  11651. 1539,
  11652. 2187,
  11653. 2186,
  11654. 2184,
  11655. 2182,
  11656. 1432,
  11657. 2179,
  11658. 1430,
  11659. 2176,
  11660. 1427,
  11661. 414,
  11662. 412,
  11663. 2197,
  11664. 409,
  11665. 2195,
  11666. 405,
  11667. 2193,
  11668. 2190,
  11669. 426,
  11670. 424,
  11671. 421,
  11672. 2203,
  11673. 418,
  11674. 2201,
  11675. 431,
  11676. 429,
  11677. 1473,
  11678. 1471,
  11679. 1469,
  11680. 1466,
  11681. 434,
  11682. 1477,
  11683. 1475,
  11684. 2478,
  11685. 2472,
  11686. 2470,
  11687. 2459,
  11688. 2457,
  11689. 2454,
  11690. 2462,
  11691. 803,
  11692. 2437,
  11693. 2432,
  11694. 2429,
  11695. 1726,
  11696. 2443,
  11697. 2440,
  11698. 792,
  11699. 789,
  11700. 785,
  11701. 2401,
  11702. 2399,
  11703. 2393,
  11704. 1702,
  11705. 2389,
  11706. 1699,
  11707. 2411,
  11708. 2408,
  11709. 2405,
  11710. 745,
  11711. 741,
  11712. 2415,
  11713. 758,
  11714. 755,
  11715. 1721,
  11716. 2358,
  11717. 2357,
  11718. 2355,
  11719. 2353,
  11720. 1661,
  11721. 2350,
  11722. 1660,
  11723. 2347,
  11724. 1657,
  11725. 2368,
  11726. 2366,
  11727. 2364,
  11728. 2361,
  11729. 1666,
  11730. 690,
  11731. 687,
  11732. 2374,
  11733. 683,
  11734. 2372,
  11735. 701,
  11736. 698,
  11737. 705,
  11738. 1691,
  11739. 1689,
  11740. 2619,
  11741. 2617,
  11742. 2610,
  11743. 2608,
  11744. 2605,
  11745. 2613,
  11746. 2593,
  11747. 2588,
  11748. 2585,
  11749. 1803,
  11750. 2599,
  11751. 2596,
  11752. 2563,
  11753. 2561,
  11754. 2555,
  11755. 1797,
  11756. 2551,
  11757. 1795,
  11758. 2573,
  11759. 2570,
  11760. 2567,
  11761. 2577,
  11762. 2525,
  11763. 2524,
  11764. 2522,
  11765. 2520,
  11766. 1786,
  11767. 2517,
  11768. 1785,
  11769. 2514,
  11770. 1783,
  11771. 2535,
  11772. 2533,
  11773. 2531,
  11774. 2528,
  11775. 1788,
  11776. 2541,
  11777. 2539,
  11778. 906,
  11779. 903,
  11780. 911,
  11781. 2721,
  11782. 1844,
  11783. 2715,
  11784. 2712,
  11785. 1838,
  11786. 1836,
  11787. 2699,
  11788. 2696,
  11789. 2693,
  11790. 2703,
  11791. 1827,
  11792. 1826,
  11793. 1824,
  11794. 2673,
  11795. 2671,
  11796. 2669,
  11797. 2666,
  11798. 1829,
  11799. 2679,
  11800. 2677,
  11801. 1858,
  11802. 1857,
  11803. 2772,
  11804. 1854,
  11805. 1853,
  11806. 1851,
  11807. 1856,
  11808. 2766,
  11809. 2764,
  11810. 143,
  11811. 1987,
  11812. 139,
  11813. 1986,
  11814. 135,
  11815. 133,
  11816. 131,
  11817. 1984,
  11818. 128,
  11819. 1983,
  11820. 125,
  11821. 1981,
  11822. 138,
  11823. 137,
  11824. 136,
  11825. 1985,
  11826. 1133,
  11827. 1132,
  11828. 1130,
  11829. 112,
  11830. 110,
  11831. 1974,
  11832. 107,
  11833. 1973,
  11834. 104,
  11835. 1971,
  11836. 1969,
  11837. 122,
  11838. 121,
  11839. 119,
  11840. 117,
  11841. 1977,
  11842. 114,
  11843. 1976,
  11844. 124,
  11845. 1115,
  11846. 1114,
  11847. 1112,
  11848. 1110,
  11849. 1117,
  11850. 1116,
  11851. 84,
  11852. 83,
  11853. 1953,
  11854. 81,
  11855. 1952,
  11856. 78,
  11857. 1950,
  11858. 1948,
  11859. 1945,
  11860. 94,
  11861. 93,
  11862. 91,
  11863. 1959,
  11864. 88,
  11865. 1958,
  11866. 85,
  11867. 1955,
  11868. 99,
  11869. 97,
  11870. 95,
  11871. 1961,
  11872. 1086,
  11873. 1085,
  11874. 1083,
  11875. 1081,
  11876. 1078,
  11877. 100,
  11878. 1090,
  11879. 1089,
  11880. 1087,
  11881. 1091,
  11882. 49,
  11883. 47,
  11884. 1917,
  11885. 44,
  11886. 1915,
  11887. 1913,
  11888. 1910,
  11889. 1907,
  11890. 59,
  11891. 1926,
  11892. 56,
  11893. 1925,
  11894. 53,
  11895. 1922,
  11896. 1919,
  11897. 66,
  11898. 64,
  11899. 1931,
  11900. 61,
  11901. 1929,
  11902. 1042,
  11903. 1040,
  11904. 1038,
  11905. 71,
  11906. 1035,
  11907. 70,
  11908. 1032,
  11909. 68,
  11910. 1048,
  11911. 1047,
  11912. 1045,
  11913. 1043,
  11914. 1050,
  11915. 1049,
  11916. 12,
  11917. 10,
  11918. 1869,
  11919. 1867,
  11920. 1864,
  11921. 1861,
  11922. 21,
  11923. 1880,
  11924. 19,
  11925. 1877,
  11926. 1874,
  11927. 1871,
  11928. 28,
  11929. 1888,
  11930. 25,
  11931. 1886,
  11932. 22,
  11933. 1883,
  11934. 982,
  11935. 980,
  11936. 977,
  11937. 974,
  11938. 32,
  11939. 30,
  11940. 991,
  11941. 989,
  11942. 987,
  11943. 984,
  11944. 34,
  11945. 995,
  11946. 994,
  11947. 992,
  11948. 2151,
  11949. 2150,
  11950. 2147,
  11951. 2146,
  11952. 2144,
  11953. 356,
  11954. 355,
  11955. 354,
  11956. 2149,
  11957. 2139,
  11958. 2138,
  11959. 2136,
  11960. 2134,
  11961. 1359,
  11962. 343,
  11963. 341,
  11964. 338,
  11965. 2143,
  11966. 335,
  11967. 2141,
  11968. 348,
  11969. 347,
  11970. 346,
  11971. 1376,
  11972. 1374,
  11973. 2124,
  11974. 2123,
  11975. 2121,
  11976. 2119,
  11977. 1326,
  11978. 2116,
  11979. 1324,
  11980. 310,
  11981. 308,
  11982. 305,
  11983. 2131,
  11984. 302,
  11985. 2129,
  11986. 298,
  11987. 2127,
  11988. 320,
  11989. 318,
  11990. 316,
  11991. 313,
  11992. 2133,
  11993. 322,
  11994. 321,
  11995. 1355,
  11996. 1353,
  11997. 1351,
  11998. 1357,
  11999. 2092,
  12000. 2091,
  12001. 2089,
  12002. 2087,
  12003. 1276,
  12004. 2084,
  12005. 1274,
  12006. 2081,
  12007. 1271,
  12008. 259,
  12009. 2102,
  12010. 256,
  12011. 2100,
  12012. 252,
  12013. 2098,
  12014. 2095,
  12015. 272,
  12016. 269,
  12017. 2108,
  12018. 266,
  12019. 2106,
  12020. 281,
  12021. 279,
  12022. 277,
  12023. 1317,
  12024. 1315,
  12025. 1313,
  12026. 1310,
  12027. 282,
  12028. 1321,
  12029. 1319,
  12030. 2039,
  12031. 2037,
  12032. 2035,
  12033. 2032,
  12034. 1203,
  12035. 2029,
  12036. 1200,
  12037. 1197,
  12038. 207,
  12039. 2053,
  12040. 205,
  12041. 2051,
  12042. 201,
  12043. 2049,
  12044. 2046,
  12045. 2043,
  12046. 220,
  12047. 218,
  12048. 2064,
  12049. 215,
  12050. 2062,
  12051. 211,
  12052. 2059,
  12053. 228,
  12054. 226,
  12055. 223,
  12056. 2069,
  12057. 1259,
  12058. 1257,
  12059. 1254,
  12060. 232,
  12061. 1251,
  12062. 230,
  12063. 1267,
  12064. 1265,
  12065. 1263,
  12066. 2316,
  12067. 2315,
  12068. 2312,
  12069. 2311,
  12070. 2309,
  12071. 2314,
  12072. 2304,
  12073. 2303,
  12074. 2301,
  12075. 2299,
  12076. 1593,
  12077. 2308,
  12078. 2306,
  12079. 590,
  12080. 2288,
  12081. 2287,
  12082. 2285,
  12083. 2283,
  12084. 1578,
  12085. 2280,
  12086. 1577,
  12087. 2295,
  12088. 2293,
  12089. 2291,
  12090. 579,
  12091. 577,
  12092. 574,
  12093. 571,
  12094. 2298,
  12095. 582,
  12096. 581,
  12097. 1592,
  12098. 2263,
  12099. 2262,
  12100. 2260,
  12101. 2258,
  12102. 1545,
  12103. 2255,
  12104. 1544,
  12105. 2252,
  12106. 1541,
  12107. 2273,
  12108. 2271,
  12109. 2269,
  12110. 2266,
  12111. 1550,
  12112. 535,
  12113. 532,
  12114. 2279,
  12115. 528,
  12116. 2277,
  12117. 546,
  12118. 543,
  12119. 549,
  12120. 1575,
  12121. 1573,
  12122. 2224,
  12123. 2222,
  12124. 2220,
  12125. 1486,
  12126. 2217,
  12127. 1485,
  12128. 2214,
  12129. 1482,
  12130. 1479,
  12131. 2238,
  12132. 2236,
  12133. 2234,
  12134. 2231,
  12135. 1496,
  12136. 2228,
  12137. 1492,
  12138. 480,
  12139. 477,
  12140. 2248,
  12141. 473,
  12142. 2246,
  12143. 469,
  12144. 2243,
  12145. 490,
  12146. 487,
  12147. 2251,
  12148. 497,
  12149. 1537,
  12150. 1535,
  12151. 1532,
  12152. 2477,
  12153. 2476,
  12154. 2474,
  12155. 2479,
  12156. 2469,
  12157. 2468,
  12158. 2466,
  12159. 2464,
  12160. 1730,
  12161. 2473,
  12162. 2471,
  12163. 2453,
  12164. 2452,
  12165. 2450,
  12166. 2448,
  12167. 1729,
  12168. 2445,
  12169. 1728,
  12170. 2460,
  12171. 2458,
  12172. 2456,
  12173. 2463,
  12174. 805,
  12175. 804,
  12176. 2428,
  12177. 2427,
  12178. 2425,
  12179. 2423,
  12180. 1725,
  12181. 2420,
  12182. 1724,
  12183. 2417,
  12184. 1722,
  12185. 2438,
  12186. 2436,
  12187. 2434,
  12188. 2431,
  12189. 1727,
  12190. 2444,
  12191. 2442,
  12192. 793,
  12193. 791,
  12194. 788,
  12195. 795,
  12196. 2388,
  12197. 2386,
  12198. 2384,
  12199. 1697,
  12200. 2381,
  12201. 1696,
  12202. 2378,
  12203. 1694,
  12204. 1692,
  12205. 2402,
  12206. 2400,
  12207. 2398,
  12208. 2395,
  12209. 1703,
  12210. 2392,
  12211. 1701,
  12212. 2412,
  12213. 2410,
  12214. 2407,
  12215. 751,
  12216. 748,
  12217. 744,
  12218. 2416,
  12219. 759,
  12220. 757,
  12221. 1807,
  12222. 2620,
  12223. 2618,
  12224. 1806,
  12225. 1805,
  12226. 2611,
  12227. 2609,
  12228. 2607,
  12229. 2614,
  12230. 1802,
  12231. 1801,
  12232. 1799,
  12233. 2594,
  12234. 2592,
  12235. 2590,
  12236. 2587,
  12237. 1804,
  12238. 2600,
  12239. 2598,
  12240. 1794,
  12241. 1793,
  12242. 1791,
  12243. 1789,
  12244. 2564,
  12245. 2562,
  12246. 2560,
  12247. 2557,
  12248. 1798,
  12249. 2554,
  12250. 1796,
  12251. 2574,
  12252. 2572,
  12253. 2569,
  12254. 2578,
  12255. 1847,
  12256. 1846,
  12257. 2722,
  12258. 1843,
  12259. 1842,
  12260. 1840,
  12261. 1845,
  12262. 2716,
  12263. 2714,
  12264. 1835,
  12265. 1834,
  12266. 1832,
  12267. 1830,
  12268. 1839,
  12269. 1837,
  12270. 2700,
  12271. 2698,
  12272. 2695,
  12273. 2704,
  12274. 1817,
  12275. 1811,
  12276. 1810,
  12277. 897,
  12278. 862,
  12279. 1777,
  12280. 829,
  12281. 826,
  12282. 838,
  12283. 1760,
  12284. 1758,
  12285. 808,
  12286. 2481,
  12287. 1741,
  12288. 1740,
  12289. 1738,
  12290. 1743,
  12291. 2624,
  12292. 1818,
  12293. 2726,
  12294. 2776,
  12295. 782,
  12296. 740,
  12297. 737,
  12298. 1715,
  12299. 686,
  12300. 679,
  12301. 695,
  12302. 1682,
  12303. 1680,
  12304. 639,
  12305. 628,
  12306. 2339,
  12307. 647,
  12308. 644,
  12309. 1645,
  12310. 1643,
  12311. 1640,
  12312. 1648,
  12313. 602,
  12314. 600,
  12315. 597,
  12316. 595,
  12317. 2320,
  12318. 593,
  12319. 2318,
  12320. 609,
  12321. 607,
  12322. 604,
  12323. 1611,
  12324. 1610,
  12325. 1608,
  12326. 1606,
  12327. 613,
  12328. 1615,
  12329. 1613,
  12330. 2328,
  12331. 926,
  12332. 924,
  12333. 892,
  12334. 886,
  12335. 899,
  12336. 857,
  12337. 850,
  12338. 2505,
  12339. 1778,
  12340. 824,
  12341. 823,
  12342. 821,
  12343. 819,
  12344. 2488,
  12345. 818,
  12346. 2486,
  12347. 833,
  12348. 831,
  12349. 828,
  12350. 840,
  12351. 1761,
  12352. 1759,
  12353. 2649,
  12354. 2632,
  12355. 2630,
  12356. 2746,
  12357. 2734,
  12358. 2732,
  12359. 2782,
  12360. 2781,
  12361. 570,
  12362. 567,
  12363. 1587,
  12364. 531,
  12365. 527,
  12366. 523,
  12367. 540,
  12368. 1566,
  12369. 1564,
  12370. 476,
  12371. 467,
  12372. 463,
  12373. 2240,
  12374. 486,
  12375. 483,
  12376. 1524,
  12377. 1521,
  12378. 1518,
  12379. 1529,
  12380. 411,
  12381. 403,
  12382. 2192,
  12383. 399,
  12384. 2189,
  12385. 423,
  12386. 416,
  12387. 1462,
  12388. 1457,
  12389. 1454,
  12390. 428,
  12391. 1468,
  12392. 1465,
  12393. 2210,
  12394. 366,
  12395. 363,
  12396. 2158,
  12397. 360,
  12398. 2156,
  12399. 357,
  12400. 2153,
  12401. 376,
  12402. 373,
  12403. 370,
  12404. 2163,
  12405. 1410,
  12406. 1409,
  12407. 1407,
  12408. 1405,
  12409. 382,
  12410. 1402,
  12411. 380,
  12412. 1417,
  12413. 1415,
  12414. 1412,
  12415. 1421,
  12416. 2175,
  12417. 2174,
  12418. 777,
  12419. 774,
  12420. 771,
  12421. 784,
  12422. 732,
  12423. 725,
  12424. 722,
  12425. 2404,
  12426. 743,
  12427. 1716,
  12428. 676,
  12429. 674,
  12430. 668,
  12431. 2363,
  12432. 665,
  12433. 2360,
  12434. 685,
  12435. 1684,
  12436. 1681,
  12437. 626,
  12438. 624,
  12439. 622,
  12440. 2335,
  12441. 620,
  12442. 2333,
  12443. 617,
  12444. 2330,
  12445. 641,
  12446. 635,
  12447. 649,
  12448. 1646,
  12449. 1644,
  12450. 1642,
  12451. 2566,
  12452. 928,
  12453. 925,
  12454. 2530,
  12455. 2527,
  12456. 894,
  12457. 891,
  12458. 888,
  12459. 2501,
  12460. 2499,
  12461. 2496,
  12462. 858,
  12463. 856,
  12464. 854,
  12465. 851,
  12466. 1779,
  12467. 2692,
  12468. 2668,
  12469. 2665,
  12470. 2645,
  12471. 2643,
  12472. 2640,
  12473. 2651,
  12474. 2768,
  12475. 2759,
  12476. 2757,
  12477. 2744,
  12478. 2743,
  12479. 2741,
  12480. 2748,
  12481. 352,
  12482. 1382,
  12483. 340,
  12484. 337,
  12485. 333,
  12486. 1371,
  12487. 1369,
  12488. 307,
  12489. 300,
  12490. 296,
  12491. 2126,
  12492. 315,
  12493. 312,
  12494. 1347,
  12495. 1342,
  12496. 1350,
  12497. 261,
  12498. 258,
  12499. 250,
  12500. 2097,
  12501. 246,
  12502. 2094,
  12503. 271,
  12504. 268,
  12505. 264,
  12506. 1306,
  12507. 1301,
  12508. 1298,
  12509. 276,
  12510. 1312,
  12511. 1309,
  12512. 2115,
  12513. 203,
  12514. 2048,
  12515. 195,
  12516. 2045,
  12517. 191,
  12518. 2041,
  12519. 213,
  12520. 209,
  12521. 2056,
  12522. 1246,
  12523. 1244,
  12524. 1238,
  12525. 225,
  12526. 1234,
  12527. 222,
  12528. 1256,
  12529. 1253,
  12530. 1249,
  12531. 1262,
  12532. 2080,
  12533. 2079,
  12534. 154,
  12535. 1997,
  12536. 150,
  12537. 1995,
  12538. 147,
  12539. 1992,
  12540. 1989,
  12541. 163,
  12542. 160,
  12543. 2004,
  12544. 156,
  12545. 2001,
  12546. 1175,
  12547. 1174,
  12548. 1172,
  12549. 1170,
  12550. 1167,
  12551. 170,
  12552. 1164,
  12553. 167,
  12554. 1185,
  12555. 1183,
  12556. 1180,
  12557. 1177,
  12558. 174,
  12559. 1190,
  12560. 1188,
  12561. 2025,
  12562. 2024,
  12563. 2022,
  12564. 587,
  12565. 586,
  12566. 564,
  12567. 559,
  12568. 556,
  12569. 2290,
  12570. 573,
  12571. 1588,
  12572. 520,
  12573. 518,
  12574. 512,
  12575. 2268,
  12576. 508,
  12577. 2265,
  12578. 530,
  12579. 1568,
  12580. 1565,
  12581. 461,
  12582. 457,
  12583. 2233,
  12584. 450,
  12585. 2230,
  12586. 446,
  12587. 2226,
  12588. 479,
  12589. 471,
  12590. 489,
  12591. 1526,
  12592. 1523,
  12593. 1520,
  12594. 397,
  12595. 395,
  12596. 2185,
  12597. 392,
  12598. 2183,
  12599. 389,
  12600. 2180,
  12601. 2177,
  12602. 410,
  12603. 2194,
  12604. 402,
  12605. 422,
  12606. 1463,
  12607. 1461,
  12608. 1459,
  12609. 1456,
  12610. 1470,
  12611. 2455,
  12612. 799,
  12613. 2433,
  12614. 2430,
  12615. 779,
  12616. 776,
  12617. 773,
  12618. 2397,
  12619. 2394,
  12620. 2390,
  12621. 734,
  12622. 728,
  12623. 724,
  12624. 746,
  12625. 1717,
  12626. 2356,
  12627. 2354,
  12628. 2351,
  12629. 2348,
  12630. 1658,
  12631. 677,
  12632. 675,
  12633. 673,
  12634. 670,
  12635. 667,
  12636. 688,
  12637. 1685,
  12638. 1683,
  12639. 2606,
  12640. 2589,
  12641. 2586,
  12642. 2559,
  12643. 2556,
  12644. 2552,
  12645. 927,
  12646. 2523,
  12647. 2521,
  12648. 2518,
  12649. 2515,
  12650. 1784,
  12651. 2532,
  12652. 895,
  12653. 893,
  12654. 890,
  12655. 2718,
  12656. 2709,
  12657. 2707,
  12658. 2689,
  12659. 2687,
  12660. 2684,
  12661. 2663,
  12662. 2662,
  12663. 2660,
  12664. 2658,
  12665. 1825,
  12666. 2667,
  12667. 2769,
  12668. 1852,
  12669. 2760,
  12670. 2758,
  12671. 142,
  12672. 141,
  12673. 1139,
  12674. 1138,
  12675. 134,
  12676. 132,
  12677. 129,
  12678. 126,
  12679. 1982,
  12680. 1129,
  12681. 1128,
  12682. 1126,
  12683. 1131,
  12684. 113,
  12685. 111,
  12686. 108,
  12687. 105,
  12688. 1972,
  12689. 101,
  12690. 1970,
  12691. 120,
  12692. 118,
  12693. 115,
  12694. 1109,
  12695. 1108,
  12696. 1106,
  12697. 1104,
  12698. 123,
  12699. 1113,
  12700. 1111,
  12701. 82,
  12702. 79,
  12703. 1951,
  12704. 75,
  12705. 1949,
  12706. 72,
  12707. 1946,
  12708. 92,
  12709. 89,
  12710. 86,
  12711. 1956,
  12712. 1077,
  12713. 1076,
  12714. 1074,
  12715. 1072,
  12716. 98,
  12717. 1069,
  12718. 96,
  12719. 1084,
  12720. 1082,
  12721. 1079,
  12722. 1088,
  12723. 1968,
  12724. 1967,
  12725. 48,
  12726. 45,
  12727. 1916,
  12728. 42,
  12729. 1914,
  12730. 39,
  12731. 1911,
  12732. 1908,
  12733. 60,
  12734. 57,
  12735. 54,
  12736. 1923,
  12737. 50,
  12738. 1920,
  12739. 1031,
  12740. 1030,
  12741. 1028,
  12742. 1026,
  12743. 67,
  12744. 1023,
  12745. 65,
  12746. 1020,
  12747. 62,
  12748. 1041,
  12749. 1039,
  12750. 1036,
  12751. 1033,
  12752. 69,
  12753. 1046,
  12754. 1044,
  12755. 1944,
  12756. 1943,
  12757. 1941,
  12758. 11,
  12759. 9,
  12760. 1868,
  12761. 7,
  12762. 1865,
  12763. 1862,
  12764. 1859,
  12765. 20,
  12766. 1878,
  12767. 16,
  12768. 1875,
  12769. 13,
  12770. 1872,
  12771. 970,
  12772. 968,
  12773. 966,
  12774. 963,
  12775. 29,
  12776. 960,
  12777. 26,
  12778. 23,
  12779. 983,
  12780. 981,
  12781. 978,
  12782. 975,
  12783. 33,
  12784. 971,
  12785. 31,
  12786. 990,
  12787. 988,
  12788. 985,
  12789. 1906,
  12790. 1904,
  12791. 1902,
  12792. 993,
  12793. 351,
  12794. 2145,
  12795. 1383,
  12796. 331,
  12797. 330,
  12798. 328,
  12799. 326,
  12800. 2137,
  12801. 323,
  12802. 2135,
  12803. 339,
  12804. 1372,
  12805. 1370,
  12806. 294,
  12807. 293,
  12808. 291,
  12809. 289,
  12810. 2122,
  12811. 286,
  12812. 2120,
  12813. 283,
  12814. 2117,
  12815. 309,
  12816. 303,
  12817. 317,
  12818. 1348,
  12819. 1346,
  12820. 1344,
  12821. 245,
  12822. 244,
  12823. 242,
  12824. 2090,
  12825. 239,
  12826. 2088,
  12827. 236,
  12828. 2085,
  12829. 2082,
  12830. 260,
  12831. 2099,
  12832. 249,
  12833. 270,
  12834. 1307,
  12835. 1305,
  12836. 1303,
  12837. 1300,
  12838. 1314,
  12839. 189,
  12840. 2038,
  12841. 186,
  12842. 2036,
  12843. 183,
  12844. 2033,
  12845. 2030,
  12846. 2026,
  12847. 206,
  12848. 198,
  12849. 2047,
  12850. 194,
  12851. 216,
  12852. 1247,
  12853. 1245,
  12854. 1243,
  12855. 1240,
  12856. 227,
  12857. 1237,
  12858. 1255,
  12859. 2310,
  12860. 2302,
  12861. 2300,
  12862. 2286,
  12863. 2284,
  12864. 2281,
  12865. 565,
  12866. 563,
  12867. 561,
  12868. 558,
  12869. 575,
  12870. 1589,
  12871. 2261,
  12872. 2259,
  12873. 2256,
  12874. 2253,
  12875. 1542,
  12876. 521,
  12877. 519,
  12878. 517,
  12879. 514,
  12880. 2270,
  12881. 511,
  12882. 533,
  12883. 1569,
  12884. 1567,
  12885. 2223,
  12886. 2221,
  12887. 2218,
  12888. 2215,
  12889. 1483,
  12890. 2211,
  12891. 1480,
  12892. 459,
  12893. 456,
  12894. 453,
  12895. 2232,
  12896. 449,
  12897. 474,
  12898. 491,
  12899. 1527,
  12900. 1525,
  12901. 1522,
  12902. 2475,
  12903. 2467,
  12904. 2465,
  12905. 2451,
  12906. 2449,
  12907. 2446,
  12908. 801,
  12909. 800,
  12910. 2426,
  12911. 2424,
  12912. 2421,
  12913. 2418,
  12914. 1723,
  12915. 2435,
  12916. 780,
  12917. 778,
  12918. 775,
  12919. 2387,
  12920. 2385,
  12921. 2382,
  12922. 2379,
  12923. 1695,
  12924. 2375,
  12925. 1693,
  12926. 2396,
  12927. 735,
  12928. 733,
  12929. 730,
  12930. 727,
  12931. 749,
  12932. 1718,
  12933. 2616,
  12934. 2615,
  12935. 2604,
  12936. 2603,
  12937. 2601,
  12938. 2584,
  12939. 2583,
  12940. 2581,
  12941. 2579,
  12942. 1800,
  12943. 2591,
  12944. 2550,
  12945. 2549,
  12946. 2547,
  12947. 2545,
  12948. 1792,
  12949. 2542,
  12950. 1790,
  12951. 2558,
  12952. 929,
  12953. 2719,
  12954. 1841,
  12955. 2710,
  12956. 2708,
  12957. 1833,
  12958. 1831,
  12959. 2690,
  12960. 2688,
  12961. 2686,
  12962. 1815,
  12963. 1809,
  12964. 1808,
  12965. 1774,
  12966. 1756,
  12967. 1754,
  12968. 1737,
  12969. 1736,
  12970. 1734,
  12971. 1739,
  12972. 1816,
  12973. 1711,
  12974. 1676,
  12975. 1674,
  12976. 633,
  12977. 629,
  12978. 1638,
  12979. 1636,
  12980. 1633,
  12981. 1641,
  12982. 598,
  12983. 1605,
  12984. 1604,
  12985. 1602,
  12986. 1600,
  12987. 605,
  12988. 1609,
  12989. 1607,
  12990. 2327,
  12991. 887,
  12992. 853,
  12993. 1775,
  12994. 822,
  12995. 820,
  12996. 1757,
  12997. 1755,
  12998. 1584,
  12999. 524,
  13000. 1560,
  13001. 1558,
  13002. 468,
  13003. 464,
  13004. 1514,
  13005. 1511,
  13006. 1508,
  13007. 1519,
  13008. 408,
  13009. 404,
  13010. 400,
  13011. 1452,
  13012. 1447,
  13013. 1444,
  13014. 417,
  13015. 1458,
  13016. 1455,
  13017. 2208,
  13018. 364,
  13019. 361,
  13020. 358,
  13021. 2154,
  13022. 1401,
  13023. 1400,
  13024. 1398,
  13025. 1396,
  13026. 374,
  13027. 1393,
  13028. 371,
  13029. 1408,
  13030. 1406,
  13031. 1403,
  13032. 1413,
  13033. 2173,
  13034. 2172,
  13035. 772,
  13036. 726,
  13037. 723,
  13038. 1712,
  13039. 672,
  13040. 669,
  13041. 666,
  13042. 682,
  13043. 1678,
  13044. 1675,
  13045. 625,
  13046. 623,
  13047. 621,
  13048. 618,
  13049. 2331,
  13050. 636,
  13051. 632,
  13052. 1639,
  13053. 1637,
  13054. 1635,
  13055. 920,
  13056. 918,
  13057. 884,
  13058. 880,
  13059. 889,
  13060. 849,
  13061. 848,
  13062. 847,
  13063. 846,
  13064. 2497,
  13065. 855,
  13066. 852,
  13067. 1776,
  13068. 2641,
  13069. 2742,
  13070. 2787,
  13071. 1380,
  13072. 334,
  13073. 1367,
  13074. 1365,
  13075. 301,
  13076. 297,
  13077. 1340,
  13078. 1338,
  13079. 1335,
  13080. 1343,
  13081. 255,
  13082. 251,
  13083. 247,
  13084. 1296,
  13085. 1291,
  13086. 1288,
  13087. 265,
  13088. 1302,
  13089. 1299,
  13090. 2113,
  13091. 204,
  13092. 196,
  13093. 192,
  13094. 2042,
  13095. 1232,
  13096. 1230,
  13097. 1224,
  13098. 214,
  13099. 1220,
  13100. 210,
  13101. 1242,
  13102. 1239,
  13103. 1235,
  13104. 1250,
  13105. 2077,
  13106. 2075,
  13107. 151,
  13108. 148,
  13109. 1993,
  13110. 144,
  13111. 1990,
  13112. 1163,
  13113. 1162,
  13114. 1160,
  13115. 1158,
  13116. 1155,
  13117. 161,
  13118. 1152,
  13119. 157,
  13120. 1173,
  13121. 1171,
  13122. 1168,
  13123. 1165,
  13124. 168,
  13125. 1181,
  13126. 1178,
  13127. 2021,
  13128. 2020,
  13129. 2018,
  13130. 2023,
  13131. 585,
  13132. 560,
  13133. 557,
  13134. 1585,
  13135. 516,
  13136. 509,
  13137. 1562,
  13138. 1559,
  13139. 458,
  13140. 447,
  13141. 2227,
  13142. 472,
  13143. 1516,
  13144. 1513,
  13145. 1510,
  13146. 398,
  13147. 396,
  13148. 393,
  13149. 390,
  13150. 2181,
  13151. 386,
  13152. 2178,
  13153. 407,
  13154. 1453,
  13155. 1451,
  13156. 1449,
  13157. 1446,
  13158. 420,
  13159. 1460,
  13160. 2209,
  13161. 769,
  13162. 764,
  13163. 720,
  13164. 712,
  13165. 2391,
  13166. 729,
  13167. 1713,
  13168. 664,
  13169. 663,
  13170. 661,
  13171. 659,
  13172. 2352,
  13173. 656,
  13174. 2349,
  13175. 671,
  13176. 1679,
  13177. 1677,
  13178. 2553,
  13179. 922,
  13180. 919,
  13181. 2519,
  13182. 2516,
  13183. 885,
  13184. 883,
  13185. 881,
  13186. 2685,
  13187. 2661,
  13188. 2659,
  13189. 2767,
  13190. 2756,
  13191. 2755,
  13192. 140,
  13193. 1137,
  13194. 1136,
  13195. 130,
  13196. 127,
  13197. 1125,
  13198. 1124,
  13199. 1122,
  13200. 1127,
  13201. 109,
  13202. 106,
  13203. 102,
  13204. 1103,
  13205. 1102,
  13206. 1100,
  13207. 1098,
  13208. 116,
  13209. 1107,
  13210. 1105,
  13211. 1980,
  13212. 80,
  13213. 76,
  13214. 73,
  13215. 1947,
  13216. 1068,
  13217. 1067,
  13218. 1065,
  13219. 1063,
  13220. 90,
  13221. 1060,
  13222. 87,
  13223. 1075,
  13224. 1073,
  13225. 1070,
  13226. 1080,
  13227. 1966,
  13228. 1965,
  13229. 46,
  13230. 43,
  13231. 40,
  13232. 1912,
  13233. 36,
  13234. 1909,
  13235. 1019,
  13236. 1018,
  13237. 1016,
  13238. 1014,
  13239. 58,
  13240. 1011,
  13241. 55,
  13242. 1008,
  13243. 51,
  13244. 1029,
  13245. 1027,
  13246. 1024,
  13247. 1021,
  13248. 63,
  13249. 1037,
  13250. 1034,
  13251. 1940,
  13252. 1939,
  13253. 1937,
  13254. 1942,
  13255. 8,
  13256. 1866,
  13257. 4,
  13258. 1863,
  13259. 1,
  13260. 1860,
  13261. 956,
  13262. 954,
  13263. 952,
  13264. 949,
  13265. 946,
  13266. 17,
  13267. 14,
  13268. 969,
  13269. 967,
  13270. 964,
  13271. 961,
  13272. 27,
  13273. 957,
  13274. 24,
  13275. 979,
  13276. 976,
  13277. 972,
  13278. 1901,
  13279. 1900,
  13280. 1898,
  13281. 1896,
  13282. 986,
  13283. 1905,
  13284. 1903,
  13285. 350,
  13286. 349,
  13287. 1381,
  13288. 329,
  13289. 327,
  13290. 324,
  13291. 1368,
  13292. 1366,
  13293. 292,
  13294. 290,
  13295. 287,
  13296. 284,
  13297. 2118,
  13298. 304,
  13299. 1341,
  13300. 1339,
  13301. 1337,
  13302. 1345,
  13303. 243,
  13304. 240,
  13305. 237,
  13306. 2086,
  13307. 233,
  13308. 2083,
  13309. 254,
  13310. 1297,
  13311. 1295,
  13312. 1293,
  13313. 1290,
  13314. 1304,
  13315. 2114,
  13316. 190,
  13317. 187,
  13318. 184,
  13319. 2034,
  13320. 180,
  13321. 2031,
  13322. 177,
  13323. 2027,
  13324. 199,
  13325. 1233,
  13326. 1231,
  13327. 1229,
  13328. 1226,
  13329. 217,
  13330. 1223,
  13331. 1241,
  13332. 2078,
  13333. 2076,
  13334. 584,
  13335. 555,
  13336. 554,
  13337. 552,
  13338. 550,
  13339. 2282,
  13340. 562,
  13341. 1586,
  13342. 507,
  13343. 506,
  13344. 504,
  13345. 502,
  13346. 2257,
  13347. 499,
  13348. 2254,
  13349. 515,
  13350. 1563,
  13351. 1561,
  13352. 445,
  13353. 443,
  13354. 441,
  13355. 2219,
  13356. 438,
  13357. 2216,
  13358. 435,
  13359. 2212,
  13360. 460,
  13361. 454,
  13362. 475,
  13363. 1517,
  13364. 1515,
  13365. 1512,
  13366. 2447,
  13367. 798,
  13368. 797,
  13369. 2422,
  13370. 2419,
  13371. 770,
  13372. 768,
  13373. 766,
  13374. 2383,
  13375. 2380,
  13376. 2376,
  13377. 721,
  13378. 719,
  13379. 717,
  13380. 714,
  13381. 731,
  13382. 1714,
  13383. 2602,
  13384. 2582,
  13385. 2580,
  13386. 2548,
  13387. 2546,
  13388. 2543,
  13389. 923,
  13390. 921,
  13391. 2717,
  13392. 2706,
  13393. 2705,
  13394. 2683,
  13395. 2682,
  13396. 2680,
  13397. 1771,
  13398. 1752,
  13399. 1750,
  13400. 1733,
  13401. 1732,
  13402. 1731,
  13403. 1735,
  13404. 1814,
  13405. 1707,
  13406. 1670,
  13407. 1668,
  13408. 1631,
  13409. 1629,
  13410. 1626,
  13411. 1634,
  13412. 1599,
  13413. 1598,
  13414. 1596,
  13415. 1594,
  13416. 1603,
  13417. 1601,
  13418. 2326,
  13419. 1772,
  13420. 1753,
  13421. 1751,
  13422. 1581,
  13423. 1554,
  13424. 1552,
  13425. 1504,
  13426. 1501,
  13427. 1498,
  13428. 1509,
  13429. 1442,
  13430. 1437,
  13431. 1434,
  13432. 401,
  13433. 1448,
  13434. 1445,
  13435. 2206,
  13436. 1392,
  13437. 1391,
  13438. 1389,
  13439. 1387,
  13440. 1384,
  13441. 359,
  13442. 1399,
  13443. 1397,
  13444. 1394,
  13445. 1404,
  13446. 2171,
  13447. 2170,
  13448. 1708,
  13449. 1672,
  13450. 1669,
  13451. 619,
  13452. 1632,
  13453. 1630,
  13454. 1628,
  13455. 1773,
  13456. 1378,
  13457. 1363,
  13458. 1361,
  13459. 1333,
  13460. 1328,
  13461. 1336,
  13462. 1286,
  13463. 1281,
  13464. 1278,
  13465. 248,
  13466. 1292,
  13467. 1289,
  13468. 2111,
  13469. 1218,
  13470. 1216,
  13471. 1210,
  13472. 197,
  13473. 1206,
  13474. 193,
  13475. 1228,
  13476. 1225,
  13477. 1221,
  13478. 1236,
  13479. 2073,
  13480. 2071,
  13481. 1151,
  13482. 1150,
  13483. 1148,
  13484. 1146,
  13485. 152,
  13486. 1143,
  13487. 149,
  13488. 1140,
  13489. 145,
  13490. 1161,
  13491. 1159,
  13492. 1156,
  13493. 1153,
  13494. 158,
  13495. 1169,
  13496. 1166,
  13497. 2017,
  13498. 2016,
  13499. 2014,
  13500. 2019,
  13501. 1582,
  13502. 510,
  13503. 1556,
  13504. 1553,
  13505. 452,
  13506. 448,
  13507. 1506,
  13508. 1500,
  13509. 394,
  13510. 391,
  13511. 387,
  13512. 1443,
  13513. 1441,
  13514. 1439,
  13515. 1436,
  13516. 1450,
  13517. 2207,
  13518. 765,
  13519. 716,
  13520. 713,
  13521. 1709,
  13522. 662,
  13523. 660,
  13524. 657,
  13525. 1673,
  13526. 1671,
  13527. 916,
  13528. 914,
  13529. 879,
  13530. 878,
  13531. 877,
  13532. 882,
  13533. 1135,
  13534. 1134,
  13535. 1121,
  13536. 1120,
  13537. 1118,
  13538. 1123,
  13539. 1097,
  13540. 1096,
  13541. 1094,
  13542. 1092,
  13543. 103,
  13544. 1101,
  13545. 1099,
  13546. 1979,
  13547. 1059,
  13548. 1058,
  13549. 1056,
  13550. 1054,
  13551. 77,
  13552. 1051,
  13553. 74,
  13554. 1066,
  13555. 1064,
  13556. 1061,
  13557. 1071,
  13558. 1964,
  13559. 1963,
  13560. 1007,
  13561. 1006,
  13562. 1004,
  13563. 1002,
  13564. 999,
  13565. 41,
  13566. 996,
  13567. 37,
  13568. 1017,
  13569. 1015,
  13570. 1012,
  13571. 1009,
  13572. 52,
  13573. 1025,
  13574. 1022,
  13575. 1936,
  13576. 1935,
  13577. 1933,
  13578. 1938,
  13579. 942,
  13580. 940,
  13581. 938,
  13582. 935,
  13583. 932,
  13584. 5,
  13585. 2,
  13586. 955,
  13587. 953,
  13588. 950,
  13589. 947,
  13590. 18,
  13591. 943,
  13592. 15,
  13593. 965,
  13594. 962,
  13595. 958,
  13596. 1895,
  13597. 1894,
  13598. 1892,
  13599. 1890,
  13600. 973,
  13601. 1899,
  13602. 1897,
  13603. 1379,
  13604. 325,
  13605. 1364,
  13606. 1362,
  13607. 288,
  13608. 285,
  13609. 1334,
  13610. 1332,
  13611. 1330,
  13612. 241,
  13613. 238,
  13614. 234,
  13615. 1287,
  13616. 1285,
  13617. 1283,
  13618. 1280,
  13619. 1294,
  13620. 2112,
  13621. 188,
  13622. 185,
  13623. 181,
  13624. 178,
  13625. 2028,
  13626. 1219,
  13627. 1217,
  13628. 1215,
  13629. 1212,
  13630. 200,
  13631. 1209,
  13632. 1227,
  13633. 2074,
  13634. 2072,
  13635. 583,
  13636. 553,
  13637. 551,
  13638. 1583,
  13639. 505,
  13640. 503,
  13641. 500,
  13642. 513,
  13643. 1557,
  13644. 1555,
  13645. 444,
  13646. 442,
  13647. 439,
  13648. 436,
  13649. 2213,
  13650. 455,
  13651. 451,
  13652. 1507,
  13653. 1505,
  13654. 1502,
  13655. 796,
  13656. 763,
  13657. 762,
  13658. 760,
  13659. 767,
  13660. 711,
  13661. 710,
  13662. 708,
  13663. 706,
  13664. 2377,
  13665. 718,
  13666. 715,
  13667. 1710,
  13668. 2544,
  13669. 917,
  13670. 915,
  13671. 2681,
  13672. 1627,
  13673. 1597,
  13674. 1595,
  13675. 2325,
  13676. 1769,
  13677. 1749,
  13678. 1747,
  13679. 1499,
  13680. 1438,
  13681. 1435,
  13682. 2204,
  13683. 1390,
  13684. 1388,
  13685. 1385,
  13686. 1395,
  13687. 2169,
  13688. 2167,
  13689. 1704,
  13690. 1665,
  13691. 1662,
  13692. 1625,
  13693. 1623,
  13694. 1620,
  13695. 1770,
  13696. 1329,
  13697. 1282,
  13698. 1279,
  13699. 2109,
  13700. 1214,
  13701. 1207,
  13702. 1222,
  13703. 2068,
  13704. 2065,
  13705. 1149,
  13706. 1147,
  13707. 1144,
  13708. 1141,
  13709. 146,
  13710. 1157,
  13711. 1154,
  13712. 2013,
  13713. 2011,
  13714. 2008,
  13715. 2015,
  13716. 1579,
  13717. 1549,
  13718. 1546,
  13719. 1495,
  13720. 1487,
  13721. 1433,
  13722. 1431,
  13723. 1428,
  13724. 1425,
  13725. 388,
  13726. 1440,
  13727. 2205,
  13728. 1705,
  13729. 658,
  13730. 1667,
  13731. 1664,
  13732. 1119,
  13733. 1095,
  13734. 1093,
  13735. 1978,
  13736. 1057,
  13737. 1055,
  13738. 1052,
  13739. 1062,
  13740. 1962,
  13741. 1960,
  13742. 1005,
  13743. 1003,
  13744. 1e3,
  13745. 997,
  13746. 38,
  13747. 1013,
  13748. 1010,
  13749. 1932,
  13750. 1930,
  13751. 1927,
  13752. 1934,
  13753. 941,
  13754. 939,
  13755. 936,
  13756. 933,
  13757. 6,
  13758. 930,
  13759. 3,
  13760. 951,
  13761. 948,
  13762. 944,
  13763. 1889,
  13764. 1887,
  13765. 1884,
  13766. 1881,
  13767. 959,
  13768. 1893,
  13769. 1891,
  13770. 35,
  13771. 1377,
  13772. 1360,
  13773. 1358,
  13774. 1327,
  13775. 1325,
  13776. 1322,
  13777. 1331,
  13778. 1277,
  13779. 1275,
  13780. 1272,
  13781. 1269,
  13782. 235,
  13783. 1284,
  13784. 2110,
  13785. 1205,
  13786. 1204,
  13787. 1201,
  13788. 1198,
  13789. 182,
  13790. 1195,
  13791. 179,
  13792. 1213,
  13793. 2070,
  13794. 2067,
  13795. 1580,
  13796. 501,
  13797. 1551,
  13798. 1548,
  13799. 440,
  13800. 437,
  13801. 1497,
  13802. 1494,
  13803. 1490,
  13804. 1503,
  13805. 761,
  13806. 709,
  13807. 707,
  13808. 1706,
  13809. 913,
  13810. 912,
  13811. 2198,
  13812. 1386,
  13813. 2164,
  13814. 2161,
  13815. 1621,
  13816. 1766,
  13817. 2103,
  13818. 1208,
  13819. 2058,
  13820. 2054,
  13821. 1145,
  13822. 1142,
  13823. 2005,
  13824. 2002,
  13825. 1999,
  13826. 2009,
  13827. 1488,
  13828. 1429,
  13829. 1426,
  13830. 2200,
  13831. 1698,
  13832. 1659,
  13833. 1656,
  13834. 1975,
  13835. 1053,
  13836. 1957,
  13837. 1954,
  13838. 1001,
  13839. 998,
  13840. 1924,
  13841. 1921,
  13842. 1918,
  13843. 1928,
  13844. 937,
  13845. 934,
  13846. 931,
  13847. 1879,
  13848. 1876,
  13849. 1873,
  13850. 1870,
  13851. 945,
  13852. 1885,
  13853. 1882,
  13854. 1323,
  13855. 1273,
  13856. 1270,
  13857. 2105,
  13858. 1202,
  13859. 1199,
  13860. 1196,
  13861. 1211,
  13862. 2061,
  13863. 2057,
  13864. 1576,
  13865. 1543,
  13866. 1540,
  13867. 1484,
  13868. 1481,
  13869. 1478,
  13870. 1491,
  13871. 1700
  13872. ]))
  13873. class Le {
  13874. constructor(t, e) {
  13875. ;(this.bits = t), (this.points = e)
  13876. }
  13877. getBits() {
  13878. return this.bits
  13879. }
  13880. getPoints() {
  13881. return this.points
  13882. }
  13883. }
  13884. class Be {
  13885. static detectMultiple(t, e, r) {
  13886. let n = t.getBlackMatrix(),
  13887. i = Be.detect(r, n)
  13888. return i.length || ((n = n.clone()), n.rotate180(), (i = Be.detect(r, n))), new Le(n, i)
  13889. }
  13890. static detect(t, e) {
  13891. const r = new Array()
  13892. let n = 0,
  13893. i = 0,
  13894. o = !1
  13895. for (; n < e.getHeight(); ) {
  13896. const s = Be.findVertices(e, n, i)
  13897. if (null != s[0] || null != s[3]) {
  13898. if (((o = !0), r.push(s), !t)) break
  13899. null != s[2] ? ((i = Math.trunc(s[2].getX())), (n = Math.trunc(s[2].getY()))) : ((i = Math.trunc(s[4].getX())), (n = Math.trunc(s[4].getY())))
  13900. } else {
  13901. if (!o) break
  13902. ;(o = !1), (i = 0)
  13903. for (const t of r) null != t[1] && (n = Math.trunc(Math.max(n, t[1].getY()))), null != t[3] && (n = Math.max(n, Math.trunc(t[3].getY())))
  13904. n += Be.ROW_STEP
  13905. }
  13906. }
  13907. return r
  13908. }
  13909. static findVertices(t, e, r) {
  13910. const n = t.getHeight(),
  13911. i = t.getWidth(),
  13912. o = new Array(8)
  13913. return (
  13914. Be.copyToResult(o, Be.findRowsWithPattern(t, n, i, e, r, Be.START_PATTERN), Be.INDEXES_START_PATTERN),
  13915. null != o[4] && ((r = Math.trunc(o[4].getX())), (e = Math.trunc(o[4].getY()))),
  13916. Be.copyToResult(o, Be.findRowsWithPattern(t, n, i, e, r, Be.STOP_PATTERN), Be.INDEXES_STOP_PATTERN),
  13917. o
  13918. )
  13919. }
  13920. static copyToResult(t, e, r) {
  13921. for (let n = 0; n < r.length; n++) t[r[n]] = e[n]
  13922. }
  13923. static findRowsWithPattern(t, e, r, n, i, o) {
  13924. const s = new Array(4)
  13925. let a = !1
  13926. const l = new Int32Array(o.length)
  13927. for (; n < e; n += Be.ROW_STEP) {
  13928. let e = Be.findGuardPattern(t, i, n, r, !1, o, l)
  13929. if (null != e) {
  13930. for (; n > 0; ) {
  13931. const s = Be.findGuardPattern(t, i, --n, r, !1, o, l)
  13932. if (null == s) {
  13933. n++
  13934. break
  13935. }
  13936. e = s
  13937. }
  13938. ;(s[0] = new nt(e[0], n)), (s[1] = new nt(e[1], n)), (a = !0)
  13939. break
  13940. }
  13941. }
  13942. let c = n + 1
  13943. if (a) {
  13944. let n = 0,
  13945. i = Int32Array.from([Math.trunc(s[0].getX()), Math.trunc(s[1].getX())])
  13946. for (; c < e; c++) {
  13947. const e = Be.findGuardPattern(t, i[0], c, r, !1, o, l)
  13948. if (null != e && Math.abs(i[0] - e[0]) < Be.MAX_PATTERN_DRIFT && Math.abs(i[1] - e[1]) < Be.MAX_PATTERN_DRIFT) (i = e), (n = 0)
  13949. else {
  13950. if (n > Be.SKIPPED_ROW_COUNT_MAX) break
  13951. n++
  13952. }
  13953. }
  13954. ;(c -= n + 1), (s[2] = new nt(i[0], c)), (s[3] = new nt(i[1], c))
  13955. }
  13956. return c - n < Be.BARCODE_MIN_HEIGHT && f.fill(s, null), s
  13957. }
  13958. static findGuardPattern(t, e, r, n, i, o, s) {
  13959. f.fillWithin(s, 0, s.length, 0)
  13960. let a = e,
  13961. l = 0
  13962. for (; t.get(a, r) && a > 0 && l++ < Be.MAX_PIXEL_DRIFT; ) a--
  13963. let c = a,
  13964. h = 0,
  13965. d = o.length
  13966. for (let e = i; c < n; c++)
  13967. if (t.get(c, r) !== e) s[h]++
  13968. else {
  13969. if (h === d - 1) {
  13970. if (Be.patternMatchVariance(s, o, Be.MAX_INDIVIDUAL_VARIANCE) < Be.MAX_AVG_VARIANCE) return new Int32Array([a, c])
  13971. ;(a += s[0] + s[1]), u.arraycopy(s, 2, s, 0, h - 1), (s[h - 1] = 0), (s[h] = 0), h--
  13972. } else h++
  13973. ;(s[h] = 1), (e = !e)
  13974. }
  13975. return h === d - 1 && Be.patternMatchVariance(s, o, Be.MAX_INDIVIDUAL_VARIANCE) < Be.MAX_AVG_VARIANCE ? new Int32Array([a, c - 1]) : null
  13976. }
  13977. static patternMatchVariance(t, e, r) {
  13978. let n = t.length,
  13979. i = 0,
  13980. o = 0
  13981. for (let r = 0; r < n; r++) (i += t[r]), (o += e[r])
  13982. if (i < o) return 1 / 0
  13983. let s = i / o
  13984. r *= s
  13985. let a = 0
  13986. for (let i = 0; i < n; i++) {
  13987. let n = t[i],
  13988. o = e[i] * s,
  13989. l = n > o ? n - o : o - n
  13990. if (l > r) return 1 / 0
  13991. a += l
  13992. }
  13993. return a / i
  13994. }
  13995. }
  13996. ;(Be.INDEXES_START_PATTERN = Int32Array.from([0, 4, 1, 5])),
  13997. (Be.INDEXES_STOP_PATTERN = Int32Array.from([6, 2, 7, 3])),
  13998. (Be.MAX_AVG_VARIANCE = 0.42),
  13999. (Be.MAX_INDIVIDUAL_VARIANCE = 0.8),
  14000. (Be.START_PATTERN = Int32Array.from([8, 1, 1, 1, 1, 1, 1, 3])),
  14001. (Be.STOP_PATTERN = Int32Array.from([7, 1, 1, 3, 1, 1, 1, 2, 1])),
  14002. (Be.MAX_PIXEL_DRIFT = 3),
  14003. (Be.MAX_PATTERN_DRIFT = 5),
  14004. (Be.SKIPPED_ROW_COUNT_MAX = 25),
  14005. (Be.ROW_STEP = 5),
  14006. (Be.BARCODE_MIN_HEIGHT = 10)
  14007. class Pe {
  14008. constructor(t, e) {
  14009. if (0 === e.length) throw new a()
  14010. this.field = t
  14011. let r = e.length
  14012. if (r > 1 && 0 === e[0]) {
  14013. let t = 1
  14014. for (; t < r && 0 === e[t]; ) t++
  14015. t === r ? (this.coefficients = new Int32Array([0])) : ((this.coefficients = new Int32Array(r - t)), u.arraycopy(e, t, this.coefficients, 0, this.coefficients.length))
  14016. } else this.coefficients = e
  14017. }
  14018. getCoefficients() {
  14019. return this.coefficients
  14020. }
  14021. getDegree() {
  14022. return this.coefficients.length - 1
  14023. }
  14024. isZero() {
  14025. return 0 === this.coefficients[0]
  14026. }
  14027. getCoefficient(t) {
  14028. return this.coefficients[this.coefficients.length - 1 - t]
  14029. }
  14030. evaluateAt(t) {
  14031. if (0 === t) return this.getCoefficient(0)
  14032. if (1 === t) {
  14033. let t = 0
  14034. for (let e of this.coefficients) t = this.field.add(t, e)
  14035. return t
  14036. }
  14037. let e = this.coefficients[0],
  14038. r = this.coefficients.length
  14039. for (let n = 1; n < r; n++) e = this.field.add(this.field.multiply(t, e), this.coefficients[n])
  14040. return e
  14041. }
  14042. add(t) {
  14043. if (!this.field.equals(t.field)) throw new a('ModulusPolys do not have same ModulusGF field')
  14044. if (this.isZero()) return t
  14045. if (t.isZero()) return this
  14046. let e = this.coefficients,
  14047. r = t.coefficients
  14048. if (e.length > r.length) {
  14049. let t = e
  14050. ;(e = r), (r = t)
  14051. }
  14052. let n = new Int32Array(r.length),
  14053. i = r.length - e.length
  14054. u.arraycopy(r, 0, n, 0, i)
  14055. for (let t = i; t < r.length; t++) n[t] = this.field.add(e[t - i], r[t])
  14056. return new Pe(this.field, n)
  14057. }
  14058. subtract(t) {
  14059. if (!this.field.equals(t.field)) throw new a('ModulusPolys do not have same ModulusGF field')
  14060. return t.isZero() ? this : this.add(t.negative())
  14061. }
  14062. multiply(t) {
  14063. return t instanceof Pe ? this.multiplyOther(t) : this.multiplyScalar(t)
  14064. }
  14065. multiplyOther(t) {
  14066. if (!this.field.equals(t.field)) throw new a('ModulusPolys do not have same ModulusGF field')
  14067. if (this.isZero() || t.isZero()) return new Pe(this.field, new Int32Array([0]))
  14068. let e = this.coefficients,
  14069. r = e.length,
  14070. n = t.coefficients,
  14071. i = n.length,
  14072. o = new Int32Array(r + i - 1)
  14073. for (let t = 0; t < r; t++) {
  14074. let r = e[t]
  14075. for (let e = 0; e < i; e++) o[t + e] = this.field.add(o[t + e], this.field.multiply(r, n[e]))
  14076. }
  14077. return new Pe(this.field, o)
  14078. }
  14079. negative() {
  14080. let t = this.coefficients.length,
  14081. e = new Int32Array(t)
  14082. for (let r = 0; r < t; r++) e[r] = this.field.subtract(0, this.coefficients[r])
  14083. return new Pe(this.field, e)
  14084. }
  14085. multiplyScalar(t) {
  14086. if (0 === t) return new Pe(this.field, new Int32Array([0]))
  14087. if (1 === t) return this
  14088. let e = this.coefficients.length,
  14089. r = new Int32Array(e)
  14090. for (let n = 0; n < e; n++) r[n] = this.field.multiply(this.coefficients[n], t)
  14091. return new Pe(this.field, r)
  14092. }
  14093. multiplyByMonomial(t, e) {
  14094. if (t < 0) throw new a()
  14095. if (0 === e) return new Pe(this.field, new Int32Array([0]))
  14096. let r = this.coefficients.length,
  14097. n = new Int32Array(r + t)
  14098. for (let t = 0; t < r; t++) n[t] = this.field.multiply(this.coefficients[t], e)
  14099. return new Pe(this.field, n)
  14100. }
  14101. toString() {
  14102. let t = new T()
  14103. for (let e = this.getDegree(); e >= 0; e--) {
  14104. let r = this.getCoefficient(e)
  14105. 0 !== r &&
  14106. (r < 0 ? (t.append(' - '), (r = -r)) : t.length() > 0 && t.append(' + '),
  14107. (0 !== e && 1 === r) || t.append(r),
  14108. 0 !== e && (1 === e ? t.append('x') : (t.append('x^'), t.append(e))))
  14109. }
  14110. return t.toString()
  14111. }
  14112. }
  14113. class ve extends class {
  14114. add(t, e) {
  14115. return (t + e) % this.modulus
  14116. }
  14117. subtract(t, e) {
  14118. return (this.modulus + t - e) % this.modulus
  14119. }
  14120. exp(t) {
  14121. return this.expTable[t]
  14122. }
  14123. log(t) {
  14124. if (0 === t) throw new a()
  14125. return this.logTable[t]
  14126. }
  14127. inverse(t) {
  14128. if (0 === t) throw new Q()
  14129. return this.expTable[this.modulus - this.logTable[t] - 1]
  14130. }
  14131. multiply(t, e) {
  14132. return 0 === t || 0 === e ? 0 : this.expTable[(this.logTable[t] + this.logTable[e]) % (this.modulus - 1)]
  14133. }
  14134. getSize() {
  14135. return this.modulus
  14136. }
  14137. equals(t) {
  14138. return t === this
  14139. }
  14140. } {
  14141. constructor(t, e) {
  14142. super(), (this.modulus = t), (this.expTable = new Int32Array(t)), (this.logTable = new Int32Array(t))
  14143. let r = 1
  14144. for (let n = 0; n < t; n++) (this.expTable[n] = r), (r = (r * e) % t)
  14145. for (let e = 0; e < t - 1; e++) this.logTable[this.expTable[e]] = e
  14146. ;(this.zero = new Pe(this, new Int32Array([0]))), (this.one = new Pe(this, new Int32Array([1])))
  14147. }
  14148. getZero() {
  14149. return this.zero
  14150. }
  14151. getOne() {
  14152. return this.one
  14153. }
  14154. buildMonomial(t, e) {
  14155. if (t < 0) throw new a()
  14156. if (0 === e) return this.zero
  14157. let r = new Int32Array(t + 1)
  14158. return (r[0] = e), new Pe(this, r)
  14159. }
  14160. }
  14161. ve.PDF417_GF = new ve(be.NUMBER_OF_CODEWORDS, 3)
  14162. class Fe {
  14163. constructor() {
  14164. this.field = ve.PDF417_GF
  14165. }
  14166. decode(t, e, r) {
  14167. let n = new Pe(this.field, t),
  14168. i = new Int32Array(e),
  14169. o = !1
  14170. for (let t = e; t > 0; t--) {
  14171. let r = n.evaluateAt(this.field.exp(t))
  14172. ;(i[e - t] = r), 0 !== r && (o = !0)
  14173. }
  14174. if (!o) return 0
  14175. let s = this.field.getOne()
  14176. if (null != r)
  14177. for (const e of r) {
  14178. let r = this.field.exp(t.length - 1 - e),
  14179. n = new Pe(this.field, new Int32Array([this.field.subtract(0, r), 1]))
  14180. s = s.multiply(n)
  14181. }
  14182. let a = new Pe(this.field, i),
  14183. l = this.runEuclideanAlgorithm(this.field.buildMonomial(e, 1), a, e),
  14184. h = l[0],
  14185. u = l[1],
  14186. d = this.findErrorLocations(h),
  14187. g = this.findErrorMagnitudes(u, h, d)
  14188. for (let e = 0; e < d.length; e++) {
  14189. let r = t.length - 1 - this.field.log(d[e])
  14190. if (r < 0) throw c.getChecksumInstance()
  14191. t[r] = this.field.subtract(t[r], g[e])
  14192. }
  14193. return d.length
  14194. }
  14195. runEuclideanAlgorithm(t, e, r) {
  14196. if (t.getDegree() < e.getDegree()) {
  14197. let r = t
  14198. ;(t = e), (e = r)
  14199. }
  14200. let n = t,
  14201. i = e,
  14202. o = this.field.getZero(),
  14203. s = this.field.getOne()
  14204. for (; i.getDegree() >= Math.round(r / 2); ) {
  14205. let t = n,
  14206. e = o
  14207. if (((n = i), (o = s), n.isZero())) throw c.getChecksumInstance()
  14208. i = t
  14209. let r = this.field.getZero(),
  14210. a = n.getCoefficient(n.getDegree()),
  14211. l = this.field.inverse(a)
  14212. for (; i.getDegree() >= n.getDegree() && !i.isZero(); ) {
  14213. let t = i.getDegree() - n.getDegree(),
  14214. e = this.field.multiply(i.getCoefficient(i.getDegree()), l)
  14215. ;(r = r.add(this.field.buildMonomial(t, e))), (i = i.subtract(n.multiplyByMonomial(t, e)))
  14216. }
  14217. s = r
  14218. .multiply(o)
  14219. .subtract(e)
  14220. .negative()
  14221. }
  14222. let a = s.getCoefficient(0)
  14223. if (0 === a) throw c.getChecksumInstance()
  14224. let l = this.field.inverse(a)
  14225. return [s.multiply(l), i.multiply(l)]
  14226. }
  14227. findErrorLocations(t) {
  14228. let e = t.getDegree(),
  14229. r = new Int32Array(e),
  14230. n = 0
  14231. for (let i = 1; i < this.field.getSize() && n < e; i++) 0 === t.evaluateAt(i) && ((r[n] = this.field.inverse(i)), n++)
  14232. if (n !== e) throw c.getChecksumInstance()
  14233. return r
  14234. }
  14235. findErrorMagnitudes(t, e, r) {
  14236. let n = e.getDegree(),
  14237. i = new Int32Array(n)
  14238. for (let t = 1; t <= n; t++) i[n - t] = this.field.multiply(t, e.getCoefficient(t))
  14239. let o = new Pe(this.field, i),
  14240. s = r.length,
  14241. a = new Int32Array(s)
  14242. for (let e = 0; e < s; e++) {
  14243. let n = this.field.inverse(r[e]),
  14244. i = this.field.subtract(0, t.evaluateAt(n)),
  14245. s = this.field.inverse(o.evaluateAt(n))
  14246. a[e] = this.field.multiply(i, s)
  14247. }
  14248. return a
  14249. }
  14250. }
  14251. class xe {
  14252. constructor(t, e, r, n, i) {
  14253. t instanceof xe ? this.constructor_2(t) : this.constructor_1(t, e, r, n, i)
  14254. }
  14255. constructor_1(t, e, r, n, i) {
  14256. const o = null == e || null == r,
  14257. s = null == n || null == i
  14258. if (o && s) throw new N()
  14259. o ? ((e = new nt(0, n.getY())), (r = new nt(0, i.getY()))) : s && ((n = new nt(t.getWidth() - 1, e.getY())), (i = new nt(t.getWidth() - 1, r.getY()))),
  14260. (this.image = t),
  14261. (this.topLeft = e),
  14262. (this.bottomLeft = r),
  14263. (this.topRight = n),
  14264. (this.bottomRight = i),
  14265. (this.minX = Math.trunc(Math.min(e.getX(), r.getX()))),
  14266. (this.maxX = Math.trunc(Math.max(n.getX(), i.getX()))),
  14267. (this.minY = Math.trunc(Math.min(e.getY(), n.getY()))),
  14268. (this.maxY = Math.trunc(Math.max(r.getY(), i.getY())))
  14269. }
  14270. constructor_2(t) {
  14271. ;(this.image = t.image),
  14272. (this.topLeft = t.getTopLeft()),
  14273. (this.bottomLeft = t.getBottomLeft()),
  14274. (this.topRight = t.getTopRight()),
  14275. (this.bottomRight = t.getBottomRight()),
  14276. (this.minX = t.getMinX()),
  14277. (this.maxX = t.getMaxX()),
  14278. (this.minY = t.getMinY()),
  14279. (this.maxY = t.getMaxY())
  14280. }
  14281. static merge(t, e) {
  14282. return null == t ? e : null == e ? t : new xe(t.image, t.topLeft, t.bottomLeft, e.topRight, e.bottomRight)
  14283. }
  14284. addMissingRows(t, e, r) {
  14285. let n = this.topLeft,
  14286. i = this.bottomLeft,
  14287. o = this.topRight,
  14288. s = this.bottomRight
  14289. if (t > 0) {
  14290. let e = r ? this.topLeft : this.topRight,
  14291. i = Math.trunc(e.getY() - t)
  14292. i < 0 && (i = 0)
  14293. let s = new nt(e.getX(), i)
  14294. r ? (n = s) : (o = s)
  14295. }
  14296. if (e > 0) {
  14297. let t = r ? this.bottomLeft : this.bottomRight,
  14298. n = Math.trunc(t.getY() + e)
  14299. n >= this.image.getHeight() && (n = this.image.getHeight() - 1)
  14300. let o = new nt(t.getX(), n)
  14301. r ? (i = o) : (s = o)
  14302. }
  14303. return new xe(this.image, n, i, o, s)
  14304. }
  14305. getMinX() {
  14306. return this.minX
  14307. }
  14308. getMaxX() {
  14309. return this.maxX
  14310. }
  14311. getMinY() {
  14312. return this.minY
  14313. }
  14314. getMaxY() {
  14315. return this.maxY
  14316. }
  14317. getTopLeft() {
  14318. return this.topLeft
  14319. }
  14320. getTopRight() {
  14321. return this.topRight
  14322. }
  14323. getBottomLeft() {
  14324. return this.bottomLeft
  14325. }
  14326. getBottomRight() {
  14327. return this.bottomRight
  14328. }
  14329. }
  14330. class ke {
  14331. constructor(t, e, r, n) {
  14332. ;(this.columnCount = t), (this.errorCorrectionLevel = n), (this.rowCountUpperPart = e), (this.rowCountLowerPart = r), (this.rowCount = e + r)
  14333. }
  14334. getColumnCount() {
  14335. return this.columnCount
  14336. }
  14337. getErrorCorrectionLevel() {
  14338. return this.errorCorrectionLevel
  14339. }
  14340. getRowCount() {
  14341. return this.rowCount
  14342. }
  14343. getRowCountUpperPart() {
  14344. return this.rowCountUpperPart
  14345. }
  14346. getRowCountLowerPart() {
  14347. return this.rowCountLowerPart
  14348. }
  14349. }
  14350. class Ue {
  14351. constructor() {
  14352. this.buffer = ''
  14353. }
  14354. static form(t, e) {
  14355. let r = -1
  14356. return t.replace(/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g, function(t, n, i, o, s, a) {
  14357. if ('%%' === t) return '%'
  14358. if (void 0 === e[++r]) return
  14359. t = o ? parseInt(o.substr(1)) : void 0
  14360. let l,
  14361. c = s ? parseInt(s.substr(1)) : void 0
  14362. switch (a) {
  14363. case 's':
  14364. l = e[r]
  14365. break
  14366. case 'c':
  14367. l = e[r][0]
  14368. break
  14369. case 'f':
  14370. l = parseFloat(e[r]).toFixed(t)
  14371. break
  14372. case 'p':
  14373. l = parseFloat(e[r]).toPrecision(t)
  14374. break
  14375. case 'e':
  14376. l = parseFloat(e[r]).toExponential(t)
  14377. break
  14378. case 'x':
  14379. l = parseInt(e[r]).toString(c || 16)
  14380. break
  14381. case 'd':
  14382. l = parseFloat(parseInt(e[r], c || 10).toPrecision(t)).toFixed(0)
  14383. }
  14384. l = 'object' == typeof l ? JSON.stringify(l) : (+l).toString(c)
  14385. let h = parseInt(i),
  14386. u = i && i[0] + '' == '0' ? '0' : ' '
  14387. for (; l.length < h; ) l = void 0 !== n ? l + u : u + l
  14388. return l
  14389. })
  14390. }
  14391. format(t, ...e) {
  14392. this.buffer += Ue.form(t, e)
  14393. }
  14394. toString() {
  14395. return this.buffer
  14396. }
  14397. }
  14398. class He {
  14399. constructor(t) {
  14400. ;(this.boundingBox = new xe(t)), (this.codewords = new Array(t.getMaxY() - t.getMinY() + 1))
  14401. }
  14402. getCodewordNearby(t) {
  14403. let e = this.getCodeword(t)
  14404. if (null != e) return e
  14405. for (let r = 1; r < He.MAX_NEARBY_DISTANCE; r++) {
  14406. let n = this.imageRowToCodewordIndex(t) - r
  14407. if (n >= 0 && ((e = this.codewords[n]), null != e)) return e
  14408. if (((n = this.imageRowToCodewordIndex(t) + r), n < this.codewords.length && ((e = this.codewords[n]), null != e))) return e
  14409. }
  14410. return null
  14411. }
  14412. imageRowToCodewordIndex(t) {
  14413. return t - this.boundingBox.getMinY()
  14414. }
  14415. setCodeword(t, e) {
  14416. this.codewords[this.imageRowToCodewordIndex(t)] = e
  14417. }
  14418. getCodeword(t) {
  14419. return this.codewords[this.imageRowToCodewordIndex(t)]
  14420. }
  14421. getBoundingBox() {
  14422. return this.boundingBox
  14423. }
  14424. getCodewords() {
  14425. return this.codewords
  14426. }
  14427. toString() {
  14428. const t = new Ue()
  14429. let e = 0
  14430. for (const r of this.codewords) null != r ? t.format('%3d: %3d|%3d%n', e++, r.getRowNumber(), r.getValue()) : t.format('%3d: | %n', e++)
  14431. return t.toString()
  14432. }
  14433. }
  14434. He.MAX_NEARBY_DISTANCE = 5
  14435. class Ve {
  14436. constructor() {
  14437. this.values = new Map()
  14438. }
  14439. setValue(t) {
  14440. t = Math.trunc(t)
  14441. let e = this.values.get(t)
  14442. null == e && (e = 0), e++, this.values.set(t, e)
  14443. }
  14444. getValue() {
  14445. let t = -1,
  14446. e = new Array()
  14447. for (const [r, n] of this.values.entries()) {
  14448. const i = { getKey: () => r, getValue: () => n }
  14449. i.getValue() > t ? ((t = i.getValue()), (e = []), e.push(i.getKey())) : i.getValue() === t && e.push(i.getKey())
  14450. }
  14451. return be.toIntArray(e)
  14452. }
  14453. getConfidence(t) {
  14454. return this.values.get(t)
  14455. }
  14456. }
  14457. class ze extends He {
  14458. constructor(t, e) {
  14459. super(t), (this._isLeft = e)
  14460. }
  14461. setRowNumbers() {
  14462. for (let t of this.getCodewords()) null != t && t.setRowNumberAsRowIndicatorColumn()
  14463. }
  14464. adjustCompleteIndicatorColumnRowNumbers(t) {
  14465. let e = this.getCodewords()
  14466. this.setRowNumbers(), this.removeIncorrectCodewords(e, t)
  14467. let r = this.getBoundingBox(),
  14468. n = this._isLeft ? r.getTopLeft() : r.getTopRight(),
  14469. i = this._isLeft ? r.getBottomLeft() : r.getBottomRight(),
  14470. o = this.imageRowToCodewordIndex(Math.trunc(n.getY())),
  14471. s = this.imageRowToCodewordIndex(Math.trunc(i.getY())),
  14472. a = -1,
  14473. l = 1,
  14474. c = 0
  14475. for (let r = o; r < s; r++) {
  14476. if (null == e[r]) continue
  14477. let n = e[r],
  14478. i = n.getRowNumber() - a
  14479. if (0 === i) c++
  14480. else if (1 === i) (l = Math.max(l, c)), (c = 1), (a = n.getRowNumber())
  14481. else if (i < 0 || n.getRowNumber() >= t.getRowCount() || i > r) e[r] = null
  14482. else {
  14483. let t
  14484. t = l > 2 ? (l - 2) * i : i
  14485. let o = t >= r
  14486. for (let n = 1; n <= t && !o; n++) o = null != e[r - n]
  14487. o ? (e[r] = null) : ((a = n.getRowNumber()), (c = 1))
  14488. }
  14489. }
  14490. }
  14491. getRowHeights() {
  14492. let t = this.getBarcodeMetadata()
  14493. if (null == t) return null
  14494. this.adjustIncompleteIndicatorColumnRowNumbers(t)
  14495. let e = new Int32Array(t.getRowCount())
  14496. for (let t of this.getCodewords())
  14497. if (null != t) {
  14498. let r = t.getRowNumber()
  14499. if (r >= e.length) continue
  14500. e[r]++
  14501. }
  14502. return e
  14503. }
  14504. adjustIncompleteIndicatorColumnRowNumbers(t) {
  14505. let e = this.getBoundingBox(),
  14506. r = this._isLeft ? e.getTopLeft() : e.getTopRight(),
  14507. n = this._isLeft ? e.getBottomLeft() : e.getBottomRight(),
  14508. i = this.imageRowToCodewordIndex(Math.trunc(r.getY())),
  14509. o = this.imageRowToCodewordIndex(Math.trunc(n.getY())),
  14510. s = this.getCodewords(),
  14511. a = -1
  14512. for (let e = i; e < o; e++) {
  14513. if (null == s[e]) continue
  14514. let r = s[e]
  14515. r.setRowNumberAsRowIndicatorColumn()
  14516. let n = r.getRowNumber() - a
  14517. 0 === n || (1 === n ? (a = r.getRowNumber()) : r.getRowNumber() >= t.getRowCount() ? (s[e] = null) : (a = r.getRowNumber()))
  14518. }
  14519. }
  14520. getBarcodeMetadata() {
  14521. let t = this.getCodewords(),
  14522. e = new Ve(),
  14523. r = new Ve(),
  14524. n = new Ve(),
  14525. i = new Ve()
  14526. for (let o of t) {
  14527. if (null == o) continue
  14528. o.setRowNumberAsRowIndicatorColumn()
  14529. let t = o.getValue() % 30,
  14530. s = o.getRowNumber()
  14531. switch ((this._isLeft || (s += 2), s % 3)) {
  14532. case 0:
  14533. r.setValue(3 * t + 1)
  14534. break
  14535. case 1:
  14536. i.setValue(t / 3), n.setValue(t % 3)
  14537. break
  14538. case 2:
  14539. e.setValue(t + 1)
  14540. }
  14541. }
  14542. if (
  14543. 0 === e.getValue().length ||
  14544. 0 === r.getValue().length ||
  14545. 0 === n.getValue().length ||
  14546. 0 === i.getValue().length ||
  14547. e.getValue()[0] < 1 ||
  14548. r.getValue()[0] + n.getValue()[0] < be.MIN_ROWS_IN_BARCODE ||
  14549. r.getValue()[0] + n.getValue()[0] > be.MAX_ROWS_IN_BARCODE
  14550. )
  14551. return null
  14552. let o = new ke(e.getValue()[0], r.getValue()[0], n.getValue()[0], i.getValue()[0])
  14553. return this.removeIncorrectCodewords(t, o), o
  14554. }
  14555. removeIncorrectCodewords(t, e) {
  14556. for (let r = 0; r < t.length; r++) {
  14557. let n = t[r]
  14558. if (null == t[r]) continue
  14559. let i = n.getValue() % 30,
  14560. o = n.getRowNumber()
  14561. if (o > e.getRowCount()) t[r] = null
  14562. else
  14563. switch ((this._isLeft || (o += 2), o % 3)) {
  14564. case 0:
  14565. 3 * i + 1 !== e.getRowCountUpperPart() && (t[r] = null)
  14566. break
  14567. case 1:
  14568. ;(Math.trunc(i / 3) === e.getErrorCorrectionLevel() && i % 3 === e.getRowCountLowerPart()) || (t[r] = null)
  14569. break
  14570. case 2:
  14571. i + 1 !== e.getColumnCount() && (t[r] = null)
  14572. }
  14573. }
  14574. }
  14575. isLeft() {
  14576. return this._isLeft
  14577. }
  14578. toString() {
  14579. return 'IsLeft: ' + this._isLeft + '\n' + super.toString()
  14580. }
  14581. }
  14582. class Ge {
  14583. constructor(t, e) {
  14584. ;(this.ADJUST_ROW_NUMBER_SKIP = 2),
  14585. (this.barcodeMetadata = t),
  14586. (this.barcodeColumnCount = t.getColumnCount()),
  14587. (this.boundingBox = e),
  14588. (this.detectionResultColumns = new Array(this.barcodeColumnCount + 2))
  14589. }
  14590. getDetectionResultColumns() {
  14591. this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]), this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount + 1])
  14592. let t,
  14593. e = be.MAX_CODEWORDS_IN_BARCODE
  14594. do {
  14595. ;(t = e), (e = this.adjustRowNumbersAndGetCount())
  14596. } while (e > 0 && e < t)
  14597. return this.detectionResultColumns
  14598. }
  14599. adjustIndicatorColumnRowNumbers(t) {
  14600. null != t && t.adjustCompleteIndicatorColumnRowNumbers(this.barcodeMetadata)
  14601. }
  14602. adjustRowNumbersAndGetCount() {
  14603. let t = this.adjustRowNumbersByRow()
  14604. if (0 === t) return 0
  14605. for (let t = 1; t < this.barcodeColumnCount + 1; t++) {
  14606. let e = this.detectionResultColumns[t].getCodewords()
  14607. for (let r = 0; r < e.length; r++) null != e[r] && (e[r].hasValidRowNumber() || this.adjustRowNumbers(t, r, e))
  14608. }
  14609. return t
  14610. }
  14611. adjustRowNumbersByRow() {
  14612. return this.adjustRowNumbersFromBothRI(), this.adjustRowNumbersFromLRI() + this.adjustRowNumbersFromRRI()
  14613. }
  14614. adjustRowNumbersFromBothRI() {
  14615. if (null == this.detectionResultColumns[0] || null == this.detectionResultColumns[this.barcodeColumnCount + 1]) return
  14616. let t = this.detectionResultColumns[0].getCodewords(),
  14617. e = this.detectionResultColumns[this.barcodeColumnCount + 1].getCodewords()
  14618. for (let r = 0; r < t.length; r++)
  14619. if (null != t[r] && null != e[r] && t[r].getRowNumber() === e[r].getRowNumber())
  14620. for (let e = 1; e <= this.barcodeColumnCount; e++) {
  14621. let n = this.detectionResultColumns[e].getCodewords()[r]
  14622. null != n && (n.setRowNumber(t[r].getRowNumber()), n.hasValidRowNumber() || (this.detectionResultColumns[e].getCodewords()[r] = null))
  14623. }
  14624. }
  14625. adjustRowNumbersFromRRI() {
  14626. if (null == this.detectionResultColumns[this.barcodeColumnCount + 1]) return 0
  14627. let t = 0,
  14628. e = this.detectionResultColumns[this.barcodeColumnCount + 1].getCodewords()
  14629. for (let r = 0; r < e.length; r++) {
  14630. if (null == e[r]) continue
  14631. let n = e[r].getRowNumber(),
  14632. i = 0
  14633. for (let e = this.barcodeColumnCount + 1; e > 0 && i < this.ADJUST_ROW_NUMBER_SKIP; e--) {
  14634. let o = this.detectionResultColumns[e].getCodewords()[r]
  14635. null != o && ((i = Ge.adjustRowNumberIfValid(n, i, o)), o.hasValidRowNumber() || t++)
  14636. }
  14637. }
  14638. return t
  14639. }
  14640. adjustRowNumbersFromLRI() {
  14641. if (null == this.detectionResultColumns[0]) return 0
  14642. let t = 0,
  14643. e = this.detectionResultColumns[0].getCodewords()
  14644. for (let r = 0; r < e.length; r++) {
  14645. if (null == e[r]) continue
  14646. let n = e[r].getRowNumber(),
  14647. i = 0
  14648. for (let e = 1; e < this.barcodeColumnCount + 1 && i < this.ADJUST_ROW_NUMBER_SKIP; e++) {
  14649. let o = this.detectionResultColumns[e].getCodewords()[r]
  14650. null != o && ((i = Ge.adjustRowNumberIfValid(n, i, o)), o.hasValidRowNumber() || t++)
  14651. }
  14652. }
  14653. return t
  14654. }
  14655. static adjustRowNumberIfValid(t, e, r) {
  14656. return null == r || r.hasValidRowNumber() || (r.isValidRowNumber(t) ? (r.setRowNumber(t), (e = 0)) : ++e), e
  14657. }
  14658. adjustRowNumbers(t, e, r) {
  14659. let n = r[e],
  14660. i = this.detectionResultColumns[t - 1].getCodewords(),
  14661. o = i
  14662. null != this.detectionResultColumns[t + 1] && (o = this.detectionResultColumns[t + 1].getCodewords())
  14663. let s = new Array(14)
  14664. ;(s[2] = i[e]),
  14665. (s[3] = o[e]),
  14666. e > 0 && ((s[0] = r[e - 1]), (s[4] = i[e - 1]), (s[5] = o[e - 1])),
  14667. e > 1 && ((s[8] = r[e - 2]), (s[10] = i[e - 2]), (s[11] = o[e - 2])),
  14668. e < r.length - 1 && ((s[1] = r[e + 1]), (s[6] = i[e + 1]), (s[7] = o[e + 1])),
  14669. e < r.length - 2 && ((s[9] = r[e + 2]), (s[12] = i[e + 2]), (s[13] = o[e + 2]))
  14670. for (let t of s) if (Ge.adjustRowNumber(n, t)) return
  14671. }
  14672. static adjustRowNumber(t, e) {
  14673. return !(null == e || !e.hasValidRowNumber() || e.getBucket() !== t.getBucket() || (t.setRowNumber(e.getRowNumber()), 0))
  14674. }
  14675. getBarcodeColumnCount() {
  14676. return this.barcodeColumnCount
  14677. }
  14678. getBarcodeRowCount() {
  14679. return this.barcodeMetadata.getRowCount()
  14680. }
  14681. getBarcodeECLevel() {
  14682. return this.barcodeMetadata.getErrorCorrectionLevel()
  14683. }
  14684. setBoundingBox(t) {
  14685. this.boundingBox = t
  14686. }
  14687. getBoundingBox() {
  14688. return this.boundingBox
  14689. }
  14690. setDetectionResultColumn(t, e) {
  14691. this.detectionResultColumns[t] = e
  14692. }
  14693. getDetectionResultColumn(t) {
  14694. return this.detectionResultColumns[t]
  14695. }
  14696. toString() {
  14697. let t = this.detectionResultColumns[0]
  14698. null == t && (t = this.detectionResultColumns[this.barcodeColumnCount + 1])
  14699. let e = new Ue()
  14700. for (let r = 0; r < t.getCodewords().length; r++) {
  14701. e.format('CW %3d:', r)
  14702. for (let t = 0; t < this.barcodeColumnCount + 2; t++) {
  14703. if (null == this.detectionResultColumns[t]) {
  14704. e.format(' | ')
  14705. continue
  14706. }
  14707. let n = this.detectionResultColumns[t].getCodewords()[r]
  14708. null != n ? e.format(' %3d|%3d', n.getRowNumber(), n.getValue()) : e.format(' | ')
  14709. }
  14710. e.format('%n')
  14711. }
  14712. return e.toString()
  14713. }
  14714. }
  14715. class Ye {
  14716. constructor(t, e, r, n) {
  14717. ;(this.rowNumber = Ye.BARCODE_ROW_UNKNOWN), (this.startX = Math.trunc(t)), (this.endX = Math.trunc(e)), (this.bucket = Math.trunc(r)), (this.value = Math.trunc(n))
  14718. }
  14719. hasValidRowNumber() {
  14720. return this.isValidRowNumber(this.rowNumber)
  14721. }
  14722. isValidRowNumber(t) {
  14723. return t !== Ye.BARCODE_ROW_UNKNOWN && this.bucket === (t % 3) * 3
  14724. }
  14725. setRowNumberAsRowIndicatorColumn() {
  14726. this.rowNumber = Math.trunc(3 * Math.trunc(this.value / 30) + Math.trunc(this.bucket / 3))
  14727. }
  14728. getWidth() {
  14729. return this.endX - this.startX
  14730. }
  14731. getStartX() {
  14732. return this.startX
  14733. }
  14734. getEndX() {
  14735. return this.endX
  14736. }
  14737. getBucket() {
  14738. return this.bucket
  14739. }
  14740. getValue() {
  14741. return this.value
  14742. }
  14743. getRowNumber() {
  14744. return this.rowNumber
  14745. }
  14746. setRowNumber(t) {
  14747. this.rowNumber = t
  14748. }
  14749. toString() {
  14750. return this.rowNumber + '|' + this.value
  14751. }
  14752. }
  14753. Ye.BARCODE_ROW_UNKNOWN = -1
  14754. class Xe {
  14755. static initialize() {
  14756. for (let t = 0; t < be.SYMBOL_TABLE.length; t++) {
  14757. let e = be.SYMBOL_TABLE[t],
  14758. r = 1 & e
  14759. for (let n = 0; n < be.BARS_IN_MODULE; n++) {
  14760. let i = 0
  14761. for (; (1 & e) === r; ) (i += 1), (e >>= 1)
  14762. ;(r = 1 & e),
  14763. Xe.RATIOS_TABLE[t] || (Xe.RATIOS_TABLE[t] = new Array(be.BARS_IN_MODULE)),
  14764. (Xe.RATIOS_TABLE[t][be.BARS_IN_MODULE - n - 1] = Math.fround(i / be.MODULES_IN_CODEWORD))
  14765. }
  14766. }
  14767. this.bSymbolTableReady = !0
  14768. }
  14769. static getDecodedValue(t) {
  14770. let e = Xe.getDecodedCodewordValue(Xe.sampleBitCounts(t))
  14771. return -1 !== e ? e : Xe.getClosestDecodedValue(t)
  14772. }
  14773. static sampleBitCounts(t) {
  14774. let e = et.sum(t),
  14775. r = new Int32Array(be.BARS_IN_MODULE),
  14776. n = 0,
  14777. i = 0
  14778. for (let o = 0; o < be.MODULES_IN_CODEWORD; o++) {
  14779. let s = e / (2 * be.MODULES_IN_CODEWORD) + (o * e) / be.MODULES_IN_CODEWORD
  14780. i + t[n] <= s && ((i += t[n]), n++), r[n]++
  14781. }
  14782. return r
  14783. }
  14784. static getDecodedCodewordValue(t) {
  14785. let e = Xe.getBitValue(t)
  14786. return -1 === be.getCodeword(e) ? -1 : e
  14787. }
  14788. static getBitValue(t) {
  14789. let e = 0
  14790. for (let r = 0; r < t.length; r++) for (let n = 0; n < t[r]; n++) e = (e << 1) | (r % 2 == 0 ? 1 : 0)
  14791. return Math.trunc(e)
  14792. }
  14793. static getClosestDecodedValue(t) {
  14794. let e = et.sum(t),
  14795. r = new Array(be.BARS_IN_MODULE)
  14796. if (e > 1) for (let n = 0; n < r.length; n++) r[n] = Math.fround(t[n] / e)
  14797. let n = rt.MAX_VALUE,
  14798. i = -1
  14799. this.bSymbolTableReady || Xe.initialize()
  14800. for (let t = 0; t < Xe.RATIOS_TABLE.length; t++) {
  14801. let e = 0,
  14802. o = Xe.RATIOS_TABLE[t]
  14803. for (let t = 0; t < be.BARS_IN_MODULE; t++) {
  14804. let i = Math.fround(o[t] - r[t])
  14805. if (((e += Math.fround(i * i)), e >= n)) break
  14806. }
  14807. e < n && ((n = e), (i = be.SYMBOL_TABLE[t]))
  14808. }
  14809. return i
  14810. }
  14811. }
  14812. ;(Xe.bSymbolTableReady = !1), (Xe.RATIOS_TABLE = new Array(be.SYMBOL_TABLE.length).map(t => new Array(be.BARS_IN_MODULE)))
  14813. class We {
  14814. constructor() {
  14815. ;(this.segmentCount = -1), (this.fileSize = -1), (this.timestamp = -1), (this.checksum = -1)
  14816. }
  14817. getSegmentIndex() {
  14818. return this.segmentIndex
  14819. }
  14820. setSegmentIndex(t) {
  14821. this.segmentIndex = t
  14822. }
  14823. getFileId() {
  14824. return this.fileId
  14825. }
  14826. setFileId(t) {
  14827. this.fileId = t
  14828. }
  14829. getOptionalData() {
  14830. return this.optionalData
  14831. }
  14832. setOptionalData(t) {
  14833. this.optionalData = t
  14834. }
  14835. isLastSegment() {
  14836. return this.lastSegment
  14837. }
  14838. setLastSegment(t) {
  14839. this.lastSegment = t
  14840. }
  14841. getSegmentCount() {
  14842. return this.segmentCount
  14843. }
  14844. setSegmentCount(t) {
  14845. this.segmentCount = t
  14846. }
  14847. getSender() {
  14848. return this.sender || null
  14849. }
  14850. setSender(t) {
  14851. this.sender = t
  14852. }
  14853. getAddressee() {
  14854. return this.addressee || null
  14855. }
  14856. setAddressee(t) {
  14857. this.addressee = t
  14858. }
  14859. getFileName() {
  14860. return this.fileName
  14861. }
  14862. setFileName(t) {
  14863. this.fileName = t
  14864. }
  14865. getFileSize() {
  14866. return this.fileSize
  14867. }
  14868. setFileSize(t) {
  14869. this.fileSize = t
  14870. }
  14871. getChecksum() {
  14872. return this.checksum
  14873. }
  14874. setChecksum(t) {
  14875. this.checksum = t
  14876. }
  14877. getTimestamp() {
  14878. return this.timestamp
  14879. }
  14880. setTimestamp(t) {
  14881. this.timestamp = t
  14882. }
  14883. }
  14884. class je {
  14885. static parseLong(t, e) {
  14886. return parseInt(t, e)
  14887. }
  14888. }
  14889. class Ze extends o {}
  14890. Ze.kind = 'NullPointerException'
  14891. class Qe extends o {}
  14892. class Ke extends class {
  14893. writeBytes(t) {
  14894. this.writeBytesOffset(t, 0, t.length)
  14895. }
  14896. writeBytesOffset(t, e, r) {
  14897. if (null == t) throw new Ze()
  14898. if (e < 0 || e > t.length || r < 0 || e + r > t.length || e + r < 0) throw new d()
  14899. if (0 !== r) for (let n = 0; n < r; n++) this.write(t[e + n])
  14900. }
  14901. flush() {}
  14902. close() {}
  14903. } {
  14904. constructor(t = 32) {
  14905. if ((super(), (this.count = 0), t < 0)) throw new a('Negative initial size: ' + t)
  14906. this.buf = new Uint8Array(t)
  14907. }
  14908. ensureCapacity(t) {
  14909. t - this.buf.length > 0 && this.grow(t)
  14910. }
  14911. grow(t) {
  14912. let e = this.buf.length << 1
  14913. if ((e - t < 0 && (e = t), e < 0)) {
  14914. if (t < 0) throw new Qe()
  14915. e = w.MAX_VALUE
  14916. }
  14917. this.buf = f.copyOfUint8Array(this.buf, e)
  14918. }
  14919. write(t) {
  14920. this.ensureCapacity(this.count + 1), (this.buf[this.count] = t), (this.count += 1)
  14921. }
  14922. writeBytesOffset(t, e, r) {
  14923. if (e < 0 || e > t.length || r < 0 || e + r - t.length > 0) throw new d()
  14924. this.ensureCapacity(this.count + r), u.arraycopy(t, e, this.buf, this.count, r), (this.count += r)
  14925. }
  14926. writeTo(t) {
  14927. t.writeBytesOffset(this.buf, 0, this.count)
  14928. }
  14929. reset() {
  14930. this.count = 0
  14931. }
  14932. toByteArray() {
  14933. return f.copyOfUint8Array(this.buf, this.count)
  14934. }
  14935. size() {
  14936. return this.count
  14937. }
  14938. toString(t) {
  14939. return t ? ('string' == typeof t ? this.toString_string(t) : this.toString_number(t)) : this.toString_void()
  14940. }
  14941. toString_void() {
  14942. return new String(this.buf).toString()
  14943. }
  14944. toString_string(t) {
  14945. return new String(this.buf).toString()
  14946. }
  14947. toString_number(t) {
  14948. return new String(this.buf).toString()
  14949. }
  14950. close() {}
  14951. }
  14952. function qe() {
  14953. if ('undefined' != typeof window) return window.BigInt || null
  14954. if (void 0 !== r.g) return r.g.BigInt || null
  14955. if ('undefined' != typeof self) return self.BigInt || null
  14956. throw new Error("Can't search globals for BigInt!")
  14957. }
  14958. let Je
  14959. function $e(t) {
  14960. if ((void 0 === Je && (Je = qe()), null === Je)) throw new Error('BigInt is not supported!')
  14961. return Je(t)
  14962. }
  14963. !(function(t) {
  14964. ;(t[(t.ALPHA = 0)] = 'ALPHA'),
  14965. (t[(t.LOWER = 1)] = 'LOWER'),
  14966. (t[(t.MIXED = 2)] = 'MIXED'),
  14967. (t[(t.PUNCT = 3)] = 'PUNCT'),
  14968. (t[(t.ALPHA_SHIFT = 4)] = 'ALPHA_SHIFT'),
  14969. (t[(t.PUNCT_SHIFT = 5)] = 'PUNCT_SHIFT')
  14970. })(Y || (Y = {}))
  14971. class tr {
  14972. static decode(t, e) {
  14973. let r = new T(''),
  14974. n = I.ISO8859_1
  14975. r.enableDecoding(n)
  14976. let i = 1,
  14977. o = t[i++],
  14978. s = new We()
  14979. for (; i < t[0]; ) {
  14980. switch (o) {
  14981. case tr.TEXT_COMPACTION_MODE_LATCH:
  14982. i = tr.textCompaction(t, i, r)
  14983. break
  14984. case tr.BYTE_COMPACTION_MODE_LATCH:
  14985. case tr.BYTE_COMPACTION_MODE_LATCH_6:
  14986. i = tr.byteCompaction(o, t, n, i, r)
  14987. break
  14988. case tr.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
  14989. r.append(t[i++])
  14990. break
  14991. case tr.NUMERIC_COMPACTION_MODE_LATCH:
  14992. i = tr.numericCompaction(t, i, r)
  14993. break
  14994. case tr.ECI_CHARSET:
  14995. I.getCharacterSetECIByValue(t[i++])
  14996. break
  14997. case tr.ECI_GENERAL_PURPOSE:
  14998. i += 2
  14999. break
  15000. case tr.ECI_USER_DEFINED:
  15001. i++
  15002. break
  15003. case tr.BEGIN_MACRO_PDF417_CONTROL_BLOCK:
  15004. i = tr.decodeMacroBlock(t, i, s)
  15005. break
  15006. case tr.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:
  15007. case tr.MACRO_PDF417_TERMINATOR:
  15008. throw new C()
  15009. default:
  15010. i--, (i = tr.textCompaction(t, i, r))
  15011. }
  15012. if (!(i < t.length)) throw C.getFormatInstance()
  15013. o = t[i++]
  15014. }
  15015. if (0 === r.length()) throw C.getFormatInstance()
  15016. let a = new W(null, r.toString(), null, e)
  15017. return a.setOther(s), a
  15018. }
  15019. static decodeMacroBlock(t, e, r) {
  15020. if (e + tr.NUMBER_OF_SEQUENCE_CODEWORDS > t[0]) throw C.getFormatInstance()
  15021. let n = new Int32Array(tr.NUMBER_OF_SEQUENCE_CODEWORDS)
  15022. for (let r = 0; r < tr.NUMBER_OF_SEQUENCE_CODEWORDS; r++, e++) n[r] = t[e]
  15023. r.setSegmentIndex(w.parseInt(tr.decodeBase900toBase10(n, tr.NUMBER_OF_SEQUENCE_CODEWORDS)))
  15024. let i = new T()
  15025. ;(e = tr.textCompaction(t, e, i)), r.setFileId(i.toString())
  15026. let o = -1
  15027. for (t[e] === tr.BEGIN_MACRO_PDF417_OPTIONAL_FIELD && (o = e + 1); e < t[0]; )
  15028. switch (t[e]) {
  15029. case tr.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:
  15030. switch (t[++e]) {
  15031. case tr.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:
  15032. let n = new T()
  15033. ;(e = tr.textCompaction(t, e + 1, n)), r.setFileName(n.toString())
  15034. break
  15035. case tr.MACRO_PDF417_OPTIONAL_FIELD_SENDER:
  15036. let i = new T()
  15037. ;(e = tr.textCompaction(t, e + 1, i)), r.setSender(i.toString())
  15038. break
  15039. case tr.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:
  15040. let o = new T()
  15041. ;(e = tr.textCompaction(t, e + 1, o)), r.setAddressee(o.toString())
  15042. break
  15043. case tr.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:
  15044. let s = new T()
  15045. ;(e = tr.numericCompaction(t, e + 1, s)), r.setSegmentCount(w.parseInt(s.toString()))
  15046. break
  15047. case tr.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:
  15048. let a = new T()
  15049. ;(e = tr.numericCompaction(t, e + 1, a)), r.setTimestamp(je.parseLong(a.toString()))
  15050. break
  15051. case tr.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:
  15052. let l = new T()
  15053. ;(e = tr.numericCompaction(t, e + 1, l)), r.setChecksum(w.parseInt(l.toString()))
  15054. break
  15055. case tr.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:
  15056. let c = new T()
  15057. ;(e = tr.numericCompaction(t, e + 1, c)), r.setFileSize(je.parseLong(c.toString()))
  15058. break
  15059. default:
  15060. throw C.getFormatInstance()
  15061. }
  15062. break
  15063. case tr.MACRO_PDF417_TERMINATOR:
  15064. e++, r.setLastSegment(!0)
  15065. break
  15066. default:
  15067. throw C.getFormatInstance()
  15068. }
  15069. if (-1 !== o) {
  15070. let n = e - o
  15071. r.isLastSegment() && n--, r.setOptionalData(f.copyOfRange(t, o, o + n))
  15072. }
  15073. return e
  15074. }
  15075. static textCompaction(t, e, r) {
  15076. let n = new Int32Array(2 * (t[0] - e)),
  15077. i = new Int32Array(2 * (t[0] - e)),
  15078. o = 0,
  15079. s = !1
  15080. for (; e < t[0] && !s; ) {
  15081. let r = t[e++]
  15082. if (r < tr.TEXT_COMPACTION_MODE_LATCH) (n[o] = r / 30), (n[o + 1] = r % 30), (o += 2)
  15083. else
  15084. switch (r) {
  15085. case tr.TEXT_COMPACTION_MODE_LATCH:
  15086. n[o++] = tr.TEXT_COMPACTION_MODE_LATCH
  15087. break
  15088. case tr.BYTE_COMPACTION_MODE_LATCH:
  15089. case tr.BYTE_COMPACTION_MODE_LATCH_6:
  15090. case tr.NUMERIC_COMPACTION_MODE_LATCH:
  15091. case tr.BEGIN_MACRO_PDF417_CONTROL_BLOCK:
  15092. case tr.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:
  15093. case tr.MACRO_PDF417_TERMINATOR:
  15094. e--, (s = !0)
  15095. break
  15096. case tr.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
  15097. ;(n[o] = tr.MODE_SHIFT_TO_BYTE_COMPACTION_MODE), (r = t[e++]), (i[o] = r), o++
  15098. }
  15099. }
  15100. return tr.decodeTextCompaction(n, i, o, r), e
  15101. }
  15102. static decodeTextCompaction(t, e, r, n) {
  15103. let i = Y.ALPHA,
  15104. o = Y.ALPHA,
  15105. s = 0
  15106. for (; s < r; ) {
  15107. let r = t[s],
  15108. a = ''
  15109. switch (i) {
  15110. case Y.ALPHA:
  15111. if (r < 26) a = String.fromCharCode(65 + r)
  15112. else
  15113. switch (r) {
  15114. case 26:
  15115. a = ' '
  15116. break
  15117. case tr.LL:
  15118. i = Y.LOWER
  15119. break
  15120. case tr.ML:
  15121. i = Y.MIXED
  15122. break
  15123. case tr.PS:
  15124. ;(o = i), (i = Y.PUNCT_SHIFT)
  15125. break
  15126. case tr.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
  15127. n.append(e[s])
  15128. break
  15129. case tr.TEXT_COMPACTION_MODE_LATCH:
  15130. i = Y.ALPHA
  15131. }
  15132. break
  15133. case Y.LOWER:
  15134. if (r < 26) a = String.fromCharCode(97 + r)
  15135. else
  15136. switch (r) {
  15137. case 26:
  15138. a = ' '
  15139. break
  15140. case tr.AS:
  15141. ;(o = i), (i = Y.ALPHA_SHIFT)
  15142. break
  15143. case tr.ML:
  15144. i = Y.MIXED
  15145. break
  15146. case tr.PS:
  15147. ;(o = i), (i = Y.PUNCT_SHIFT)
  15148. break
  15149. case tr.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
  15150. n.append(e[s])
  15151. break
  15152. case tr.TEXT_COMPACTION_MODE_LATCH:
  15153. i = Y.ALPHA
  15154. }
  15155. break
  15156. case Y.MIXED:
  15157. if (r < tr.PL) a = tr.MIXED_CHARS[r]
  15158. else
  15159. switch (r) {
  15160. case tr.PL:
  15161. i = Y.PUNCT
  15162. break
  15163. case 26:
  15164. a = ' '
  15165. break
  15166. case tr.LL:
  15167. i = Y.LOWER
  15168. break
  15169. case tr.AL:
  15170. i = Y.ALPHA
  15171. break
  15172. case tr.PS:
  15173. ;(o = i), (i = Y.PUNCT_SHIFT)
  15174. break
  15175. case tr.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
  15176. n.append(e[s])
  15177. break
  15178. case tr.TEXT_COMPACTION_MODE_LATCH:
  15179. i = Y.ALPHA
  15180. }
  15181. break
  15182. case Y.PUNCT:
  15183. if (r < tr.PAL) a = tr.PUNCT_CHARS[r]
  15184. else
  15185. switch (r) {
  15186. case tr.PAL:
  15187. i = Y.ALPHA
  15188. break
  15189. case tr.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
  15190. n.append(e[s])
  15191. break
  15192. case tr.TEXT_COMPACTION_MODE_LATCH:
  15193. i = Y.ALPHA
  15194. }
  15195. break
  15196. case Y.ALPHA_SHIFT:
  15197. if (((i = o), r < 26)) a = String.fromCharCode(65 + r)
  15198. else
  15199. switch (r) {
  15200. case 26:
  15201. a = ' '
  15202. break
  15203. case tr.TEXT_COMPACTION_MODE_LATCH:
  15204. i = Y.ALPHA
  15205. }
  15206. break
  15207. case Y.PUNCT_SHIFT:
  15208. if (((i = o), r < tr.PAL)) a = tr.PUNCT_CHARS[r]
  15209. else
  15210. switch (r) {
  15211. case tr.PAL:
  15212. i = Y.ALPHA
  15213. break
  15214. case tr.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
  15215. n.append(e[s])
  15216. break
  15217. case tr.TEXT_COMPACTION_MODE_LATCH:
  15218. i = Y.ALPHA
  15219. }
  15220. }
  15221. '' !== a && n.append(a), s++
  15222. }
  15223. }
  15224. static byteCompaction(t, e, r, n, i) {
  15225. let o = new Ke(),
  15226. s = 0,
  15227. a = 0,
  15228. l = !1
  15229. switch (t) {
  15230. case tr.BYTE_COMPACTION_MODE_LATCH:
  15231. let t = new Int32Array(6),
  15232. r = e[n++]
  15233. for (; n < e[0] && !l; )
  15234. switch (((t[s++] = r), (a = 900 * a + r), (r = e[n++]), r)) {
  15235. case tr.TEXT_COMPACTION_MODE_LATCH:
  15236. case tr.BYTE_COMPACTION_MODE_LATCH:
  15237. case tr.NUMERIC_COMPACTION_MODE_LATCH:
  15238. case tr.BYTE_COMPACTION_MODE_LATCH_6:
  15239. case tr.BEGIN_MACRO_PDF417_CONTROL_BLOCK:
  15240. case tr.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:
  15241. case tr.MACRO_PDF417_TERMINATOR:
  15242. n--, (l = !0)
  15243. break
  15244. default:
  15245. if (s % 5 == 0 && s > 0) {
  15246. for (let t = 0; t < 6; ++t) o.write(Number($e(a) >> $e(8 * (5 - t))))
  15247. ;(a = 0), (s = 0)
  15248. }
  15249. }
  15250. n === e[0] && r < tr.TEXT_COMPACTION_MODE_LATCH && (t[s++] = r)
  15251. for (let e = 0; e < s; e++) o.write(t[e])
  15252. break
  15253. case tr.BYTE_COMPACTION_MODE_LATCH_6:
  15254. for (; n < e[0] && !l; ) {
  15255. let t = e[n++]
  15256. if (t < tr.TEXT_COMPACTION_MODE_LATCH) s++, (a = 900 * a + t)
  15257. else
  15258. switch (t) {
  15259. case tr.TEXT_COMPACTION_MODE_LATCH:
  15260. case tr.BYTE_COMPACTION_MODE_LATCH:
  15261. case tr.NUMERIC_COMPACTION_MODE_LATCH:
  15262. case tr.BYTE_COMPACTION_MODE_LATCH_6:
  15263. case tr.BEGIN_MACRO_PDF417_CONTROL_BLOCK:
  15264. case tr.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:
  15265. case tr.MACRO_PDF417_TERMINATOR:
  15266. n--, (l = !0)
  15267. }
  15268. if (s % 5 == 0 && s > 0) {
  15269. for (let t = 0; t < 6; ++t) o.write(Number($e(a) >> $e(8 * (5 - t))))
  15270. ;(a = 0), (s = 0)
  15271. }
  15272. }
  15273. }
  15274. return i.append(S.decode(o.toByteArray(), r)), n
  15275. }
  15276. static numericCompaction(t, e, r) {
  15277. let n = 0,
  15278. i = !1,
  15279. o = new Int32Array(tr.MAX_NUMERIC_CODEWORDS)
  15280. for (; e < t[0] && !i; ) {
  15281. let s = t[e++]
  15282. if ((e === t[0] && (i = !0), s < tr.TEXT_COMPACTION_MODE_LATCH)) (o[n] = s), n++
  15283. else
  15284. switch (s) {
  15285. case tr.TEXT_COMPACTION_MODE_LATCH:
  15286. case tr.BYTE_COMPACTION_MODE_LATCH:
  15287. case tr.BYTE_COMPACTION_MODE_LATCH_6:
  15288. case tr.BEGIN_MACRO_PDF417_CONTROL_BLOCK:
  15289. case tr.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:
  15290. case tr.MACRO_PDF417_TERMINATOR:
  15291. e--, (i = !0)
  15292. }
  15293. ;(n % tr.MAX_NUMERIC_CODEWORDS == 0 || s === tr.NUMERIC_COMPACTION_MODE_LATCH || i) && n > 0 && (r.append(tr.decodeBase900toBase10(o, n)), (n = 0))
  15294. }
  15295. return e
  15296. }
  15297. static decodeBase900toBase10(t, e) {
  15298. let r = $e(0)
  15299. for (let n = 0; n < e; n++) r += tr.EXP900[e - n - 1] * $e(t[n])
  15300. let n = r.toString()
  15301. if ('1' !== n.charAt(0)) throw new C()
  15302. return n.substring(1)
  15303. }
  15304. }
  15305. ;(tr.TEXT_COMPACTION_MODE_LATCH = 900),
  15306. (tr.BYTE_COMPACTION_MODE_LATCH = 901),
  15307. (tr.NUMERIC_COMPACTION_MODE_LATCH = 902),
  15308. (tr.BYTE_COMPACTION_MODE_LATCH_6 = 924),
  15309. (tr.ECI_USER_DEFINED = 925),
  15310. (tr.ECI_GENERAL_PURPOSE = 926),
  15311. (tr.ECI_CHARSET = 927),
  15312. (tr.BEGIN_MACRO_PDF417_CONTROL_BLOCK = 928),
  15313. (tr.BEGIN_MACRO_PDF417_OPTIONAL_FIELD = 923),
  15314. (tr.MACRO_PDF417_TERMINATOR = 922),
  15315. (tr.MODE_SHIFT_TO_BYTE_COMPACTION_MODE = 913),
  15316. (tr.MAX_NUMERIC_CODEWORDS = 15),
  15317. (tr.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME = 0),
  15318. (tr.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT = 1),
  15319. (tr.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP = 2),
  15320. (tr.MACRO_PDF417_OPTIONAL_FIELD_SENDER = 3),
  15321. (tr.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE = 4),
  15322. (tr.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE = 5),
  15323. (tr.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM = 6),
  15324. (tr.PL = 25),
  15325. (tr.LL = 27),
  15326. (tr.AS = 27),
  15327. (tr.ML = 28),
  15328. (tr.AL = 28),
  15329. (tr.PS = 29),
  15330. (tr.PAL = 29),
  15331. (tr.PUNCT_CHARS = ';<>@[\\]_`~!\r\t,:\n-.$/"|*()?{}\''),
  15332. (tr.MIXED_CHARS = '0123456789&\r\t,:#-.$/+%*=^'),
  15333. (tr.EXP900 = qe()
  15334. ? (function() {
  15335. let t = []
  15336. t[0] = $e(1)
  15337. let e = $e(900)
  15338. t[1] = e
  15339. for (let r = 2; r < 16; r++) t[r] = t[r - 1] * e
  15340. return t
  15341. })()
  15342. : []),
  15343. (tr.NUMBER_OF_SEQUENCE_CODEWORDS = 2)
  15344. class er {
  15345. constructor() {}
  15346. static decode(t, e, r, n, i, o, s) {
  15347. let a,
  15348. l = new xe(t, e, r, n, i),
  15349. c = null,
  15350. h = null
  15351. for (let r = !0; ; r = !1) {
  15352. if ((null != e && (c = er.getRowIndicatorColumn(t, l, e, !0, o, s)), null != n && (h = er.getRowIndicatorColumn(t, l, n, !1, o, s)), (a = er.merge(c, h)), null == a))
  15353. throw N.getNotFoundInstance()
  15354. let i = a.getBoundingBox()
  15355. if (!r || null == i || !(i.getMinY() < l.getMinY() || i.getMaxY() > l.getMaxY())) break
  15356. l = i
  15357. }
  15358. a.setBoundingBox(l)
  15359. let u = a.getBarcodeColumnCount() + 1
  15360. a.setDetectionResultColumn(0, c), a.setDetectionResultColumn(u, h)
  15361. let d = null != c
  15362. for (let e = 1; e <= u; e++) {
  15363. let r,
  15364. n = d ? e : u - e
  15365. if (void 0 !== a.getDetectionResultColumn(n)) continue
  15366. ;(r = 0 === n || n === u ? new ze(l, 0 === n) : new He(l)), a.setDetectionResultColumn(n, r)
  15367. let i = -1,
  15368. c = i
  15369. for (let e = l.getMinY(); e <= l.getMaxY(); e++) {
  15370. if (((i = er.getStartColumn(a, n, e, d)), i < 0 || i > l.getMaxX())) {
  15371. if (-1 === c) continue
  15372. i = c
  15373. }
  15374. let h = er.detectCodeword(t, l.getMinX(), l.getMaxX(), d, i, e, o, s)
  15375. null != h && (r.setCodeword(e, h), (c = i), (o = Math.min(o, h.getWidth())), (s = Math.max(s, h.getWidth())))
  15376. }
  15377. }
  15378. return er.createDecoderResult(a)
  15379. }
  15380. static merge(t, e) {
  15381. if (null == t && null == e) return null
  15382. let r = er.getBarcodeMetadata(t, e)
  15383. if (null == r) return null
  15384. let n = xe.merge(er.adjustBoundingBox(t), er.adjustBoundingBox(e))
  15385. return new Ge(r, n)
  15386. }
  15387. static adjustBoundingBox(t) {
  15388. if (null == t) return null
  15389. let e = t.getRowHeights()
  15390. if (null == e) return null
  15391. let r = er.getMax(e),
  15392. n = 0
  15393. for (let t of e) if (((n += r - t), t > 0)) break
  15394. let i = t.getCodewords()
  15395. for (let t = 0; n > 0 && null == i[t]; t++) n--
  15396. let o = 0
  15397. for (let t = e.length - 1; t >= 0 && ((o += r - e[t]), !(e[t] > 0)); t--);
  15398. for (let t = i.length - 1; o > 0 && null == i[t]; t--) o--
  15399. return t.getBoundingBox().addMissingRows(n, o, t.isLeft())
  15400. }
  15401. static getMax(t) {
  15402. let e = -1
  15403. for (let r of t) e = Math.max(e, r)
  15404. return e
  15405. }
  15406. static getBarcodeMetadata(t, e) {
  15407. let r, n
  15408. return null == t || null == (r = t.getBarcodeMetadata())
  15409. ? null == e
  15410. ? null
  15411. : e.getBarcodeMetadata()
  15412. : null == e || null == (n = e.getBarcodeMetadata())
  15413. ? r
  15414. : r.getColumnCount() !== n.getColumnCount() && r.getErrorCorrectionLevel() !== n.getErrorCorrectionLevel() && r.getRowCount() !== n.getRowCount()
  15415. ? null
  15416. : r
  15417. }
  15418. static getRowIndicatorColumn(t, e, r, n, i, o) {
  15419. let s = new ze(e, n)
  15420. for (let a = 0; a < 2; a++) {
  15421. let l = 0 === a ? 1 : -1,
  15422. c = Math.trunc(Math.trunc(r.getX()))
  15423. for (let a = Math.trunc(Math.trunc(r.getY())); a <= e.getMaxY() && a >= e.getMinY(); a += l) {
  15424. let e = er.detectCodeword(t, 0, t.getWidth(), n, c, a, i, o)
  15425. null != e && (s.setCodeword(a, e), (c = n ? e.getStartX() : e.getEndX()))
  15426. }
  15427. }
  15428. return s
  15429. }
  15430. static adjustCodewordCount(t, e) {
  15431. let r = e[0][1],
  15432. n = r.getValue(),
  15433. i = t.getBarcodeColumnCount() * t.getBarcodeRowCount() - er.getNumberOfECCodeWords(t.getBarcodeECLevel())
  15434. if (0 === n.length) {
  15435. if (i < 1 || i > be.MAX_CODEWORDS_IN_BARCODE) throw N.getNotFoundInstance()
  15436. r.setValue(i)
  15437. } else n[0] !== i && r.setValue(i)
  15438. }
  15439. static createDecoderResult(t) {
  15440. let e = er.createBarcodeMatrix(t)
  15441. er.adjustCodewordCount(t, e)
  15442. let r = new Array(),
  15443. n = new Int32Array(t.getBarcodeRowCount() * t.getBarcodeColumnCount()),
  15444. i = [],
  15445. o = new Array()
  15446. for (let s = 0; s < t.getBarcodeRowCount(); s++)
  15447. for (let a = 0; a < t.getBarcodeColumnCount(); a++) {
  15448. let l = e[s][a + 1].getValue(),
  15449. c = s * t.getBarcodeColumnCount() + a
  15450. 0 === l.length ? r.push(c) : 1 === l.length ? (n[c] = l[0]) : (o.push(c), i.push(l))
  15451. }
  15452. let s = new Array(i.length)
  15453. for (let t = 0; t < s.length; t++) s[t] = i[t]
  15454. return er.createDecoderResultFromAmbiguousValues(t.getBarcodeECLevel(), n, be.toIntArray(r), be.toIntArray(o), s)
  15455. }
  15456. static createDecoderResultFromAmbiguousValues(t, e, r, n, i) {
  15457. let o = new Int32Array(n.length),
  15458. s = 100
  15459. for (; s-- > 0; ) {
  15460. for (let t = 0; t < o.length; t++) e[n[t]] = i[t][o[t]]
  15461. try {
  15462. return er.decodeCodewords(e, t, r)
  15463. } catch (t) {
  15464. if (!(t instanceof c)) throw t
  15465. }
  15466. if (0 === o.length) throw c.getChecksumInstance()
  15467. for (let t = 0; t < o.length; t++) {
  15468. if (o[t] < i[t].length - 1) {
  15469. o[t]++
  15470. break
  15471. }
  15472. if (((o[t] = 0), t === o.length - 1)) throw c.getChecksumInstance()
  15473. }
  15474. }
  15475. throw c.getChecksumInstance()
  15476. }
  15477. static createBarcodeMatrix(t) {
  15478. let e = Array.from({ length: t.getBarcodeRowCount() }, () => new Array(t.getBarcodeColumnCount() + 2))
  15479. for (let t = 0; t < e.length; t++) for (let r = 0; r < e[t].length; r++) e[t][r] = new Ve()
  15480. let r = 0
  15481. for (let n of t.getDetectionResultColumns()) {
  15482. if (null != n)
  15483. for (let t of n.getCodewords())
  15484. if (null != t) {
  15485. let n = t.getRowNumber()
  15486. if (n >= 0) {
  15487. if (n >= e.length) continue
  15488. e[n][r].setValue(t.getValue())
  15489. }
  15490. }
  15491. r++
  15492. }
  15493. return e
  15494. }
  15495. static isValidBarcodeColumn(t, e) {
  15496. return e >= 0 && e <= t.getBarcodeColumnCount() + 1
  15497. }
  15498. static getStartColumn(t, e, r, n) {
  15499. let i = n ? 1 : -1,
  15500. o = null
  15501. if ((er.isValidBarcodeColumn(t, e - i) && (o = t.getDetectionResultColumn(e - i).getCodeword(r)), null != o)) return n ? o.getEndX() : o.getStartX()
  15502. if (((o = t.getDetectionResultColumn(e).getCodewordNearby(r)), null != o)) return n ? o.getStartX() : o.getEndX()
  15503. if ((er.isValidBarcodeColumn(t, e - i) && (o = t.getDetectionResultColumn(e - i).getCodewordNearby(r)), null != o)) return n ? o.getEndX() : o.getStartX()
  15504. let s = 0
  15505. for (; er.isValidBarcodeColumn(t, e - i); ) {
  15506. e -= i
  15507. for (let r of t.getDetectionResultColumn(e).getCodewords()) if (null != r) return (n ? r.getEndX() : r.getStartX()) + i * s * (r.getEndX() - r.getStartX())
  15508. s++
  15509. }
  15510. return n ? t.getBoundingBox().getMinX() : t.getBoundingBox().getMaxX()
  15511. }
  15512. static detectCodeword(t, e, r, n, i, o, s, a) {
  15513. i = er.adjustCodewordStartColumn(t, e, r, n, i, o)
  15514. let l,
  15515. c = er.getModuleBitCount(t, e, r, n, i, o)
  15516. if (null == c) return null
  15517. let h = et.sum(c)
  15518. if (n) l = i + h
  15519. else {
  15520. for (let t = 0; t < c.length / 2; t++) {
  15521. let e = c[t]
  15522. ;(c[t] = c[c.length - 1 - t]), (c[c.length - 1 - t] = e)
  15523. }
  15524. ;(l = i), (i = l - h)
  15525. }
  15526. if (!er.checkCodewordSkew(h, s, a)) return null
  15527. let u = Xe.getDecodedValue(c),
  15528. d = be.getCodeword(u)
  15529. return -1 === d ? null : new Ye(i, l, er.getCodewordBucketNumber(u), d)
  15530. }
  15531. static getModuleBitCount(t, e, r, n, i, o) {
  15532. let s = i,
  15533. a = new Int32Array(8),
  15534. l = 0,
  15535. c = n ? 1 : -1,
  15536. h = n
  15537. for (; (n ? s < r : s >= e) && l < a.length; ) t.get(s, o) === h ? (a[l]++, (s += c)) : (l++, (h = !h))
  15538. return l === a.length || (s === (n ? r : e) && l === a.length - 1) ? a : null
  15539. }
  15540. static getNumberOfECCodeWords(t) {
  15541. return 2 << t
  15542. }
  15543. static adjustCodewordStartColumn(t, e, r, n, i, o) {
  15544. let s = i,
  15545. a = n ? -1 : 1
  15546. for (let l = 0; l < 2; l++) {
  15547. for (; (n ? s >= e : s < r) && n === t.get(s, o); ) {
  15548. if (Math.abs(i - s) > er.CODEWORD_SKEW_SIZE) return i
  15549. s += a
  15550. }
  15551. ;(a = -a), (n = !n)
  15552. }
  15553. return s
  15554. }
  15555. static checkCodewordSkew(t, e, r) {
  15556. return e - er.CODEWORD_SKEW_SIZE <= t && t <= r + er.CODEWORD_SKEW_SIZE
  15557. }
  15558. static decodeCodewords(t, e, r) {
  15559. if (0 === t.length) throw C.getFormatInstance()
  15560. let n = 1 << (e + 1),
  15561. i = er.correctErrors(t, r, n)
  15562. er.verifyCodewordCount(t, n)
  15563. let o = tr.decode(t, '' + e)
  15564. return o.setErrorsCorrected(i), o.setErasures(r.length), o
  15565. }
  15566. static correctErrors(t, e, r) {
  15567. if ((null != e && e.length > r / 2 + er.MAX_ERRORS) || r < 0 || r > er.MAX_EC_CODEWORDS) throw c.getChecksumInstance()
  15568. return er.errorCorrection.decode(t, r, e)
  15569. }
  15570. static verifyCodewordCount(t, e) {
  15571. if (t.length < 4) throw C.getFormatInstance()
  15572. let r = t[0]
  15573. if (r > t.length) throw C.getFormatInstance()
  15574. if (0 === r) {
  15575. if (!(e < t.length)) throw C.getFormatInstance()
  15576. t[0] = t.length - e
  15577. }
  15578. }
  15579. static getBitCountForCodeword(t) {
  15580. let e = new Int32Array(8),
  15581. r = 0,
  15582. n = e.length - 1
  15583. for (; !((1 & t) !== r && ((r = 1 & t), n--, n < 0)); ) e[n]++, (t >>= 1)
  15584. return e
  15585. }
  15586. static getCodewordBucketNumber(t) {
  15587. return t instanceof Int32Array ? this.getCodewordBucketNumber_Int32Array(t) : this.getCodewordBucketNumber_number(t)
  15588. }
  15589. static getCodewordBucketNumber_number(t) {
  15590. return er.getCodewordBucketNumber(er.getBitCountForCodeword(t))
  15591. }
  15592. static getCodewordBucketNumber_Int32Array(t) {
  15593. return (t[0] - t[2] + t[4] - t[6] + 9) % 9
  15594. }
  15595. static toString(t) {
  15596. let e = new Ue()
  15597. for (let r = 0; r < t.length; r++) {
  15598. e.format('Row %2d: ', r)
  15599. for (let n = 0; n < t[r].length; n++) {
  15600. let i = t[r][n]
  15601. 0 === i.getValue().length ? e.format(' ', null) : e.format('%4d(%2d)', i.getValue()[0], i.getConfidence(i.getValue()[0]))
  15602. }
  15603. e.format('%n')
  15604. }
  15605. return e.toString()
  15606. }
  15607. }
  15608. ;(er.CODEWORD_SKEW_SIZE = 2), (er.MAX_ERRORS = 3), (er.MAX_EC_CODEWORDS = 512), (er.errorCorrection = new Fe())
  15609. class rr {
  15610. decode(t, e = null) {
  15611. let r = rr.decode(t, e, !1)
  15612. if (null == r || 0 === r.length || null == r[0]) throw N.getNotFoundInstance()
  15613. return r[0]
  15614. }
  15615. decodeMultiple(t, e = null) {
  15616. try {
  15617. return rr.decode(t, e, !0)
  15618. } catch (t) {
  15619. if (t instanceof C || t instanceof c) throw N.getNotFoundInstance()
  15620. throw t
  15621. }
  15622. }
  15623. static decode(t, e, r) {
  15624. const n = new Array(),
  15625. i = Be.detectMultiple(t, e, r)
  15626. for (const t of i.getPoints()) {
  15627. const e = er.decode(i.getBits(), t[4], t[5], t[6], t[7], rr.getMinCodewordWidth(t), rr.getMaxCodewordWidth(t)),
  15628. r = new F(e.getText(), e.getRawBytes(), void 0, t, k.PDF_417)
  15629. r.putMetadata(X.ERROR_CORRECTION_LEVEL, e.getECLevel())
  15630. const o = e.getOther()
  15631. null != o && r.putMetadata(X.PDF417_EXTRA_METADATA, o), n.push(r)
  15632. }
  15633. return n.map(t => t)
  15634. }
  15635. static getMaxWidth(t, e) {
  15636. return null == t || null == e ? 0 : Math.trunc(Math.abs(t.getX() - e.getX()))
  15637. }
  15638. static getMinWidth(t, e) {
  15639. return null == t || null == e ? w.MAX_VALUE : Math.trunc(Math.abs(t.getX() - e.getX()))
  15640. }
  15641. static getMaxCodewordWidth(t) {
  15642. return Math.floor(
  15643. Math.max(
  15644. Math.max(rr.getMaxWidth(t[0], t[4]), (rr.getMaxWidth(t[6], t[2]) * be.MODULES_IN_CODEWORD) / be.MODULES_IN_STOP_PATTERN),
  15645. Math.max(rr.getMaxWidth(t[1], t[5]), (rr.getMaxWidth(t[7], t[3]) * be.MODULES_IN_CODEWORD) / be.MODULES_IN_STOP_PATTERN)
  15646. )
  15647. )
  15648. }
  15649. static getMinCodewordWidth(t) {
  15650. return Math.floor(
  15651. Math.min(
  15652. Math.min(rr.getMinWidth(t[0], t[4]), (rr.getMinWidth(t[6], t[2]) * be.MODULES_IN_CODEWORD) / be.MODULES_IN_STOP_PATTERN),
  15653. Math.min(rr.getMinWidth(t[1], t[5]), (rr.getMinWidth(t[7], t[3]) * be.MODULES_IN_CODEWORD) / be.MODULES_IN_STOP_PATTERN)
  15654. )
  15655. )
  15656. }
  15657. reset() {}
  15658. }
  15659. class nr extends o {}
  15660. nr.kind = 'ReaderException'
  15661. class ir {
  15662. constructor(t, e) {
  15663. ;(this.verbose = !0 === t), e && this.setHints(e)
  15664. }
  15665. decode(t, e) {
  15666. return e && this.setHints(e), this.decodeInternal(t)
  15667. }
  15668. decodeWithState(t) {
  15669. return (null !== this.readers && void 0 !== this.readers) || this.setHints(null), this.decodeInternal(t)
  15670. }
  15671. setHints(t) {
  15672. this.hints = t
  15673. const e = null != t && void 0 !== t.get(E.TRY_HARDER),
  15674. r = null == t ? null : t.get(E.POSSIBLE_FORMATS),
  15675. n = new Array()
  15676. if (null != r) {
  15677. const i = r.some(
  15678. t =>
  15679. t === k.UPC_A ||
  15680. t === k.UPC_E ||
  15681. t === k.EAN_13 ||
  15682. t === k.EAN_8 ||
  15683. t === k.CODABAR ||
  15684. t === k.CODE_39 ||
  15685. t === k.CODE_93 ||
  15686. t === k.CODE_128 ||
  15687. t === k.ITF ||
  15688. t === k.RSS_14 ||
  15689. t === k.RSS_EXPANDED
  15690. )
  15691. i && !e && n.push(new ee(t, this.verbose)),
  15692. r.includes(k.QR_CODE) && n.push(new Oe()),
  15693. r.includes(k.DATA_MATRIX) && n.push(new ue()),
  15694. r.includes(k.AZTEC) && n.push(new gt()),
  15695. r.includes(k.PDF_417) && n.push(new rr()),
  15696. i && e && n.push(new ee(t, this.verbose))
  15697. }
  15698. 0 === n.length && (e || n.push(new ee(t, this.verbose)), n.push(new Oe()), n.push(new ue()), n.push(new gt()), n.push(new rr()), e && n.push(new ee(t, this.verbose))),
  15699. (this.readers = n)
  15700. }
  15701. reset() {
  15702. if (null !== this.readers) for (const t of this.readers) t.reset()
  15703. }
  15704. decodeInternal(t) {
  15705. if (null === this.readers) throw new nr('No readers where selected, nothing can be read.')
  15706. for (const e of this.readers)
  15707. try {
  15708. return e.decode(t, this.hints)
  15709. } catch (t) {
  15710. if (t instanceof nr) continue
  15711. }
  15712. throw new N('No MultiFormat Readers were able to detect the code.')
  15713. }
  15714. }
  15715. var or
  15716. !(function(t) {
  15717. ;(t[(t.ERROR_CORRECTION = 0)] = 'ERROR_CORRECTION'),
  15718. (t[(t.CHARACTER_SET = 1)] = 'CHARACTER_SET'),
  15719. (t[(t.DATA_MATRIX_SHAPE = 2)] = 'DATA_MATRIX_SHAPE'),
  15720. (t[(t.MIN_SIZE = 3)] = 'MIN_SIZE'),
  15721. (t[(t.MAX_SIZE = 4)] = 'MAX_SIZE'),
  15722. (t[(t.MARGIN = 5)] = 'MARGIN'),
  15723. (t[(t.PDF417_COMPACT = 6)] = 'PDF417_COMPACT'),
  15724. (t[(t.PDF417_COMPACTION = 7)] = 'PDF417_COMPACTION'),
  15725. (t[(t.PDF417_DIMENSIONS = 8)] = 'PDF417_DIMENSIONS'),
  15726. (t[(t.AZTEC_LAYERS = 9)] = 'AZTEC_LAYERS'),
  15727. (t[(t.QR_VERSION = 10)] = 'QR_VERSION')
  15728. })(or || (or = {}))
  15729. var sr = or
  15730. class ar {
  15731. constructor(t) {
  15732. ;(this.field = t), (this.cachedGenerators = []), this.cachedGenerators.push(new Z(t, Int32Array.from([1])))
  15733. }
  15734. buildGenerator(t) {
  15735. const e = this.cachedGenerators
  15736. if (t >= e.length) {
  15737. let r = e[e.length - 1]
  15738. const n = this.field
  15739. for (let i = e.length; i <= t; i++) {
  15740. const t = r.multiply(new Z(n, Int32Array.from([1, n.exp(i - 1 + n.getGeneratorBase())])))
  15741. e.push(t), (r = t)
  15742. }
  15743. }
  15744. return e[t]
  15745. }
  15746. encode(t, e) {
  15747. if (0 === e) throw new a('No error correction bytes')
  15748. const r = t.length - e
  15749. if (r <= 0) throw new a('No data bytes provided')
  15750. const n = this.buildGenerator(e),
  15751. i = new Int32Array(r)
  15752. u.arraycopy(t, 0, i, 0, r)
  15753. let o = new Z(this.field, i)
  15754. o = o.multiplyByMonomial(e, 1)
  15755. const s = o.divide(n)[1].getCoefficients(),
  15756. l = e - s.length
  15757. for (let e = 0; e < l; e++) t[r + e] = 0
  15758. u.arraycopy(s, 0, t, r + l, s.length)
  15759. }
  15760. }
  15761. class lr {
  15762. constructor() {}
  15763. static applyMaskPenaltyRule1(t) {
  15764. return lr.applyMaskPenaltyRule1Internal(t, !0) + lr.applyMaskPenaltyRule1Internal(t, !1)
  15765. }
  15766. static applyMaskPenaltyRule2(t) {
  15767. let e = 0
  15768. const r = t.getArray(),
  15769. n = t.getWidth(),
  15770. i = t.getHeight()
  15771. for (let t = 0; t < i - 1; t++) {
  15772. const i = r[t]
  15773. for (let o = 0; o < n - 1; o++) {
  15774. const n = i[o]
  15775. n === i[o + 1] && n === r[t + 1][o] && n === r[t + 1][o + 1] && e++
  15776. }
  15777. }
  15778. return lr.N2 * e
  15779. }
  15780. static applyMaskPenaltyRule3(t) {
  15781. let e = 0
  15782. const r = t.getArray(),
  15783. n = t.getWidth(),
  15784. i = t.getHeight()
  15785. for (let t = 0; t < i; t++)
  15786. for (let o = 0; o < n; o++) {
  15787. const s = r[t]
  15788. o + 6 < n &&
  15789. 1 === s[o] &&
  15790. 0 === s[o + 1] &&
  15791. 1 === s[o + 2] &&
  15792. 1 === s[o + 3] &&
  15793. 1 === s[o + 4] &&
  15794. 0 === s[o + 5] &&
  15795. 1 === s[o + 6] &&
  15796. (lr.isWhiteHorizontal(s, o - 4, o) || lr.isWhiteHorizontal(s, o + 7, o + 11)) &&
  15797. e++,
  15798. t + 6 < i &&
  15799. 1 === r[t][o] &&
  15800. 0 === r[t + 1][o] &&
  15801. 1 === r[t + 2][o] &&
  15802. 1 === r[t + 3][o] &&
  15803. 1 === r[t + 4][o] &&
  15804. 0 === r[t + 5][o] &&
  15805. 1 === r[t + 6][o] &&
  15806. (lr.isWhiteVertical(r, o, t - 4, t) || lr.isWhiteVertical(r, o, t + 7, t + 11)) &&
  15807. e++
  15808. }
  15809. return e * lr.N3
  15810. }
  15811. static isWhiteHorizontal(t, e, r) {
  15812. ;(e = Math.max(e, 0)), (r = Math.min(r, t.length))
  15813. for (let n = e; n < r; n++) if (1 === t[n]) return !1
  15814. return !0
  15815. }
  15816. static isWhiteVertical(t, e, r, n) {
  15817. ;(r = Math.max(r, 0)), (n = Math.min(n, t.length))
  15818. for (let i = r; i < n; i++) if (1 === t[i][e]) return !1
  15819. return !0
  15820. }
  15821. static applyMaskPenaltyRule4(t) {
  15822. let e = 0
  15823. const r = t.getArray(),
  15824. n = t.getWidth(),
  15825. i = t.getHeight()
  15826. for (let t = 0; t < i; t++) {
  15827. const i = r[t]
  15828. for (let t = 0; t < n; t++) 1 === i[t] && e++
  15829. }
  15830. const o = t.getHeight() * t.getWidth()
  15831. return Math.floor((10 * Math.abs(2 * e - o)) / o) * lr.N4
  15832. }
  15833. static getDataMaskBit(t, e, r) {
  15834. let n, i
  15835. switch (t) {
  15836. case 0:
  15837. n = (r + e) & 1
  15838. break
  15839. case 1:
  15840. n = 1 & r
  15841. break
  15842. case 2:
  15843. n = e % 3
  15844. break
  15845. case 3:
  15846. n = (r + e) % 3
  15847. break
  15848. case 4:
  15849. n = (Math.floor(r / 2) + Math.floor(e / 3)) & 1
  15850. break
  15851. case 5:
  15852. ;(i = r * e), (n = (1 & i) + (i % 3))
  15853. break
  15854. case 6:
  15855. ;(i = r * e), (n = ((1 & i) + (i % 3)) & 1)
  15856. break
  15857. case 7:
  15858. ;(i = r * e), (n = ((i % 3) + ((r + e) & 1)) & 1)
  15859. break
  15860. default:
  15861. throw new a('Invalid mask pattern: ' + t)
  15862. }
  15863. return 0 === n
  15864. }
  15865. static applyMaskPenaltyRule1Internal(t, e) {
  15866. let r = 0
  15867. const n = e ? t.getHeight() : t.getWidth(),
  15868. i = e ? t.getWidth() : t.getHeight(),
  15869. o = t.getArray()
  15870. for (let t = 0; t < n; t++) {
  15871. let n = 0,
  15872. s = -1
  15873. for (let a = 0; a < i; a++) {
  15874. const i = e ? o[t][a] : o[a][t]
  15875. i === s ? n++ : (n >= 5 && (r += lr.N1 + (n - 5)), (n = 1), (s = i))
  15876. }
  15877. n >= 5 && (r += lr.N1 + (n - 5))
  15878. }
  15879. return r
  15880. }
  15881. }
  15882. ;(lr.N1 = 3), (lr.N2 = 3), (lr.N3 = 40), (lr.N4 = 10)
  15883. class cr {
  15884. constructor(t, e) {
  15885. ;(this.width = t), (this.height = e)
  15886. const r = new Array(e)
  15887. for (let n = 0; n !== e; n++) r[n] = new Uint8Array(t)
  15888. this.bytes = r
  15889. }
  15890. getHeight() {
  15891. return this.height
  15892. }
  15893. getWidth() {
  15894. return this.width
  15895. }
  15896. get(t, e) {
  15897. return this.bytes[e][t]
  15898. }
  15899. getArray() {
  15900. return this.bytes
  15901. }
  15902. setNumber(t, e, r) {
  15903. this.bytes[e][t] = r
  15904. }
  15905. setBoolean(t, e, r) {
  15906. this.bytes[e][t] = r ? 1 : 0
  15907. }
  15908. clear(t) {
  15909. for (const e of this.bytes) f.fill(e, t)
  15910. }
  15911. equals(t) {
  15912. if (!(t instanceof cr)) return !1
  15913. const e = t
  15914. if (this.width !== e.width) return !1
  15915. if (this.height !== e.height) return !1
  15916. for (let t = 0, r = this.height; t < r; ++t) {
  15917. const r = this.bytes[t],
  15918. n = e.bytes[t]
  15919. for (let t = 0, e = this.width; t < e; ++t) if (r[t] !== n[t]) return !1
  15920. }
  15921. return !0
  15922. }
  15923. toString() {
  15924. const t = new T()
  15925. for (let e = 0, r = this.height; e < r; ++e) {
  15926. const r = this.bytes[e]
  15927. for (let e = 0, n = this.width; e < n; ++e)
  15928. switch (r[e]) {
  15929. case 0:
  15930. t.append(' 0')
  15931. break
  15932. case 1:
  15933. t.append(' 1')
  15934. break
  15935. default:
  15936. t.append(' ')
  15937. }
  15938. t.append('\n')
  15939. }
  15940. return t.toString()
  15941. }
  15942. }
  15943. class hr {
  15944. constructor() {
  15945. this.maskPattern = -1
  15946. }
  15947. getMode() {
  15948. return this.mode
  15949. }
  15950. getECLevel() {
  15951. return this.ecLevel
  15952. }
  15953. getVersion() {
  15954. return this.version
  15955. }
  15956. getMaskPattern() {
  15957. return this.maskPattern
  15958. }
  15959. getMatrix() {
  15960. return this.matrix
  15961. }
  15962. toString() {
  15963. const t = new T()
  15964. return (
  15965. t.append('<<\n'),
  15966. t.append(' mode: '),
  15967. t.append(this.mode ? this.mode.toString() : 'null'),
  15968. t.append('\n ecLevel: '),
  15969. t.append(this.ecLevel ? this.ecLevel.toString() : 'null'),
  15970. t.append('\n version: '),
  15971. t.append(this.version ? this.version.toString() : 'null'),
  15972. t.append('\n maskPattern: '),
  15973. t.append(this.maskPattern.toString()),
  15974. this.matrix ? (t.append('\n matrix:\n'), t.append(this.matrix.toString())) : t.append('\n matrix: null\n'),
  15975. t.append('>>\n'),
  15976. t.toString()
  15977. )
  15978. }
  15979. setMode(t) {
  15980. this.mode = t
  15981. }
  15982. setECLevel(t) {
  15983. this.ecLevel = t
  15984. }
  15985. setVersion(t) {
  15986. this.version = t
  15987. }
  15988. setMaskPattern(t) {
  15989. this.maskPattern = t
  15990. }
  15991. setMatrix(t) {
  15992. this.matrix = t
  15993. }
  15994. static isValidMaskPattern(t) {
  15995. return t >= 0 && t < hr.NUM_MASK_PATTERNS
  15996. }
  15997. }
  15998. hr.NUM_MASK_PATTERNS = 8
  15999. class ur extends o {}
  16000. ur.kind = 'WriterException'
  16001. class dr {
  16002. constructor() {}
  16003. static clearMatrix(t) {
  16004. t.clear(255)
  16005. }
  16006. static buildMatrix(t, e, r, n, i) {
  16007. dr.clearMatrix(i), dr.embedBasicPatterns(r, i), dr.embedTypeInfo(e, n, i), dr.maybeEmbedVersionInfo(r, i), dr.embedDataBits(t, n, i)
  16008. }
  16009. static embedBasicPatterns(t, e) {
  16010. dr.embedPositionDetectionPatternsAndSeparators(e), dr.embedDarkDotAtLeftBottomCorner(e), dr.maybeEmbedPositionAdjustmentPatterns(t, e), dr.embedTimingPatterns(e)
  16011. }
  16012. static embedTypeInfo(t, e, r) {
  16013. const n = new A()
  16014. dr.makeTypeInfoBits(t, e, n)
  16015. for (let t = 0, e = n.getSize(); t < e; ++t) {
  16016. const e = n.get(n.getSize() - 1 - t),
  16017. i = dr.TYPE_INFO_COORDINATES[t],
  16018. o = i[0],
  16019. s = i[1]
  16020. if ((r.setBoolean(o, s, e), t < 8)) {
  16021. const n = r.getWidth() - t - 1,
  16022. i = 8
  16023. r.setBoolean(n, i, e)
  16024. } else {
  16025. const n = 8,
  16026. i = r.getHeight() - 7 + (t - 8)
  16027. r.setBoolean(n, i, e)
  16028. }
  16029. }
  16030. }
  16031. static maybeEmbedVersionInfo(t, e) {
  16032. if (t.getVersionNumber() < 7) return
  16033. const r = new A()
  16034. dr.makeVersionInfoBits(t, r)
  16035. let n = 17
  16036. for (let t = 0; t < 6; ++t)
  16037. for (let i = 0; i < 3; ++i) {
  16038. const o = r.get(n)
  16039. n--, e.setBoolean(t, e.getHeight() - 11 + i, o), e.setBoolean(e.getHeight() - 11 + i, t, o)
  16040. }
  16041. }
  16042. static embedDataBits(t, e, r) {
  16043. let n = 0,
  16044. i = -1,
  16045. o = r.getWidth() - 1,
  16046. s = r.getHeight() - 1
  16047. for (; o > 0; ) {
  16048. for (6 === o && (o -= 1); s >= 0 && s < r.getHeight(); ) {
  16049. for (let i = 0; i < 2; ++i) {
  16050. const a = o - i
  16051. if (!dr.isEmpty(r.get(a, s))) continue
  16052. let l
  16053. n < t.getSize() ? ((l = t.get(n)), ++n) : (l = !1), 255 !== e && lr.getDataMaskBit(e, a, s) && (l = !l), r.setBoolean(a, s, l)
  16054. }
  16055. s += i
  16056. }
  16057. ;(i = -i), (s += i), (o -= 2)
  16058. }
  16059. if (n !== t.getSize()) throw new ur('Not all bits consumed: ' + n + '/' + t.getSize())
  16060. }
  16061. static findMSBSet(t) {
  16062. return 32 - w.numberOfLeadingZeros(t)
  16063. }
  16064. static calculateBCHCode(t, e) {
  16065. if (0 === e) throw new a('0 polynomial')
  16066. const r = dr.findMSBSet(e)
  16067. for (t <<= r - 1; dr.findMSBSet(t) >= r; ) t ^= e << (dr.findMSBSet(t) - r)
  16068. return t
  16069. }
  16070. static makeTypeInfoBits(t, e, r) {
  16071. if (!hr.isValidMaskPattern(e)) throw new ur('Invalid mask pattern')
  16072. const n = (t.getBits() << 3) | e
  16073. r.appendBits(n, 5)
  16074. const i = dr.calculateBCHCode(n, dr.TYPE_INFO_POLY)
  16075. r.appendBits(i, 10)
  16076. const o = new A()
  16077. if ((o.appendBits(dr.TYPE_INFO_MASK_PATTERN, 15), r.xor(o), 15 !== r.getSize())) throw new ur('should not happen but we got: ' + r.getSize())
  16078. }
  16079. static makeVersionInfoBits(t, e) {
  16080. e.appendBits(t.getVersionNumber(), 6)
  16081. const r = dr.calculateBCHCode(t.getVersionNumber(), dr.VERSION_INFO_POLY)
  16082. if ((e.appendBits(r, 12), 18 !== e.getSize())) throw new ur('should not happen but we got: ' + e.getSize())
  16083. }
  16084. static isEmpty(t) {
  16085. return 255 === t
  16086. }
  16087. static embedTimingPatterns(t) {
  16088. for (let e = 8; e < t.getWidth() - 8; ++e) {
  16089. const r = (e + 1) % 2
  16090. dr.isEmpty(t.get(e, 6)) && t.setNumber(e, 6, r), dr.isEmpty(t.get(6, e)) && t.setNumber(6, e, r)
  16091. }
  16092. }
  16093. static embedDarkDotAtLeftBottomCorner(t) {
  16094. if (0 === t.get(8, t.getHeight() - 8)) throw new ur()
  16095. t.setNumber(8, t.getHeight() - 8, 1)
  16096. }
  16097. static embedHorizontalSeparationPattern(t, e, r) {
  16098. for (let n = 0; n < 8; ++n) {
  16099. if (!dr.isEmpty(r.get(t + n, e))) throw new ur()
  16100. r.setNumber(t + n, e, 0)
  16101. }
  16102. }
  16103. static embedVerticalSeparationPattern(t, e, r) {
  16104. for (let n = 0; n < 7; ++n) {
  16105. if (!dr.isEmpty(r.get(t, e + n))) throw new ur()
  16106. r.setNumber(t, e + n, 0)
  16107. }
  16108. }
  16109. static embedPositionAdjustmentPattern(t, e, r) {
  16110. for (let n = 0; n < 5; ++n) {
  16111. const i = dr.POSITION_ADJUSTMENT_PATTERN[n]
  16112. for (let o = 0; o < 5; ++o) r.setNumber(t + o, e + n, i[o])
  16113. }
  16114. }
  16115. static embedPositionDetectionPattern(t, e, r) {
  16116. for (let n = 0; n < 7; ++n) {
  16117. const i = dr.POSITION_DETECTION_PATTERN[n]
  16118. for (let o = 0; o < 7; ++o) r.setNumber(t + o, e + n, i[o])
  16119. }
  16120. }
  16121. static embedPositionDetectionPatternsAndSeparators(t) {
  16122. const e = dr.POSITION_DETECTION_PATTERN[0].length
  16123. dr.embedPositionDetectionPattern(0, 0, t), dr.embedPositionDetectionPattern(t.getWidth() - e, 0, t), dr.embedPositionDetectionPattern(0, t.getWidth() - e, t)
  16124. dr.embedHorizontalSeparationPattern(0, 7, t), dr.embedHorizontalSeparationPattern(t.getWidth() - 8, 7, t), dr.embedHorizontalSeparationPattern(0, t.getWidth() - 8, t)
  16125. dr.embedVerticalSeparationPattern(7, 0, t), dr.embedVerticalSeparationPattern(t.getHeight() - 7 - 1, 0, t), dr.embedVerticalSeparationPattern(7, t.getHeight() - 7, t)
  16126. }
  16127. static maybeEmbedPositionAdjustmentPatterns(t, e) {
  16128. if (t.getVersionNumber() < 2) return
  16129. const r = t.getVersionNumber() - 1,
  16130. n = dr.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[r]
  16131. for (let t = 0, r = n.length; t !== r; t++) {
  16132. const i = n[t]
  16133. if (i >= 0)
  16134. for (let t = 0; t !== r; t++) {
  16135. const r = n[t]
  16136. r >= 0 && dr.isEmpty(e.get(r, i)) && dr.embedPositionAdjustmentPattern(r - 2, i - 2, e)
  16137. }
  16138. }
  16139. }
  16140. }
  16141. ;(dr.POSITION_DETECTION_PATTERN = Array.from([
  16142. Int32Array.from([1, 1, 1, 1, 1, 1, 1]),
  16143. Int32Array.from([1, 0, 0, 0, 0, 0, 1]),
  16144. Int32Array.from([1, 0, 1, 1, 1, 0, 1]),
  16145. Int32Array.from([1, 0, 1, 1, 1, 0, 1]),
  16146. Int32Array.from([1, 0, 1, 1, 1, 0, 1]),
  16147. Int32Array.from([1, 0, 0, 0, 0, 0, 1]),
  16148. Int32Array.from([1, 1, 1, 1, 1, 1, 1])
  16149. ])),
  16150. (dr.POSITION_ADJUSTMENT_PATTERN = Array.from([
  16151. Int32Array.from([1, 1, 1, 1, 1]),
  16152. Int32Array.from([1, 0, 0, 0, 1]),
  16153. Int32Array.from([1, 0, 1, 0, 1]),
  16154. Int32Array.from([1, 0, 0, 0, 1]),
  16155. Int32Array.from([1, 1, 1, 1, 1])
  16156. ])),
  16157. (dr.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE = Array.from([
  16158. Int32Array.from([-1, -1, -1, -1, -1, -1, -1]),
  16159. Int32Array.from([6, 18, -1, -1, -1, -1, -1]),
  16160. Int32Array.from([6, 22, -1, -1, -1, -1, -1]),
  16161. Int32Array.from([6, 26, -1, -1, -1, -1, -1]),
  16162. Int32Array.from([6, 30, -1, -1, -1, -1, -1]),
  16163. Int32Array.from([6, 34, -1, -1, -1, -1, -1]),
  16164. Int32Array.from([6, 22, 38, -1, -1, -1, -1]),
  16165. Int32Array.from([6, 24, 42, -1, -1, -1, -1]),
  16166. Int32Array.from([6, 26, 46, -1, -1, -1, -1]),
  16167. Int32Array.from([6, 28, 50, -1, -1, -1, -1]),
  16168. Int32Array.from([6, 30, 54, -1, -1, -1, -1]),
  16169. Int32Array.from([6, 32, 58, -1, -1, -1, -1]),
  16170. Int32Array.from([6, 34, 62, -1, -1, -1, -1]),
  16171. Int32Array.from([6, 26, 46, 66, -1, -1, -1]),
  16172. Int32Array.from([6, 26, 48, 70, -1, -1, -1]),
  16173. Int32Array.from([6, 26, 50, 74, -1, -1, -1]),
  16174. Int32Array.from([6, 30, 54, 78, -1, -1, -1]),
  16175. Int32Array.from([6, 30, 56, 82, -1, -1, -1]),
  16176. Int32Array.from([6, 30, 58, 86, -1, -1, -1]),
  16177. Int32Array.from([6, 34, 62, 90, -1, -1, -1]),
  16178. Int32Array.from([6, 28, 50, 72, 94, -1, -1]),
  16179. Int32Array.from([6, 26, 50, 74, 98, -1, -1]),
  16180. Int32Array.from([6, 30, 54, 78, 102, -1, -1]),
  16181. Int32Array.from([6, 28, 54, 80, 106, -1, -1]),
  16182. Int32Array.from([6, 32, 58, 84, 110, -1, -1]),
  16183. Int32Array.from([6, 30, 58, 86, 114, -1, -1]),
  16184. Int32Array.from([6, 34, 62, 90, 118, -1, -1]),
  16185. Int32Array.from([6, 26, 50, 74, 98, 122, -1]),
  16186. Int32Array.from([6, 30, 54, 78, 102, 126, -1]),
  16187. Int32Array.from([6, 26, 52, 78, 104, 130, -1]),
  16188. Int32Array.from([6, 30, 56, 82, 108, 134, -1]),
  16189. Int32Array.from([6, 34, 60, 86, 112, 138, -1]),
  16190. Int32Array.from([6, 30, 58, 86, 114, 142, -1]),
  16191. Int32Array.from([6, 34, 62, 90, 118, 146, -1]),
  16192. Int32Array.from([6, 30, 54, 78, 102, 126, 150]),
  16193. Int32Array.from([6, 24, 50, 76, 102, 128, 154]),
  16194. Int32Array.from([6, 28, 54, 80, 106, 132, 158]),
  16195. Int32Array.from([6, 32, 58, 84, 110, 136, 162]),
  16196. Int32Array.from([6, 26, 54, 82, 110, 138, 166]),
  16197. Int32Array.from([6, 30, 58, 86, 114, 142, 170])
  16198. ])),
  16199. (dr.TYPE_INFO_COORDINATES = Array.from([
  16200. Int32Array.from([8, 0]),
  16201. Int32Array.from([8, 1]),
  16202. Int32Array.from([8, 2]),
  16203. Int32Array.from([8, 3]),
  16204. Int32Array.from([8, 4]),
  16205. Int32Array.from([8, 5]),
  16206. Int32Array.from([8, 7]),
  16207. Int32Array.from([8, 8]),
  16208. Int32Array.from([7, 8]),
  16209. Int32Array.from([5, 8]),
  16210. Int32Array.from([4, 8]),
  16211. Int32Array.from([3, 8]),
  16212. Int32Array.from([2, 8]),
  16213. Int32Array.from([1, 8]),
  16214. Int32Array.from([0, 8])
  16215. ])),
  16216. (dr.VERSION_INFO_POLY = 7973),
  16217. (dr.TYPE_INFO_POLY = 1335),
  16218. (dr.TYPE_INFO_MASK_PATTERN = 21522)
  16219. class gr {
  16220. constructor(t, e) {
  16221. ;(this.dataBytes = t), (this.errorCorrectionBytes = e)
  16222. }
  16223. getDataBytes() {
  16224. return this.dataBytes
  16225. }
  16226. getErrorCorrectionBytes() {
  16227. return this.errorCorrectionBytes
  16228. }
  16229. }
  16230. class fr {
  16231. constructor() {}
  16232. static calculateMaskPenalty(t) {
  16233. return lr.applyMaskPenaltyRule1(t) + lr.applyMaskPenaltyRule2(t) + lr.applyMaskPenaltyRule3(t) + lr.applyMaskPenaltyRule4(t)
  16234. }
  16235. static encode(t, e, r = null) {
  16236. let n = fr.DEFAULT_BYTE_MODE_ENCODING
  16237. const i = null !== r && void 0 !== r.get(sr.CHARACTER_SET)
  16238. i && (n = r.get(sr.CHARACTER_SET).toString())
  16239. const o = this.chooseMode(t, n),
  16240. s = new A()
  16241. if (o === Ie.BYTE && (i || fr.DEFAULT_BYTE_MODE_ENCODING !== n)) {
  16242. const t = I.getCharacterSetECIByName(n)
  16243. void 0 !== t && this.appendECI(t, s)
  16244. }
  16245. this.appendModeInfo(o, s)
  16246. const a = new A()
  16247. let l
  16248. if ((this.appendBytes(t, o, a, n), null !== r && void 0 !== r.get(sr.QR_VERSION))) {
  16249. const t = Number.parseInt(r.get(sr.QR_VERSION).toString(), 10)
  16250. l = Ae.getVersionForNumber(t)
  16251. const n = this.calculateBitsNeeded(o, s, a, l)
  16252. if (!this.willFit(n, l, e)) throw new ur('Data too big for requested version')
  16253. } else l = this.recommendVersion(e, o, s, a)
  16254. const c = new A()
  16255. c.appendBitArray(s)
  16256. const h = o === Ie.BYTE ? a.getSizeInBytes() : t.length
  16257. this.appendLengthInfo(h, l, o, c), c.appendBitArray(a)
  16258. const u = l.getECBlocksForLevel(e),
  16259. d = l.getTotalCodewords() - u.getTotalECCodewords()
  16260. this.terminateBits(d, c)
  16261. const g = this.interleaveWithECBytes(c, l.getTotalCodewords(), d, u.getNumBlocks()),
  16262. f = new hr()
  16263. f.setECLevel(e), f.setMode(o), f.setVersion(l)
  16264. const w = l.getDimensionForVersion(),
  16265. m = new cr(w, w),
  16266. E = this.chooseMaskPattern(g, e, l, m)
  16267. return f.setMaskPattern(E), dr.buildMatrix(g, e, l, E, m), f.setMatrix(m), f
  16268. }
  16269. static recommendVersion(t, e, r, n) {
  16270. const i = this.calculateBitsNeeded(e, r, n, Ae.getVersionForNumber(1)),
  16271. o = this.chooseVersion(i, t),
  16272. s = this.calculateBitsNeeded(e, r, n, o)
  16273. return this.chooseVersion(s, t)
  16274. }
  16275. static calculateBitsNeeded(t, e, r, n) {
  16276. return e.getSize() + t.getCharacterCountBits(n) + r.getSize()
  16277. }
  16278. static getAlphanumericCode(t) {
  16279. return t < fr.ALPHANUMERIC_TABLE.length ? fr.ALPHANUMERIC_TABLE[t] : -1
  16280. }
  16281. static chooseMode(t, e = null) {
  16282. if (I.SJIS.getName() === e && this.isOnlyDoubleByteKanji(t)) return Ie.KANJI
  16283. let r = !1,
  16284. n = !1
  16285. for (let e = 0, i = t.length; e < i; ++e) {
  16286. const i = t.charAt(e)
  16287. if (fr.isDigit(i)) r = !0
  16288. else {
  16289. if (-1 === this.getAlphanumericCode(i.charCodeAt(0))) return Ie.BYTE
  16290. n = !0
  16291. }
  16292. }
  16293. return n ? Ie.ALPHANUMERIC : r ? Ie.NUMERIC : Ie.BYTE
  16294. }
  16295. static isOnlyDoubleByteKanji(t) {
  16296. let e
  16297. try {
  16298. e = S.encode(t, I.SJIS)
  16299. } catch (t) {
  16300. return !1
  16301. }
  16302. const r = e.length
  16303. if (r % 2 != 0) return !1
  16304. for (let t = 0; t < r; t += 2) {
  16305. const r = 255 & e[t]
  16306. if ((r < 129 || r > 159) && (r < 224 || r > 235)) return !1
  16307. }
  16308. return !0
  16309. }
  16310. static chooseMaskPattern(t, e, r, n) {
  16311. let i = Number.MAX_SAFE_INTEGER,
  16312. o = -1
  16313. for (let s = 0; s < hr.NUM_MASK_PATTERNS; s++) {
  16314. dr.buildMatrix(t, e, r, s, n)
  16315. let a = this.calculateMaskPenalty(n)
  16316. a < i && ((i = a), (o = s))
  16317. }
  16318. return o
  16319. }
  16320. static chooseVersion(t, e) {
  16321. for (let r = 1; r <= 40; r++) {
  16322. const n = Ae.getVersionForNumber(r)
  16323. if (fr.willFit(t, n, e)) return n
  16324. }
  16325. throw new ur('Data too big')
  16326. }
  16327. static willFit(t, e, r) {
  16328. return e.getTotalCodewords() - e.getECBlocksForLevel(r).getTotalECCodewords() >= (t + 7) / 8
  16329. }
  16330. static terminateBits(t, e) {
  16331. const r = 8 * t
  16332. if (e.getSize() > r) throw new ur('data bits cannot fit in the QR Code' + e.getSize() + ' > ' + r)
  16333. for (let t = 0; t < 4 && e.getSize() < r; ++t) e.appendBit(!1)
  16334. const n = 7 & e.getSize()
  16335. if (n > 0) for (let t = n; t < 8; t++) e.appendBit(!1)
  16336. const i = t - e.getSizeInBytes()
  16337. for (let t = 0; t < i; ++t) e.appendBits(0 == (1 & t) ? 236 : 17, 8)
  16338. if (e.getSize() !== r) throw new ur('Bits size does not equal capacity')
  16339. }
  16340. static getNumDataBytesAndNumECBytesForBlockID(t, e, r, n, i, o) {
  16341. if (n >= r) throw new ur('Block ID too large')
  16342. const s = t % r,
  16343. a = r - s,
  16344. l = Math.floor(t / r),
  16345. c = l + 1,
  16346. h = Math.floor(e / r),
  16347. u = h + 1,
  16348. d = l - h,
  16349. g = c - u
  16350. if (d !== g) throw new ur('EC bytes mismatch')
  16351. if (r !== a + s) throw new ur('RS blocks mismatch')
  16352. if (t !== (h + d) * a + (u + g) * s) throw new ur('Total bytes mismatch')
  16353. n < a ? ((i[0] = h), (o[0] = d)) : ((i[0] = u), (o[0] = g))
  16354. }
  16355. static interleaveWithECBytes(t, e, r, n) {
  16356. if (t.getSizeInBytes() !== r) throw new ur('Number of bits and data bytes does not match')
  16357. let i = 0,
  16358. o = 0,
  16359. s = 0
  16360. const a = new Array()
  16361. for (let l = 0; l < n; ++l) {
  16362. const c = new Int32Array(1),
  16363. h = new Int32Array(1)
  16364. fr.getNumDataBytesAndNumECBytesForBlockID(e, r, n, l, c, h)
  16365. const u = c[0],
  16366. d = new Uint8Array(u)
  16367. t.toBytes(8 * i, d, 0, u)
  16368. const g = fr.generateECBytes(d, h[0])
  16369. a.push(new gr(d, g)), (o = Math.max(o, u)), (s = Math.max(s, g.length)), (i += c[0])
  16370. }
  16371. if (r !== i) throw new ur('Data bytes does not match offset')
  16372. const l = new A()
  16373. for (let t = 0; t < o; ++t)
  16374. for (const e of a) {
  16375. const r = e.getDataBytes()
  16376. t < r.length && l.appendBits(r[t], 8)
  16377. }
  16378. for (let t = 0; t < s; ++t)
  16379. for (const e of a) {
  16380. const r = e.getErrorCorrectionBytes()
  16381. t < r.length && l.appendBits(r[t], 8)
  16382. }
  16383. if (e !== l.getSizeInBytes()) throw new ur('Interleaving error: ' + e + ' and ' + l.getSizeInBytes() + ' differ.')
  16384. return l
  16385. }
  16386. static generateECBytes(t, e) {
  16387. const r = t.length,
  16388. n = new Int32Array(r + e)
  16389. for (let e = 0; e < r; e++) n[e] = 255 & t[e]
  16390. new ar(K.QR_CODE_FIELD_256).encode(n, e)
  16391. const i = new Uint8Array(e)
  16392. for (let t = 0; t < e; t++) i[t] = n[r + t]
  16393. return i
  16394. }
  16395. static appendModeInfo(t, e) {
  16396. e.appendBits(t.getBits(), 4)
  16397. }
  16398. static appendLengthInfo(t, e, r, n) {
  16399. const i = r.getCharacterCountBits(e)
  16400. if (t >= 1 << i) throw new ur(t + ' is bigger than ' + ((1 << i) - 1))
  16401. n.appendBits(t, i)
  16402. }
  16403. static appendBytes(t, e, r, n) {
  16404. switch (e) {
  16405. case Ie.NUMERIC:
  16406. fr.appendNumericBytes(t, r)
  16407. break
  16408. case Ie.ALPHANUMERIC:
  16409. fr.appendAlphanumericBytes(t, r)
  16410. break
  16411. case Ie.BYTE:
  16412. fr.append8BitBytes(t, r, n)
  16413. break
  16414. case Ie.KANJI:
  16415. fr.appendKanjiBytes(t, r)
  16416. break
  16417. default:
  16418. throw new ur('Invalid mode: ' + e)
  16419. }
  16420. }
  16421. static getDigit(t) {
  16422. return t.charCodeAt(0) - 48
  16423. }
  16424. static isDigit(t) {
  16425. const e = fr.getDigit(t)
  16426. return e >= 0 && e <= 9
  16427. }
  16428. static appendNumericBytes(t, e) {
  16429. const r = t.length
  16430. let n = 0
  16431. for (; n < r; ) {
  16432. const i = fr.getDigit(t.charAt(n))
  16433. if (n + 2 < r) {
  16434. const r = fr.getDigit(t.charAt(n + 1)),
  16435. o = fr.getDigit(t.charAt(n + 2))
  16436. e.appendBits(100 * i + 10 * r + o, 10), (n += 3)
  16437. } else if (n + 1 < r) {
  16438. const r = fr.getDigit(t.charAt(n + 1))
  16439. e.appendBits(10 * i + r, 7), (n += 2)
  16440. } else e.appendBits(i, 4), n++
  16441. }
  16442. }
  16443. static appendAlphanumericBytes(t, e) {
  16444. const r = t.length
  16445. let n = 0
  16446. for (; n < r; ) {
  16447. const i = fr.getAlphanumericCode(t.charCodeAt(n))
  16448. if (-1 === i) throw new ur()
  16449. if (n + 1 < r) {
  16450. const r = fr.getAlphanumericCode(t.charCodeAt(n + 1))
  16451. if (-1 === r) throw new ur()
  16452. e.appendBits(45 * i + r, 11), (n += 2)
  16453. } else e.appendBits(i, 6), n++
  16454. }
  16455. }
  16456. static append8BitBytes(t, e, r) {
  16457. let n
  16458. try {
  16459. n = S.encode(t, r)
  16460. } catch (t) {
  16461. throw new ur(t)
  16462. }
  16463. for (let t = 0, r = n.length; t !== r; t++) {
  16464. const r = n[t]
  16465. e.appendBits(r, 8)
  16466. }
  16467. }
  16468. static appendKanjiBytes(t, e) {
  16469. let r
  16470. try {
  16471. r = S.encode(t, I.SJIS)
  16472. } catch (t) {
  16473. throw new ur(t)
  16474. }
  16475. const n = r.length
  16476. for (let t = 0; t < n; t += 2) {
  16477. const n = (((255 & r[t]) << 8) & 4294967295) | (255 & r[t + 1])
  16478. let i = -1
  16479. if ((n >= 33088 && n <= 40956 ? (i = n - 33088) : n >= 57408 && n <= 60351 && (i = n - 49472), -1 === i)) throw new ur('Invalid byte sequence')
  16480. const o = 192 * (i >> 8) + (255 & i)
  16481. e.appendBits(o, 13)
  16482. }
  16483. }
  16484. static appendECI(t, e) {
  16485. e.appendBits(Ie.ECI.getBits(), 4), e.appendBits(t.getValue(), 8)
  16486. }
  16487. }
  16488. ;(fr.ALPHANUMERIC_TABLE = Int32Array.from([
  16489. -1,
  16490. -1,
  16491. -1,
  16492. -1,
  16493. -1,
  16494. -1,
  16495. -1,
  16496. -1,
  16497. -1,
  16498. -1,
  16499. -1,
  16500. -1,
  16501. -1,
  16502. -1,
  16503. -1,
  16504. -1,
  16505. -1,
  16506. -1,
  16507. -1,
  16508. -1,
  16509. -1,
  16510. -1,
  16511. -1,
  16512. -1,
  16513. -1,
  16514. -1,
  16515. -1,
  16516. -1,
  16517. -1,
  16518. -1,
  16519. -1,
  16520. -1,
  16521. 36,
  16522. -1,
  16523. -1,
  16524. -1,
  16525. 37,
  16526. 38,
  16527. -1,
  16528. -1,
  16529. -1,
  16530. -1,
  16531. 39,
  16532. 40,
  16533. -1,
  16534. 41,
  16535. 42,
  16536. 43,
  16537. 0,
  16538. 1,
  16539. 2,
  16540. 3,
  16541. 4,
  16542. 5,
  16543. 6,
  16544. 7,
  16545. 8,
  16546. 9,
  16547. 44,
  16548. -1,
  16549. -1,
  16550. -1,
  16551. -1,
  16552. -1,
  16553. -1,
  16554. 10,
  16555. 11,
  16556. 12,
  16557. 13,
  16558. 14,
  16559. 15,
  16560. 16,
  16561. 17,
  16562. 18,
  16563. 19,
  16564. 20,
  16565. 21,
  16566. 22,
  16567. 23,
  16568. 24,
  16569. 25,
  16570. 26,
  16571. 27,
  16572. 28,
  16573. 29,
  16574. 30,
  16575. 31,
  16576. 32,
  16577. 33,
  16578. 34,
  16579. 35,
  16580. -1,
  16581. -1,
  16582. -1,
  16583. -1,
  16584. -1
  16585. ])),
  16586. (fr.DEFAULT_BYTE_MODE_ENCODING = I.UTF8.getName())
  16587. class wr {
  16588. write(t, e, r, n = null) {
  16589. if (0 === t.length) throw new a('Found empty contents')
  16590. if (e < 0 || r < 0) throw new a('Requested dimensions are too small: ' + e + 'x' + r)
  16591. let i = de.L,
  16592. o = wr.QUIET_ZONE_SIZE
  16593. null !== n &&
  16594. (void 0 !== n.get(sr.ERROR_CORRECTION) && (i = de.fromString(n.get(sr.ERROR_CORRECTION).toString())),
  16595. void 0 !== n.get(sr.MARGIN) && (o = Number.parseInt(n.get(sr.MARGIN).toString(), 10)))
  16596. const s = fr.encode(t, i, n)
  16597. return this.renderResult(s, e, r, o)
  16598. }
  16599. writeToDom(t, e, r, n, i = null) {
  16600. 'string' == typeof t && (t = document.querySelector(t))
  16601. const o = this.write(e, r, n, i)
  16602. t && t.appendChild(o)
  16603. }
  16604. renderResult(t, e, r, n) {
  16605. const i = t.getMatrix()
  16606. if (null === i) throw new J()
  16607. const o = i.getWidth(),
  16608. s = i.getHeight(),
  16609. a = o + 2 * n,
  16610. l = s + 2 * n,
  16611. c = Math.max(e, a),
  16612. h = Math.max(r, l),
  16613. u = Math.min(Math.floor(c / a), Math.floor(h / l)),
  16614. d = Math.floor((c - o * u) / 2),
  16615. g = Math.floor((h - s * u) / 2),
  16616. f = this.createSVGElement(c, h)
  16617. for (let t = 0, e = g; t < s; t++, e += u)
  16618. for (let r = 0, n = d; r < o; r++, n += u)
  16619. if (1 === i.get(r, t)) {
  16620. const t = this.createSvgRectElement(n, e, u, u)
  16621. f.appendChild(t)
  16622. }
  16623. return f
  16624. }
  16625. createSVGElement(t, e) {
  16626. const r = document.createElementNS(wr.SVG_NS, 'svg')
  16627. return r.setAttributeNS(null, 'height', t.toString()), r.setAttributeNS(null, 'width', e.toString()), r
  16628. }
  16629. createSvgRectElement(t, e, r, n) {
  16630. const i = document.createElementNS(wr.SVG_NS, 'rect')
  16631. return (
  16632. i.setAttributeNS(null, 'x', t.toString()),
  16633. i.setAttributeNS(null, 'y', e.toString()),
  16634. i.setAttributeNS(null, 'height', r.toString()),
  16635. i.setAttributeNS(null, 'width', n.toString()),
  16636. i.setAttributeNS(null, 'fill', '#000000'),
  16637. i
  16638. )
  16639. }
  16640. }
  16641. ;(wr.QUIET_ZONE_SIZE = 4), (wr.SVG_NS = 'http://www.w3.org/2000/svg')
  16642. class Ar {
  16643. encode(t, e, r, n, i) {
  16644. if (0 === t.length) throw new a('Found empty contents')
  16645. if (e !== k.QR_CODE) throw new a('Can only encode QR_CODE, but got ' + e)
  16646. if (r < 0 || n < 0) throw new a(`Requested dimensions are too small: ${r}x${n}`)
  16647. let o = de.L,
  16648. s = Ar.QUIET_ZONE_SIZE
  16649. null !== i &&
  16650. (void 0 !== i.get(sr.ERROR_CORRECTION) && (o = de.fromString(i.get(sr.ERROR_CORRECTION).toString())),
  16651. void 0 !== i.get(sr.MARGIN) && (s = Number.parseInt(i.get(sr.MARGIN).toString(), 10)))
  16652. const l = fr.encode(t, o, i)
  16653. return Ar.renderResult(l, r, n, s)
  16654. }
  16655. static renderResult(t, e, r, n) {
  16656. const i = t.getMatrix()
  16657. if (null === i) throw new J()
  16658. const o = i.getWidth(),
  16659. s = i.getHeight(),
  16660. a = o + 2 * n,
  16661. l = s + 2 * n,
  16662. c = Math.max(e, a),
  16663. h = Math.max(r, l),
  16664. u = Math.min(Math.floor(c / a), Math.floor(h / l)),
  16665. d = Math.floor((c - o * u) / 2),
  16666. g = Math.floor((h - s * u) / 2),
  16667. f = new y(c, h)
  16668. for (let t = 0, e = g; t < s; t++, e += u) for (let r = 0, n = d; r < o; r++, n += u) 1 === i.get(r, t) && f.setRegion(n, e, u, u)
  16669. return f
  16670. }
  16671. }
  16672. Ar.QUIET_ZONE_SIZE = 4
  16673. class mr extends R {
  16674. constructor(t, e, r, n, i, o, s, l) {
  16675. if ((super(o, s), (this.yuvData = t), (this.dataWidth = e), (this.dataHeight = r), (this.left = n), (this.top = i), n + o > e || i + s > r))
  16676. throw new a('Crop rectangle does not fit within image data.')
  16677. l && this.reverseHorizontal(o, s)
  16678. }
  16679. getRow(t, e) {
  16680. if (t < 0 || t >= this.getHeight()) throw new a('Requested row is outside the image: ' + t)
  16681. const r = this.getWidth()
  16682. ;(null == e || e.length < r) && (e = new Uint8ClampedArray(r))
  16683. const n = (t + this.top) * this.dataWidth + this.left
  16684. return u.arraycopy(this.yuvData, n, e, 0, r), e
  16685. }
  16686. getMatrix() {
  16687. const t = this.getWidth(),
  16688. e = this.getHeight()
  16689. if (t === this.dataWidth && e === this.dataHeight) return this.yuvData
  16690. const r = t * e,
  16691. n = new Uint8ClampedArray(r)
  16692. let i = this.top * this.dataWidth + this.left
  16693. if (t === this.dataWidth) return u.arraycopy(this.yuvData, i, n, 0, r), n
  16694. for (let r = 0; r < e; r++) {
  16695. const e = r * t
  16696. u.arraycopy(this.yuvData, i, n, e, t), (i += this.dataWidth)
  16697. }
  16698. return n
  16699. }
  16700. isCropSupported() {
  16701. return !0
  16702. }
  16703. crop(t, e, r, n) {
  16704. return new mr(this.yuvData, this.dataWidth, this.dataHeight, this.left + t, this.top + e, r, n, !1)
  16705. }
  16706. renderThumbnail() {
  16707. const t = this.getWidth() / mr.THUMBNAIL_SCALE_FACTOR,
  16708. e = this.getHeight() / mr.THUMBNAIL_SCALE_FACTOR,
  16709. r = new Int32Array(t * e),
  16710. n = this.yuvData
  16711. let i = this.top * this.dataWidth + this.left
  16712. for (let o = 0; o < e; o++) {
  16713. const e = o * t
  16714. for (let o = 0; o < t; o++) {
  16715. const t = 255 & n[i + o * mr.THUMBNAIL_SCALE_FACTOR]
  16716. r[e + o] = 4278190080 | (65793 * t)
  16717. }
  16718. i += this.dataWidth * mr.THUMBNAIL_SCALE_FACTOR
  16719. }
  16720. return r
  16721. }
  16722. getThumbnailWidth() {
  16723. return this.getWidth() / mr.THUMBNAIL_SCALE_FACTOR
  16724. }
  16725. getThumbnailHeight() {
  16726. return this.getHeight() / mr.THUMBNAIL_SCALE_FACTOR
  16727. }
  16728. reverseHorizontal(t, e) {
  16729. const r = this.yuvData
  16730. for (let n = 0, i = this.top * this.dataWidth + this.left; n < e; n++, i += this.dataWidth) {
  16731. const e = i + t / 2
  16732. for (let n = i, o = i + t - 1; n < e; n++, o--) {
  16733. const t = r[n]
  16734. ;(r[n] = r[o]), (r[o] = t)
  16735. }
  16736. }
  16737. }
  16738. invert() {
  16739. return new O(this)
  16740. }
  16741. }
  16742. mr.THUMBNAIL_SCALE_FACTOR = 2
  16743. class Er extends R {
  16744. constructor(t, e, r, n, i, o, s) {
  16745. if ((super(e, r), (this.dataWidth = n), (this.dataHeight = i), (this.left = o), (this.top = s), 4 === t.BYTES_PER_ELEMENT)) {
  16746. const n = e * r,
  16747. i = new Uint8ClampedArray(n)
  16748. for (let e = 0; e < n; e++) {
  16749. const r = t[e],
  16750. n = (r >> 16) & 255,
  16751. o = (r >> 7) & 510,
  16752. s = 255 & r
  16753. i[e] = ((n + o + s) / 4) & 255
  16754. }
  16755. this.luminances = i
  16756. } else this.luminances = t
  16757. if (
  16758. (void 0 === n && (this.dataWidth = e),
  16759. void 0 === i && (this.dataHeight = r),
  16760. void 0 === o && (this.left = 0),
  16761. void 0 === s && (this.top = 0),
  16762. this.left + e > this.dataWidth || this.top + r > this.dataHeight)
  16763. )
  16764. throw new a('Crop rectangle does not fit within image data.')
  16765. }
  16766. getRow(t, e) {
  16767. if (t < 0 || t >= this.getHeight()) throw new a('Requested row is outside the image: ' + t)
  16768. const r = this.getWidth()
  16769. ;(null == e || e.length < r) && (e = new Uint8ClampedArray(r))
  16770. const n = (t + this.top) * this.dataWidth + this.left
  16771. return u.arraycopy(this.luminances, n, e, 0, r), e
  16772. }
  16773. getMatrix() {
  16774. const t = this.getWidth(),
  16775. e = this.getHeight()
  16776. if (t === this.dataWidth && e === this.dataHeight) return this.luminances
  16777. const r = t * e,
  16778. n = new Uint8ClampedArray(r)
  16779. let i = this.top * this.dataWidth + this.left
  16780. if (t === this.dataWidth) return u.arraycopy(this.luminances, i, n, 0, r), n
  16781. for (let r = 0; r < e; r++) {
  16782. const e = r * t
  16783. u.arraycopy(this.luminances, i, n, e, t), (i += this.dataWidth)
  16784. }
  16785. return n
  16786. }
  16787. isCropSupported() {
  16788. return !0
  16789. }
  16790. crop(t, e, r, n) {
  16791. return new Er(this.luminances, r, n, this.dataWidth, this.dataHeight, this.left + t, this.top + e)
  16792. }
  16793. invert() {
  16794. return new O(this)
  16795. }
  16796. }
  16797. class Cr extends I {
  16798. static forName(t) {
  16799. return this.getCharacterSetECIByName(t)
  16800. }
  16801. }
  16802. class Ir {}
  16803. Ir.ISO_8859_1 = I.ISO8859_1
  16804. class pr {
  16805. isCompact() {
  16806. return this.compact
  16807. }
  16808. setCompact(t) {
  16809. this.compact = t
  16810. }
  16811. getSize() {
  16812. return this.size
  16813. }
  16814. setSize(t) {
  16815. this.size = t
  16816. }
  16817. getLayers() {
  16818. return this.layers
  16819. }
  16820. setLayers(t) {
  16821. this.layers = t
  16822. }
  16823. getCodeWords() {
  16824. return this.codeWords
  16825. }
  16826. setCodeWords(t) {
  16827. this.codeWords = t
  16828. }
  16829. getMatrix() {
  16830. return this.matrix
  16831. }
  16832. setMatrix(t) {
  16833. this.matrix = t
  16834. }
  16835. }
  16836. class Sr {
  16837. static singletonList(t) {
  16838. return [t]
  16839. }
  16840. static min(t, e) {
  16841. return t.sort(e)[0]
  16842. }
  16843. }
  16844. class _r extends class {
  16845. constructor(t) {
  16846. this.previous = t
  16847. }
  16848. getPrevious() {
  16849. return this.previous
  16850. }
  16851. } {
  16852. constructor(t, e, r) {
  16853. super(t), (this.value = e), (this.bitCount = r)
  16854. }
  16855. appendTo(t, e) {
  16856. t.appendBits(this.value, this.bitCount)
  16857. }
  16858. add(t, e) {
  16859. return new _r(this, t, e)
  16860. }
  16861. addBinaryShift(t, e) {
  16862. return console.warn('addBinaryShift on SimpleToken, this simply returns a copy of this token'), new _r(this, t, e)
  16863. }
  16864. toString() {
  16865. let t = this.value & ((1 << this.bitCount) - 1)
  16866. return (t |= 1 << this.bitCount), '<' + w.toBinaryString(t | (1 << this.bitCount)).substring(1) + '>'
  16867. }
  16868. }
  16869. class Tr extends _r {
  16870. constructor(t, e, r) {
  16871. super(t, 0, 0), (this.binaryShiftStart = e), (this.binaryShiftByteCount = r)
  16872. }
  16873. appendTo(t, e) {
  16874. for (let r = 0; r < this.binaryShiftByteCount; r++)
  16875. (0 === r || (31 === r && this.binaryShiftByteCount <= 62)) &&
  16876. (t.appendBits(31, 5),
  16877. this.binaryShiftByteCount > 62
  16878. ? t.appendBits(this.binaryShiftByteCount - 31, 16)
  16879. : 0 === r
  16880. ? t.appendBits(Math.min(this.binaryShiftByteCount, 31), 5)
  16881. : t.appendBits(this.binaryShiftByteCount - 31, 5)),
  16882. t.appendBits(e[this.binaryShiftStart + r], 8)
  16883. }
  16884. addBinaryShift(t, e) {
  16885. return new Tr(this, t, e)
  16886. }
  16887. toString() {
  16888. return '<' + this.binaryShiftStart + '::' + (this.binaryShiftStart + this.binaryShiftByteCount - 1) + '>'
  16889. }
  16890. }
  16891. function yr(t, e, r) {
  16892. return new _r(t, e, r)
  16893. }
  16894. const Nr = ['UPPER', 'LOWER', 'DIGIT', 'MIXED', 'PUNCT'],
  16895. Mr = new _r(null, 0, 0),
  16896. Dr = [
  16897. Int32Array.from([0, 327708, 327710, 327709, 656318]),
  16898. Int32Array.from([590318, 0, 327710, 327709, 656318]),
  16899. Int32Array.from([262158, 590300, 0, 590301, 932798]),
  16900. Int32Array.from([327709, 327708, 656318, 0, 327710]),
  16901. Int32Array.from([327711, 656380, 656382, 656381, 0])
  16902. ]
  16903. const Rr = (function(t) {
  16904. for (let e of t) f.fill(e, -1)
  16905. return (t[0][4] = 0), (t[1][4] = 0), (t[1][0] = 28), (t[3][4] = 0), (t[2][4] = 0), (t[2][0] = 15), t
  16906. })(f.createInt32Array(6, 6))
  16907. class Or {
  16908. constructor(t, e, r, n) {
  16909. ;(this.token = t), (this.mode = e), (this.binaryShiftByteCount = r), (this.bitCount = n)
  16910. }
  16911. getMode() {
  16912. return this.mode
  16913. }
  16914. getToken() {
  16915. return this.token
  16916. }
  16917. getBinaryShiftByteCount() {
  16918. return this.binaryShiftByteCount
  16919. }
  16920. getBitCount() {
  16921. return this.bitCount
  16922. }
  16923. latchAndAppend(t, e) {
  16924. let r = this.bitCount,
  16925. n = this.token
  16926. if (t !== this.mode) {
  16927. let e = Dr[this.mode][t]
  16928. ;(n = yr(n, 65535 & e, e >> 16)), (r += e >> 16)
  16929. }
  16930. let i = 2 === t ? 4 : 5
  16931. return (n = yr(n, e, i)), new Or(n, t, 0, r + i)
  16932. }
  16933. shiftAndAppend(t, e) {
  16934. let r = this.token,
  16935. n = 2 === this.mode ? 4 : 5
  16936. return (r = yr(r, Rr[this.mode][t], n)), (r = yr(r, e, 5)), new Or(r, this.mode, 0, this.bitCount + n + 5)
  16937. }
  16938. addBinaryShiftChar(t) {
  16939. let e = this.token,
  16940. r = this.mode,
  16941. n = this.bitCount
  16942. if (4 === this.mode || 2 === this.mode) {
  16943. let t = Dr[r][0]
  16944. ;(e = yr(e, 65535 & t, t >> 16)), (n += t >> 16), (r = 0)
  16945. }
  16946. let i = 0 === this.binaryShiftByteCount || 31 === this.binaryShiftByteCount ? 18 : 62 === this.binaryShiftByteCount ? 9 : 8,
  16947. o = new Or(e, r, this.binaryShiftByteCount + 1, n + i)
  16948. return 2078 === o.binaryShiftByteCount && (o = o.endBinaryShift(t + 1)), o
  16949. }
  16950. endBinaryShift(t) {
  16951. if (0 === this.binaryShiftByteCount) return this
  16952. let e = this.token
  16953. return (
  16954. (e = (function(t, e, r) {
  16955. return new Tr(t, e, r)
  16956. })(e, t - this.binaryShiftByteCount, this.binaryShiftByteCount)),
  16957. new Or(e, this.mode, 0, this.bitCount)
  16958. )
  16959. }
  16960. isBetterThanOrEqualTo(t) {
  16961. let e = this.bitCount + (Dr[this.mode][t.mode] >> 16)
  16962. return (
  16963. this.binaryShiftByteCount < t.binaryShiftByteCount
  16964. ? (e += Or.calculateBinaryShiftCost(t) - Or.calculateBinaryShiftCost(this))
  16965. : this.binaryShiftByteCount > t.binaryShiftByteCount && t.binaryShiftByteCount > 0 && (e += 10),
  16966. e <= t.bitCount
  16967. )
  16968. }
  16969. toBitArray(t) {
  16970. let e = []
  16971. for (let r = this.endBinaryShift(t.length).token; null !== r; r = r.getPrevious()) e.unshift(r)
  16972. let r = new A()
  16973. for (const n of e) n.appendTo(r, t)
  16974. return r
  16975. }
  16976. toString() {
  16977. return _.format('%s bits=%d bytes=%d', Nr[this.mode], this.bitCount, this.binaryShiftByteCount)
  16978. }
  16979. static calculateBinaryShiftCost(t) {
  16980. return t.binaryShiftByteCount > 62 ? 21 : t.binaryShiftByteCount > 31 ? 20 : t.binaryShiftByteCount > 0 ? 10 : 0
  16981. }
  16982. }
  16983. Or.INITIAL_STATE = new Or(Mr, 0, 0, 0)
  16984. const br = (function(t) {
  16985. const e = _.getCharCode(' '),
  16986. r = _.getCharCode('.'),
  16987. n = _.getCharCode(',')
  16988. t[0][e] = 1
  16989. const i = _.getCharCode('Z'),
  16990. o = _.getCharCode('A')
  16991. for (let e = o; e <= i; e++) t[0][e] = e - o + 2
  16992. t[1][e] = 1
  16993. const s = _.getCharCode('z'),
  16994. a = _.getCharCode('a')
  16995. for (let e = a; e <= s; e++) t[1][e] = e - a + 2
  16996. t[2][e] = 1
  16997. const l = _.getCharCode('9'),
  16998. c = _.getCharCode('0')
  16999. for (let e = c; e <= l; e++) t[2][e] = e - c + 2
  17000. ;(t[2][n] = 12), (t[2][r] = 13)
  17001. const h = ['\0', ' ', '', '', '', '', '', '', '', '\b', '\t', '\n', '\v', '\f', '\r', '', '', '', '', '', '@', '\\', '^', '_', '`', '|', '~', '']
  17002. for (let e = 0; e < h.length; e++) t[3][_.getCharCode(h[e])] = e
  17003. const u = ['\0', '\r', '\0', '\0', '\0', '\0', '!', "'", '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '[', ']', '{', '}']
  17004. for (let e = 0; e < u.length; e++) _.getCharCode(u[e]) > 0 && (t[4][_.getCharCode(u[e])] = e)
  17005. return t
  17006. })(f.createInt32Array(5, 256))
  17007. class Lr {
  17008. constructor(t) {
  17009. this.text = t
  17010. }
  17011. encode() {
  17012. const t = _.getCharCode(' '),
  17013. e = _.getCharCode('\n')
  17014. let r = Sr.singletonList(Or.INITIAL_STATE)
  17015. for (let n = 0; n < this.text.length; n++) {
  17016. let i,
  17017. o = n + 1 < this.text.length ? this.text[n + 1] : 0
  17018. switch (this.text[n]) {
  17019. case _.getCharCode('\r'):
  17020. i = o === e ? 2 : 0
  17021. break
  17022. case _.getCharCode('.'):
  17023. i = o === t ? 3 : 0
  17024. break
  17025. case _.getCharCode(','):
  17026. i = o === t ? 4 : 0
  17027. break
  17028. case _.getCharCode(':'):
  17029. i = o === t ? 5 : 0
  17030. break
  17031. default:
  17032. i = 0
  17033. }
  17034. i > 0 ? ((r = Lr.updateStateListForPair(r, n, i)), n++) : (r = this.updateStateListForChar(r, n))
  17035. }
  17036. return Sr.min(r, (t, e) => t.getBitCount() - e.getBitCount()).toBitArray(this.text)
  17037. }
  17038. updateStateListForChar(t, e) {
  17039. const r = []
  17040. for (let n of t) this.updateStateForChar(n, e, r)
  17041. return Lr.simplifyStates(r)
  17042. }
  17043. updateStateForChar(t, e, r) {
  17044. let n = 255 & this.text[e],
  17045. i = br[t.getMode()][n] > 0,
  17046. o = null
  17047. for (let s = 0; s <= 4; s++) {
  17048. let a = br[s][n]
  17049. if (a > 0) {
  17050. if ((null == o && (o = t.endBinaryShift(e)), !i || s === t.getMode() || 2 === s)) {
  17051. const t = o.latchAndAppend(s, a)
  17052. r.push(t)
  17053. }
  17054. if (!i && Rr[t.getMode()][s] >= 0) {
  17055. const t = o.shiftAndAppend(s, a)
  17056. r.push(t)
  17057. }
  17058. }
  17059. }
  17060. if (t.getBinaryShiftByteCount() > 0 || 0 === br[t.getMode()][n]) {
  17061. let n = t.addBinaryShiftChar(e)
  17062. r.push(n)
  17063. }
  17064. }
  17065. static updateStateListForPair(t, e, r) {
  17066. const n = []
  17067. for (let i of t) this.updateStateForPair(i, e, r, n)
  17068. return this.simplifyStates(n)
  17069. }
  17070. static updateStateForPair(t, e, r, n) {
  17071. let i = t.endBinaryShift(e)
  17072. if ((n.push(i.latchAndAppend(4, r)), 4 !== t.getMode() && n.push(i.shiftAndAppend(4, r)), 3 === r || 4 === r)) {
  17073. let t = i.latchAndAppend(2, 16 - r).latchAndAppend(2, 1)
  17074. n.push(t)
  17075. }
  17076. if (t.getBinaryShiftByteCount() > 0) {
  17077. let r = t.addBinaryShiftChar(e).addBinaryShiftChar(e + 1)
  17078. n.push(r)
  17079. }
  17080. }
  17081. static simplifyStates(t) {
  17082. let e = []
  17083. for (const r of t) {
  17084. let t = !0
  17085. for (const n of e) {
  17086. if (n.isBetterThanOrEqualTo(r)) {
  17087. t = !1
  17088. break
  17089. }
  17090. r.isBetterThanOrEqualTo(n) && (e = e.filter(t => t !== n))
  17091. }
  17092. t && e.push(r)
  17093. }
  17094. return e
  17095. }
  17096. }
  17097. class Br {
  17098. constructor() {}
  17099. static encodeBytes(t) {
  17100. return Br.encode(t, Br.DEFAULT_EC_PERCENT, Br.DEFAULT_AZTEC_LAYERS)
  17101. }
  17102. static encode(t, e, r) {
  17103. let n,
  17104. i,
  17105. o,
  17106. s,
  17107. l,
  17108. c = new Lr(t).encode(),
  17109. h = w.truncDivision(c.getSize() * e, 100) + 11,
  17110. u = c.getSize() + h
  17111. if (r !== Br.DEFAULT_AZTEC_LAYERS) {
  17112. if (((n = r < 0), (i = Math.abs(r)), i > (n ? Br.MAX_NB_BITS_COMPACT : Br.MAX_NB_BITS))) throw new a(_.format('Illegal value %s for layers', r))
  17113. ;(o = Br.totalBitsInLayer(i, n)), (s = Br.WORD_SIZE[i])
  17114. let t = o - (o % s)
  17115. if (((l = Br.stuffBits(c, s)), l.getSize() + h > t)) throw new a('Data to large for user specified layer')
  17116. if (n && l.getSize() > 64 * s) throw new a('Data to large for user specified layer')
  17117. } else {
  17118. ;(s = 0), (l = null)
  17119. for (let t = 0; ; t++) {
  17120. if (t > Br.MAX_NB_BITS) throw new a('Data too large for an Aztec code')
  17121. if (((n = t <= 3), (i = n ? t + 1 : t), (o = Br.totalBitsInLayer(i, n)), u > o)) continue
  17122. ;(null != l && s === Br.WORD_SIZE[i]) || ((s = Br.WORD_SIZE[i]), (l = Br.stuffBits(c, s)))
  17123. let e = o - (o % s)
  17124. if (!(n && l.getSize() > 64 * s) && l.getSize() + h <= e) break
  17125. }
  17126. }
  17127. let d,
  17128. g = Br.generateCheckWords(l, o, s),
  17129. f = l.getSize() / s,
  17130. A = Br.generateModeMessage(n, i, f),
  17131. m = (n ? 11 : 14) + 4 * i,
  17132. E = new Int32Array(m)
  17133. if (n) {
  17134. d = m
  17135. for (let t = 0; t < E.length; t++) E[t] = t
  17136. } else {
  17137. d = m + 1 + 2 * w.truncDivision(w.truncDivision(m, 2) - 1, 15)
  17138. let t = w.truncDivision(m, 2),
  17139. e = w.truncDivision(d, 2)
  17140. for (let r = 0; r < t; r++) {
  17141. let n = r + w.truncDivision(r, 15)
  17142. ;(E[t - r - 1] = e - n - 1), (E[t + r] = e + n + 1)
  17143. }
  17144. }
  17145. let C = new y(d)
  17146. for (let t = 0, e = 0; t < i; t++) {
  17147. let r = 4 * (i - t) + (n ? 9 : 12)
  17148. for (let n = 0; n < r; n++) {
  17149. let i = 2 * n
  17150. for (let o = 0; o < 2; o++)
  17151. g.get(e + i + o) && C.set(E[2 * t + o], E[2 * t + n]),
  17152. g.get(e + 2 * r + i + o) && C.set(E[2 * t + n], E[m - 1 - 2 * t - o]),
  17153. g.get(e + 4 * r + i + o) && C.set(E[m - 1 - 2 * t - o], E[m - 1 - 2 * t - n]),
  17154. g.get(e + 6 * r + i + o) && C.set(E[m - 1 - 2 * t - n], E[2 * t + o])
  17155. }
  17156. e += 8 * r
  17157. }
  17158. if ((Br.drawModeMessage(C, n, d, A), n)) Br.drawBullsEye(C, w.truncDivision(d, 2), 5)
  17159. else {
  17160. Br.drawBullsEye(C, w.truncDivision(d, 2), 7)
  17161. for (let t = 0, e = 0; t < w.truncDivision(m, 2) - 1; t += 15, e += 16)
  17162. for (let t = 1 & w.truncDivision(d, 2); t < d; t += 2)
  17163. C.set(w.truncDivision(d, 2) - e, t), C.set(w.truncDivision(d, 2) + e, t), C.set(t, w.truncDivision(d, 2) - e), C.set(t, w.truncDivision(d, 2) + e)
  17164. }
  17165. let I = new pr()
  17166. return I.setCompact(n), I.setSize(d), I.setLayers(i), I.setCodeWords(f), I.setMatrix(C), I
  17167. }
  17168. static drawBullsEye(t, e, r) {
  17169. for (let n = 0; n < r; n += 2) for (let r = e - n; r <= e + n; r++) t.set(r, e - n), t.set(r, e + n), t.set(e - n, r), t.set(e + n, r)
  17170. t.set(e - r, e - r), t.set(e - r + 1, e - r), t.set(e - r, e - r + 1), t.set(e + r, e - r), t.set(e + r, e - r + 1), t.set(e + r, e + r - 1)
  17171. }
  17172. static generateModeMessage(t, e, r) {
  17173. let n = new A()
  17174. return (
  17175. t
  17176. ? (n.appendBits(e - 1, 2), n.appendBits(r - 1, 6), (n = Br.generateCheckWords(n, 28, 4)))
  17177. : (n.appendBits(e - 1, 5), n.appendBits(r - 1, 11), (n = Br.generateCheckWords(n, 40, 4))),
  17178. n
  17179. )
  17180. }
  17181. static drawModeMessage(t, e, r, n) {
  17182. let i = w.truncDivision(r, 2)
  17183. if (e)
  17184. for (let e = 0; e < 7; e++) {
  17185. let r = i - 3 + e
  17186. n.get(e) && t.set(r, i - 5), n.get(e + 7) && t.set(i + 5, r), n.get(20 - e) && t.set(r, i + 5), n.get(27 - e) && t.set(i - 5, r)
  17187. }
  17188. else
  17189. for (let e = 0; e < 10; e++) {
  17190. let r = i - 5 + e + w.truncDivision(e, 5)
  17191. n.get(e) && t.set(r, i - 7), n.get(e + 10) && t.set(i + 7, r), n.get(29 - e) && t.set(r, i + 7), n.get(39 - e) && t.set(i - 7, r)
  17192. }
  17193. }
  17194. static generateCheckWords(t, e, r) {
  17195. let n = t.getSize() / r,
  17196. i = new ar(Br.getGF(r)),
  17197. o = w.truncDivision(e, r),
  17198. s = Br.bitsToWords(t, r, o)
  17199. i.encode(s, o - n)
  17200. let a = e % r,
  17201. l = new A()
  17202. l.appendBits(0, a)
  17203. for (const t of Array.from(s)) l.appendBits(t, r)
  17204. return l
  17205. }
  17206. static bitsToWords(t, e, r) {
  17207. let n,
  17208. i,
  17209. o = new Int32Array(r)
  17210. for (n = 0, i = t.getSize() / e; n < i; n++) {
  17211. let r = 0
  17212. for (let i = 0; i < e; i++) r |= t.get(n * e + i) ? 1 << (e - i - 1) : 0
  17213. o[n] = r
  17214. }
  17215. return o
  17216. }
  17217. static getGF(t) {
  17218. switch (t) {
  17219. case 4:
  17220. return K.AZTEC_PARAM
  17221. case 6:
  17222. return K.AZTEC_DATA_6
  17223. case 8:
  17224. return K.AZTEC_DATA_8
  17225. case 10:
  17226. return K.AZTEC_DATA_10
  17227. case 12:
  17228. return K.AZTEC_DATA_12
  17229. default:
  17230. throw new a('Unsupported word size ' + t)
  17231. }
  17232. }
  17233. static stuffBits(t, e) {
  17234. let r = new A(),
  17235. n = t.getSize(),
  17236. i = (1 << e) - 2
  17237. for (let o = 0; o < n; o += e) {
  17238. let s = 0
  17239. for (let r = 0; r < e; r++) (o + r >= n || t.get(o + r)) && (s |= 1 << (e - 1 - r))
  17240. ;(s & i) === i ? (r.appendBits(s & i, e), o--) : 0 == (s & i) ? (r.appendBits(1 | s, e), o--) : r.appendBits(s, e)
  17241. }
  17242. return r
  17243. }
  17244. static totalBitsInLayer(t, e) {
  17245. return ((e ? 88 : 112) + 16 * t) * t
  17246. }
  17247. }
  17248. ;(Br.DEFAULT_EC_PERCENT = 33),
  17249. (Br.DEFAULT_AZTEC_LAYERS = 0),
  17250. (Br.MAX_NB_BITS = 32),
  17251. (Br.MAX_NB_BITS_COMPACT = 4),
  17252. (Br.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]))
  17253. class Pr {
  17254. encode(t, e, r, n) {
  17255. return this.encodeWithHints(t, e, r, n, null)
  17256. }
  17257. encodeWithHints(t, e, r, n, i) {
  17258. let o = Ir.ISO_8859_1,
  17259. s = Br.DEFAULT_EC_PERCENT,
  17260. a = Br.DEFAULT_AZTEC_LAYERS
  17261. return (
  17262. null != i &&
  17263. (i.has(sr.CHARACTER_SET) && (o = Cr.forName(i.get(sr.CHARACTER_SET).toString())),
  17264. i.has(sr.ERROR_CORRECTION) && (s = w.parseInt(i.get(sr.ERROR_CORRECTION).toString())),
  17265. i.has(sr.AZTEC_LAYERS) && (a = w.parseInt(i.get(sr.AZTEC_LAYERS).toString()))),
  17266. Pr.encodeLayers(t, e, r, n, o, s, a)
  17267. )
  17268. }
  17269. static encodeLayers(t, e, r, n, i, o, s) {
  17270. if (e !== k.AZTEC) throw new a('Can only encode AZTEC, but got ' + e)
  17271. let l = Br.encode(_.getBytes(t, i), o, s)
  17272. return Pr.renderResult(l, r, n)
  17273. }
  17274. static renderResult(t, e, r) {
  17275. let n = t.getMatrix()
  17276. if (null == n) throw new J()
  17277. let i = n.getWidth(),
  17278. o = n.getHeight(),
  17279. s = Math.max(e, i),
  17280. a = Math.max(r, o),
  17281. l = Math.min(s / i, a / o),
  17282. c = (s - i * l) / 2,
  17283. h = (a - o * l) / 2,
  17284. u = new y(s, a)
  17285. for (let t = 0, e = h; t < o; t++, e += l) for (let r = 0, o = c; r < i; r++, o += l) n.get(r, t) && u.setRegion(o, e, l, l)
  17286. return u
  17287. }
  17288. }
  17289. ;(t.ArgumentException = s),
  17290. (t.ArithmeticException = Q),
  17291. (t.AztecCode = pr),
  17292. (t.AztecCodeReader = gt),
  17293. (t.AztecCodeWriter = Pr),
  17294. (t.AztecDecoder = tt),
  17295. (t.AztecDetector = dt),
  17296. (t.AztecDetectorResult = ot),
  17297. (t.AztecEncoder = Br),
  17298. (t.AztecHighLevelEncoder = Lr),
  17299. (t.AztecPoint = ut),
  17300. (t.BarcodeFormat = k),
  17301. (t.Binarizer = h),
  17302. (t.BinaryBitmap = l),
  17303. (t.BitArray = A),
  17304. (t.BitMatrix = y),
  17305. (t.BitSource = ae),
  17306. (t.BrowserAztecCodeReader = class extends v {
  17307. constructor(t = 500) {
  17308. super(new gt(), t)
  17309. }
  17310. }),
  17311. (t.BrowserBarcodeReader = class extends v {
  17312. constructor(t = 500, e) {
  17313. super(new ee(e), t, e)
  17314. }
  17315. }),
  17316. (t.BrowserCodeReader = v),
  17317. (t.BrowserDatamatrixCodeReader = class extends v {
  17318. constructor(t = 500) {
  17319. super(new ue(), t)
  17320. }
  17321. }),
  17322. (t.BrowserMultiFormatReader = class extends v {
  17323. constructor(t = null, e = 500) {
  17324. const r = new ir()
  17325. r.setHints(t), super(r, e)
  17326. }
  17327. decodeBitmap(t) {
  17328. return this.reader.decodeWithState(t)
  17329. }
  17330. }),
  17331. (t.BrowserPDF417Reader = class extends v {
  17332. constructor(t = 500) {
  17333. super(new rr(), t)
  17334. }
  17335. }),
  17336. (t.BrowserQRCodeReader = class extends v {
  17337. constructor(t = 500) {
  17338. super(new Oe(), t)
  17339. }
  17340. }),
  17341. (t.BrowserQRCodeSvgWriter = wr),
  17342. (t.CharacterSetECI = I),
  17343. (t.ChecksumException = c),
  17344. (t.Code128Reader = wt),
  17345. (t.Code39Reader = At),
  17346. (t.DataMatrixDecodedBitStreamParser = le),
  17347. (t.DataMatrixReader = ue),
  17348. (t.DecodeHintType = E),
  17349. (t.DecoderResult = W),
  17350. (t.DefaultGridSampler = ct),
  17351. (t.DetectorResult = it),
  17352. (t.EAN13Reader = _t),
  17353. (t.EncodeHintType = sr),
  17354. (t.Exception = o),
  17355. (t.FormatException = C),
  17356. (t.GenericGF = K),
  17357. (t.GenericGFPoly = Z),
  17358. (t.GlobalHistogramBinarizer = M),
  17359. (t.GridSampler = at),
  17360. (t.GridSamplerInstance = ht),
  17361. (t.HTMLCanvasElementLuminanceSource = b),
  17362. (t.HybridBinarizer = D),
  17363. (t.ITFReader = mt),
  17364. (t.IllegalArgumentException = a),
  17365. (t.IllegalStateException = J),
  17366. (t.InvertedLuminanceSource = O),
  17367. (t.LuminanceSource = R),
  17368. (t.MathUtils = et),
  17369. (t.MultiFormatOneDReader = ee),
  17370. (t.MultiFormatReader = ir),
  17371. (t.MultiFormatWriter = class {
  17372. encode(t, e, r, n, i) {
  17373. let o
  17374. switch (e) {
  17375. case k.QR_CODE:
  17376. o = new Ar()
  17377. break
  17378. default:
  17379. throw new a('No encoder available for format ' + e)
  17380. }
  17381. return o.encode(t, e, r, n, i)
  17382. }
  17383. }),
  17384. (t.NotFoundException = N),
  17385. (t.OneDReader = ft),
  17386. (t.PDF417DecodedBitStreamParser = tr),
  17387. (t.PDF417DecoderErrorCorrection = Fe),
  17388. (t.PDF417Reader = rr),
  17389. (t.PDF417ResultMetadata = We),
  17390. (t.PerspectiveTransform = lt),
  17391. (t.PlanarYUVLuminanceSource = mr),
  17392. (t.QRCodeByteMatrix = cr),
  17393. (t.QRCodeDataMask = me),
  17394. (t.QRCodeDecodedBitStreamParser = pe),
  17395. (t.QRCodeDecoderErrorCorrectionLevel = de),
  17396. (t.QRCodeDecoderFormatInformation = ge),
  17397. (t.QRCodeEncoder = fr),
  17398. (t.QRCodeEncoderQRCode = hr),
  17399. (t.QRCodeMaskUtil = lr),
  17400. (t.QRCodeMatrixUtil = dr),
  17401. (t.QRCodeMode = Ie),
  17402. (t.QRCodeReader = Oe),
  17403. (t.QRCodeVersion = Ae),
  17404. (t.QRCodeWriter = Ar),
  17405. (t.RGBLuminanceSource = Er),
  17406. (t.RSS14Reader = te),
  17407. (t.RSSExpandedReader = Jt),
  17408. (t.ReaderException = nr),
  17409. (t.ReedSolomonDecoder = $),
  17410. (t.ReedSolomonEncoder = ar),
  17411. (t.ReedSolomonException = q),
  17412. (t.Result = F),
  17413. (t.ResultMetadataType = X),
  17414. (t.ResultPoint = nt),
  17415. (t.StringUtils = _),
  17416. (t.UnsupportedOperationException = p),
  17417. (t.VideoInputDevice = L),
  17418. (t.WhiteRectangleDetector = st),
  17419. (t.WriterException = ur),
  17420. (t.ZXingArrays = f),
  17421. (t.ZXingCharset = Cr),
  17422. (t.ZXingInteger = w),
  17423. (t.ZXingStandardCharsets = Ir),
  17424. (t.ZXingStringBuilder = T),
  17425. (t.ZXingStringEncoding = S),
  17426. (t.ZXingSystem = u),
  17427. Object.defineProperty(t, '__esModule', { value: !0 })
  17428. })(e)
  17429. }
  17430. },
  17431. e = {}
  17432. function r(n) {
  17433. var i = e[n]
  17434. if (void 0 !== i) return i.exports
  17435. var o = (e[n] = { exports: {} })
  17436. return t[n].call(o.exports, o, o.exports, r), o.exports
  17437. }
  17438. ;(r.d = (t, e) => {
  17439. for (var n in e) r.o(e, n) && !r.o(t, n) && Object.defineProperty(t, n, { enumerable: !0, get: e[n] })
  17440. }),
  17441. (r.g = (function() {
  17442. if ('object' == typeof globalThis) return globalThis
  17443. try {
  17444. return this || new Function('return this')()
  17445. } catch (t) {
  17446. if ('object' == typeof window) return window
  17447. }
  17448. })()),
  17449. (r.o = (t, e) => Object.prototype.hasOwnProperty.call(t, e)),
  17450. (r.r = t => {
  17451. 'undefined' != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, { value: 'Module' }), Object.defineProperty(t, '__esModule', { value: !0 })
  17452. })
  17453. var n = {}
  17454. ;(() => {
  17455. 'use strict'
  17456. var t
  17457. r.r(n),
  17458. r.d(n, { Html5Qrcode: () => L, Html5QrcodeScanType: () => i, Html5QrcodeScanner: () => V, Html5QrcodeScannerState: () => f, Html5QrcodeSupportedFormats: () => t }),
  17459. (function(t) {
  17460. ;(t[(t.QR_CODE = 0)] = 'QR_CODE'),
  17461. (t[(t.AZTEC = 1)] = 'AZTEC'),
  17462. (t[(t.CODABAR = 2)] = 'CODABAR'),
  17463. (t[(t.CODE_39 = 3)] = 'CODE_39'),
  17464. (t[(t.CODE_93 = 4)] = 'CODE_93'),
  17465. (t[(t.CODE_128 = 5)] = 'CODE_128'),
  17466. (t[(t.DATA_MATRIX = 6)] = 'DATA_MATRIX'),
  17467. (t[(t.MAXICODE = 7)] = 'MAXICODE'),
  17468. (t[(t.ITF = 8)] = 'ITF'),
  17469. (t[(t.EAN_13 = 9)] = 'EAN_13'),
  17470. (t[(t.EAN_8 = 10)] = 'EAN_8'),
  17471. (t[(t.PDF_417 = 11)] = 'PDF_417'),
  17472. (t[(t.RSS_14 = 12)] = 'RSS_14'),
  17473. (t[(t.RSS_EXPANDED = 13)] = 'RSS_EXPANDED'),
  17474. (t[(t.UPC_A = 14)] = 'UPC_A'),
  17475. (t[(t.UPC_E = 15)] = 'UPC_E'),
  17476. (t[(t.UPC_EAN_EXTENSION = 16)] = 'UPC_EAN_EXTENSION')
  17477. })(t || (t = {}))
  17478. var e,
  17479. i,
  17480. o = new Map([
  17481. [t.QR_CODE, 'QR_CODE'],
  17482. [t.AZTEC, 'AZTEC'],
  17483. [t.CODABAR, 'CODABAR'],
  17484. [t.CODE_39, 'CODE_39'],
  17485. [t.CODE_93, 'CODE_93'],
  17486. [t.CODE_128, 'CODE_128'],
  17487. [t.DATA_MATRIX, 'DATA_MATRIX'],
  17488. [t.MAXICODE, 'MAXICODE'],
  17489. [t.ITF, 'ITF'],
  17490. [t.EAN_13, 'EAN_13'],
  17491. [t.EAN_8, 'EAN_8'],
  17492. [t.PDF_417, 'PDF_417'],
  17493. [t.RSS_14, 'RSS_14'],
  17494. [t.RSS_EXPANDED, 'RSS_EXPANDED'],
  17495. [t.UPC_A, 'UPC_A'],
  17496. [t.UPC_E, 'UPC_E'],
  17497. [t.UPC_EAN_EXTENSION, 'UPC_EAN_EXTENSION']
  17498. ])
  17499. function s(e) {
  17500. return Object.values(t).includes(e)
  17501. }
  17502. !(function(t) {
  17503. ;(t[(t.UNKNOWN = 0)] = 'UNKNOWN'), (t[(t.URL = 1)] = 'URL')
  17504. })(e || (e = {})),
  17505. (function(t) {
  17506. ;(t[(t.SCAN_TYPE_CAMERA = 0)] = 'SCAN_TYPE_CAMERA'), (t[(t.SCAN_TYPE_FILE = 1)] = 'SCAN_TYPE_FILE')
  17507. })(i || (i = {}))
  17508. var a,
  17509. l = (function() {
  17510. function t() {}
  17511. return (
  17512. (t.GITHUB_PROJECT_URL = 'https://github.com/mebjas/html5-qrcode'),
  17513. (t.SCAN_DEFAULT_FPS = 2),
  17514. (t.DEFAULT_DISABLE_FLIP = !1),
  17515. (t.DEFAULT_REMEMBER_LAST_CAMERA_USED = !0),
  17516. (t.DEFAULT_SUPPORTED_SCAN_TYPE = [i.SCAN_TYPE_CAMERA, i.SCAN_TYPE_FILE]),
  17517. t
  17518. )
  17519. })(),
  17520. c = (function() {
  17521. function t(t, e) {
  17522. ;(this.format = t), (this.formatName = e)
  17523. }
  17524. return (
  17525. (t.prototype.toString = function() {
  17526. return this.formatName
  17527. }),
  17528. (t.create = function(e) {
  17529. if (!o.has(e)) throw e + ' not in html5QrcodeSupportedFormatsTextMap'
  17530. return new t(e, o.get(e))
  17531. }),
  17532. t
  17533. )
  17534. })(),
  17535. h = (function() {
  17536. function t() {}
  17537. return (
  17538. (t.createFromText = function(t) {
  17539. return { decodedText: t, result: { text: t } }
  17540. }),
  17541. (t.createFromQrcodeResult = function(t) {
  17542. return { decodedText: t.text, result: t }
  17543. }),
  17544. t
  17545. )
  17546. })()
  17547. !(function(t) {
  17548. ;(t[(t.UNKWOWN_ERROR = 0)] = 'UNKWOWN_ERROR'), (t[(t.IMPLEMENTATION_ERROR = 1)] = 'IMPLEMENTATION_ERROR'), (t[(t.NO_CODE_FOUND_ERROR = 2)] = 'NO_CODE_FOUND_ERROR')
  17549. })(a || (a = {}))
  17550. var u = (function() {
  17551. function t() {}
  17552. return (
  17553. (t.createFrom = function(t) {
  17554. return { errorMessage: t, type: a.UNKWOWN_ERROR }
  17555. }),
  17556. t
  17557. )
  17558. })(),
  17559. d = (function() {
  17560. function t(t) {
  17561. this.verbose = t
  17562. }
  17563. return (
  17564. (t.prototype.log = function(t) {
  17565. this.verbose && console.log(t)
  17566. }),
  17567. (t.prototype.warn = function(t) {
  17568. this.verbose && console.warn(t)
  17569. }),
  17570. (t.prototype.logError = function(t, e) {
  17571. ;(this.verbose || !0 === e) && console.error(t)
  17572. }),
  17573. (t.prototype.logErrors = function(t) {
  17574. if (0 === t.length) throw 'Logger#logError called without arguments'
  17575. this.verbose && console.error(t)
  17576. }),
  17577. t
  17578. )
  17579. })()
  17580. function g(t) {
  17581. return null == t
  17582. }
  17583. var f,
  17584. w = (function() {
  17585. function t() {}
  17586. return (
  17587. (t.codeParseError = function(t) {
  17588. return 'QR code parse error, error = ' + t
  17589. }),
  17590. (t.errorGettingUserMedia = function(t) {
  17591. return 'Error getting userMedia, error = ' + t
  17592. }),
  17593. (t.onlyDeviceSupportedError = function() {
  17594. return "The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."
  17595. }),
  17596. (t.cameraStreamingNotSupported = function() {
  17597. return 'Camera streaming not supported by the browser.'
  17598. }),
  17599. (t.unableToQuerySupportedDevices = function() {
  17600. return 'Unable to query supported devices, unknown error.'
  17601. }),
  17602. (t.insecureContextCameraQueryError = function() {
  17603. return 'Camera access is only supported in secure context like https or localhost.'
  17604. }),
  17605. t
  17606. )
  17607. })(),
  17608. A = (function() {
  17609. function t() {}
  17610. return (
  17611. (t.scanningStatus = function() {
  17612. return 'Scanning'
  17613. }),
  17614. (t.idleStatus = function() {
  17615. return 'Idle'
  17616. }),
  17617. (t.errorStatus = function() {
  17618. return 'Error'
  17619. }),
  17620. (t.permissionStatus = function() {
  17621. return 'Permission'
  17622. }),
  17623. (t.noCameraFoundErrorStatus = function() {
  17624. return 'No Cameras'
  17625. }),
  17626. (t.lastMatch = function(t) {
  17627. return 'Last Match: ' + t
  17628. }),
  17629. (t.codeScannerTitle = function() {
  17630. return 'Code Scanner'
  17631. }),
  17632. (t.cameraPermissionTitle = function() {
  17633. return 'Request Camera Permissions'
  17634. }),
  17635. (t.cameraPermissionRequesting = function() {
  17636. return 'Requesting camera permissions...'
  17637. }),
  17638. (t.noCameraFound = function() {
  17639. return 'No camera found'
  17640. }),
  17641. (t.scanButtonStopScanningText = function() {
  17642. return 'Stop Scanning'
  17643. }),
  17644. (t.scanButtonStartScanningText = function() {
  17645. return 'Start Scanning'
  17646. }),
  17647. (t.scanButtonScanningStarting = function() {
  17648. return 'Launching Camera...'
  17649. }),
  17650. (t.textIfCameraScanSelected = function() {
  17651. return 'Scan an Image File'
  17652. }),
  17653. (t.textIfFileScanSelected = function() {
  17654. return 'Scan using camera directly'
  17655. }),
  17656. (t.selectCamera = function() {
  17657. return 'Select Camera'
  17658. }),
  17659. t
  17660. )
  17661. })(),
  17662. m = (function() {
  17663. function t() {}
  17664. return (
  17665. (t.builtUsing = function() {
  17666. return 'Built using '
  17667. }),
  17668. (t.reportIssues = function() {
  17669. return 'Report issues'
  17670. }),
  17671. t
  17672. )
  17673. })(),
  17674. E = (function() {
  17675. function t() {}
  17676. return (
  17677. (t.isMediaStreamConstraintsValid = function(t, e) {
  17678. if ('object' != typeof t) {
  17679. var r = typeof t
  17680. return e.logError('videoConstraints should be of type object, the object passed is of type ' + r + '.', !0), !1
  17681. }
  17682. for (
  17683. var n = new Set(['autoGainControl', 'channelCount', 'echoCancellation', 'latency', 'noiseSuppression', 'sampleRate', 'sampleSize', 'volume']), i = 0, o = Object.keys(t);
  17684. i < o.length;
  17685. i++
  17686. ) {
  17687. var s = o[i]
  17688. if (n.has(s)) return e.logError(s + ' is not supported videoConstaints.', !0), !1
  17689. }
  17690. return !0
  17691. }),
  17692. t
  17693. )
  17694. })(),
  17695. C = r(449),
  17696. I = (function() {
  17697. function e(e, r, n) {
  17698. if (
  17699. ((this.formatMap = new Map([
  17700. [t.QR_CODE, C.BarcodeFormat.QR_CODE],
  17701. [t.AZTEC, C.BarcodeFormat.AZTEC],
  17702. [t.CODABAR, C.BarcodeFormat.CODABAR],
  17703. [t.CODE_39, C.BarcodeFormat.CODE_39],
  17704. [t.CODE_93, C.BarcodeFormat.CODE_93],
  17705. [t.CODE_128, C.BarcodeFormat.CODE_128],
  17706. [t.DATA_MATRIX, C.BarcodeFormat.DATA_MATRIX],
  17707. [t.MAXICODE, C.BarcodeFormat.MAXICODE],
  17708. [t.ITF, C.BarcodeFormat.ITF],
  17709. [t.EAN_13, C.BarcodeFormat.EAN_13],
  17710. [t.EAN_8, C.BarcodeFormat.EAN_8],
  17711. [t.PDF_417, C.BarcodeFormat.PDF_417],
  17712. [t.RSS_14, C.BarcodeFormat.RSS_14],
  17713. [t.RSS_EXPANDED, C.BarcodeFormat.RSS_EXPANDED],
  17714. [t.UPC_A, C.BarcodeFormat.UPC_A],
  17715. [t.UPC_E, C.BarcodeFormat.UPC_E],
  17716. [t.UPC_EAN_EXTENSION, C.BarcodeFormat.UPC_EAN_EXTENSION]
  17717. ])),
  17718. (this.reverseFormatMap = this.createReverseFormatMap()),
  17719. !C)
  17720. )
  17721. throw 'Use html5qrcode.min.js without edit, ZXing not found.'
  17722. ;(this.verbose = r), (this.logger = n)
  17723. var i = this.createZXingFormats(e),
  17724. o = new Map()
  17725. o.set(C.DecodeHintType.POSSIBLE_FORMATS, i), (this.hints = o)
  17726. }
  17727. return (
  17728. (e.prototype.decodeAsync = function(t) {
  17729. var e = this
  17730. return new Promise(function(r, n) {
  17731. try {
  17732. r(e.decode(t))
  17733. } catch (t) {
  17734. n(t)
  17735. }
  17736. })
  17737. }),
  17738. (e.prototype.decode = function(t) {
  17739. var e = new C.MultiFormatReader(this.verbose, this.hints),
  17740. r = new C.HTMLCanvasElementLuminanceSource(t),
  17741. n = new C.BinaryBitmap(new C.HybridBinarizer(r)),
  17742. i = e.decode(n)
  17743. return { text: i.text, format: c.create(this.toHtml5QrcodeSupportedFormats(i.format)) }
  17744. }),
  17745. (e.prototype.createReverseFormatMap = function() {
  17746. var t = new Map()
  17747. return (
  17748. this.formatMap.forEach(function(e, r, n) {
  17749. t.set(e, r)
  17750. }),
  17751. t
  17752. )
  17753. }),
  17754. (e.prototype.toHtml5QrcodeSupportedFormats = function(t) {
  17755. if (!this.reverseFormatMap.has(t)) throw "reverseFormatMap doesn't have " + t
  17756. return this.reverseFormatMap.get(t)
  17757. }),
  17758. (e.prototype.createZXingFormats = function(t) {
  17759. for (var e = [], r = 0, n = t; r < n.length; r++) {
  17760. var i = n[r]
  17761. this.formatMap.has(i) ? e.push(this.formatMap.get(i)) : this.logger.logError(i + ' is not supported byZXingHtml5QrcodeShim')
  17762. }
  17763. return e
  17764. }),
  17765. e
  17766. )
  17767. })(),
  17768. p = (function() {
  17769. function e(r, n, i) {
  17770. if (
  17771. ((this.formatMap = new Map([
  17772. [t.QR_CODE, 'qr_code'],
  17773. [t.AZTEC, 'aztec'],
  17774. [t.CODABAR, 'codabar'],
  17775. [t.CODE_39, 'code_39'],
  17776. [t.CODE_93, 'code_93'],
  17777. [t.CODE_128, 'code_128'],
  17778. [t.DATA_MATRIX, 'data_matrix'],
  17779. [t.ITF, 'itf'],
  17780. [t.EAN_13, 'ean_13'],
  17781. [t.EAN_8, 'ean_8'],
  17782. [t.PDF_417, 'pdf417'],
  17783. [t.UPC_A, 'upc_a'],
  17784. [t.UPC_E, 'upc_e']
  17785. ])),
  17786. (this.reverseFormatMap = this.createReverseFormatMap()),
  17787. !e.isSupported())
  17788. )
  17789. throw 'Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();'
  17790. ;(this.verbose = n), (this.logger = i)
  17791. var o = this.createBarcodeDetectorFormats(r)
  17792. if (((this.detector = new BarcodeDetector(o)), !this.detector)) throw 'BarcodeDetector detector not supported'
  17793. }
  17794. return (
  17795. (e.isSupported = function() {
  17796. return 'BarcodeDetector' in window && void 0 !== new BarcodeDetector({ formats: ['qr_code'] })
  17797. }),
  17798. (e.prototype.decodeAsync = function(t) {
  17799. return (
  17800. (e = this),
  17801. (r = void 0),
  17802. (i = function() {
  17803. var e, r
  17804. return (function(t, e) {
  17805. var r,
  17806. n,
  17807. i,
  17808. o,
  17809. s = {
  17810. label: 0,
  17811. sent: function() {
  17812. if (1 & i[0]) throw i[1]
  17813. return i[1]
  17814. },
  17815. trys: [],
  17816. ops: []
  17817. }
  17818. return (
  17819. (o = { next: a(0), throw: a(1), return: a(2) }),
  17820. 'function' == typeof Symbol &&
  17821. (o[Symbol.iterator] = function() {
  17822. return this
  17823. }),
  17824. o
  17825. )
  17826. function a(o) {
  17827. return function(a) {
  17828. return (function(o) {
  17829. if (r) throw new TypeError('Generator is already executing.')
  17830. for (; s; )
  17831. try {
  17832. if (((r = 1), n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n), 0) : n.next) && !(i = i.call(n, o[1])).done))
  17833. return i
  17834. switch (((n = 0), i && (o = [2 & o[0], i.value]), o[0])) {
  17835. case 0:
  17836. case 1:
  17837. i = o
  17838. break
  17839. case 4:
  17840. return s.label++, { value: o[1], done: !1 }
  17841. case 5:
  17842. s.label++, (n = o[1]), (o = [0])
  17843. continue
  17844. case 7:
  17845. ;(o = s.ops.pop()), s.trys.pop()
  17846. continue
  17847. default:
  17848. if (!((i = (i = s.trys).length > 0 && i[i.length - 1]) || (6 !== o[0] && 2 !== o[0]))) {
  17849. s = 0
  17850. continue
  17851. }
  17852. if (3 === o[0] && (!i || (o[1] > i[0] && o[1] < i[3]))) {
  17853. s.label = o[1]
  17854. break
  17855. }
  17856. if (6 === o[0] && s.label < i[1]) {
  17857. ;(s.label = i[1]), (i = o)
  17858. break
  17859. }
  17860. if (i && s.label < i[2]) {
  17861. ;(s.label = i[2]), s.ops.push(o)
  17862. break
  17863. }
  17864. i[2] && s.ops.pop(), s.trys.pop()
  17865. continue
  17866. }
  17867. o = e.call(t, s)
  17868. } catch (t) {
  17869. ;(o = [6, t]), (n = 0)
  17870. } finally {
  17871. r = i = 0
  17872. }
  17873. if (5 & o[0]) throw o[1]
  17874. return { value: o[0] ? o[1] : void 0, done: !0 }
  17875. })([o, a])
  17876. }
  17877. }
  17878. })(this, function(n) {
  17879. switch (n.label) {
  17880. case 0:
  17881. return [4, this.detector.detect(t)]
  17882. case 1:
  17883. if (!(e = n.sent()) || 0 === e.length) throw 'No barcode or QR code detected.'
  17884. return [2, { text: (r = this.selectLargestBarcode(e)).rawValue, format: c.create(this.toHtml5QrcodeSupportedFormats(r.format)) }]
  17885. }
  17886. })
  17887. }),
  17888. new ((n = void 0) || (n = Promise))(function(t, o) {
  17889. function s(t) {
  17890. try {
  17891. l(i.next(t))
  17892. } catch (t) {
  17893. o(t)
  17894. }
  17895. }
  17896. function a(t) {
  17897. try {
  17898. l(i.throw(t))
  17899. } catch (t) {
  17900. o(t)
  17901. }
  17902. }
  17903. function l(e) {
  17904. var r
  17905. e.done
  17906. ? t(e.value)
  17907. : ((r = e.value),
  17908. r instanceof n
  17909. ? r
  17910. : new n(function(t) {
  17911. t(r)
  17912. })).then(s, a)
  17913. }
  17914. l((i = i.apply(e, r || [])).next())
  17915. })
  17916. )
  17917. var e, r, n, i
  17918. }),
  17919. (e.prototype.selectLargestBarcode = function(t) {
  17920. for (var e = null, r = 0, n = 0, i = t; n < i.length; n++) {
  17921. var o = i[n],
  17922. s = o.boundingBox.width * o.boundingBox.height
  17923. s > r && ((r = s), (e = o))
  17924. }
  17925. if (!e) throw 'No largest barcode found'
  17926. return e
  17927. }),
  17928. (e.prototype.createBarcodeDetectorFormats = function(t) {
  17929. for (var e = [], r = 0, n = t; r < n.length; r++) {
  17930. var i = n[r]
  17931. this.formatMap.has(i) ? e.push(this.formatMap.get(i)) : this.logger.warn(i + ' is not supported byBarcodeDetectorDelegate')
  17932. }
  17933. return { formats: e }
  17934. }),
  17935. (e.prototype.toHtml5QrcodeSupportedFormats = function(t) {
  17936. if (!this.reverseFormatMap.has(t)) throw "reverseFormatMap doesn't have " + t
  17937. return this.reverseFormatMap.get(t)
  17938. }),
  17939. (e.prototype.createReverseFormatMap = function() {
  17940. var t = new Map()
  17941. return (
  17942. this.formatMap.forEach(function(e, r, n) {
  17943. t.set(e, r)
  17944. }),
  17945. t
  17946. )
  17947. }),
  17948. e
  17949. )
  17950. })(),
  17951. S = (function() {
  17952. function t(t, e, r, n) {
  17953. ;(this.EXECUTIONS_TO_REPORT_PERFORMANCE = 100),
  17954. (this.executions = 0),
  17955. (this.executionResults = []),
  17956. (this.verbose = e),
  17957. !0 === n.useBarCodeDetectorIfSupported && p.isSupported() ? (this.decoder = new p(t, e, r)) : (this.decoder = new I(t, e, r))
  17958. }
  17959. return (
  17960. (t.prototype.decodeAsync = function(t) {
  17961. var e = this,
  17962. r = performance.now()
  17963. return this.decoder.decodeAsync(t).finally(function() {
  17964. if (e.verbose) {
  17965. var t = performance.now() - r
  17966. e.executionResults.push(t), e.executions++, e.possiblyFlushPerformanceReport()
  17967. }
  17968. })
  17969. }),
  17970. (t.prototype.possiblyFlushPerformanceReport = function() {
  17971. if (!(this.executions < this.EXECUTIONS_TO_REPORT_PERFORMANCE)) {
  17972. for (var t = 0, e = 0, r = this.executionResults; e < r.length; e++) t += r[e]
  17973. var n = t / this.executionResults.length
  17974. console.log(n + ' ms for ' + this.executionResults.length + ' last runs.'), (this.executions = 0), (this.executionResults = [])
  17975. }
  17976. }),
  17977. t
  17978. )
  17979. })(),
  17980. _ = (function() {
  17981. function t() {}
  17982. return (
  17983. (t.createExperimentalFeaturesConfig = function(t) {
  17984. return t ? (!0 !== t.useBarCodeDetectorIfSupported && (t.useBarCodeDetectorIfSupported = !1), t) : { useBarCodeDetectorIfSupported: !1 }
  17985. }),
  17986. t
  17987. )
  17988. })()
  17989. !(function(t) {
  17990. ;(t[(t.UNKNOWN = 0)] = 'UNKNOWN'), (t[(t.NOT_STARTED = 1)] = 'NOT_STARTED'), (t[(t.SCANNING = 2)] = 'SCANNING'), (t[(t.PAUSED = 3)] = 'PAUSED')
  17991. })(f || (f = {}))
  17992. var T,
  17993. y,
  17994. N = (function() {
  17995. function t() {
  17996. ;(this.state = f.NOT_STARTED), (this.onGoingTransactionNewState = f.UNKNOWN)
  17997. }
  17998. return (
  17999. (t.prototype.directTransition = function(t) {
  18000. this.failIfTransitionOngoing(), this.validateTransition(t), (this.state = t)
  18001. }),
  18002. (t.prototype.startTransition = function(t) {
  18003. return this.failIfTransitionOngoing(), this.validateTransition(t), (this.onGoingTransactionNewState = t), this
  18004. }),
  18005. (t.prototype.execute = function() {
  18006. if (this.onGoingTransactionNewState === f.UNKNOWN) throw 'Transaction is already cancelled, cannot execute().'
  18007. var t = this.onGoingTransactionNewState
  18008. ;(this.onGoingTransactionNewState = f.UNKNOWN), this.directTransition(t)
  18009. }),
  18010. (t.prototype.cancel = function() {
  18011. if (this.onGoingTransactionNewState === f.UNKNOWN) throw 'Transaction is already cancelled, cannot cancel().'
  18012. this.onGoingTransactionNewState = f.UNKNOWN
  18013. }),
  18014. (t.prototype.getState = function() {
  18015. return this.state
  18016. }),
  18017. (t.prototype.failIfTransitionOngoing = function() {
  18018. if (this.onGoingTransactionNewState !== f.UNKNOWN) throw 'Cannnot transition to a new state, already under transition'
  18019. }),
  18020. (t.prototype.validateTransition = function(t) {
  18021. switch (this.state) {
  18022. case f.UNKNOWN:
  18023. throw 'Transition from unknown is not allowed'
  18024. case f.NOT_STARTED:
  18025. this.failIfNewStateIs(t, [f.PAUSED])
  18026. break
  18027. case f.SCANNING:
  18028. case f.PAUSED:
  18029. }
  18030. }),
  18031. (t.prototype.failIfNewStateIs = function(t, e) {
  18032. for (var r = 0, n = e; r < n.length; r++) if (t === n[r]) throw 'Cannot transition from ' + this.state + ' to ' + t
  18033. }),
  18034. t
  18035. )
  18036. })(),
  18037. M = (function() {
  18038. function t(t) {
  18039. this.stateManager = t
  18040. }
  18041. return (
  18042. (t.prototype.startTransition = function(t) {
  18043. return this.stateManager.startTransition(t)
  18044. }),
  18045. (t.prototype.directTransition = function(t) {
  18046. this.stateManager.directTransition(t)
  18047. }),
  18048. (t.prototype.getState = function() {
  18049. return this.stateManager.getState()
  18050. }),
  18051. (t.prototype.canScanFile = function() {
  18052. return this.stateManager.getState() === f.NOT_STARTED
  18053. }),
  18054. (t.prototype.isScanning = function() {
  18055. return this.stateManager.getState() !== f.NOT_STARTED
  18056. }),
  18057. (t.prototype.isStrictlyScanning = function() {
  18058. return this.stateManager.getState() === f.SCANNING
  18059. }),
  18060. (t.prototype.isPaused = function() {
  18061. return this.stateManager.getState() === f.PAUSED
  18062. }),
  18063. t
  18064. )
  18065. })(),
  18066. D = (function() {
  18067. function t() {}
  18068. return (
  18069. (t.create = function() {
  18070. return new M(new N())
  18071. }),
  18072. t
  18073. )
  18074. })(),
  18075. R =
  18076. ((T = function(t, e) {
  18077. return (T =
  18078. Object.setPrototypeOf ||
  18079. ({ __proto__: [] } instanceof Array &&
  18080. function(t, e) {
  18081. t.__proto__ = e
  18082. }) ||
  18083. function(t, e) {
  18084. for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r])
  18085. })(t, e)
  18086. }),
  18087. function(t, e) {
  18088. if ('function' != typeof e && null !== e) throw new TypeError('Class extends value ' + String(e) + ' is not a constructor or null')
  18089. function r() {
  18090. this.constructor = t
  18091. }
  18092. T(t, e), (t.prototype = null === e ? Object.create(e) : ((r.prototype = e.prototype), new r()))
  18093. }),
  18094. O = (function(t) {
  18095. function e() {
  18096. return (null !== t && t.apply(this, arguments)) || this
  18097. }
  18098. return (
  18099. R(e, t),
  18100. (e.DEFAULT_WIDTH = 300),
  18101. (e.DEFAULT_WIDTH_OFFSET = 2),
  18102. (e.FILE_SCAN_MIN_HEIGHT = 300),
  18103. (e.MIN_QR_BOX_SIZE = 50),
  18104. (e.SHADED_LEFT = 1),
  18105. (e.SHADED_RIGHT = 2),
  18106. (e.SHADED_TOP = 3),
  18107. (e.SHADED_BOTTOM = 4),
  18108. (e.SHADED_REGION_ELEMENT_ID = 'qr-shaded-region'),
  18109. (e.VERBOSE = !1),
  18110. (e.BORDER_SHADER_DEFAULT_COLOR = '#ffffff'),
  18111. (e.BORDER_SHADER_MATCH_COLOR = 'rgb(90, 193, 56)'),
  18112. e
  18113. )
  18114. })(l),
  18115. b = (function() {
  18116. function t(t, e) {
  18117. ;(this.logger = e),
  18118. (this.fps = O.SCAN_DEFAULT_FPS),
  18119. t
  18120. ? (t.fps && (this.fps = t.fps),
  18121. (this.disableFlip = !0 === t.disableFlip),
  18122. (this.qrbox = t.qrbox),
  18123. (this.aspectRatio = t.aspectRatio),
  18124. (this.videoConstraints = t.videoConstraints))
  18125. : (this.disableFlip = O.DEFAULT_DISABLE_FLIP)
  18126. }
  18127. return (
  18128. (t.prototype.isMediaStreamConstraintsValid = function() {
  18129. return this.videoConstraints ? E.isMediaStreamConstraintsValid(this.videoConstraints, this.logger) : (this.logger.logError('Empty videoConstraints', !0), !1)
  18130. }),
  18131. (t.prototype.isShadedBoxEnabled = function() {
  18132. return !g(this.qrbox)
  18133. }),
  18134. (t.create = function(e, r) {
  18135. return new t(e, r)
  18136. }),
  18137. t
  18138. )
  18139. })(),
  18140. L = (function() {
  18141. function e(t, e) {
  18142. if (
  18143. ((this.element = null),
  18144. (this.canvasElement = null),
  18145. (this.scannerPausedUiElement = null),
  18146. (this.hasBorderShaders = null),
  18147. (this.borderShaders = null),
  18148. (this.qrMatch = null),
  18149. (this.videoElement = null),
  18150. (this.localMediaStream = null),
  18151. (this.qrRegion = null),
  18152. (this.context = null),
  18153. (this.lastScanImageFile = null),
  18154. (this.isScanning = !1),
  18155. !document.getElementById(t))
  18156. )
  18157. throw 'HTML Element with id=' + t + ' not found'
  18158. var r
  18159. ;(this.elementId = t),
  18160. (this.verbose = !1),
  18161. 'boolean' == typeof e ? (this.verbose = !0 === e) : e && ((this.verbose = !0 === e.verbose), (r = e.experimentalFeatures)),
  18162. (this.logger = new d(this.verbose)),
  18163. (this.qrcode = new S(this.getSupportedFormats(e), this.verbose, this.logger, _.createExperimentalFeaturesConfig(r))),
  18164. this.foreverScanTimeout,
  18165. this.localMediaStream,
  18166. (this.shouldScan = !0),
  18167. (this.stateManagerProxy = D.create())
  18168. }
  18169. return (
  18170. (e.prototype.start = function(t, e, r, n) {
  18171. if (!t) throw 'cameraIdOrConfig is required'
  18172. if (!r || 'function' != typeof r) throw 'qrCodeSuccessCallback is required and should be a function.'
  18173. n || (n = this.verbose ? this.logger.log : function() {})
  18174. var i = b.create(e, this.logger)
  18175. this.clearElement()
  18176. var o = !1
  18177. i.videoConstraints && (i.isMediaStreamConstraintsValid() ? (o = !0) : this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'", !0))
  18178. var s = o,
  18179. a = (i.isShadedBoxEnabled(), document.getElementById(this.elementId)),
  18180. l = a.clientWidth ? a.clientWidth : O.DEFAULT_WIDTH
  18181. ;(a.style.position = 'relative'), (this.shouldScan = !0), (this.element = a)
  18182. var c = this,
  18183. h = this.stateManagerProxy.startTransition(f.SCANNING)
  18184. return new Promise(function(e, o) {
  18185. var a = s ? i.videoConstraints : c.createVideoConstraints(t)
  18186. if (!a) return h.cancel(), void o('videoConstraints should be defined')
  18187. navigator.mediaDevices && navigator.mediaDevices.getUserMedia
  18188. ? navigator.mediaDevices
  18189. .getUserMedia({ audio: !1, video: a })
  18190. .then(function(t) {
  18191. c.onMediaStreamReceived(t, i, s, l, r, n)
  18192. .then(function(t) {
  18193. h.execute(), (c.isScanning = !0), e(null)
  18194. })
  18195. .catch(function(t) {
  18196. h.cancel(), o(t)
  18197. })
  18198. })
  18199. .catch(function(t) {
  18200. h.cancel(), o(w.errorGettingUserMedia(t))
  18201. })
  18202. : (h.cancel(), o(w.cameraStreamingNotSupported()))
  18203. })
  18204. }),
  18205. (e.prototype.pause = function(t) {
  18206. if (!this.stateManagerProxy.isStrictlyScanning()) throw 'Cannot pause, scanner is not scanning.'
  18207. this.stateManagerProxy.directTransition(f.PAUSED), this.showPausedState(), (g(t) || !0 !== t) && (t = !1), t && this.videoElement && this.videoElement.pause()
  18208. }),
  18209. (e.prototype.resume = function() {
  18210. if (!this.stateManagerProxy.isPaused()) throw 'Cannot result, scanner is not paused.'
  18211. if (!this.videoElement) throw "VideoElement doesn't exist while trying resume()"
  18212. var t = this,
  18213. e = function() {
  18214. t.stateManagerProxy.directTransition(f.SCANNING), t.hidePausedState()
  18215. }
  18216. if (this.videoElement.paused) {
  18217. var r = function() {
  18218. var n
  18219. setTimeout(e, 200), null === (n = t.videoElement) || void 0 === n || n.removeEventListener('playing', r)
  18220. }
  18221. this.videoElement.addEventListener('playing', r), this.videoElement.play()
  18222. } else e()
  18223. }),
  18224. (e.prototype.getState = function() {
  18225. return this.stateManagerProxy.getState()
  18226. }),
  18227. (e.prototype.stop = function() {
  18228. var t = this
  18229. if (!this.stateManagerProxy.isScanning()) throw 'Cannot stop, scanner is not running or paused.'
  18230. var e = this.stateManagerProxy.startTransition(f.NOT_STARTED)
  18231. return (
  18232. (this.shouldScan = !1),
  18233. this.foreverScanTimeout && clearTimeout(this.foreverScanTimeout),
  18234. new Promise(function(r, n) {
  18235. var i = function() {
  18236. ;(t.localMediaStream = null),
  18237. t.element && (t.element.removeChild(t.videoElement), t.element.removeChild(t.canvasElement)),
  18238. (function() {
  18239. if (t.element) {
  18240. var e = document.getElementById(O.SHADED_REGION_ELEMENT_ID)
  18241. e && t.element.removeChild(e)
  18242. }
  18243. })(),
  18244. t.qrRegion && (t.qrRegion = null),
  18245. t.context && (t.context = null),
  18246. e.execute(),
  18247. t.hidePausedState(),
  18248. (t.isScanning = !1),
  18249. r()
  18250. }
  18251. t.localMediaStream || i()
  18252. var o = t.localMediaStream.getVideoTracks().length,
  18253. s = 0
  18254. t.localMediaStream.getVideoTracks().forEach(function(e) {
  18255. t.localMediaStream.removeTrack(e), e.stop(), ++s >= o && i()
  18256. })
  18257. })
  18258. )
  18259. }),
  18260. (e.prototype.scanFile = function(t, e) {
  18261. return this.scanFileV2(t, e).then(function(t) {
  18262. return t.decodedText
  18263. })
  18264. }),
  18265. (e.prototype.scanFileV2 = function(t, e) {
  18266. var r = this
  18267. if (!(t && t instanceof File)) throw "imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'."
  18268. if ((g(e) && (e = !0), !this.stateManagerProxy.canScanFile())) throw 'Cannot start file scan - ongoing camera scan'
  18269. return new Promise(function(n, i) {
  18270. r.possiblyCloseLastScanImageFile(), r.clearElement(), (r.lastScanImageFile = URL.createObjectURL(t))
  18271. var o = new Image()
  18272. ;(o.onload = function() {
  18273. var t = o.width,
  18274. s = o.height,
  18275. a = document.getElementById(r.elementId),
  18276. l = a.clientWidth ? a.clientWidth : O.DEFAULT_WIDTH,
  18277. c = Math.max(a.clientHeight ? a.clientHeight : s, O.FILE_SCAN_MIN_HEIGHT),
  18278. u = r.computeCanvasDrawConfig(t, s, l, c)
  18279. if (e) {
  18280. var d = r.createCanvasElement(l, c, 'qr-canvas-visible')
  18281. ;(d.style.display = 'inline-block'), a.appendChild(d)
  18282. var g = d.getContext('2d')
  18283. if (!g) throw 'Unable to get 2d context from canvas'
  18284. ;(g.canvas.width = l), (g.canvas.height = c), g.drawImage(o, 0, 0, t, s, u.x, u.y, u.width, u.height)
  18285. }
  18286. var f = r.createCanvasElement(u.width, u.height)
  18287. a.appendChild(f)
  18288. var w = f.getContext('2d')
  18289. if (!w) throw 'Unable to get 2d context from canvas'
  18290. ;(w.canvas.width = u.width), (w.canvas.height = u.height), w.drawImage(o, 0, 0, t, s, 0, 0, u.width, u.height)
  18291. try {
  18292. r.qrcode
  18293. .decodeAsync(f)
  18294. .then(function(t) {
  18295. n(h.createFromQrcodeResult(t))
  18296. })
  18297. .catch(i)
  18298. } catch (t) {
  18299. i('QR code parse error, error = ' + t)
  18300. }
  18301. }),
  18302. (o.onerror = i),
  18303. (o.onabort = i),
  18304. (o.onstalled = i),
  18305. (o.onsuspend = i),
  18306. (o.src = URL.createObjectURL(t))
  18307. })
  18308. }),
  18309. (e.prototype.clear = function() {
  18310. this.clearElement()
  18311. }),
  18312. (e.getCameras = function() {
  18313. if (navigator.mediaDevices) return e.getCamerasFromMediaDevices()
  18314. var t = MediaStreamTrack
  18315. if (MediaStreamTrack && t.getSources) return e.getCamerasFromMediaStreamTrack()
  18316. var r = w.unableToQuerySupportedDevices()
  18317. return (
  18318. (function() {
  18319. if ('https:' === location.protocol) return !0
  18320. var t = location.host.split(':')[0]
  18321. return '127.0.0.1' === t || 'localhost' === t
  18322. })() || (r = w.insecureContextCameraQueryError()),
  18323. Promise.reject(r)
  18324. )
  18325. }),
  18326. (e.prototype.getRunningTrackCapabilities = function() {
  18327. if (null == this.localMediaStream) throw 'Scanning is not in running state, call this API only when QR code scanning using camera is in running state.'
  18328. if (0 === this.localMediaStream.getVideoTracks().length) throw 'No video tracks found'
  18329. return this.localMediaStream.getVideoTracks()[0].getCapabilities()
  18330. }),
  18331. (e.prototype.applyVideoConstraints = function(t) {
  18332. var e = this
  18333. if (!t) throw 'videoConstaints is required argument.'
  18334. if (!E.isMediaStreamConstraintsValid(t, this.logger)) throw 'invalid videoConstaints passed, check logs for more details'
  18335. if (null === this.localMediaStream) throw 'Scanning is not in running state, call this API only when QR code scanning using camera is in running state.'
  18336. if (0 === this.localMediaStream.getVideoTracks().length) throw 'No video tracks found'
  18337. return new Promise(function(r, n) {
  18338. 'aspectRatio' in t
  18339. ? n("Chaning 'aspectRatio' in run-time is not yet supported.")
  18340. : e.localMediaStream
  18341. .getVideoTracks()[0]
  18342. .applyConstraints(t)
  18343. .then(function(t) {
  18344. r(t)
  18345. })
  18346. .catch(function(t) {
  18347. n(t)
  18348. })
  18349. })
  18350. }),
  18351. (e.getCamerasFromMediaDevices = function() {
  18352. return new Promise(function(t, e) {
  18353. navigator.mediaDevices
  18354. .getUserMedia({ audio: !1, video: !0 })
  18355. .then(function(r) {
  18356. navigator.mediaDevices
  18357. .enumerateDevices()
  18358. .then(function(e) {
  18359. for (var n = [], i = 0, o = e; i < o.length; i++) {
  18360. var s = o[i]
  18361. 'videoinput' === s.kind && n.push({ id: s.deviceId, label: s.label })
  18362. }
  18363. !(function(t) {
  18364. for (var e = 0, r = t.getVideoTracks(); e < r.length; e++) {
  18365. var n = r[e]
  18366. ;(n.enabled = !1), n.stop(), t.removeTrack(n)
  18367. }
  18368. })(r),
  18369. t(n)
  18370. })
  18371. .catch(function(t) {
  18372. e(t.name + ' : ' + t.message)
  18373. })
  18374. })
  18375. .catch(function(t) {
  18376. e(t.name + ' : ' + t.message)
  18377. })
  18378. })
  18379. }),
  18380. (e.getCamerasFromMediaStreamTrack = function() {
  18381. return new Promise(function(t, e) {
  18382. MediaStreamTrack.getSources(function(e) {
  18383. for (var r = [], n = 0, i = e; n < i.length; n++) {
  18384. var o = i[n]
  18385. 'video' === o.kind && r.push({ id: o.id, label: o.label })
  18386. }
  18387. t(r)
  18388. })
  18389. })
  18390. }),
  18391. (e.prototype.getSupportedFormats = function(e) {
  18392. var r = [
  18393. t.QR_CODE,
  18394. t.AZTEC,
  18395. t.CODABAR,
  18396. t.CODE_39,
  18397. t.CODE_93,
  18398. t.CODE_128,
  18399. t.DATA_MATRIX,
  18400. t.MAXICODE,
  18401. t.ITF,
  18402. t.EAN_13,
  18403. t.EAN_8,
  18404. t.PDF_417,
  18405. t.RSS_14,
  18406. t.RSS_EXPANDED,
  18407. t.UPC_A,
  18408. t.UPC_E,
  18409. t.UPC_EAN_EXTENSION
  18410. ]
  18411. if (!e || 'boolean' == typeof e) return r
  18412. if (!e.formatsToSupport) return r
  18413. if (!Array.isArray(e.formatsToSupport)) throw 'configOrVerbosityFlag.formatsToSupport should be undefined or an array.'
  18414. if (0 === e.formatsToSupport.length) throw 'Atleast 1 formatsToSupport is needed.'
  18415. for (var n = [], i = 0, o = e.formatsToSupport; i < o.length; i++) {
  18416. var a = o[i]
  18417. s(a) ? n.push(a) : this.logger.warn('Invalid format: ' + a + ' passed in config, ignoring.')
  18418. }
  18419. if (0 === n.length) throw 'None of formatsToSupport match supported values.'
  18420. return n
  18421. }),
  18422. (e.prototype.validateQrboxSize = function(t, e, r) {
  18423. var n = r.qrbox
  18424. this.validateQrboxConfig(n)
  18425. var i,
  18426. o = this.toQrdimensions(t, e, n),
  18427. s = function(t) {
  18428. if (t < O.MIN_QR_BOX_SIZE) throw "minimum size of 'config.qrbox' dimension value is " + O.MIN_QR_BOX_SIZE + 'px.'
  18429. }
  18430. s(o.width),
  18431. s(o.height),
  18432. (o.width =
  18433. ((i = o.width) > t &&
  18434. (this.logger.warn('`qrbox.width` or `qrbox` is larger than the width of the root element. The width will be truncated to the width of root element.'), (i = t)),
  18435. i))
  18436. }),
  18437. (e.prototype.validateQrboxConfig = function(t) {
  18438. if ('number' != typeof t && 'function' != typeof t && (void 0 === t.width || void 0 === t.height))
  18439. throw "Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."
  18440. }),
  18441. (e.prototype.toQrdimensions = function(t, e, r) {
  18442. if ('number' == typeof r) return { width: r, height: r }
  18443. if ('function' == typeof r)
  18444. try {
  18445. return r(t, e)
  18446. } catch (t) {
  18447. throw new Error('qrbox config was passed as a function but it failed with unknown error' + t)
  18448. }
  18449. return r
  18450. }),
  18451. (e.prototype.setupUi = function(t, e, r) {
  18452. r.isShadedBoxEnabled() && this.validateQrboxSize(t, e, r)
  18453. var n = g(r.qrbox) ? { width: t, height: e } : r.qrbox
  18454. this.validateQrboxConfig(n)
  18455. var i = this.toQrdimensions(t, e, n)
  18456. i.height > e && this.logger.warn('[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored')
  18457. var o = r.isShadedBoxEnabled() && i.height <= e,
  18458. s = { x: 0, y: 0, width: t, height: e },
  18459. a = o ? this.getShadedRegionBounds(t, e, i) : s,
  18460. l = this.createCanvasElement(a.width, a.height),
  18461. c = l.getContext('2d')
  18462. ;(c.canvas.width = a.width),
  18463. (c.canvas.height = a.height),
  18464. this.element.append(l),
  18465. o && this.possiblyInsertShadingElement(this.element, t, e, i),
  18466. this.createScannerPausedUiElement(this.element),
  18467. (this.qrRegion = a),
  18468. (this.context = c),
  18469. (this.canvasElement = l)
  18470. }),
  18471. (e.prototype.createScannerPausedUiElement = function(t) {
  18472. var e = document.createElement('div')
  18473. ;(e.innerText = 'Scanner paused'),
  18474. (e.style.display = 'none'),
  18475. (e.style.position = 'absolute'),
  18476. (e.style.top = '0px'),
  18477. (e.style.zIndex = '1'),
  18478. (e.style.background = 'yellow'),
  18479. (e.style.textAlign = 'center'),
  18480. (e.style.width = '100%'),
  18481. t.appendChild(e),
  18482. (this.scannerPausedUiElement = e)
  18483. }),
  18484. (e.prototype.scanContext = function(t, e) {
  18485. var r = this
  18486. return this.stateManagerProxy.isPaused()
  18487. ? Promise.resolve(!1)
  18488. : this.qrcode
  18489. .decodeAsync(this.canvasElement)
  18490. .then(function(e) {
  18491. return t(e.text, h.createFromQrcodeResult(e)), r.possiblyUpdateShaders(!0), !0
  18492. })
  18493. .catch(function(t) {
  18494. r.possiblyUpdateShaders(!1)
  18495. var n = w.codeParseError(t)
  18496. return e(n, u.createFrom(n)), !1
  18497. })
  18498. }),
  18499. (e.prototype.foreverScan = function(t, e, r) {
  18500. var n = this
  18501. if (this.shouldScan && this.localMediaStream) {
  18502. var i = this.videoElement,
  18503. o = i.videoWidth / i.clientWidth,
  18504. s = i.videoHeight / i.clientHeight
  18505. if (!this.qrRegion) throw 'qrRegion undefined when localMediaStream is ready.'
  18506. var a = this.qrRegion.width * o,
  18507. l = this.qrRegion.height * s,
  18508. c = this.qrRegion.x * o,
  18509. h = this.qrRegion.y * s
  18510. this.context.drawImage(i, c, h, a, l, 0, 0, this.qrRegion.width, this.qrRegion.height)
  18511. var u = function() {
  18512. n.foreverScanTimeout = setTimeout(function() {
  18513. n.foreverScan(t, e, r)
  18514. }, n.getTimeoutFps(t.fps))
  18515. }
  18516. this.scanContext(e, r)
  18517. .then(function(i) {
  18518. i || !0 === t.disableFlip
  18519. ? u()
  18520. : (n.context.translate(n.context.canvas.width, 0),
  18521. n.context.scale(-1, 1),
  18522. n.scanContext(e, r).finally(function() {
  18523. u()
  18524. }))
  18525. })
  18526. .catch(function(t) {
  18527. n.logger.logError('Error happend while scanning context', t), u()
  18528. })
  18529. }
  18530. }),
  18531. (e.prototype.onMediaStreamReceived = function(t, e, r, n, i, o) {
  18532. var s = this,
  18533. a = this
  18534. return new Promise(function(l, c) {
  18535. var h = function() {
  18536. var r = s.createVideoElement(n)
  18537. a.element.append(r), (r.onabort = c), (r.onerror = c)
  18538. var h = function() {
  18539. var t = r.clientWidth,
  18540. n = r.clientHeight
  18541. a.setupUi(t, n, e), a.foreverScan(e, i, o), r.removeEventListener('playing', h), l(null)
  18542. }
  18543. r.addEventListener('playing', h), (r.srcObject = t), r.play(), (a.videoElement = r)
  18544. }
  18545. if (((a.localMediaStream = t), r || !e.aspectRatio)) h()
  18546. else {
  18547. var u = { aspectRatio: e.aspectRatio }
  18548. t.getVideoTracks()[0]
  18549. .applyConstraints(u)
  18550. .then(function(t) {
  18551. return h()
  18552. })
  18553. .catch(function(t) {
  18554. a.logger.logErrors(['[Html5Qrcode] Constriants could not be satisfied, ignoring constraints', t]), h()
  18555. })
  18556. }
  18557. })
  18558. }),
  18559. (e.prototype.createVideoConstraints = function(t) {
  18560. if ('string' == typeof t) return { deviceId: { exact: t } }
  18561. if ('object' == typeof t) {
  18562. var e = 'facingMode',
  18563. r = { user: !0, environment: !0 },
  18564. n = 'exact',
  18565. i = function(t) {
  18566. if (t in r) return !0
  18567. throw "config has invalid 'facingMode' value = '" + t + "'"
  18568. },
  18569. o = Object.keys(t)
  18570. if (1 !== o.length) throw "'cameraIdOrConfig' object should have exactly 1 key, if passed as an object, found " + o.length + ' keys'
  18571. var s = Object.keys(t)[0]
  18572. if (s !== e && 'deviceId' !== s) throw "Only 'facingMode' and 'deviceId' are supported for 'cameraIdOrConfig'"
  18573. if (s !== e) {
  18574. var a = t.deviceId
  18575. if ('string' == typeof a) return { deviceId: a }
  18576. if ('object' == typeof a) {
  18577. if (n in a) return { deviceId: { exact: a.exact } }
  18578. throw "'deviceId' should be string or object with exact as key."
  18579. }
  18580. throw "Invalid type of 'deviceId' = " + typeof a
  18581. }
  18582. var l = t.facingMode
  18583. if ('string' == typeof l) {
  18584. if (i(l)) return { facingMode: l }
  18585. } else {
  18586. if ('object' != typeof l) throw "Invalid type of 'facingMode' = " + typeof l
  18587. if (!(n in l)) throw "'facingMode' should be string or object with exact as key."
  18588. if (i(l.exact)) return { facingMode: { exact: l.exact } }
  18589. }
  18590. }
  18591. throw "Invalid type of 'cameraIdOrConfig' = " + typeof t
  18592. }),
  18593. (e.prototype.computeCanvasDrawConfig = function(t, e, r, n) {
  18594. if (t <= r && e <= n) return { x: (r - t) / 2, y: (n - e) / 2, width: t, height: e }
  18595. var i = t,
  18596. o = e
  18597. return (
  18598. t > r && ((e *= r / t), (t = r)),
  18599. e > n && ((t *= n / e), (e = n)),
  18600. this.logger.log('Image downsampled from ' + i + 'X' + o + ' to ' + t + 'X' + e + '.'),
  18601. this.computeCanvasDrawConfig(t, e, r, n)
  18602. )
  18603. }),
  18604. (e.prototype.clearElement = function() {
  18605. if (this.stateManagerProxy.isScanning()) throw 'Cannot clear while scan is ongoing, close it first.'
  18606. var t = document.getElementById(this.elementId)
  18607. t && (t.innerHTML = '')
  18608. }),
  18609. (e.prototype.createVideoElement = function(t) {
  18610. var e = document.createElement('video')
  18611. return (e.style.width = t + 'px'), (e.muted = !0), e.setAttribute('muted', 'true'), (e.playsInline = !0), e
  18612. }),
  18613. (e.prototype.possiblyUpdateShaders = function(t) {
  18614. this.qrMatch !== t &&
  18615. (this.hasBorderShaders &&
  18616. this.borderShaders &&
  18617. this.borderShaders.length &&
  18618. this.borderShaders.forEach(function(e) {
  18619. e.style.backgroundColor = t ? O.BORDER_SHADER_MATCH_COLOR : O.BORDER_SHADER_DEFAULT_COLOR
  18620. }),
  18621. (this.qrMatch = t))
  18622. }),
  18623. (e.prototype.possiblyCloseLastScanImageFile = function() {
  18624. this.lastScanImageFile && (URL.revokeObjectURL(this.lastScanImageFile), (this.lastScanImageFile = null))
  18625. }),
  18626. (e.prototype.createCanvasElement = function(t, e, r) {
  18627. var n = t,
  18628. i = e,
  18629. o = document.createElement('canvas')
  18630. return (o.style.width = n + 'px'), (o.style.height = i + 'px'), (o.style.display = 'none'), (o.id = g(r) ? 'qr-canvas' : r), o
  18631. }),
  18632. (e.prototype.getShadedRegionBounds = function(t, e, r) {
  18633. if (r.width > t || r.height > e) throw "'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element."
  18634. return { x: (t - r.width) / 2, y: (e - r.height) / 2, width: r.width, height: r.height }
  18635. }),
  18636. (e.prototype.possiblyInsertShadingElement = function(t, e, r, n) {
  18637. if (!(e - n.width < 1 || r - n.height < 1)) {
  18638. var i = document.createElement('div')
  18639. i.style.position = 'absolute'
  18640. var o = (e - n.width) / 2,
  18641. s = (r - n.height) / 2
  18642. if (
  18643. ((i.style.borderLeft = o + 'px solid #0000007a'),
  18644. (i.style.borderRight = o + 'px solid #0000007a'),
  18645. (i.style.borderTop = s + 'px solid #0000007a'),
  18646. (i.style.borderBottom = s + 'px solid #0000007a'),
  18647. (i.style.boxSizing = 'border-box'),
  18648. (i.style.top = '0px'),
  18649. (i.style.bottom = '0px'),
  18650. (i.style.left = '0px'),
  18651. (i.style.right = '0px'),
  18652. (i.id = '' + O.SHADED_REGION_ELEMENT_ID),
  18653. e - n.width < 11 || r - n.height < 11)
  18654. )
  18655. this.hasBorderShaders = !1
  18656. else {
  18657. var a = 40
  18658. this.insertShaderBorders(i, a, 5, -5, 0, !0),
  18659. this.insertShaderBorders(i, a, 5, -5, 0, !1),
  18660. this.insertShaderBorders(i, a, 5, n.height + 5, 0, !0),
  18661. this.insertShaderBorders(i, a, 5, n.height + 5, 0, !1),
  18662. this.insertShaderBorders(i, 5, 45, -5, -5, !0),
  18663. this.insertShaderBorders(i, 5, 45, n.height + 5 - a, -5, !0),
  18664. this.insertShaderBorders(i, 5, 45, -5, -5, !1),
  18665. this.insertShaderBorders(i, 5, 45, n.height + 5 - a, -5, !1),
  18666. (this.hasBorderShaders = !0)
  18667. }
  18668. t.append(i)
  18669. }
  18670. }),
  18671. (e.prototype.insertShaderBorders = function(t, e, r, n, i, o) {
  18672. var s = document.createElement('div')
  18673. ;(s.style.position = 'absolute'),
  18674. (s.style.backgroundColor = O.BORDER_SHADER_DEFAULT_COLOR),
  18675. (s.style.width = e + 'px'),
  18676. (s.style.height = r + 'px'),
  18677. (s.style.top = n + 'px'),
  18678. o ? (s.style.left = i + 'px') : (s.style.right = i + 'px'),
  18679. this.borderShaders || (this.borderShaders = []),
  18680. this.borderShaders.push(s),
  18681. t.appendChild(s)
  18682. }),
  18683. (e.prototype.showPausedState = function() {
  18684. if (!this.scannerPausedUiElement) throw '[internal error] scanner paused UI element not found'
  18685. this.scannerPausedUiElement.style.display = 'block'
  18686. }),
  18687. (e.prototype.hidePausedState = function() {
  18688. if (!this.scannerPausedUiElement) throw '[internal error] scanner paused UI element not found'
  18689. this.scannerPausedUiElement.style.display = 'none'
  18690. }),
  18691. (e.prototype.getTimeoutFps = function(t) {
  18692. return 1e3 / t
  18693. }),
  18694. e
  18695. )
  18696. })(),
  18697. B =
  18698. 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NjAgNDYwIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA0NjAgNDYwIiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBkPSJNMjMwIDBDMTAyLjk3NSAwIDAgMTAyLjk3NSAwIDIzMHMxMDIuOTc1IDIzMCAyMzAgMjMwIDIzMC0xMDIuOTc0IDIzMC0yMzBTMzU3LjAyNSAwIDIzMCAwem0zOC4zMzMgMzc3LjM2YzAgOC42NzYtNy4wMzQgMTUuNzEtMTUuNzEgMTUuNzFoLTQzLjEwMWMtOC42NzYgMC0xNS43MS03LjAzNC0xNS43MS0xNS43MVYyMDIuNDc3YzAtOC42NzYgNy4wMzMtMTUuNzEgMTUuNzEtMTUuNzFoNDMuMTAxYzguNjc2IDAgMTUuNzEgNy4wMzMgMTUuNzEgMTUuNzFWMzc3LjM2ek0yMzAgMTU3Yy0yMS41MzkgMC0zOS0xNy40NjEtMzktMzlzMTcuNDYxLTM5IDM5LTM5IDM5IDE3LjQ2MSAzOSAzOS0xNy40NjEgMzktMzkgMzl6Ii8+PC9zdmc+',
  18699. P = (function() {
  18700. function t() {}
  18701. return (
  18702. (t.createDefault = function() {
  18703. return { hasPermission: !1, lastUsedCameraId: null }
  18704. }),
  18705. t
  18706. )
  18707. })(),
  18708. v = (function() {
  18709. function t() {
  18710. this.data = P.createDefault()
  18711. var e = localStorage.getItem(t.LOCAL_STORAGE_KEY)
  18712. e ? (this.data = JSON.parse(e)) : this.reset()
  18713. }
  18714. return (
  18715. (t.prototype.hasCameraPermissions = function() {
  18716. return this.data.hasPermission
  18717. }),
  18718. (t.prototype.getLastUsedCameraId = function() {
  18719. return this.data.lastUsedCameraId
  18720. }),
  18721. (t.prototype.setHasPermission = function(t) {
  18722. ;(this.data.hasPermission = t), this.flush()
  18723. }),
  18724. (t.prototype.setLastUsedCameraId = function(t) {
  18725. ;(this.data.lastUsedCameraId = t), this.flush()
  18726. }),
  18727. (t.prototype.resetLastUsedCameraId = function() {
  18728. ;(this.data.lastUsedCameraId = null), this.flush()
  18729. }),
  18730. (t.prototype.reset = function() {
  18731. ;(this.data = P.createDefault()), this.flush()
  18732. }),
  18733. (t.prototype.flush = function() {
  18734. localStorage.setItem(t.LOCAL_STORAGE_KEY, JSON.stringify(this.data))
  18735. }),
  18736. (t.LOCAL_STORAGE_KEY = 'HTML5_QRCODE_DATA'),
  18737. t
  18738. )
  18739. })(),
  18740. F = (function() {
  18741. function t() {
  18742. this.infoDiv = document.createElement('div')
  18743. }
  18744. return (
  18745. (t.prototype.renderInto = function(t) {
  18746. ;(this.infoDiv.style.position = 'absolute'),
  18747. (this.infoDiv.style.top = '10px'),
  18748. (this.infoDiv.style.right = '10px'),
  18749. (this.infoDiv.style.zIndex = '2'),
  18750. (this.infoDiv.style.display = 'none'),
  18751. (this.infoDiv.style.padding = '5pt'),
  18752. (this.infoDiv.style.border = '1px solid silver'),
  18753. (this.infoDiv.style.fontSize = '10pt'),
  18754. (this.infoDiv.style.background = 'rgb(248 248 248)'),
  18755. (this.infoDiv.innerText = m.builtUsing())
  18756. var e = document.createElement('a')
  18757. ;(e.innerText = 'html5-qrcode'), (e.href = 'https://github.com/mebjas/html5-qrcode'), (e.target = 'new'), this.infoDiv.appendChild(e)
  18758. var r = document.createElement('br'),
  18759. n = document.createElement('br')
  18760. this.infoDiv.appendChild(r), this.infoDiv.appendChild(n)
  18761. var i = document.createElement('a')
  18762. ;(i.innerText = m.reportIssues()), (i.href = 'https://github.com/mebjas/html5-qrcode/issues'), (i.target = 'new'), this.infoDiv.appendChild(i), t.appendChild(this.infoDiv)
  18763. }),
  18764. (t.prototype.show = function() {
  18765. this.infoDiv.style.display = 'block'
  18766. }),
  18767. (t.prototype.hide = function() {
  18768. this.infoDiv.style.display = 'none'
  18769. }),
  18770. t
  18771. )
  18772. })(),
  18773. x = (function() {
  18774. function t(t, e) {
  18775. ;(this.isShowingInfoIcon = !0), (this.onTapIn = t), (this.onTapOut = e), (this.infoIcon = document.createElement('img'))
  18776. }
  18777. return (
  18778. (t.prototype.renderInto = function(t) {
  18779. var e = this
  18780. ;(this.infoIcon.alt = 'Info icon'),
  18781. (this.infoIcon.src = B),
  18782. (this.infoIcon.style.position = 'absolute'),
  18783. (this.infoIcon.style.top = '4px'),
  18784. (this.infoIcon.style.right = '4px'),
  18785. (this.infoIcon.style.opacity = '0.6'),
  18786. (this.infoIcon.style.cursor = 'pointer'),
  18787. (this.infoIcon.style.zIndex = '2'),
  18788. (this.infoIcon.style.width = '16px'),
  18789. (this.infoIcon.style.height = '16px'),
  18790. (this.infoIcon.onmouseover = function(t) {
  18791. return e.onHoverIn()
  18792. }),
  18793. (this.infoIcon.onmouseout = function(t) {
  18794. return e.onHoverOut()
  18795. }),
  18796. (this.infoIcon.onclick = function(t) {
  18797. return e.onClick()
  18798. }),
  18799. t.appendChild(this.infoIcon)
  18800. }),
  18801. (t.prototype.onHoverIn = function() {
  18802. this.isShowingInfoIcon && (this.infoIcon.style.opacity = '1')
  18803. }),
  18804. (t.prototype.onHoverOut = function() {
  18805. this.isShowingInfoIcon && (this.infoIcon.style.opacity = '0.6')
  18806. }),
  18807. (t.prototype.onClick = function() {
  18808. this.isShowingInfoIcon
  18809. ? ((this.isShowingInfoIcon = !1),
  18810. this.onTapIn(),
  18811. (this.infoIcon.src =
  18812. 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAQgAAAEIBarqQRAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAE1SURBVDiNfdI7S0NBEAXgLya1otFgpbYSbISAgpXYi6CmiH9KCAiChaVga6OiWPgfRDQ+0itaGVNosXtluWwcuMzePfM4M3sq8lbHBubwg1dc4m1E/J/N4ghDPOIsfk/4xiEao5KX0McFljN4C9d4QTPXuY99jP3DsIoDPGM6BY5i5yI5R7O4q+ImFkJY2DCh3cAH2klyB+9J1xUMMAG7eCh1a+Mr+k48b5diXrFVwwLuS+BJ9MfR7+G0FHOHhTHhnXNWS87VDF4pcnfQK4Ep7XScNLmPTZgURNKKYENYWDpzW1BhscS1WHS8CDgURFJQrWcoF3c13KKbgg1BYQfy8xZWEzTTw1QZbAoKu8FqJnktdu5hcVSHmchiILzzuaDQvjBzV2m8yohCE1jHfPx/xhU+y4G/D75ELlRJsSYAAAAASUVORK5CYII='),
  18813. (this.infoIcon.style.opacity = '1'))
  18814. : ((this.isShowingInfoIcon = !0), this.onTapOut(), (this.infoIcon.src = B), (this.infoIcon.style.opacity = '0.6'))
  18815. }),
  18816. t
  18817. )
  18818. })(),
  18819. k = (function() {
  18820. function t() {
  18821. var t = this
  18822. ;(this.infoDiv = new F()),
  18823. (this.infoIcon = new x(
  18824. function() {
  18825. t.infoDiv.show()
  18826. },
  18827. function() {
  18828. t.infoDiv.hide()
  18829. }
  18830. ))
  18831. }
  18832. return (
  18833. (t.prototype.renderInto = function(t) {
  18834. this.infoDiv.renderInto(t), this.infoIcon.renderInto(t)
  18835. }),
  18836. t
  18837. )
  18838. })(),
  18839. U = (function() {
  18840. function t() {}
  18841. return (
  18842. (t.hasCameraPermissions = function() {
  18843. return new Promise(function(t, e) {
  18844. navigator.mediaDevices.enumerateDevices().then(function(e) {
  18845. e.forEach(function(e) {
  18846. 'videoinput' === e.kind && e.label && t(!0)
  18847. }),
  18848. t(!1)
  18849. })
  18850. })
  18851. }),
  18852. t
  18853. )
  18854. })(),
  18855. H = (function() {
  18856. function t(t) {
  18857. this.supportedScanTypes = this.validateAndReturnScanTypes(t)
  18858. }
  18859. return (
  18860. (t.prototype.getDefaultScanType = function() {
  18861. return this.supportedScanTypes[0]
  18862. }),
  18863. (t.prototype.hasMoreThanOneScanType = function() {
  18864. return this.supportedScanTypes.length > 1
  18865. }),
  18866. (t.prototype.isCameraScanRequired = function() {
  18867. for (var e = 0, r = this.supportedScanTypes; e < r.length; e++) {
  18868. var n = r[e]
  18869. if (t.isCameraScanType(n)) return !0
  18870. }
  18871. return !1
  18872. }),
  18873. (t.isCameraScanType = function(t) {
  18874. return t === i.SCAN_TYPE_CAMERA
  18875. }),
  18876. (t.isFileScanType = function(t) {
  18877. return t === i.SCAN_TYPE_FILE
  18878. }),
  18879. (t.prototype.validateAndReturnScanTypes = function(t) {
  18880. if (!t || 0 === t.length) return l.DEFAULT_SUPPORTED_SCAN_TYPE
  18881. var e = l.DEFAULT_SUPPORTED_SCAN_TYPE.length
  18882. if (t.length > e) throw 'Max ' + e + ' values expected for supportedScanTypes'
  18883. for (var r = 0, n = t; r < n.length; r++) {
  18884. var i = n[r]
  18885. if (!l.DEFAULT_SUPPORTED_SCAN_TYPE.includes(i)) throw 'Unsupported scan type ' + i
  18886. }
  18887. return t
  18888. }),
  18889. t
  18890. )
  18891. })()
  18892. !(function(t) {
  18893. ;(t[(t.STATUS_DEFAULT = 0)] = 'STATUS_DEFAULT'),
  18894. (t[(t.STATUS_SUCCESS = 1)] = 'STATUS_SUCCESS'),
  18895. (t[(t.STATUS_WARNING = 2)] = 'STATUS_WARNING'),
  18896. (t[(t.STATUS_REQUESTING_PERMISSION = 3)] = 'STATUS_REQUESTING_PERMISSION')
  18897. })(y || (y = {}))
  18898. var V = (function() {
  18899. function t(t, e, r) {
  18900. if (
  18901. ((this.lastMatchFound = null),
  18902. (this.cameraScanImage = null),
  18903. (this.fileScanImage = null),
  18904. (this.elementId = t),
  18905. (this.config = this.createConfig(e)),
  18906. (this.verbose = !0 === r),
  18907. !document.getElementById(t))
  18908. )
  18909. throw 'HTML Element with id=' + t + ' not found'
  18910. ;(this.scanTypeSelector = new H(this.config.supportedScanTypes)),
  18911. (this.currentScanType = this.scanTypeSelector.getDefaultScanType()),
  18912. (this.sectionSwapAllowed = !0),
  18913. (this.logger = new d(this.verbose)),
  18914. (this.persistedDataManager = new v()),
  18915. !0 !== e.rememberLastUsedCamera && this.persistedDataManager.reset()
  18916. }
  18917. return (
  18918. (t.prototype.render = function(t, e) {
  18919. var r = this
  18920. ;(this.lastMatchFound = null),
  18921. (this.qrCodeSuccessCallback = function(e, n) {
  18922. if (t) t(e, n)
  18923. else {
  18924. if (r.lastMatchFound === e) return
  18925. ;(r.lastMatchFound = e), r.setHeaderMessage(A.lastMatch(e), y.STATUS_SUCCESS)
  18926. }
  18927. }),
  18928. (this.qrCodeErrorCallback = function(t, r) {
  18929. e && e(t, r)
  18930. })
  18931. var n,
  18932. i,
  18933. o = document.getElementById(this.elementId)
  18934. if (!o) throw 'HTML Element with id=' + this.elementId + ' not found'
  18935. ;(o.innerHTML = ''),
  18936. this.createBasicLayout(o),
  18937. (this.html5Qrcode = new L(
  18938. this.getScanRegionId(),
  18939. ((n = this.config), (i = this.verbose), { formatsToSupport: n.formatsToSupport, experimentalFeatures: n.experimentalFeatures, verbose: i })
  18940. ))
  18941. }),
  18942. (t.prototype.pause = function(t) {
  18943. if (!this.html5Qrcode) throw 'Code scanner not initialized.'
  18944. ;(g(t) || !0 !== t) && (t = !1), this.html5Qrcode.pause(t)
  18945. }),
  18946. (t.prototype.resume = function() {
  18947. if (!this.html5Qrcode) throw 'Code scanner not initialized.'
  18948. this.html5Qrcode.resume()
  18949. }),
  18950. (t.prototype.getState = function() {
  18951. if (!this.html5Qrcode) throw 'Code scanner not initialized.'
  18952. return this.html5Qrcode.getState()
  18953. }),
  18954. (t.prototype.clear = function() {
  18955. var t = this,
  18956. e = function() {
  18957. var e = document.getElementById(t.elementId)
  18958. e && ((e.innerHTML = ''), t.resetBasicLayout(e))
  18959. }
  18960. return this.html5Qrcode
  18961. ? new Promise(function(r, n) {
  18962. t.html5Qrcode
  18963. ? t.html5Qrcode.isScanning
  18964. ? t.html5Qrcode
  18965. .stop()
  18966. .then(function(n) {
  18967. t.html5Qrcode ? (t.html5Qrcode.clear(), e(), r()) : r()
  18968. })
  18969. .catch(function(e) {
  18970. t.verbose && t.logger.logError('Unable to stop qrcode scanner', e), n(e)
  18971. })
  18972. : (t.html5Qrcode.clear(), e())
  18973. : r()
  18974. })
  18975. : Promise.resolve()
  18976. }),
  18977. (t.prototype.getRunningTrackCapabilities = function() {
  18978. if (!this.html5Qrcode) throw 'Code scanner not initialized.'
  18979. return this.html5Qrcode.getRunningTrackCapabilities()
  18980. }),
  18981. (t.prototype.applyVideoConstraints = function(t) {
  18982. if (!this.html5Qrcode) throw 'Code scanner not initialized.'
  18983. return this.html5Qrcode.applyVideoConstraints(t)
  18984. }),
  18985. (t.prototype.createConfig = function(t) {
  18986. return t
  18987. ? (t.fps || (t.fps = l.SCAN_DEFAULT_FPS),
  18988. t.rememberLastUsedCamera !== !l.DEFAULT_REMEMBER_LAST_CAMERA_USED && (t.rememberLastUsedCamera = l.DEFAULT_REMEMBER_LAST_CAMERA_USED),
  18989. t)
  18990. : { fps: l.SCAN_DEFAULT_FPS, rememberLastUsedCamera: l.DEFAULT_REMEMBER_LAST_CAMERA_USED, supportedScanTypes: l.DEFAULT_SUPPORTED_SCAN_TYPE }
  18991. }),
  18992. (t.prototype.createBasicLayout = function(t) {
  18993. ;(t.style.position = 'relative'), (t.style.padding = '0px'), (t.style.border = '1px solid silver'), this.createHeader(t)
  18994. var e = document.createElement('div'),
  18995. r = this.getScanRegionId()
  18996. ;(e.id = r),
  18997. (e.style.width = '100%'),
  18998. (e.style.minHeight = '100px'),
  18999. (e.style.textAlign = 'center'),
  19000. t.appendChild(e),
  19001. H.isCameraScanType(this.currentScanType) ? this.insertCameraScanImageToScanRegion() : this.insertFileScanImageToScanRegion()
  19002. var n = document.createElement('div'),
  19003. i = this.getDashboardId()
  19004. ;(n.id = i), (n.style.width = '100%'), t.appendChild(n), this.setupInitialDashboard(n)
  19005. }),
  19006. (t.prototype.resetBasicLayout = function(t) {
  19007. t.style.border = 'none'
  19008. }),
  19009. (t.prototype.setupInitialDashboard = function(t) {
  19010. this.createSection(t), this.createSectionControlPanel(), this.scanTypeSelector.hasMoreThanOneScanType() && this.createSectionSwap()
  19011. }),
  19012. (t.prototype.createHeader = function(t) {
  19013. var e = document.createElement('div')
  19014. ;(e.style.textAlign = 'left'), (e.style.margin = '0px'), t.appendChild(e), new k().renderInto(e)
  19015. var r = document.createElement('div')
  19016. ;(r.id = this.getHeaderMessageContainerId()),
  19017. (r.style.display = 'none'),
  19018. (r.style.textAlign = 'center'),
  19019. (r.style.fontSize = '14px'),
  19020. (r.style.padding = '2px 10px'),
  19021. (r.style.margin = '4px'),
  19022. (r.style.borderTop = '1px solid #f6f6f6'),
  19023. e.appendChild(r)
  19024. }),
  19025. (t.prototype.createSection = function(t) {
  19026. var e = document.createElement('div')
  19027. ;(e.id = this.getDashboardSectionId()), (e.style.width = '100%'), (e.style.padding = '10px 0px 10px 0px'), (e.style.textAlign = 'left'), t.appendChild(e)
  19028. }),
  19029. (t.prototype.createCameraListUi = function(t, e, r) {
  19030. var n = this
  19031. n.setHeaderMessage(A.cameraPermissionRequesting())
  19032. var i = function() {
  19033. r || n.createPermissionButton(t, e)
  19034. }
  19035. L.getCameras()
  19036. .then(function(r) {
  19037. n.persistedDataManager.setHasPermission(!0),
  19038. n.resetHeaderMessage(),
  19039. r && r.length > 0 ? (t.removeChild(e), n.renderCameraSelection(r)) : (n.setHeaderMessage(A.noCameraFound(), y.STATUS_WARNING), i())
  19040. })
  19041. .catch(function(t) {
  19042. n.persistedDataManager.setHasPermission(!1), r ? (r.disabled = !1) : i(), n.setHeaderMessage(t, y.STATUS_WARNING)
  19043. })
  19044. }),
  19045. (t.prototype.createPermissionButton = function(t, e) {
  19046. var r = this,
  19047. n = document.createElement('button')
  19048. ;(n.id = this.getCameraPermissionButtonId()),
  19049. (n.innerText = A.cameraPermissionTitle()),
  19050. n.addEventListener('click', function() {
  19051. ;(n.disabled = !0), r.createCameraListUi(t, e, n)
  19052. }),
  19053. e.appendChild(n)
  19054. }),
  19055. (t.prototype.createPermissionsUi = function(t, e) {
  19056. var r = this
  19057. H.isCameraScanType(this.currentScanType) && this.persistedDataManager.hasCameraPermissions()
  19058. ? U.hasCameraPermissions()
  19059. .then(function(n) {
  19060. n ? r.createCameraListUi(t, e) : (r.persistedDataManager.setHasPermission(!1), r.createPermissionButton(t, e))
  19061. })
  19062. .catch(function(n) {
  19063. r.persistedDataManager.setHasPermission(!1), r.createPermissionButton(t, e)
  19064. })
  19065. : this.createPermissionButton(t, e)
  19066. }),
  19067. (t.prototype.createSectionControlPanel = function() {
  19068. var t = document.getElementById(this.getDashboardSectionId()),
  19069. e = document.createElement('div')
  19070. t.appendChild(e)
  19071. var r = document.createElement('div')
  19072. ;(r.id = this.getDashboardSectionCameraScanRegionId()), (r.style.display = H.isCameraScanType(this.currentScanType) ? 'block' : 'none'), e.appendChild(r)
  19073. var n = document.createElement('div')
  19074. ;(n.style.textAlign = 'center'), r.appendChild(n), this.scanTypeSelector.isCameraScanRequired() && this.createPermissionsUi(r, n), this.renderFileScanUi(e)
  19075. }),
  19076. (t.prototype.renderFileScanUi = function(t) {
  19077. var e = this,
  19078. r = document.createElement('div')
  19079. ;(r.id = this.getDashboardSectionFileScanRegionId()),
  19080. (r.style.textAlign = 'center'),
  19081. (r.style.display = H.isCameraScanType(this.currentScanType) ? 'none' : 'block'),
  19082. t.appendChild(r)
  19083. var n = document.createElement('input')
  19084. ;(n.id = this.getFileScanInputId()), (n.accept = 'image/*'), (n.type = 'file'), (n.style.width = '200px'), (n.disabled = H.isCameraScanType(this.currentScanType))
  19085. var i = document.createElement('span')
  19086. ;(i.innerText = ' Select Image'),
  19087. r.appendChild(n),
  19088. r.appendChild(i),
  19089. n.addEventListener('change', function(t) {
  19090. if (!e.html5Qrcode) throw 'html5Qrcode not defined'
  19091. if (null != t && null != t.target && H.isFileScanType(e.currentScanType) && 0 !== t.target.files.length) {
  19092. var r = t.target.files[0]
  19093. e.html5Qrcode
  19094. .scanFileV2(r, !0)
  19095. .then(function(t) {
  19096. e.resetHeaderMessage(), e.qrCodeSuccessCallback(t.decodedText, t)
  19097. })
  19098. .catch(function(t) {
  19099. e.setHeaderMessage(t, y.STATUS_WARNING), e.qrCodeErrorCallback(t, u.createFrom(t))
  19100. })
  19101. }
  19102. })
  19103. }),
  19104. (t.prototype.renderCameraSelection = function(t) {
  19105. var e = this,
  19106. r = this,
  19107. n = document.getElementById(this.getDashboardSectionCameraScanRegionId())
  19108. n.style.textAlign = 'center'
  19109. var i = document.createElement('span')
  19110. i.style.marginRight = '10px'
  19111. var o = t.length,
  19112. s = document.createElement('select')
  19113. if (1 === o) s.style.display = 'none'
  19114. else {
  19115. var a = A.selectCamera()
  19116. i.innerText = a + ' (' + t.length + ') '
  19117. }
  19118. s.id = this.getCameraSelectionId()
  19119. for (var l = [], c = 0, h = t; c < h.length; c++) {
  19120. var u = h[c],
  19121. d = u.id,
  19122. g = null == u.label ? d : u.label
  19123. ;((_ = document.createElement('option')).value = d), (_.innerText = g), l.push(_), s.appendChild(_)
  19124. }
  19125. i.appendChild(s), n.appendChild(i)
  19126. var f = document.createElement('span'),
  19127. w = document.createElement('button')
  19128. ;(w.innerText = A.scanButtonStartScanningText()), f.appendChild(w)
  19129. var m = document.createElement('button')
  19130. ;(m.innerText = A.scanButtonStopScanningText()), (m.style.display = 'none'), (m.disabled = !0), f.appendChild(m), n.appendChild(f)
  19131. var E = function(t) {
  19132. t || (w.style.display = 'none'), (w.innerText = A.scanButtonStartScanningText()), (w.style.opacity = '1'), (w.disabled = !1), t && (w.style.display = 'inline-block')
  19133. }
  19134. if (
  19135. (w.addEventListener('click', function(t) {
  19136. ;(w.innerText = A.scanButtonScanningStarting()),
  19137. (s.disabled = !0),
  19138. (w.disabled = !0),
  19139. (w.style.opacity = '0.5'),
  19140. e.scanTypeSelector.hasMoreThanOneScanType() && r.showHideScanTypeSwapLink(!1),
  19141. r.resetHeaderMessage()
  19142. var n,
  19143. i = s.value
  19144. r.persistedDataManager.setLastUsedCameraId(i),
  19145. r.html5Qrcode
  19146. .start(
  19147. i,
  19148. ((n = r.config), { fps: n.fps, qrbox: n.qrbox, aspectRatio: n.aspectRatio, disableFlip: n.disableFlip, videoConstraints: n.videoConstraints }),
  19149. r.qrCodeSuccessCallback,
  19150. r.qrCodeErrorCallback
  19151. )
  19152. .then(function(t) {
  19153. ;(m.disabled = !1), (m.style.display = 'inline-block'), E(!1)
  19154. })
  19155. .catch(function(t) {
  19156. r.showHideScanTypeSwapLink(!0), (s.disabled = !1), E(!0), r.setHeaderMessage(t, y.STATUS_WARNING)
  19157. })
  19158. }),
  19159. 1 === o && w.click(),
  19160. m.addEventListener('click', function(t) {
  19161. if (!r.html5Qrcode) throw 'html5Qrcode not defined'
  19162. ;(m.disabled = !0),
  19163. r.html5Qrcode
  19164. .stop()
  19165. .then(function(t) {
  19166. e.scanTypeSelector.hasMoreThanOneScanType() && r.showHideScanTypeSwapLink(!0),
  19167. (s.disabled = !1),
  19168. (w.disabled = !1),
  19169. (m.style.display = 'none'),
  19170. (w.style.display = 'inline-block'),
  19171. r.insertCameraScanImageToScanRegion()
  19172. })
  19173. .catch(function(t) {
  19174. ;(m.disabled = !1), r.setHeaderMessage(t, y.STATUS_WARNING)
  19175. })
  19176. }),
  19177. r.persistedDataManager.getLastUsedCameraId())
  19178. ) {
  19179. for (var C = r.persistedDataManager.getLastUsedCameraId(), I = !1, p = 0, S = l; p < S.length; p++) {
  19180. var _
  19181. if ((_ = S[p]).value === C) {
  19182. I = !0
  19183. break
  19184. }
  19185. }
  19186. I ? ((s.value = C), w.click()) : r.persistedDataManager.resetLastUsedCameraId()
  19187. }
  19188. }),
  19189. (t.prototype.createSectionSwap = function() {
  19190. var t = this,
  19191. e = A.textIfCameraScanSelected(),
  19192. r = A.textIfFileScanSelected(),
  19193. n = document.getElementById(this.getDashboardSectionId()),
  19194. o = document.createElement('div')
  19195. o.style.textAlign = 'center'
  19196. var s = document.createElement('a')
  19197. ;(s.style.textDecoration = 'underline'),
  19198. (s.id = this.getDashboardSectionSwapLinkId()),
  19199. (s.innerText = H.isCameraScanType(this.currentScanType) ? e : r),
  19200. s.addEventListener('click', function() {
  19201. t.sectionSwapAllowed
  19202. ? (t.resetHeaderMessage(),
  19203. (t.getFileScanInput().value = ''),
  19204. (t.sectionSwapAllowed = !1),
  19205. H.isCameraScanType(t.currentScanType)
  19206. ? (t.clearScanRegion(),
  19207. (t.getFileScanInput().disabled = !1),
  19208. (t.getCameraScanRegion().style.display = 'none'),
  19209. (t.getFileScanRegion().style.display = 'block'),
  19210. (s.innerText = r),
  19211. (t.currentScanType = i.SCAN_TYPE_FILE),
  19212. t.insertFileScanImageToScanRegion())
  19213. : (t.clearScanRegion(),
  19214. (t.getFileScanInput().disabled = !0),
  19215. (t.getCameraScanRegion().style.display = 'block'),
  19216. (t.getFileScanRegion().style.display = 'none'),
  19217. (s.innerText = e),
  19218. (t.currentScanType = i.SCAN_TYPE_CAMERA),
  19219. t.insertCameraScanImageToScanRegion(),
  19220. t.startCameraScanIfPermissionExistsOnSwap()),
  19221. (t.sectionSwapAllowed = !0))
  19222. : t.verbose && t.logger.logError('Section swap called when not allowed')
  19223. }),
  19224. o.appendChild(s),
  19225. n.appendChild(o)
  19226. }),
  19227. (t.prototype.startCameraScanIfPermissionExistsOnSwap = function() {
  19228. var t = this,
  19229. e = this
  19230. this.persistedDataManager.hasCameraPermissions() &&
  19231. U.hasCameraPermissions()
  19232. .then(function(r) {
  19233. if (r) {
  19234. var n = document.getElementById(e.getCameraPermissionButtonId())
  19235. if (!n) throw (t.logger.logError('Permission button not found, fail;'), 'Permission button not found')
  19236. n.click()
  19237. } else e.persistedDataManager.setHasPermission(!1)
  19238. })
  19239. .catch(function(t) {
  19240. e.persistedDataManager.setHasPermission(!1)
  19241. })
  19242. }),
  19243. (t.prototype.resetHeaderMessage = function() {
  19244. document.getElementById(this.getHeaderMessageContainerId()).style.display = 'none'
  19245. }),
  19246. (t.prototype.setHeaderMessage = function(t, e) {
  19247. e || (e = y.STATUS_DEFAULT)
  19248. var r = this.getHeaderMessageDiv()
  19249. switch (((r.innerText = t), (r.style.display = 'block'), e)) {
  19250. case y.STATUS_SUCCESS:
  19251. ;(r.style.background = '#6aaf5042'), (r.style.color = '#477735')
  19252. break
  19253. case y.STATUS_WARNING:
  19254. ;(r.style.background = '#cb243124'), (r.style.color = '#cb2431')
  19255. break
  19256. case y.STATUS_DEFAULT:
  19257. default:
  19258. ;(r.style.background = '#00000000'), (r.style.color = 'rgb(17, 17, 17)')
  19259. }
  19260. }),
  19261. (t.prototype.showHideScanTypeSwapLink = function(t) {
  19262. !0 !== t && (t = !1), (this.sectionSwapAllowed = t), (this.getDashboardSectionSwapLink().style.display = t ? 'inline-block' : 'none')
  19263. }),
  19264. (t.prototype.insertCameraScanImageToScanRegion = function() {
  19265. var t = this,
  19266. e = document.getElementById(this.getScanRegionId())
  19267. if (this.cameraScanImage) return (e.innerHTML = '<br>'), void e.appendChild(this.cameraScanImage)
  19268. ;(this.cameraScanImage = new Image()),
  19269. (this.cameraScanImage.onload = function(r) {
  19270. ;(e.innerHTML = '<br>'), e.appendChild(t.cameraScanImage)
  19271. }),
  19272. (this.cameraScanImage.width = 64),
  19273. (this.cameraScanImage.style.opacity = '0.8'),
  19274. (this.cameraScanImage.src =
  19275. 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNzEuNjQzIDM3MS42NDMiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDM3MS42NDMgMzcxLjY0MyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZD0iTTEwNS4wODQgMzguMjcxaDE2My43Njh2MjBIMTA1LjA4NHoiLz48cGF0aCBkPSJNMzExLjU5NiAxOTAuMTg5Yy03LjQ0MS05LjM0Ny0xOC40MDMtMTYuMjA2LTMyLjc0My0yMC41MjJWMzBjMC0xNi41NDItMTMuNDU4LTMwLTMwLTMwSDEyNS4wODRjLTE2LjU0MiAwLTMwIDEzLjQ1OC0zMCAzMHYxMjAuMTQzaC04LjI5NmMtMTYuNTQyIDAtMzAgMTMuNDU4LTMwIDMwdjEuMzMzYTI5LjgwNCAyOS44MDQgMCAwIDAgNC42MDMgMTUuOTM5Yy03LjM0IDUuNDc0LTEyLjEwMyAxNC4yMjEtMTIuMTAzIDI0LjA2MXYxLjMzM2MwIDkuODQgNC43NjMgMTguNTg3IDEyLjEwMyAyNC4wNjJhMjkuODEgMjkuODEgMCAwIDAtNC42MDMgMTUuOTM4djEuMzMzYzAgMTYuNTQyIDEzLjQ1OCAzMCAzMCAzMGg4LjMyNGMuNDI3IDExLjYzMSA3LjUwMyAyMS41ODcgMTcuNTM0IDI2LjE3Ny45MzEgMTAuNTAzIDQuMDg0IDMwLjE4NyAxNC43NjggNDUuNTM3YTkuOTg4IDkuOTg4IDAgMCAwIDguMjE2IDQuMjg4IDkuOTU4IDkuOTU4IDAgMCAwIDUuNzA0LTEuNzkzYzQuNTMzLTMuMTU1IDUuNjUtOS4zODggMi40OTUtMTMuOTIxLTYuNzk4LTkuNzY3LTkuNjAyLTIyLjYwOC0xMC43Ni0zMS40aDgyLjY4NWMuMjcyLjQxNC41NDUuODE4LjgxNSAxLjIxIDMuMTQyIDQuNTQxIDkuMzcyIDUuNjc5IDEzLjkxMyAyLjUzNCA0LjU0Mi0zLjE0MiA1LjY3Ny05LjM3MSAyLjUzNS0xMy45MTMtMTEuOTE5LTE3LjIyOS04Ljc4Ny0zNS44ODQgOS41ODEtNTcuMDEyIDMuMDY3LTIuNjUyIDEyLjMwNy0xMS43MzIgMTEuMjE3LTI0LjAzMy0uODI4LTkuMzQzLTcuMTA5LTE3LjE5NC0xOC42NjktMjMuMzM3YTkuODU3IDkuODU3IDAgMCAwLTEuMDYxLS40ODZjLS40NjYtLjE4Mi0xMS40MDMtNC41NzktOS43NDEtMTUuNzA2IDEuMDA3LTYuNzM3IDE0Ljc2OC04LjI3MyAyMy43NjYtNy42NjYgMjMuMTU2IDEuNTY5IDM5LjY5OCA3LjgwMyA0Ny44MzYgMTguMDI2IDUuNzUyIDcuMjI1IDcuNjA3IDE2LjYyMyA1LjY3MyAyOC43MzMtLjQxMyAyLjU4NS0uODI0IDUuMjQxLTEuMjQ1IDcuOTU5LTUuNzU2IDM3LjE5NC0xMi45MTkgODMuNDgzLTQ5Ljg3IDExNC42NjEtNC4yMjEgMy41NjEtNC43NTYgOS44Ny0xLjE5NCAxNC4wOTJhOS45OCA5Ljk4IDAgMCAwIDcuNjQ4IDMuNTUxIDkuOTU1IDkuOTU1IDAgMCAwIDYuNDQ0LTIuMzU4YzQyLjY3Mi0zNi4wMDUgNTAuODAyLTg4LjUzMyA1Ni43MzctMTI2Ljg4OC40MTUtMi42ODQuODIxLTUuMzA5IDEuMjI5LTcuODYzIDIuODM0LTE3LjcyMS0uNDU1LTMyLjY0MS05Ljc3Mi00NC4zNDV6bS0yMzIuMzA4IDQyLjYyYy01LjUxNCAwLTEwLTQuNDg2LTEwLTEwdi0xLjMzM2MwLTUuNTE0IDQuNDg2LTEwIDEwLTEwaDE1djIxLjMzM2gtMTV6bS0yLjUtNTIuNjY2YzAtNS41MTQgNC40ODYtMTAgMTAtMTBoNy41djIxLjMzM2gtNy41Yy01LjUxNCAwLTEwLTQuNDg2LTEwLTEwdi0xLjMzM3ptMTcuNSA5My45OTloLTcuNWMtNS41MTQgMC0xMC00LjQ4Ni0xMC0xMHYtMS4zMzNjMC01LjUxNCA0LjQ4Ni0xMCAxMC0xMGg3LjV2MjEuMzMzem0zMC43OTYgMjguODg3Yy01LjUxNCAwLTEwLTQuNDg2LTEwLTEwdi04LjI3MWg5MS40NTdjLS44NTEgNi42NjgtLjQzNyAxMi43ODcuNzMxIDE4LjI3MWgtODIuMTg4em03OS40ODItMTEzLjY5OGMtMy4xMjQgMjAuOTA2IDEyLjQyNyAzMy4xODQgMjEuNjI1IDM3LjA0IDUuNDQxIDIuOTY4IDcuNTUxIDUuNjQ3IDcuNzAxIDcuMTg4LjIxIDIuMTUtMi41NTMgNS42ODQtNC40NzcgNy4yNTEtLjQ4Mi4zNzgtLjkyOS44LTEuMzM1IDEuMjYxLTYuOTg3IDcuOTM2LTExLjk4MiAxNS41Mi0xNS40MzIgMjIuNjg4aC05Ny41NjRWMzBjMC01LjUxNCA0LjQ4Ni0xMCAxMC0xMGgxMjMuNzY5YzUuNTE0IDAgMTAgNC40ODYgMTAgMTB2MTM1LjU3OWMtMy4wMzItLjM4MS02LjE1LS42OTQtOS4zODktLjkxNC0yNS4xNTktMS42OTQtNDIuMzcgNy43NDgtNDQuODk4IDI0LjY2NnoiLz48cGF0aCBkPSJNMTc5LjEyOSA4My4xNjdoLTI0LjA2YTUgNSAwIDAgMC01IDV2MjQuMDYxYTUgNSAwIDAgMCA1IDVoMjQuMDZhNSA1IDAgMCAwIDUtNVY4OC4xNjdhNSA1IDAgMCAwLTUtNXpNMTcyLjYyOSAxNDIuODZoLTEyLjU2VjEzMC44YTUgNSAwIDEgMC0xMCAwdjE3LjA2MWE1IDUgMCAwIDAgNSA1aDE3LjU2YTUgNSAwIDEgMCAwLTEwLjAwMXpNMjE2LjU2OCA4My4xNjdoLTI0LjA2YTUgNSAwIDAgMC01IDV2MjQuMDYxYTUgNSAwIDAgMCA1IDVoMjQuMDZhNSA1IDAgMCAwIDUtNVY4OC4xNjdhNSA1IDAgMCAwLTUtNXptLTUgMjQuMDYxaC0xNC4wNlY5My4xNjdoMTQuMDZ2MTQuMDYxek0yMTEuNjY5IDEyNS45MzZIMTk3LjQxYTUgNSAwIDAgMC01IDV2MTQuMjU3YTUgNSAwIDAgMCA1IDVoMTQuMjU5YTUgNSAwIDAgMCA1LTV2LTE0LjI1N2E1IDUgMCAwIDAtNS01eiIvPjwvc3ZnPg==')
  19276. }),
  19277. (t.prototype.insertFileScanImageToScanRegion = function() {
  19278. var t = this,
  19279. e = document.getElementById(this.getScanRegionId())
  19280. if (this.fileScanImage) return (e.innerHTML = '<br>'), void e.appendChild(this.fileScanImage)
  19281. ;(this.fileScanImage = new Image()),
  19282. (this.fileScanImage.onload = function(r) {
  19283. ;(e.innerHTML = '<br>'), e.appendChild(t.fileScanImage)
  19284. }),
  19285. (this.fileScanImage.width = 64),
  19286. (this.fileScanImage.style.opacity = '0.8'),
  19287. (this.fileScanImage.src =
  19288. 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1OS4wMTggNTkuMDE4IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA1OS4wMTggNTkuMDE4IiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBkPSJtNTguNzQxIDU0LjgwOS01Ljk2OS02LjI0NGExMC43NCAxMC43NCAwIDAgMCAyLjgyLTcuMjVjMC01Ljk1My00Ljg0My0xMC43OTYtMTAuNzk2LTEwLjc5NlMzNCAzNS4zNjEgMzQgNDEuMzE0IDM4Ljg0MyA1Mi4xMSA0NC43OTYgNTIuMTFjMi40NDEgMCA0LjY4OC0uODI0IDYuNDk5LTIuMTk2bDYuMDAxIDYuMjc3YS45OTguOTk4IDAgMCAwIDEuNDE0LjAzMiAxIDEgMCAwIDAgLjAzMS0xLjQxNHpNMzYgNDEuMzE0YzAtNC44NSAzLjk0Ni04Ljc5NiA4Ljc5Ni04Ljc5NnM4Ljc5NiAzLjk0NiA4Ljc5NiA4Ljc5Ni0zLjk0NiA4Ljc5Ni04Ljc5NiA4Ljc5NlMzNiA0Ni4xNjQgMzYgNDEuMzE0ek0xMC40MzEgMTYuMDg4YzAgMy4wNyAyLjQ5OCA1LjU2OCA1LjU2OSA1LjU2OHM1LjU2OS0yLjQ5OCA1LjU2OS01LjU2OGMwLTMuMDcxLTIuNDk4LTUuNTY5LTUuNTY5LTUuNTY5cy01LjU2OSAyLjQ5OC01LjU2OSA1LjU2OXptOS4xMzggMGMwIDEuOTY4LTEuNjAyIDMuNTY4LTMuNTY5IDMuNTY4cy0zLjU2OS0xLjYwMS0zLjU2OS0zLjU2OCAxLjYwMi0zLjU2OSAzLjU2OS0zLjU2OSAzLjU2OSAxLjYwMSAzLjU2OSAzLjU2OXoiLz48cGF0aCBkPSJtMzAuODgyIDI4Ljk4NyA5LjE4LTEwLjA1NCAxMS4yNjIgMTAuMzIzYTEgMSAwIDAgMCAxLjM1MS0xLjQ3NWwtMTItMTFhMSAxIDAgMCAwLTEuNDE0LjA2M2wtOS43OTQgMTAuNzI3LTQuNzQzLTQuNzQzYTEuMDAzIDEuMDAzIDAgMCAwLTEuMzY4LS4wNDRMNi4zMzkgMzcuNzY4YTEgMSAwIDEgMCAxLjMyMiAxLjUwMWwxNi4zMTMtMTQuMzYyIDcuMzE5IDcuMzE4YS45OTkuOTk5IDAgMSAwIDEuNDE0LTEuNDE0bC0xLjgyNS0xLjgyNHoiLz48cGF0aCBkPSJNMzAgNDYuNTE4SDJ2LTQyaDU0djI4YTEgMSAwIDEgMCAyIDB2LTI5YTEgMSAwIDAgMC0xLTFIMWExIDEgMCAwIDAtMSAxdjQ0YTEgMSAwIDAgMCAxIDFoMjlhMSAxIDAgMSAwIDAtMnoiLz48L3N2Zz4=')
  19289. }),
  19290. (t.prototype.clearScanRegion = function() {
  19291. document.getElementById(this.getScanRegionId()).innerHTML = ''
  19292. }),
  19293. (t.prototype.getDashboardSectionId = function() {
  19294. return this.elementId + '__dashboard_section'
  19295. }),
  19296. (t.prototype.getDashboardSectionCameraScanRegionId = function() {
  19297. return this.elementId + '__dashboard_section_csr'
  19298. }),
  19299. (t.prototype.getDashboardSectionFileScanRegionId = function() {
  19300. return this.elementId + '__dashboard_section_fsr'
  19301. }),
  19302. (t.prototype.getDashboardSectionSwapLinkId = function() {
  19303. return this.elementId + '__dashboard_section_swaplink'
  19304. }),
  19305. (t.prototype.getScanRegionId = function() {
  19306. return this.elementId + '__scan_region'
  19307. }),
  19308. (t.prototype.getDashboardId = function() {
  19309. return this.elementId + '__dashboard'
  19310. }),
  19311. (t.prototype.getFileScanInputId = function() {
  19312. return this.elementId + '__filescan_input'
  19313. }),
  19314. (t.prototype.getStatusSpanId = function() {
  19315. return this.elementId + '__status_span'
  19316. }),
  19317. (t.prototype.getHeaderMessageContainerId = function() {
  19318. return this.elementId + '__header_message'
  19319. }),
  19320. (t.prototype.getCameraSelectionId = function() {
  19321. return this.elementId + '__camera_selection'
  19322. }),
  19323. (t.prototype.getCameraPermissionButtonId = function() {
  19324. return this.elementId + '__camera_permission_button'
  19325. }),
  19326. (t.prototype.getCameraScanRegion = function() {
  19327. return document.getElementById(this.getDashboardSectionCameraScanRegionId())
  19328. }),
  19329. (t.prototype.getFileScanRegion = function() {
  19330. return document.getElementById(this.getDashboardSectionFileScanRegionId())
  19331. }),
  19332. (t.prototype.getFileScanInput = function() {
  19333. return document.getElementById(this.getFileScanInputId())
  19334. }),
  19335. (t.prototype.getDashboardSectionSwapLink = function() {
  19336. return document.getElementById(this.getDashboardSectionSwapLinkId())
  19337. }),
  19338. (t.prototype.getHeaderMessageDiv = function() {
  19339. return document.getElementById(this.getHeaderMessageContainerId())
  19340. }),
  19341. t
  19342. )
  19343. })()
  19344. })(),
  19345. (__Html5QrcodeLibrary__ = n)
  19346. })() /** Append the libary components to globals for backwards compatibility. */
  19347. if (window) {
  19348. if (!Html5QrcodeScanner) {
  19349. var Html5QrcodeScanner = __Html5QrcodeLibrary__.Html5QrcodeScanner
  19350. }
  19351. if (!Html5Qrcode) {
  19352. var Html5Qrcode = __Html5QrcodeLibrary__.Html5Qrcode
  19353. }
  19354. if (!Html5QrcodeSupportedFormats) {
  19355. var Html5QrcodeSupportedFormats = __Html5QrcodeLibrary__.Html5QrcodeSupportedFormats
  19356. }
  19357. if (!Html5QrcodeScannerState) {
  19358. var Html5QrcodeScannerState = __Html5QrcodeLibrary__.Html5QrcodeScannerState
  19359. }
  19360. if (!Html5QrcodeScanType) {
  19361. var Html5QrcodeScanType = __Html5QrcodeLibrary__.Html5QrcodeScanType
  19362. }
  19363. }
  19364. export { Html5QrcodeScanner, Html5Qrcode, Html5QrcodeSupportedFormats, Html5QrcodeScannerState, Html5QrcodeScanType }