diff --git a/browser-compatibility.js b/browser-compatibility.js index d70be569..93e18968 100644 --- a/browser-compatibility.js +++ b/browser-compatibility.js @@ -1,4 +1,4 @@ -const unsupportFeatures = (()=>{ +(()=>{ function runCodeWithFunction(obj) { return Function(`"use strict"; return (${obj})`)(); } @@ -22,8 +22,9 @@ {name: "Private class fields (#name) / 类私有域(#name)", version:{firefox:90,chrome:74,safari:14.5}, url: "https://caniuse.com/mdn-javascript_classes_private_class_fields", test: ()=>Boolean(runCodeWithFunction("class test {#v = 0;}, true"))}, {name: "Dialog element / Dialog 元素", version:{firefox:98,chrome:37,safari:15.4}, url: "https://caniuse.com/dialog", test: ()=>Boolean(window.HTMLDialogElement)}, // {name: "Class static initialization blocks / 静态初始化块", version:{firefox:93,chrome:94,safari:16.4}, url: "https://caniuse.com/mdn-javascript_classes_static_initialization_blocks", test: ()=>supportsPseudoClass(":not(html)")}, - ] - return features.filter(feature=>{ + ]; + + const unsupportFeatures = features.filter(feature=>{ try { return !feature.test(); } catch (e) { @@ -31,86 +32,87 @@ console.error(e); return true; } - }) -})(); - -if (unsupportFeatures.length) { - const browserVersion = ((UA)=>{ - let regRes; - if (regRes = /\b(Firefox|Chrome)\/([\d\.]+)/ig.exec(UA)) { - return `${regRes[1]} ${regRes[2]}`; - } else if (regRes = /\bVersion\/([\d\.]+)\s+.*\b(Safari)\//ig.exec(UA)) { - return `${regRes[2]} ${regRes[1]}`; - } else { - UA; - } - })(navigator.userAgent); - //支持的最低版本 - const needBrowserVersion = unsupportFeatures.reduce((pre,{version})=>{ - pre.firefox = Math.max(pre.firefox,version.firefox); - pre.chrome = Math.max(pre.chrome,version.chrome); - pre.safari = Math.max(pre.safari,version.safari); - return pre; - }, {firefox:0,chrome:0,safari:0}); + }); - let alertStr; - if (/^zh-(?:han(?:s|t)-)?/.test(navigator.language)) { - alertStr = -`
🙁浏览器内核版本太老
+ if (unsupportFeatures.length) { + const browserVersion = ((UA)=>{ + let regRes; + if (regRes = /\b(Firefox|Chrome)\/([\d\.]+)/ig.exec(UA)) { + return `${regRes[1]} ${regRes[2]}`; + } else if (regRes = /\bVersion\/([\d\.]+)\s+.*\b(Safari)\//ig.exec(UA)) { + return `${regRes[2]} ${regRes[1]}`; + } else { + UA; + } + })(navigator.userAgent); + //支持的最低版本 + const needBrowserVersion = unsupportFeatures.reduce((pre,{version})=>{ + pre.firefox = Math.max(pre.firefox,version.firefox); + pre.chrome = Math.max(pre.chrome,version.chrome); + pre.safari = Math.max(pre.safari,version.safari); + return pre; + }, {firefox:0,chrome:0,safari:0}); + + let alertStr; + if (/^zh-(?:han(?:s|t)-)?/.test(navigator.language)) { + alertStr = +`

🙁浏览器内核版本太老
您的浏览器版本为: ${browserVersion}
您的浏览器内核不支持本程序使用的以下技术

    ${unsupportFeatures.map(feature=>`
  1. ${feature.name}
  2. `).join('')}
-请更新您的浏览器内核到 Firefox(火狐) ≥ ${needBrowserVersion.firefox} 或 Chrome(谷歌) ≥ ${needBrowserVersion.chrome} 或 Safari ≥ ${needBrowserVersion.safari}。
`; - } else { - alertStr = -`
🙁Browser kernel is too old
+请更新您的浏览器内核到 Firefox(火狐) ≥ ${needBrowserVersion.firefox} 或 Chrome(谷歌) ≥ ${needBrowserVersion.chrome} 或 Safari ≥ ${needBrowserVersion.safari}。

`; + } else { + alertStr = +`

🙁Browser kernel is too old
Your browser is: ${browserVersion}
Your browser kernel does not support the following technologies used by this program:

    ${unsupportFeatures.map(feature=>`
  1. ${feature.name}
  2. `).join('')}
-Please update your browser core to Firefox ≥ ${needBrowserVersion.firefox} or Chrome ≥ ${needBrowserVersion.chrome} or Safari ≥ ${needBrowserVersion.safari}
`; +Please update your browser core to Firefox ≥ ${needBrowserVersion.firefox} or Chrome ≥ ${needBrowserVersion.chrome} or Safari ≥ ${needBrowserVersion.safari}

`; + } + + //alert(alertStr); + document.write(alertStr); } -//alert(alertStr); -document.write(alertStr); -} - -if (/\b(?:MicroMessenger|WeChat|Weixin|QQ|AliApp)\b/.test(navigator.userAgent)) { - const mask = document.createElement("div"); - mask.id = "denied-mask"; - const css = ` - #denied-mask { - position: fixed; - height: 100%; - width: 100%; - top: 0; - left: 0; - background-color: #000A; - } - .alert { - font-size: 2em; - font-weight: bold; - color: white; - text-align: center; + if (/\b(?:MicroMessenger|WeChat|Weixin|QQ|AliApp)\b/.test(navigator.userAgent)) { + const mask = document.createElement("div"); + mask.id = "denied-mask"; + const css = ` + #denied-mask { + position: fixed; + height: 100%; + width: 100%; + top: 0; + left: 0; + background-color: #000A; + } + .alert { + font-size: 2em; + font-weight: bold; + color: white; + text-align: center; + } + `; + const style = mask.appendChild(document.createElement("style")); + style.appendChild(document.createTextNode(css)); + const alertDiv = mask.appendChild(document.createElement("div")); + alertDiv.className = "alert"; + alertDiv.innerHTML = `请勿使用APP内置浏览器,会有功能缺失
点击菜单使用正常浏览器打开↗`; + const removeMe = mask.appendChild(document.createElement("button")); + removeMe.append("我知道了"); + removeMe.onclick = ()=>{ + mask.remove(); + delete mask; + }; + + const event = window.addEventListener("load", ()=>{ + document.body.appendChild(mask); + window.removeEventListener(event); + }); } - `; - const style = mask.appendChild(document.createElement("style")); - style.appendChild(document.createTextNode(css)); - const alertDiv = mask.appendChild(document.createElement("div")); - alertDiv.className = "alert"; - alertDiv.innerHTML = `请勿使用内置浏览
点击菜单使用正常浏览器打开↗`; - const removeMe = mask.appendChild(document.createElement("button")); - removeMe.append("我知道了"); - removeMe.onclick = ()=>{ - mask.remove(); - delete mask; - }; +}) - const event = window.addEventListener("load", ()=>{ - document.body.appendChild(mask); - window.removeEventListener(event); - }); -} \ No newline at end of file diff --git a/library/core-js.min.js b/library/core-js.min.js new file mode 100644 index 00000000..02dc39f8 --- /dev/null +++ b/library/core-js.min.js @@ -0,0 +1,15 @@ +/** + * core-js 3.31.1 + * © 2014-2023 Denis Pushkarev (zloirock.ru) + * license: https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE + * source: https://github.com/zloirock/core-js + */ +!function(t){"use strict";var r,e,n;r=[function(t,r,e){e(1),e(100),e(101),e(102),e(103),e(104),e(105),e(106),e(107),e(108),e(109),e(110),e(111),e(112),e(113),e(114),e(126),e(128),e(138),e(139),e(141),e(144),e(147),e(149),e(151),e(152),e(153),e(154),e(156),e(157),e(159),e(160),e(162),e(166),e(167),e(168),e(169),e(174),e(175),e(177),e(178),e(179),e(181),e(184),e(185),e(186),e(187),e(188),e(193),e(195),e(196),e(198),e(201),e(202),e(203),e(204),e(205),e(207),e(214),e(216),e(219),e(221),e(222),e(223),e(224),e(225),e(229),e(230),e(232),e(233),e(234),e(236),e(237),e(238),e(95),e(239),e(240),e(248),e(250),e(251),e(252),e(254),e(255),e(257),e(258),e(260),e(261),e(262),e(264),e(265),e(266),e(267),e(268),e(269),e(270),e(271),e(275),e(276),e(278),e(280),e(281),e(282),e(283),e(284),e(286),e(288),e(289),e(290),e(291),e(293),e(294),e(296),e(297),e(298),e(299),e(301),e(302),e(303),e(304),e(305),e(306),e(307),e(308),e(310),e(311),e(312),e(313),e(314),e(315),e(316),e(317),e(318),e(319),e(320),e(322),e(323),e(324),e(325),e(348),e(349),e(350),e(351),e(352),e(353),e(354),e(355),e(357),e(358),e(359),e(360),e(361),e(362),e(363),e(364),e(365),e(366),e(373),e(374),e(376),e(377),e(378),e(379),e(380),e(382),e(383),e(385),e(388),e(389),e(390),e(391),e(392),e(396),e(397),e(399),e(400),e(401),e(402),e(404),e(405),e(406),e(407),e(408),e(409),e(410),e(412),e(415),e(418),e(421),e(422),e(423),e(424),e(425),e(426),e(427),e(428),e(429),e(430),e(431),e(432),e(433),e(441),e(442),e(443),e(444),e(445),e(446),e(447),e(448),e(449),e(450),e(451),e(452),e(453),e(456),e(457),e(458),e(459),e(460),e(461),e(462),e(463),e(464),e(465),e(466),e(467),e(468),e(469),e(470),e(471),e(472),e(473),e(474),e(475),e(476),e(477),e(478),e(479),e(480),e(481),e(482),e(483),e(486),e(488),e(489),e(497),e(498),e(499),e(501),e(502),e(505),e(506),e(507),e(508),e(509),e(513),e(516),e(519),e(520),e(522),e(523),e(527),e(528),e(530),e(531),e(532),e(533),e(535),e(536),e(538),e(539),e(540),e(541),e(542),e(543),e(544),e(546),e(548),e(549),e(550),e(552),e(553),e(554),e(555),e(556),e(557),e(561),e(562),e(563),e(564),e(565),e(566),e(568),e(569),e(570),e(571),e(572),e(573),e(574),e(575),e(576),e(577),e(578),e(581),e(583),e(584),e(586),e(587),e(588),e(589),e(590),e(591),e(593),e(594),e(596),e(597),e(598),e(599),e(600),e(601),e(603),e(604),e(605),e(606),e(608),e(609),e(610),e(611),e(612),e(614),e(615),e(616),e(617),e(618),e(619),e(620),e(621),e(622),e(623),e(624),e(625),e(627),e(628),e(629),e(630),e(635),e(636),e(637),e(639),e(640),e(641),e(642),e(643),e(644),e(645),e(646),e(647),e(650),e(651),e(658),e(661),e(662),e(663),e(664),e(665),e(667),e(668),e(670),e(671),e(673),e(674),e(676),e(677),e(678),e(679),e(680),e(681),e(682),e(684),e(685),e(687),e(688),e(689),e(691),e(692),e(694),e(695),e(696),e(698),e(699),e(701),e(702),e(703),e(704),e(705),e(706),e(707),e(708),e(709),e(710),e(711),e(712),e(713),e(714),e(717),e(718),e(719),e(720),e(721),e(724),e(725),e(726),e(727),e(729),e(730),e(733),e(734),e(737),e(738),e(739),e(744),e(745),e(746),e(747),e(750),e(755),e(756),e(757),e(758),e(759),t.exports=e(760)},function(t,r,e){e(2),e(92),e(94),e(95),e(99)},function(r,e,n){var o=n(3),i=n(4),a=n(8),u=n(14),c=n(36),f=n(6),s=n(27),l=n(7),h=n(39),p=n(25),g=n(47),v=n(12),d=n(18),y=n(69),m=n(11),b=n(72),x=n(74),w=n(58),S=n(76),A=n(67),E=n(5),O=n(45),I=n(73),R=n(10),M=n(48),T=n(79),k=n(35),P=n(54),j=n(55),C=n(41),N=n(34),D=n(80),_=n(81),U=n(83),L=n(84),B=n(52),z=n(85).forEach,W=P("hidden"),V="Symbol",H="prototype",q=B.set,G=B.getterFor(V),K=Object[H],J=i.Symbol,Y=J&&J[H],$=i.TypeError,X=i.QObject,Q=E.f,Z=O.f,tt=S.f,rt=R.f,et=u([].push),nt=k("symbols"),ot=k("op-symbols"),it=k("wks"),ut=!X||!X[H]||!X[H].findChild,ct=f&&l(function(){return 7!=b(Z({},"a",{get:function(){return Z(this,"a",{value:7}).a}})).a})?function(t,r,e){var n=Q(K,r);n&&delete K[r],Z(t,r,e),n&&t!==K&&Z(K,r,n)}:Z,wrap=function(t,r){var e=nt[t]=b(Y);return q(e,{type:V,tag:t,description:r}),f||(e.description=r),e},ft=function defineProperty(t,r,e){t===K&&ft(ot,r,e),g(t);var n=d(r);return g(e),h(nt,n)?(e.enumerable?(h(t,W)&&t[W][n]&&(t[W][n]=!1),e=b(e,{enumerable:m(0,!1)})):(h(t,W)||Z(t,W,m(1,{})),t[W][n]=!0),ct(t,n,e)):Z(t,n,e)},st=function defineProperties(t,r){var e,n;return g(t),e=v(r),n=x(e).concat($getOwnPropertySymbols(e)),z(n,function(r){f&&!a(lt,e,r)||ft(t,r,e[r])}),t},lt=function propertyIsEnumerable(t){var r=d(t),e=a(rt,this,r);return!(this===K&&h(nt,r)&&!h(ot,r))&&(!(e||!h(this,r)||!h(nt,r)||h(this,W)&&this[W][r])||e)},ht=function getOwnPropertyDescriptor(t,r){var e,n=v(t),o=d(r);if(n!==K||!h(nt,o)||h(ot,o))return!(e=Q(n,o))||!h(nt,o)||h(n,W)&&n[W][o]||(e.enumerable=!0),e},pt=function getOwnPropertyNames(t){var r=tt(v(t)),e=[];return z(r,function(t){h(nt,t)||h(j,t)||et(e,t)}),e},$getOwnPropertySymbols=function(t){var r=t===K,e=tt(r?ot:v(t)),n=[];return z(e,function(t){!h(nt,t)||r&&!h(K,t)||et(n,nt[t])}),n};s||(J=function Symbol(){var r,e,n;if(p(Y,this))throw $("Symbol is not a constructor");return r=arguments.length&&arguments[0]!==t?y(arguments[0]):t,e=C(r),n=function(t){this===K&&a(n,ot,t),h(this,W)&&h(this[W],e)&&(this[W][e]=!1),ct(this,e,m(1,t))},f&&ut&&ct(K,e,{configurable:!0,set:n}),wrap(e,r)},M(Y=J[H],"toString",function toString(){return G(this).tag}),M(J,"withoutSetter",function(t){return wrap(C(t),t)}),R.f=lt,O.f=ft,I.f=st,E.f=ht,w.f=S.f=pt,A.f=$getOwnPropertySymbols,D.f=function(t){return wrap(N(t),t)},f&&(T(Y,"description",{configurable:!0,get:function description(){return G(this).description}}),c||M(K,"propertyIsEnumerable",lt,{unsafe:!0}))),o({global:!0,constructor:!0,wrap:!0,forced:!s,sham:!s},{Symbol:J}),z(x(it),function(t){_(t)}),o({target:V,stat:!0,forced:!s},{useSetter:function(){ut=!0},useSimple:function(){ut=!1}}),o({target:"Object",stat:!0,forced:!s,sham:!f},{create:function create(r,e){return e===t?b(r):st(b(r),e)},defineProperty:ft,defineProperties:st,getOwnPropertyDescriptor:ht}),o({target:"Object",stat:!0,forced:!s},{getOwnPropertyNames:pt}),U(),L(J,V),j[W]=!0},function(r,e,n){var o=n(4),i=n(5).f,a=n(44),u=n(48),c=n(38),f=n(56),s=n(68);r.exports=function(r,e){var n,l,h,p,g,v=r.target,d=r.global,y=r.stat;if(n=d?o:y?o[v]||c(v,{}):(o[v]||{}).prototype)for(l in e){if(p=e[l],h=r.dontCallGetSet?(g=i(n,l))&&g.value:n[l],!s(d?l:v+(y?".":"#")+l,r.forced)&&h!==t){if(typeof p==typeof h)continue;f(p,h)}(r.sham||h&&h.sham)&&a(p,"sham",!0),u(n,l,p,r)}}},function(t,r){var check=function(t){return t&&t.Math==Math&&t};t.exports=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof global&&global)||function(){return this}()||this||Function("return this")()},function(t,r,e){var n=e(6),o=e(8),i=e(10),a=e(11),u=e(12),c=e(18),f=e(39),s=e(42),l=Object.getOwnPropertyDescriptor;r.f=n?l:function getOwnPropertyDescriptor(t,r){if(t=u(t),r=c(r),s)try{return l(t,r)}catch(e){}if(f(t,r))return a(!o(i.f,t,r),t[r])}},function(t,r,e){var n=e(7);t.exports=!n(function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})},function(t,r){t.exports=function(t){try{return!!t()}catch(r){return!0}}},function(t,r,e){var n=e(9),o=(function(){}).call;t.exports=n?o.bind(o):function(){return o.apply(o,arguments)}},function(t,r,e){var n=e(7);t.exports=!n(function(){var t=(function(){}).bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})},function(t,r,e){var n={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,i=o&&!n.call({1:2},1);r.f=i?function propertyIsEnumerable(t){var r=o(this,t);return!!r&&r.enumerable}:n},function(t,r){t.exports=function(t,r){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:r}}},function(t,r,e){var n=e(13),o=e(16);t.exports=function(t){return n(o(t))}},function(t,r,e){var n=e(14),o=e(7),i=e(15),a=Object,u=n("".split);t.exports=o(function(){return!a("z").propertyIsEnumerable(0)})?function(t){return"String"==i(t)?u(t,""):a(t)}:a},function(t,r,e){var n=e(9),o=Function.prototype,i=o.call,a=n&&o.bind.bind(i,i);t.exports=n?a:function(t){return function(){return i.apply(t,arguments)}}},function(t,r,e){var n=e(14),o=n({}.toString),i=n("".slice);t.exports=function(t){return i(o(t),8,-1)}},function(t,r,e){var n=e(17),o=TypeError;t.exports=function(t){if(n(t))throw o("Can't call method on "+t);return t}},function(r,e){r.exports=function(r){return null===r||r===t}},function(t,r,e){var n=e(19),o=e(23);t.exports=function(t){var r=n(t,"string");return o(r)?r:r+""}},function(r,e,n){var o=n(8),i=n(20),a=n(23),u=n(30),c=n(33),f=n(34),s=TypeError,l=f("toPrimitive");r.exports=function(r,e){var n,f;if(!i(r)||a(r))return r;if(n=u(r,l)){if(e===t&&(e="default"),f=o(n,r,e),!i(f)||a(f))return f;throw s("Can't convert object to primitive value")}return e===t&&(e="number"),c(r,e)}},function(t,r,e){var n=e(21),o=e(22),i=o.all;t.exports=o.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:n(t)||t===i}:function(t){return"object"==typeof t?null!==t:n(t)}},function(t,r,e){var n=e(22),o=n.all;t.exports=n.IS_HTMLDDA?function(t){return"function"==typeof t||t===o}:function(t){return"function"==typeof t}},function(r,e){var n="object"==typeof document&&document.all;r.exports={all:n,IS_HTMLDDA:"undefined"==typeof n&&n!==t}},function(t,r,e){var n=e(24),o=e(21),i=e(25),a=e(26),u=Object;t.exports=a?function(t){return"symbol"==typeof t}:function(t){var r=n("Symbol");return o(r)&&i(r.prototype,u(t))}},function(r,e,n){var o=n(4),i=n(21);r.exports=function(r,e){return arguments.length<2?i(n=o[r])?n:t:o[r]&&o[r][e];var n}},function(t,r,e){var n=e(14);t.exports=n({}.isPrototypeOf)},function(t,r,e){var n=e(27);t.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(t,r,e){var n=e(28),o=e(7),i=e(4).String;t.exports=!!Object.getOwnPropertySymbols&&!o(function(){var t=Symbol();return!i(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&n&&n<41})},function(t,r,e){var n,o,i=e(4),a=e(29),u=i.process,c=i.Deno,f=u&&u.versions||c&&c.version,s=f&&f.v8;s&&(o=(n=s.split("."))[0]>0&&n[0]<4?1:+(n[0]+n[1])),!o&&a&&(!(n=a.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=a.match(/Chrome\/(\d+)/))&&(o=+n[1]),t.exports=o},function(t,r){t.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},function(r,e,n){var o=n(31),i=n(17);r.exports=function(r,e){var n=r[e];return i(n)?t:o(n)}},function(t,r,e){var n=e(21),o=e(32),i=TypeError;t.exports=function(t){if(n(t))return t;throw i(o(t)+" is not a function")}},function(t,r){var e=String;t.exports=function(t){try{return e(t)}catch(r){return"Object"}}},function(t,r,e){var n=e(8),o=e(21),i=e(20),a=TypeError;t.exports=function(t,r){var e,u;if("string"===r&&o(e=t.toString)&&!i(u=n(e,t)))return u;if(o(e=t.valueOf)&&!i(u=n(e,t)))return u;if("string"!==r&&o(e=t.toString)&&!i(u=n(e,t)))return u;throw a("Can't convert object to primitive value")}},function(t,r,e){var n=e(4),o=e(35),i=e(39),a=e(41),u=e(27),c=e(26),f=n.Symbol,s=o("wks"),l=c?f["for"]||f:f&&f.withoutSetter||a;t.exports=function(t){return i(s,t)||(s[t]=u&&i(f,t)?f[t]:l("Symbol."+t)),s[t]}},function(r,e,n){var o=n(36),i=n(37);(r.exports=function(r,e){return i[r]||(i[r]=e!==t?e:{})})("versions",[]).push({version:"3.31.1",mode:o?"pure":"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE",source:"https://github.com/zloirock/core-js"})},function(t,r){t.exports=!1},function(t,r,e){var n=e(4),o=e(38),i="__core-js_shared__",a=n[i]||o(i,{});t.exports=a},function(t,r,e){var n=e(4),o=Object.defineProperty;t.exports=function(t,r){try{o(n,t,{value:r,configurable:!0,writable:!0})}catch(e){n[t]=r}return r}},function(t,r,e){var n=e(14),o=e(40),i=n({}.hasOwnProperty);t.exports=Object.hasOwn||function hasOwn(t,r){return i(o(t),r)}},function(t,r,e){var n=e(16),o=Object;t.exports=function(t){return o(n(t))}},function(r,e,n){var o=n(14),i=0,a=Math.random(),u=o(1..toString);r.exports=function(r){return"Symbol("+(r===t?"":r)+")_"+u(++i+a,36)}},function(t,r,e){var n=e(6),o=e(7),i=e(43);t.exports=!n&&!o(function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a})},function(t,r,e){var n=e(4),o=e(20),i=n.document,a=o(i)&&o(i.createElement);t.exports=function(t){return a?i.createElement(t):{}}},function(t,r,e){var n=e(6),o=e(45),i=e(11);t.exports=n?function(t,r,e){return o.f(t,r,i(1,e))}:function(t,r,e){return t[r]=e,t}},function(t,r,e){var n=e(6),o=e(42),i=e(46),a=e(47),u=e(18),c=TypeError,f=Object.defineProperty,s=Object.getOwnPropertyDescriptor,l="enumerable",h="configurable",p="writable";r.f=n?i?function defineProperty(t,r,e){if(a(t),r=u(r),a(e),"function"==typeof t&&"prototype"===r&&"value"in e&&p in e&&!e[p]){var n=s(t,r);n&&n[p]&&(t[r]=e.value,e={configurable:h in e?e[h]:n[h],enumerable:l in e?e[l]:n[l],writable:!1})}return f(t,r,e)}:f:function defineProperty(t,r,e){if(a(t),r=u(r),a(e),o)try{return f(t,r,e)}catch(n){}if("get"in e||"set"in e)throw c("Accessors not supported");return"value"in e&&(t[r]=e.value),t}},function(t,r,e){var n=e(6),o=e(7);t.exports=n&&o(function(){return 42!=Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})},function(t,r,e){var n=e(20),o=String,i=TypeError;t.exports=function(t){if(n(t))return t;throw i(o(t)+" is not an object")}},function(r,e,n){var o=n(21),i=n(45),a=n(49),u=n(38);r.exports=function(r,e,n,c){var f,s;if(c||(c={}),f=c.enumerable,s=c.name!==t?c.name:e,o(n)&&a(n,s,c),c.global)f?r[e]=n:u(e,n);else{try{c.unsafe?r[e]&&(f=!0):delete r[e]}catch(l){}f?r[e]=n:i.f(r,e,{value:n,enumerable:!1,configurable:!c.nonConfigurable,writable:!c.nonWritable})}return r}},function(r,e,n){var o=n(14),i=n(7),a=n(21),u=n(39),c=n(6),f=n(50).CONFIGURABLE,s=n(51),l=n(52),h=l.enforce,p=l.get,g=String,v=Object.defineProperty,d=o("".slice),y=o("".replace),m=o([].join),b=c&&!i(function(){return 8!==v(function(){},"length",{value:8}).length}),x=String(String).split("String"),w=r.exports=function(r,e,n){"Symbol("===d(g(e),0,7)&&(e="["+y(g(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!u(r,"name")||f&&r.name!==e)&&(c?v(r,"name",{value:e,configurable:!0}):r.name=e),b&&n&&u(n,"arity")&&r.length!==n.arity&&v(r,"length",{value:n.arity});try{n&&u(n,"constructor")&&n.constructor?c&&v(r,"prototype",{writable:!1}):r.prototype&&(r.prototype=t)}catch(i){}var o=h(r);return u(o,"source")||(o.source=m(x,"string"==typeof e?e:"")),r};Function.prototype.toString=w(function toString(){return a(this)&&p(this).source||s(this)},"toString")},function(t,r,e){var n=e(6),o=e(39),i=Function.prototype,a=n&&Object.getOwnPropertyDescriptor,u=o(i,"name"),c=u&&"something"===(function something(){}).name,f=u&&(!n||n&&a(i,"name").configurable);t.exports={EXISTS:u,PROPER:c,CONFIGURABLE:f}},function(t,r,e){var n=e(14),o=e(21),i=e(37),a=n(Function.toString);o(i.inspectSource)||(i.inspectSource=function(t){return a(t)}),t.exports=i.inspectSource},function(t,r,e){var n,o,i,a,u,c=e(53),f=e(4),s=e(20),l=e(44),h=e(39),p=e(37),g=e(54),v=e(55),d="Object already initialized",y=f.TypeError;c||p.state?((a=p.state||(p.state=new(0,f.WeakMap))).get=a.get,a.has=a.has,a.set=a.set,n=function(t,r){if(a.has(t))throw y(d);return r.facade=t,a.set(t,r),r},o=function(t){return a.get(t)||{}},i=function(t){return a.has(t)}):(v[u=g("state")]=!0,n=function(t,r){if(h(t,u))throw y(d);return r.facade=t,l(t,u,r),r},o=function(t){return h(t,u)?t[u]:{}},i=function(t){return h(t,u)}),t.exports={set:n,get:o,has:i,enforce:function(t){return i(t)?o(t):n(t,{})},getterFor:function(t){return function(r){var e;if(!s(r)||(e=o(r)).type!==t)throw y("Incompatible receiver, "+t+" required");return e}}}},function(t,r,e){var n=e(4),o=e(21),i=n.WeakMap;t.exports=o(i)&&/native code/.test(String(i))},function(t,r,e){var n=e(35),o=e(41),i=n("keys");t.exports=function(t){return i[t]||(i[t]=o(t))}},function(t,r){t.exports={}},function(t,r,e){var n=e(39),o=e(57),i=e(5),a=e(45);t.exports=function(t,r,e){var u,c,f=o(r),s=a.f,l=i.f;for(u=0;uf;)o(n,e=r[f++])&&(~a(s,e)||c(s,e));return s}},function(t,r,e){var n=e(12),o=e(61),i=e(64),createMethod=function(t){return function(r,e,a){var u,c=n(r),f=i(c),s=o(a,f);if(t&&e!=e){for(;f>s;)if((u=c[s++])!=u)return!0}else for(;f>s;s++)if((t||s in c)&&c[s]===e)return t||s||0;return!t&&-1}};t.exports={includes:createMethod(!0),indexOf:createMethod(!1)}},function(t,r,e){var n=e(62),o=Math.max,i=Math.min;t.exports=function(t,r){var e=n(t);return e<0?o(e+r,0):i(e,r)}},function(t,r,e){var n=e(63);t.exports=function(t){var r=+t;return r!=r||0===r?0:n(r)}},function(t,r){var e=Math.ceil,n=Math.floor;t.exports=Math.trunc||function trunc(t){var r=+t;return(r>0?n:e)(r)}},function(t,r,e){var n=e(65);t.exports=function(t){return n(t.length)}},function(t,r,e){var n=e(62),o=Math.min;t.exports=function(t){return t>0?o(n(t),9007199254740991):0}},function(t,r){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(t,r){r.f=Object.getOwnPropertySymbols},function(t,r,e){var n=e(7),o=e(21),i=/#|\.prototype\./,isForced=function(t,r){var e=u[a(t)];return e==f||e!=c&&(o(r)?n(r):!!r)},a=isForced.normalize=function(t){return String(t).replace(i,".").toLowerCase()},u=isForced.data={},c=isForced.NATIVE="N",f=isForced.POLYFILL="P";t.exports=isForced},function(t,r,e){var n=e(70),o=String;t.exports=function(t){if("Symbol"===n(t))throw TypeError("Cannot convert a Symbol value to a string");return o(t)}},function(r,e,n){var o=n(71),i=n(21),a=n(15),u=n(34)("toStringTag"),c=Object,f="Arguments"==a(function(){return arguments}());r.exports=o?a:function(r){var e,n,o;return r===t?"Undefined":null===r?"Null":"string"==typeof(n=function(t,r){try{return t[r]}catch(e){}}(e=c(r),u))?n:f?a(e):"Object"==(o=a(e))&&i(e.callee)?"Arguments":o}},function(t,r,e){var n={};n[e(34)("toStringTag")]="z",t.exports="[object z]"===String(n)},function(r,e,n){var o,i=n(47),a=n(73),u=n(66),c=n(55),f=n(75),s=n(43),l=n(54),h="prototype",p="script",g=l("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(t){return"<"+p+">"+t+""},NullProtoObjectViaActiveX=function(t){t.write(scriptTag("")),t.close();var r=t.parentWindow.Object;return t=null,r},NullProtoObject=function(){try{o=new ActiveXObject("htmlfile")}catch(i){}var t,r,e;NullProtoObject="undefined"!=typeof document?document.domain&&o?NullProtoObjectViaActiveX(o):(r=s("iframe"),e="java"+p+":",r.style.display="none",f.appendChild(r),r.src=String(e),(t=r.contentWindow.document).open(),t.write(scriptTag("document.F=Object")),t.close(),t.F):NullProtoObjectViaActiveX(o);for(var n=u.length;n--;)delete NullProtoObject[h][u[n]];return NullProtoObject()};c[g]=!0,r.exports=Object.create||function create(r,e){var n;return null!==r?(EmptyConstructor[h]=i(r),n=new EmptyConstructor,EmptyConstructor[h]=null,n[g]=r):n=NullProtoObject(),e===t?n:a.f(n,e)}},function(t,r,e){var n=e(6),o=e(46),i=e(45),a=e(47),u=e(12),c=e(74);r.f=n&&!o?Object.defineProperties:function defineProperties(t,r){var e,n,o,f,s;for(a(t),e=u(r),o=(n=c(r)).length,f=0;o>f;)i.f(t,s=n[f++],e[s]);return t}},function(t,r,e){var n=e(59),o=e(66);t.exports=Object.keys||function keys(t){return n(t,o)}},function(t,r,e){var n=e(24);t.exports=n("document","documentElement")},function(t,r,e){var n=e(15),o=e(12),i=e(58).f,a=e(77),u="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function getOwnPropertyNames(t){return u&&"Window"==n(t)?function(t){try{return i(t)}catch(r){return a(u)}}(t):i(o(t))}},function(r,e,n){var o=n(61),i=n(64),a=n(78),u=Array,c=Math.max;r.exports=function(r,e,n){var f,s=i(r),l=o(e,s),h=o(n===t?s:n,s),p=u(c(h-l,0));for(f=0;lO;O++)if((g||O in S)&&(x=A(b=S[O],O,w),r))if(e)R[O]=x;else if(x)switch(r){case 3:return!0;case 5:return b;case 6:return O;case 2:s(R,b)}else switch(r){case 4:return!1;case 7:s(R,b)}return h?-1:i||l?l:R}};r.exports={forEach:createMethod(0),map:createMethod(1),filter:createMethod(2),some:createMethod(3),every:createMethod(4),find:createMethod(5),findIndex:createMethod(6),filterReject:createMethod(7)}},function(r,e,n){var o=n(87),i=n(31),a=n(9),u=o(o.bind);r.exports=function(r,e){return i(r),e===t?r:a?u(r,e):function(){return r.apply(e,arguments)}}},function(t,r,e){var n=e(15),o=e(14);t.exports=function(t){if("Function"===n(t))return o(t)}},function(t,r,e){var n=e(89);t.exports=function(t,r){return new(n(t))(0===r?0:r)}},function(r,e,n){var o=n(90),i=n(91),a=n(20),u=n(34)("species"),c=Array;r.exports=function(r){var e;return o(r)&&(i(e=r.constructor)&&(e===c||o(e.prototype))||a(e)&&null===(e=e[u]))&&(e=t),e===t?c:e}},function(t,r,e){var n=e(15);t.exports=Array.isArray||function isArray(t){return"Array"==n(t)}},function(t,r,e){var n=e(14),o=e(7),i=e(21),a=e(70),u=e(24),c=e(51),noop=function(){},f=[],s=u("Reflect","construct"),l=/^\s*(?:class|function)\b/,h=n(l.exec),p=!l.exec(noop),g=function isConstructor(t){if(!i(t))return!1;try{return s(noop,f,t),!0}catch(r){return!1}},v=function isConstructor(t){if(!i(t))return!1;switch(a(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return p||!!h(l,c(t))}catch(r){return!0}};v.sham=!0,t.exports=!s||o(function(){var t;return g(g.call)||!g(Object)||!g(function(){t=!0})||t})?v:g},function(t,r,e){var n=e(3),o=e(24),i=e(39),a=e(69),u=e(35),c=e(93),f=u("string-to-symbol-registry"),s=u("symbol-to-string-registry");n({target:"Symbol",stat:!0,forced:!c},{"for":function(t){var r,e=a(t);return i(f,e)?f[e]:(r=o("Symbol")(e),f[e]=r,s[r]=e,r)}})},function(t,r,e){var n=e(27);t.exports=n&&!!Symbol["for"]&&!!Symbol.keyFor},function(t,r,e){var n=e(3),o=e(39),i=e(23),a=e(32),u=e(35),c=e(93),f=u("symbol-to-string-registry");n({target:"Symbol",stat:!0,forced:!c},{keyFor:function keyFor(t){if(!i(t))throw TypeError(a(t)+" is not a symbol");if(o(f,t))return f[t]}})},function(r,e,n){var o=n(3),i=n(24),a=n(96),u=n(8),c=n(14),f=n(7),s=n(21),l=n(23),h=n(97),p=n(98),g=n(27),v=String,d=i("JSON","stringify"),y=c(/./.exec),m=c("".charAt),b=c("".charCodeAt),x=c("".replace),w=c(1..toString),S=/[\uD800-\uDFFF]/g,A=/^[\uD800-\uDBFF]$/,E=/^[\uDC00-\uDFFF]$/,O=!g||f(function(){var t=i("Symbol")();return"[null]"!=d([t])||"{}"!=d({a:t})||"{}"!=d(Object(t))}),I=f(function(){return'"\\udf06\\ud834"'!==d("\udf06\ud834")||'"\\udead"'!==d("\udead")}),stringifyWithSymbolsFix=function(r,e){var n=h(arguments),o=p(e);if(s(o)||r!==t&&!l(r))return n[1]=function(t,r){if(s(o)&&(r=u(o,this,v(t),r)),!l(r))return r},a(d,null,n)},fixIllFormed=function(t,r,e){var n=m(e,r-1),o=m(e,r+1);return y(A,t)&&!y(E,o)||y(E,t)&&!y(A,n)?"\\u"+w(b(t,0),16):t};d&&o({target:"JSON",stat:!0,arity:3,forced:O||I},{stringify:function stringify(t,r,e){var n=h(arguments),o=a(O?stringifyWithSymbolsFix:d,null,n);return I&&"string"==typeof o?x(o,S,fixIllFormed):o}})},function(t,r,e){var n=e(9),o=Function.prototype,i=o.apply,a=o.call;t.exports="object"==typeof Reflect&&Reflect.apply||(n?a.bind(i):function(){return a.apply(i,arguments)})},function(t,r,e){var n=e(14);t.exports=n([].slice)},function(t,r,e){var n=e(14),o=e(90),i=e(21),a=e(15),u=e(69),c=n([].push);t.exports=function(t){var r,e,n,f,s,l;if(i(t))return t;if(o(t)){for(r=t.length,e=[],n=0;nS&&p(o,arguments[S]),o}),x.prototype=m,"Error"!==E?c?c(x,b):f(x,b,{name:!0}):v&&w in O&&(s(x,O,w),s(x,O,"prepareStackTrace")),f(x,O),!d)try{m.name!==E&&a(m,"name",E),m.constructor=x}catch(I){}return x}}},function(r,e,n){var o=n(117),i=n(47),a=n(118);r.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,r=!1,e={};try{(t=o(Object.prototype,"__proto__","set"))(e,[]),r=e instanceof Array}catch(n){}return function setPrototypeOf(e,n){return i(e),a(n),r?t(e,n):e.__proto__=n,e}}():t)},function(t,r,e){var n=e(14),o=e(31);t.exports=function(t,r,e){try{return n(o(Object.getOwnPropertyDescriptor(t,r)[e]))}catch(i){}}},function(t,r,e){var n=e(21),o=String,i=TypeError;t.exports=function(t){if("object"==typeof t||n(t))return t;throw i("Can't set "+o(t)+" as a prototype")}},function(t,r,e){var n=e(45).f;t.exports=function(t,r,e){e in t||n(t,e,{configurable:!0,get:function(){return r[e]},set:function(t){r[e]=t}})}},function(t,r,e){var n=e(21),o=e(20),i=e(116);t.exports=function(t,r,e){var a,u;return i&&n(a=r.constructor)&&a!==e&&o(u=a.prototype)&&u!==e.prototype&&i(t,u),t}},function(r,e,n){var o=n(69);r.exports=function(r,e){return r===t?arguments.length<2?"":e:o(r)}},function(t,r,e){var n=e(20),o=e(44);t.exports=function(t,r){n(r)&&"cause"in r&&o(t,"cause",r.cause)}},function(t,r,e){var n=e(44),o=e(124),i=e(125),a=Error.captureStackTrace;t.exports=function(t,r,e,u){i&&(a?a(t,r):n(t,"stack",o(e,u)))}},function(t,r,e){var n=e(14),o=Error,i=n("".replace),a=String(o("zxcasd").stack),u=/\n\s*at [^:]*:[^\n]*/,c=u.test(a);t.exports=function(t,r){if(c&&"string"==typeof t&&!o.prepareStackTrace)for(;r--;)t=i(t,u,"");return t}},function(t,r,e){var n=e(7),o=e(11);t.exports=!n(function(){var t=Error("a");return!("stack"in t)||(Object.defineProperty(t,"stack",o(1,7)),7!==t.stack)})},function(t,r,e){var n=e(48),o=e(127),i=Error.prototype;i.toString!==o&&n(i,"toString",o)},function(t,r,e){var n=e(6),o=e(7),i=e(47),a=e(72),u=e(121),c=Error.prototype.toString,f=o(function(){if(n){var t=a(Object.defineProperty({},"name",{get:function(){return this===t}}));if("true"!==c.call(t))return!0}return"2: 1"!==c.call({message:1,name:2})||"Error"!==c.call({})});t.exports=f?function toString(){var t=i(this),r=u(t.name,"Error"),e=u(t.message);return r?e?r+": "+e:r:e}:c},function(t,r,e){e(129)},function(r,e,n){var o,i=n(3),a=n(25),u=n(130),c=n(116),f=n(56),s=n(72),l=n(44),h=n(11),p=n(122),g=n(123),v=n(132),d=n(121),y=n(34)("toStringTag"),m=Error,b=[].push,x=function AggregateError(r,e){var n,i,f=a(o,this);return c?n=c(m(),f?u(this):o):(n=f?this:s(o),l(n,y,"Error")),e!==t&&l(n,"message",d(e)),g(n,x,n.stack,1),arguments.length>2&&p(n,arguments[2]),v(r,b,{that:i=[]}),l(n,"errors",i),n};c?c(x,m):f(x,m,{name:!0}),o=x.prototype=s(m.prototype,{constructor:h(1,x),message:h(1,""),name:h(1,"AggregateError")}),i({global:!0,constructor:!0,arity:2},{AggregateError:x})},function(t,r,e){var n=e(39),o=e(21),i=e(40),a=e(54),u=e(131),c=a("IE_PROTO"),f=Object,s=f.prototype;t.exports=u?f.getPrototypeOf:function(t){var r,e=i(t);return n(e,c)?e[c]:o(r=e.constructor)&&e instanceof r?r.prototype:e instanceof f?s:null}},function(t,r,e){var n=e(7);t.exports=!n(function(){function F(){}return F.prototype.constructor=null,Object.getPrototypeOf(new F)!==F.prototype})},function(t,r,e){var n=e(86),o=e(8),i=e(47),a=e(32),u=e(133),c=e(64),f=e(25),s=e(135),l=e(136),h=e(137),p=TypeError,Result=function(t,r){this.stopped=t,this.result=r},g=Result.prototype;t.exports=function(t,r,e){ +var v,d,y,m,b,x,w,S=!(!e||!e.AS_ENTRIES),A=!(!e||!e.IS_RECORD),E=!(!e||!e.IS_ITERATOR),O=!(!e||!e.INTERRUPTED),I=n(r,e&&e.that),stop=function(t){return v&&h(v,"normal",t),new Result(!0,t)},callFn=function(t){return S?(i(t),O?I(t[0],t[1],stop):I(t[0],t[1])):O?I(t,stop):I(t)};if(A)v=t.iterator;else if(E)v=t;else{if(!(d=l(t)))throw p(a(t)+" is not iterable");if(u(d)){for(y=0,m=c(t);m>y;y++)if((b=callFn(t[y]))&&f(g,b))return b;return new Result(!1)}v=s(t,d)}for(x=A?t.next:v.next;!(w=o(x,v)).done;){try{b=callFn(w.value)}catch(R){h(v,"throw",R)}if("object"==typeof b&&b&&f(g,b))return b}return new Result(!1)}},function(r,e,n){var o=n(34),i=n(134),a=o("iterator"),u=Array.prototype;r.exports=function(r){return r!==t&&(i.Array===r||u[a]===r)}},function(t,r){t.exports={}},function(t,r,e){var n=e(8),o=e(31),i=e(47),a=e(32),u=e(136),c=TypeError;t.exports=function(t,r){var e=arguments.length<2?u(t):r;if(o(e))return i(n(e,t));throw c(a(t)+" is not iterable")}},function(t,r,e){var n=e(70),o=e(30),i=e(17),a=e(134),u=e(34)("iterator");t.exports=function(t){if(!i(t))return o(t,u)||o(t,"@@iterator")||a[n(t)]}},function(t,r,e){var n=e(8),o=e(47),i=e(30);t.exports=function(t,r,e){var a,u;o(t);try{if(!(a=i(t,"return"))){if("throw"===r)throw e;return e}a=n(a,t)}catch(c){u=!0,a=c}if("throw"===r)throw e;if(u)throw a;return o(a),e}},function(t,r,e){var n=e(3),o=e(24),i=e(96),a=e(7),u=e(115),c="AggregateError",f=o(c),s=!a(function(){return 1!==f([1]).errors[0]})&&a(function(){return 7!==f([1],c,{cause:7}).cause});n({global:!0,constructor:!0,arity:2,forced:s},{AggregateError:u(c,function(t){return function AggregateError(r,e){return i(t,this,arguments)}},s,!0)})},function(r,e,n){var o=n(3),i=n(40),a=n(64),u=n(62),c=n(140);o({target:"Array",proto:!0},{at:function at(r){var e=i(this),n=a(e),o=u(r),c=o>=0?o:n+o;return c<0||c>=n?t:e[c]}}),c("at")},function(r,e,n){var o=n(34),i=n(72),a=n(45).f,u=o("unscopables"),c=Array.prototype;c[u]==t&&a(c,u,{configurable:!0,value:i(null)}),r.exports=function(t){c[u][t]=!0}},function(r,e,n){var o=n(3),i=n(7),a=n(90),u=n(20),c=n(40),f=n(64),s=n(142),l=n(78),h=n(88),p=n(143),g=n(34),v=n(28),d=g("isConcatSpreadable"),y=v>=51||!i(function(){var t=[];return t[d]=!1,t.concat()[0]!==t}),isConcatSpreadable=function(r){if(!u(r))return!1;var e=r[d];return e!==t?!!e:a(r)};o({target:"Array",proto:!0,arity:1,forced:!y||!p("concat")},{concat:function concat(t){var r,e,n,o,i,a=c(this),u=h(a,0),p=0;for(r=-1,n=arguments.length;r9007199254740991)throw e("Maximum allowed index exceeded");return t}},function(t,r,e){var n=e(7),o=e(34),i=e(28),a=o("species");t.exports=function(t){return i>=51||!n(function(){var r=[];return(r.constructor={})[a]=function(){return{foo:1}},1!==r[t](Boolean).foo})}},function(t,r,e){var n=e(3),o=e(145),i=e(140);n({target:"Array",proto:!0},{copyWithin:o}),i("copyWithin")},function(r,e,n){var o=n(40),i=n(61),a=n(64),u=n(146),c=Math.min;r.exports=[].copyWithin||function copyWithin(r,e){var n=o(this),f=a(n),s=i(r,f),l=i(e,f),h=arguments.length>2?arguments[2]:t,p=c((h===t?f:i(h,f))-l,f-s),g=1;for(l0;)l in n?n[s]=n[l]:u(n,s),s+=g,l+=g;return n}},function(t,r,e){var n=e(32),o=TypeError;t.exports=function(t,r){if(!delete t[r])throw o("Cannot delete property "+n(r)+" of "+n(t))}},function(r,e,n){var o=n(3),i=n(85).every;o({target:"Array",proto:!0,forced:!n(148)("every")},{every:function every(r){return i(this,r,arguments.length>1?arguments[1]:t)}})},function(t,r,e){var n=e(7);t.exports=function(t,r){var e=[][t];return!!e&&n(function(){e.call(null,r||function(){return 1},1)})}},function(t,r,e){var n=e(3),o=e(150),i=e(140);n({target:"Array",proto:!0},{fill:o}),i("fill")},function(r,e,n){var o=n(40),i=n(61),a=n(64);r.exports=function fill(r){for(var e=o(this),n=a(e),u=arguments.length,c=i(u>1?arguments[1]:t,n),f=u>2?arguments[2]:t,s=f===t?n:i(f,n);s>c;)e[c++]=r;return e}},function(r,e,n){var o=n(3),i=n(85).filter;o({target:"Array",proto:!0,forced:!n(143)("filter")},{filter:function filter(r){return i(this,r,arguments.length>1?arguments[1]:t)}})},function(r,e,n){var o=n(3),i=n(85).find,a=n(140),u="find",c=!0;u in[]&&Array(1)[u](function(){c=!1}),o({target:"Array",proto:!0,forced:c},{find:function find(r){return i(this,r,arguments.length>1?arguments[1]:t)}}),a(u)},function(r,e,n){var o=n(3),i=n(85).findIndex,a=n(140),u="findIndex",c=!0;u in[]&&Array(1)[u](function(){c=!1}),o({target:"Array",proto:!0,forced:c},{findIndex:function findIndex(r){return i(this,r,arguments.length>1?arguments[1]:t)}}),a(u)},function(r,e,n){var o=n(3),i=n(155).findLast,a=n(140);o({target:"Array",proto:!0},{findLast:function findLast(r){return i(this,r,arguments.length>1?arguments[1]:t)}}),a("findLast")},function(r,e,n){var o=n(86),i=n(13),a=n(40),u=n(64),createMethod=function(r){var e=1==r;return function(n,c,f){for(var s,l=a(n),h=i(l),p=o(c,f),g=u(h);g-- >0;)if(p(s=h[g],g,l))switch(r){case 0:return s;case 1:return g}return e?-1:t}};r.exports={findLast:createMethod(0),findLastIndex:createMethod(1)}},function(r,e,n){var o=n(3),i=n(155).findLastIndex,a=n(140);o({target:"Array",proto:!0},{findLastIndex:function findLastIndex(r){return i(this,r,arguments.length>1?arguments[1]:t)}}),a("findLastIndex")},function(r,e,n){var o=n(3),i=n(158),a=n(40),u=n(64),c=n(62),f=n(88);o({target:"Array",proto:!0},{flat:function flat(){var r=arguments.length?arguments[0]:t,e=a(this),n=u(e),o=f(e,0);return o.length=i(o,e,e,n,0,r===t?1:c(r)),o}})},function(t,r,e){var n=e(90),o=e(64),i=e(142),a=e(86),flattenIntoArray=function(t,r,e,u,c,f,s,l){for(var h,p,g=c,v=0,d=!!s&&a(s,l);v0&&n(h)?(p=o(h),g=flattenIntoArray(t,r,h,p,g,f-1)-1):(i(g+1),t[g]=h),g++),v++;return g};t.exports=flattenIntoArray},function(r,e,n){var o=n(3),i=n(158),a=n(31),u=n(40),c=n(64),f=n(88);o({target:"Array",proto:!0},{flatMap:function flatMap(r){var e,n=u(this),o=c(n);return a(r),(e=f(n,0)).length=i(e,n,n,o,0,1,r,arguments.length>1?arguments[1]:t),e}})},function(t,r,e){var n=e(3),o=e(161);n({target:"Array",proto:!0,forced:[].forEach!=o},{forEach:o})},function(r,e,n){var o=n(85).forEach,i=n(148)("forEach");r.exports=i?[].forEach:function forEach(r){return o(this,r,arguments.length>1?arguments[1]:t)}},function(t,r,e){var n=e(3),o=e(163);n({target:"Array",stat:!0,forced:!e(165)(function(t){Array.from(t)})},{from:o})},function(r,e,n){var o=n(86),i=n(8),a=n(40),u=n(164),c=n(133),f=n(91),s=n(64),l=n(78),h=n(135),p=n(136),g=Array;r.exports=function from(r){var e,n,v,d,y,m,b,x,w=a(r),S=f(this),A=arguments.length,E=A>1?arguments[1]:t,O=E!==t;if(O&&(E=o(E,A>2?arguments[2]:t)),n=0,!(e=p(w))||this===g&&c(e))for(v=s(w),d=S?new this(v):g(v);v>n;n++)x=O?E(w[n],n):w[n],l(d,n,x);else for(b=(m=h(w,e)).next,d=S?new this:[];!(y=i(b,m)).done;n++)x=O?u(m,E,[y.value,n],!0):y.value,l(d,n,x);return d.length=n,d}},function(t,r,e){var n=e(47),o=e(137);t.exports=function(t,r,e,i){try{return i?r(n(e)[0],e[1]):r(e)}catch(a){o(t,"throw",a)}}},function(t,r,e){var n,o,i=e(34)("iterator"),a=!1;try{n=0,(o={next:function(){return{done:!!n++}},"return":function(){a=!0}})[i]=function(){return this},Array.from(o,function(){throw 2})}catch(u){}t.exports=function(t,r){var e,n;if(!r&&!a)return!1;e=!1;try{(n={})[i]=function(){return{next:function(){return{done:e=!0}}}},t(n)}catch(u){}return e}},function(r,e,n){var o=n(3),i=n(60).includes,a=n(7),u=n(140);o({target:"Array",proto:!0,forced:a(function(){return!Array(1).includes()})},{includes:function includes(r){return i(this,r,arguments.length>1?arguments[1]:t)}}),u("includes")},function(r,e,n){var o=n(3),i=n(87),a=n(60).indexOf,u=n(148),c=i([].indexOf),f=!!c&&1/c([1],1,-0)<0;o({target:"Array",proto:!0,forced:f||!u("indexOf")},{indexOf:function indexOf(r){var e=arguments.length>1?arguments[1]:t;return f?c(this,r,e)||0:a(this,r,e)}})},function(t,r,e){e(3)({target:"Array",stat:!0},{isArray:e(90)})},function(r,e,n){var o,i=n(12),a=n(140),u=n(134),c=n(52),f=n(45).f,s=n(170),l=n(173),h=n(36),p=n(6),g="Array Iterator",v=c.set,d=c.getterFor(g);if(r.exports=s(Array,"Array",function(t,r){v(this,{type:g,target:i(t),index:0,kind:r})},function(){var r=d(this),e=r.target,n=r.kind,o=r.index++;return!e||o>=e.length?(r.target=t,l(t,!0)):l("keys"==n?o:"values"==n?e[o]:[o,e[o]],!1)},"values"),o=u.Arguments=u.Array,a("keys"),a("values"),a("entries"),!h&&p&&"values"!==o.name)try{f(o,"name",{value:"values"})}catch(y){}},function(t,r,e){var n=e(3),o=e(8),i=e(36),a=e(50),u=e(21),c=e(171),f=e(130),s=e(116),l=e(84),h=e(44),p=e(48),g=e(34),v=e(134),d=e(172),y=a.PROPER,m=a.CONFIGURABLE,b=d.IteratorPrototype,x=d.BUGGY_SAFARI_ITERATORS,w=g("iterator"),S="keys",A="values",E="entries",returnThis=function(){return this};t.exports=function(t,r,e,a,g,d,O){var I,R,M,T,k,P,j,C,N,D;if(c(e,r,a),I=function(t){if(t===g&&P)return P;if(!x&&t in T)return T[t];switch(t){case S:return function keys(){return new e(this,t)};case A:return function values(){return new e(this,t)};case E:return function entries(){return new e(this,t)}}return function(){return new e(this)}},R=r+" Iterator",M=!1,k=(T=t.prototype)[w]||T["@@iterator"]||g&&T[g],P=!x&&k||I(g),(j="Array"==r&&T.entries||k)&&(C=f(j.call(new t)))!==Object.prototype&&C.next&&(i||f(C)===b||(s?s(C,b):u(C[w])||p(C,w,returnThis)),l(C,R,!0,!0),i&&(v[R]=returnThis)),y&&g==A&&k&&k.name!==A&&(!i&&m?h(T,"name",A):(M=!0,P=function values(){return o(k,this)})),g)if(N={values:I(A),keys:d?P:I(S),entries:I(E)},O)for(D in N)(x||M||!(D in T))&&p(T,D,N[D]);else n({target:r,proto:!0,forced:x||M},N);return i&&!O||T[w]===P||p(T,w,P,{name:g}),v[r]=P,N}},function(t,r,e){var n=e(172).IteratorPrototype,o=e(72),i=e(11),a=e(84),u=e(134),returnThis=function(){return this};t.exports=function(t,r,e,c){var f=r+" Iterator";return t.prototype=o(n,{next:i(+!c,e)}),a(t,f,!1,!0),u[f]=returnThis,t}},function(t,r,e){var n,o,i,a=e(7),u=e(21),c=e(20),f=e(72),s=e(130),l=e(48),h=e(34),p=e(36),g=h("iterator"),v=!1;[].keys&&("next"in(i=[].keys())?(o=s(s(i)))!==Object.prototype&&(n=o):v=!0),!c(n)||a(function(){var t={};return n[g].call(t)!==t})?n={}:p&&(n=f(n)),u(n[g])||l(n,g,function(){return this}),t.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:v}},function(t,r){t.exports=function(t,r){return{value:t,done:r}}},function(r,e,n){var o=n(3),i=n(14),a=n(13),u=n(12),c=n(148),f=i([].join);o({target:"Array",proto:!0,forced:a!=Object||!c("join",",")},{join:function join(r){return f(u(this),r===t?",":r)}})},function(t,r,e){var n=e(3),o=e(176);n({target:"Array",proto:!0,forced:o!==[].lastIndexOf},{lastIndexOf:o})},function(t,r,e){var n=e(96),o=e(12),i=e(62),a=e(64),u=e(148),c=Math.min,f=[].lastIndexOf,s=!!f&&1/[1].lastIndexOf(1,-0)<0,l=u("lastIndexOf");t.exports=s||!l?function lastIndexOf(t){var r,e,u;if(s)return n(f,this,arguments)||0;for(r=o(this),u=(e=a(r))-1,arguments.length>1&&(u=c(u,i(arguments[1]))),u<0&&(u=e+u);u>=0;u--)if(u in r&&r[u]===t)return u||0;return-1}:f},function(r,e,n){var o=n(3),i=n(85).map;o({target:"Array",proto:!0,forced:!n(143)("map")},{map:function map(r){return i(this,r,arguments.length>1?arguments[1]:t)}})},function(t,r,e){var n=e(3),o=e(7),i=e(91),a=e(78),u=Array;n({target:"Array",stat:!0,forced:o(function(){function F(){}return!(u.of.call(F)instanceof F)})},{of:function of(){for(var t=0,r=arguments.length,e=new(i(this)?this:u)(r);r>t;)a(e,t,arguments[t++]);return e.length=r,e}})},function(t,r,e){var n=e(3),o=e(40),i=e(64),a=e(180),u=e(142);n({target:"Array",proto:!0,arity:1,forced:e(7)(function(){return 4294967297!==[].push.call({length:4294967296},1)})||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(t){return t instanceof TypeError}}()},{push:function push(t){var r,e=o(this),n=i(e),c=arguments.length;for(u(n+c),r=0;r79&&u<83||!a("reduce")},{reduce:function reduce(r){var e=arguments.length;return i(this,r,e,e>1?arguments[1]:t)}})},function(t,r,e){var n=e(31),o=e(40),i=e(13),a=e(64),u=TypeError,createMethod=function(t){return function(r,e,c,f){var s,l,h,p,g;if(n(e),s=o(r),l=i(s),h=a(s),p=t?h-1:0,g=t?-1:1,c<2)for(;;){if(p in l){f=l[p],p+=g;break}if(p+=g,t?p<0:h<=p)throw u("Reduce of empty array with no initial value")}for(;t?p>=0:h>p;p+=g)p in l&&(f=e(f,l[p],p,s));return f}};t.exports={left:createMethod(!1),right:createMethod(!0)}},function(t,r,e){var n=e(15);t.exports="undefined"!=typeof process&&"process"==n(process)},function(r,e,n){var o=n(3),i=n(182).right,a=n(148),u=n(28);o({target:"Array",proto:!0,forced:!n(183)&&u>79&&u<83||!a("reduceRight")},{reduceRight:function reduceRight(r){return i(this,r,arguments.length,arguments.length>1?arguments[1]:t)}})},function(t,r,e){var n=e(3),o=e(14),i=e(90),a=o([].reverse),u=[1,2];n({target:"Array",proto:!0,forced:String(u)===String(u.reverse())},{reverse:function reverse(){return i(this)&&(this.length=this.length),a(this)}})},function(r,e,n){var o=n(3),i=n(90),a=n(91),u=n(20),c=n(61),f=n(64),s=n(12),l=n(78),h=n(34),p=n(143),g=n(97),v=p("slice"),d=h("species"),y=Array,m=Math.max;o({target:"Array",proto:!0,forced:!v},{slice:function slice(r,e){var n,o,h,p=s(this),v=f(p),b=c(r,v),x=c(e===t?v:e,v);if(i(p)&&((a(n=p.constructor)&&(n===y||i(n.prototype))||u(n)&&null===(n=n[d]))&&(n=t),n===y||n===t))return g(p,b,x);for(o=new(n===t?y:n)(m(x-b,0)),h=0;b1?arguments[1]:t)}})},function(r,e,n){var o=n(3),i=n(14),a=n(31),u=n(40),c=n(64),f=n(146),s=n(69),l=n(7),h=n(189),p=n(148),g=n(190),v=n(191),d=n(28),y=n(192),m=[],b=i(m.sort),x=i(m.push),w=l(function(){m.sort(t)}),S=l(function(){m.sort(null)}),A=p("sort"),E=!l(function(){var t,r,e,n,o;if(d)return d<70;if(!(g&&g>3)){if(v)return!0;if(y)return y<603;for(t="",r=65;r<76;r++){switch(e=String.fromCharCode(r),r){case 66:case 69:case 70:case 72:n=3;break;case 68:case 71:n=4;break;default:n=2}for(o=0;o<47;o++)m.push({k:e+o,v:n})}for(m.sort(function(t,r){return r.v-t.v}),o=0;os(n)?1:-1}}(r)),i=c(n),l=0;l0;)t[n]=t[--n];n!==i++&&(t[n]=e)}return t},merge=function(t,r,e,n){for(var o=r.length,i=e.length,a=0,u=0;ax-n+e;d--)h(b,d-1)}else if(e>n)for(d=x-n;d>w;d--)m=d+e-1,(y=d+n-1)in b?b[m]=b[y]:h(b,m);for(d=0;de;)i[e]=r[e++];return i}},function(t,r,e){var n=e(4);t.exports=function(t){return n[t].prototype}},function(t,r,e){var n=e(3),o=e(140),i=e(142),a=e(64),u=e(61),c=e(12),f=e(62),s=Array,l=Math.max,h=Math.min;n({target:"Array",proto:!0},{toSpliced:function toSpliced(t,r){var e,n,o,p,g=c(this),v=a(g),d=u(t,v),y=arguments.length,m=0;for(0===y?e=n=0:1===y?(e=0,n=v-d):(e=y-2,n=h(l(f(r),0),v-d)),o=i(v+e-n),p=s(o);m=f||l<0)throw i("Incorrect index");for(u=new r(f),c=0;c>8&255]},packInt32=function(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]},unpackInt32=function(t){return t[3]<<24|t[2]<<16|t[1]<<8|t[0]},packFloat32=function(t){return X(t,23,4)},packFloat64=function(t){return X(t,52,8)},addGetter=function(t,r,e){d(t[D],r,{configurable:!0,get:function(){return e(this)[r]}})},get=function(t,r,e,n){var o,i,a=L(t),u=S(e),c=!!n;if(u+r>a.byteLength)throw J(_);return i=M(a.bytes,o=u+a.byteOffset,o+r),c?i:$(i)},set=function(t,r,e,n,o,i){var a,u,c,f=L(t),s=S(e),l=n(+o),h=!!i;if(s+r>f.byteLength)throw J(_);for(a=f.bytes,u=s+f.byteOffset,c=0;ca;)(u=i[a++])in W||v(W,u,z[u]);V.constructor=W}O&&E(q)!==G&&O(q,G),c=new H(new W(2)),f=l(q.setInt8),c.setInt8(0,2147483648),c.setInt8(1,2147483649),!c.getInt8(0)&&c.getInt8(1)||y(q,{setInt8:function setInt8(t,r){f(this,t,r<<24>>24)},setUint8:function setUint8(t,r){f(this,t,r<<24>>24)}},{unsafe:!0})}else V=(W=function ArrayBuffer(t){b(this,V);var r=S(t);B(this,{type:C,bytes:Y(K(r),0),byteLength:r}),h||(this.byteLength=r,this.detached=!1)})[D],q=(H=function DataView(r,e,n){var o,i,a;if(b(this,q),b(r,V),i=(o=U(r)).byteLength,(a=x(e))<0||a>i)throw J("Wrong offset");if(a+(n=n===t?i-a:w(n))>i)throw J("Wrong length");B(this,{type:N,buffer:r,byteLength:n,byteOffset:a,bytes:o.bytes}),h||(this.buffer=r,this.byteLength=n,this.byteOffset=a)})[D],h&&(addGetter(W,"byteLength",U),addGetter(H,"buffer",L),addGetter(H,"byteLength",L),addGetter(H,"byteOffset",L)),y(q,{getInt8:function getInt8(t){return get(this,1,t)[0]<<24>>24},getUint8:function getUint8(t){return get(this,1,t)[0]},getInt16:function getInt16(t){var r=get(this,2,t,arguments.length>1&&arguments[1]);return(r[1]<<8|r[0])<<16>>16},getUint16:function getUint16(t){var r=get(this,2,t,arguments.length>1&&arguments[1]);return r[1]<<8|r[0]},getInt32:function getInt32(t){return unpackInt32(get(this,4,t,arguments.length>1&&arguments[1]))},getUint32:function getUint32(t){return unpackInt32(get(this,4,t,arguments.length>1&&arguments[1]))>>>0},getFloat32:function getFloat32(t){return Q(get(this,4,t,arguments.length>1&&arguments[1]),23)},getFloat64:function getFloat64(t){return Q(get(this,8,t,arguments.length>1&&arguments[1]),52)},setInt8:function setInt8(t,r){set(this,1,t,packInt8,r)},setUint8:function setUint8(t,r){set(this,1,t,packInt8,r)},setInt16:function setInt16(t,r){set(this,2,t,packInt16,r,arguments.length>2&&arguments[2])},setUint16:function setUint16(t,r){set(this,2,t,packInt16,r,arguments.length>2&&arguments[2])},setInt32:function setInt32(t,r){set(this,4,t,packInt32,r,arguments.length>2&&arguments[2])},setUint32:function setUint32(t,r){set(this,4,t,packInt32,r,arguments.length>2&&arguments[2])},setFloat32:function setFloat32(t,r){set(this,4,t,packFloat32,r,arguments.length>2&&arguments[2])},setFloat64:function setFloat64(t,r){set(this,8,t,packFloat64,r,arguments.length>2&&arguments[2])}});T(W,C),T(H,N),r.exports={ArrayBuffer:W,DataView:H}},function(t,r){t.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView},function(t,r,e){var n=e(48);t.exports=function(t,r,e){for(var o in r)n(t,o,r[o],e);return t}},function(t,r,e){var n=e(25),o=TypeError;t.exports=function(t,r){if(n(r,t))return t;throw o("Incorrect invocation")}},function(r,e,n){var o=n(62),i=n(65),a=RangeError;r.exports=function(r){var e,n;if(r===t)return 0;if((e=o(r))!==(n=i(e)))throw a("Wrong length or index");return n}},function(t,r){var e=Array,n=Math.abs,o=Math.pow,i=Math.floor,a=Math.log,u=Math.LN2;t.exports={pack:function(t,r,c){var f,s,l,h=e(c),p=8*c-r-1,g=(1<>1,d=23===r?o(2,-24)-o(2,-77):0,y=t<0||0===t&&1/t<0?1:0,m=0;for((t=n(t))!=t||t===Infinity?(s=t!=t?1:0,f=g):(f=i(a(t)/u),t*(l=o(2,-f))<1&&(f--,l*=2),(t+=f+v>=1?d/l:d*o(2,1-v))*l>=2&&(f++,l/=2),f+v>=g?(s=0,f=g):f+v>=1?(s=(t*l-1)*o(2,r),f+=v):(s=t*o(2,v-1)*o(2,r),f=0));r>=8;)h[m++]=255&s,s/=256,r-=8;for(f=f<0;)h[m++]=255&f,f/=256,p-=8;return h[--m]|=128*y,h},unpack:function(t,r){var e,n=t.length,i=8*n-r-1,a=(1<>1,c=i-7,f=n-1,s=t[f--],l=127&s;for(s>>=7;c>0;)l=256*l+t[f--],c-=8;for(e=l&(1<<-c)-1,l>>=-c,c+=r;c>0;)e=256*e+t[f--],c-=8;if(0===l)l=1-u;else{if(l===a)return e?NaN:s?-Infinity:Infinity;e+=o(2,r),l-=u}return(s?-1:1)*e*o(2,l-r)}}},function(t,r,e){var n=e(3),o=e(215);n({target:"ArrayBuffer",stat:!0,forced:!o.NATIVE_ARRAY_BUFFER_VIEWS},{isView:o.isView})},function(r,e,n){var o,i,a,u=n(209),c=n(6),f=n(4),s=n(21),l=n(20),h=n(39),p=n(70),g=n(32),v=n(44),d=n(48),y=n(79),m=n(25),b=n(130),x=n(116),w=n(34),S=n(41),A=n(52),E=A.enforce,O=A.get,I=f.Int8Array,R=I&&I.prototype,M=f.Uint8ClampedArray,T=M&&M.prototype,k=I&&b(I),P=R&&b(R),j=Object.prototype,C=f.TypeError,N=w("toStringTag"),D=S("TYPED_ARRAY_TAG"),_="TypedArrayConstructor",U=u&&!!x&&"Opera"!==p(f.opera),L=!1,B={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},z={BigInt64Array:8,BigUint64Array:8},getTypedArrayConstructor=function(t){var r,e=b(t);if(l(e))return(r=O(e))&&h(r,_)?r[_]:getTypedArrayConstructor(e)},isTypedArray=function(t){if(!l(t))return!1;var r=p(t);return h(B,r)||h(z,r)};for(o in B)(a=(i=f[o])&&i.prototype)?E(a)[_]=i:U=!1;for(o in z)(a=(i=f[o])&&i.prototype)&&(E(a)[_]=i);if((!U||!s(k)||k===Function.prototype)&&(k=function TypedArray(){throw C("Incorrect invocation")},U))for(o in B)f[o]&&x(f[o],k);if((!U||!P||P===j)&&(P=k.prototype,U))for(o in B)f[o]&&x(f[o].prototype,P);if(U&&b(T)!==P&&x(T,P),c&&!h(P,N))for(o in L=!0,y(P,N,{configurable:!0,get:function(){return l(this)?this[D]:t}}),B)f[o]&&v(f[o],D,o);r.exports={NATIVE_ARRAY_BUFFER_VIEWS:U,TYPED_ARRAY_TAG:L&&D,aTypedArray:function(t){if(isTypedArray(t))return t;throw C("Target is not a typed array")},aTypedArrayConstructor:function(t){if(s(t)&&(!x||m(k,t)))return t;throw C(g(t)+" is not a typed array constructor")},exportTypedArrayMethod:function(t,r,e,n){var o,i;if(c){if(e)for(o in B)if((i=f[o])&&h(i.prototype,t))try{delete i.prototype[t]}catch(a){try{i.prototype[t]=r}catch(u){}}P[t]&&!e||d(P,t,e?r:U&&R[t]||r,n)}},exportTypedArrayStaticMethod:function(t,r,e){var n,o;if(c){if(x){if(e)for(n in B)if((o=f[n])&&h(o,t))try{delete o[t]}catch(i){}if(k[t]&&!e)return;try{return d(k,t,e?r:U&&k[t]||r)}catch(i){}}for(n in B)!(o=f[n])||o[t]&&!e||d(o,t,r)}},getTypedArrayConstructor:getTypedArrayConstructor,isView:function isView(t){if(!l(t))return!1;var r=p(t);return"DataView"===r||h(B,r)||h(z,r)},isTypedArray:isTypedArray,TypedArray:k,TypedArrayPrototype:P}},function(r,e,n){var o=n(3),i=n(87),a=n(7),u=n(208),c=n(47),f=n(61),s=n(65),l=n(217),h=u.ArrayBuffer,p=u.DataView,g=p.prototype,v=i(h.prototype.slice),d=i(g.getUint8),y=i(g.setUint8);o({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:a(function(){return!new h(2).slice(1,t).byteLength})},{slice:function slice(r,e){var n,o,i,a,u,g,m;if(v&&e===t)return v(c(this),r);for(n=c(this).byteLength,o=f(r,n),i=f(e===t?n:e,n),a=new(l(this,h))(s(i-o)),u=new p(this),g=new p(a),m=0;o9999?"+":"")+i(c(r),n?6:4,0)+"-"+i(y(t)+1,2,0)+"-"+i(h(t),2,0)+"T"+i(g(t),2,0)+":"+i(d(t),2,0)+":"+i(m(t),2,0)+"."+i(e,3,0)+"Z"}:s},function(r,e,n){var o=n(14),i=n(65),a=n(69),u=n(228),c=n(16),f=o(u),s=o("".slice),l=Math.ceil,createMethod=function(r){return function(e,n,o){var u,h,p=a(c(e)),g=i(n),v=p.length,d=o===t?" ":a(o);return g<=v||""==d?p:((h=f(d,l((u=g-v)/d.length))).length>u&&(h=s(h,0,u)),r?p+h:h+p)}};r.exports={start:createMethod(!1),end:createMethod(!0)}},function(t,r,e){var n=e(62),o=e(69),i=e(16),a=RangeError;t.exports=function repeat(t){var r=o(i(this)),e="",u=n(t);if(u<0||u==Infinity)throw a("Wrong number of repetitions");for(;u>0;(u>>>=1)&&(r+=r))1&u&&(e+=r);return e}},function(t,r,e){var n=e(3),o=e(7),i=e(40),a=e(19);n({target:"Date",proto:!0,arity:1,forced:o(function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})})},{toJSON:function toJSON(t){var r=i(this),e=a(r,"number");return"number"!=typeof e||isFinite(e)?r.toISOString():null}})},function(t,r,e){var n=e(39),o=e(48),i=e(231),a=e(34)("toPrimitive"),u=Date.prototype;n(u,a)||o(u,a,i)},function(t,r,e){var n=e(47),o=e(33),i=TypeError;t.exports=function(t){if(n(this),"string"===t||"default"===t)t="string";else if("number"!==t)throw i("Incorrect hint");return o(this,t)}},function(t,r,e){var n=e(14),o=e(48),i=Date.prototype,a="Invalid Date",u="toString",c=n(i[u]),f=n(i.getTime);String(new Date(NaN))!=a&&o(i,u,function toString(){var t=f(this);return t==t?c(this):a})},function(t,r,e){var n=e(3),o=e(14),i=e(69),a=o("".charAt),u=o("".charCodeAt),c=o(/./.exec),f=o(1..toString),s=o("".toUpperCase),l=/[\w*+\-./@]/,hex=function(t,r){for(var e=f(t,16);e.length1?arguments[1]:t);e=e?e.next:n.first;)for(o(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function has(t){return!!getEntry(this,t)}}),a(p,n?{get:function get(t){var r=getEntry(this,t);return r&&r.value},set:function set(t,r){return define(this,0===t?0:t,r)}}:{add:function add(t){return define(this,t=0===t?0:t,t)}}),g&&i(p,"size",{configurable:!0,get:function(){return d(this).size}}),h},setStrong:function(r,e,n){var o=e+" Iterator",i=m(e),a=m(o);l(r,e,function(r,e){y(this,{type:o,target:r,state:i(r),kind:e,last:t})},function(){for(var r=a(this),e=r.kind,n=r.last;n&&n.removed;)n=n.previous;return r.target&&(r.last=n=n?n.next:r.state.first)?h("keys"==e?n.key:"values"==e?n.value:[n.key,n.value],!1):(r.target=t,h(t,!0))},n?"entries":"values",!n,!0),p(e)}}},function(t,r,e){var n=e(3),o=e(249),i=Math.acosh,a=Math.log,u=Math.sqrt,c=Math.LN2;n({target:"Math",stat:!0,forced:!i||710!=Math.floor(i(Number.MAX_VALUE))||i(Infinity)!=Infinity},{acosh:function acosh(t){var r=+t;return r<1?NaN:r>94906265.62425156?a(r)+c:o(r-1+u(r-1)*u(r+1))}})},function(t,r){var e=Math.log;t.exports=Math.log1p||function log1p(t){var r=+t;return r>-1e-8&&r<1e-8?r-r*r/2:e(1+r)}},function(t,r,e){var n=e(3),o=Math.asinh,i=Math.log,a=Math.sqrt;n({target:"Math",stat:!0,forced:!(o&&1/o(0)>0)},{asinh:function asinh(t){var r=+t;return isFinite(r)&&0!=r?r<0?-asinh(-r):i(r+a(r*r+1)):r}})},function(t,r,e){var n=e(3),o=Math.atanh,i=Math.log;n({target:"Math",stat:!0,forced:!(o&&1/o(-0)<0)},{atanh:function atanh(t){var r=+t;return 0==r?r:i((1+r)/(1-r))/2}})},function(t,r,e){var n=e(3),o=e(253),i=Math.abs,a=Math.pow;n({target:"Math",stat:!0},{cbrt:function cbrt(t){var r=+t;return o(r)*a(i(r),1/3)}})},function(t,r){t.exports=Math.sign||function sign(t){var r=+t;return 0==r||r!=r?r:r<0?-1:1}},function(t,r,e){var n=e(3),o=Math.floor,i=Math.log,a=Math.LOG2E;n({target:"Math",stat:!0},{clz32:function clz32(t){var r=t>>>0;return r?31-o(i(r+.5)*a):32}})},function(t,r,e){var n=e(3),o=e(256),i=Math.cosh,a=Math.abs,u=Math.E;n({target:"Math",stat:!0,forced:!i||i(710)===Infinity},{cosh:function cosh(t){var r=o(a(t)-1)+1;return(r+1/(r*u*u))*(u/2)}})},function(t,r){var e=Math.expm1,n=Math.exp;t.exports=!e||e(10)>22025.465794806718||e(10)<22025.465794806718||-2e-17!=e(-2e-17)?function expm1(t){var r=+t;return 0==r?r:r>-1e-6&&r<1e-6?r+r*r/2:n(r)-1}:e},function(t,r,e){var n=e(3),o=e(256);n({target:"Math",stat:!0,forced:o!=Math.expm1},{expm1:o})},function(t,r,e){e(3)({target:"Math",stat:!0},{fround:e(259)})},function(t,r,e){var n=e(253),o=Math.abs,i=Math.pow,a=i(2,-52),u=i(2,-23),c=i(2,127)*(2-u),f=i(2,-126);t.exports=Math.fround||function fround(t){var r,e,i=+t,s=o(i),l=n(i);return sc||e!=e?l*Infinity:l*e}},function(t,r,e){var n=e(3),o=Math.hypot,i=Math.abs,a=Math.sqrt;n({target:"Math",stat:!0,arity:2,forced:!!o&&o(Infinity,NaN)!==Infinity},{hypot:function hypot(t,r){for(var e,n,o=0,u=0,c=arguments.length,f=0;u0?(n=e/f)*n:e;return f===Infinity?Infinity:f*a(o)}})},function(t,r,e){var n=e(3),o=e(7),i=Math.imul;n({target:"Math",stat:!0,forced:o(function(){return-5!=i(4294967295,5)||2!=i.length})},{imul:function imul(t,r){var e=65535,n=+t,o=+r,i=e&n,a=e&o;return 0|i*a+((e&n>>>16)*a+i*(e&o>>>16)<<16>>>0)}})},function(t,r,e){e(3)({target:"Math",stat:!0},{log10:e(263)})},function(t,r){var e=Math.log,n=Math.LOG10E;t.exports=Math.log10||function log10(t){return e(t)*n}},function(t,r,e){e(3)({target:"Math",stat:!0},{log1p:e(249)})},function(t,r,e){var n=e(3),o=Math.log,i=Math.LN2;n({target:"Math",stat:!0},{log2:function log2(t){return o(t)/i}})},function(t,r,e){e(3)({target:"Math",stat:!0},{sign:e(253)})},function(t,r,e){var n=e(3),o=e(7),i=e(256),a=Math.abs,u=Math.exp,c=Math.E;n({target:"Math",stat:!0,forced:o(function(){return-2e-17!=Math.sinh(-2e-17)})},{sinh:function sinh(t){var r=+t;return a(r)<1?(i(r)-i(-r))/2:(u(r-1)-u(-r-1))*(c/2)}})},function(t,r,e){var n=e(3),o=e(256),i=Math.exp;n({target:"Math",stat:!0},{tanh:function tanh(t){var r=+t,e=o(r),n=o(-r);return e==Infinity?1:n==Infinity?-1:(e-n)/(i(r)+i(-r))}})},function(t,r,e){e(84)(Math,"Math",!0)},function(t,r,e){e(3)({target:"Math",stat:!0},{trunc:e(63)})},function(t,r,e){var n,o=e(3),i=e(36),a=e(6),u=e(4),c=e(82),f=e(14),s=e(68),l=e(39),h=e(120),p=e(25),g=e(23),v=e(19),d=e(7),y=e(58).f,m=e(5).f,b=e(45).f,x=e(272),w=e(273).trim,S="Number",A=u[S],E=c[S],O=A.prototype,I=u.TypeError,R=f("".slice),M=f("".charCodeAt),toNumber=function(t){var r,e,n,o,i,a,u,c,f=v(t,"number");if(g(f))throw I("Cannot convert a Symbol value to a number");if("string"==typeof f&&f.length>2)if(f=w(f),43===(r=M(f,0))||45===r){if(88===(e=M(f,2))||120===e)return NaN}else if(48===r){switch(M(f,1)){case 66:case 98:n=2,o=49;break;case 79:case 111:n=8,o=55;break;default:return+f}for(a=(i=R(f,2)).length,u=0;uo)return NaN;return parseInt(i,n)}return+f},T=s(S,!A(" 0o1")||!A("0b1")||A("+0x1")),k=function Number(t){var r,e=arguments.length<1?0:A(function(t){var r=v(t,"number");return"bigint"==typeof r?r:toNumber(r)}(t));return p(O,r=this)&&d(function(){x(r)})?h(Object(e),this,k):e};k.prototype=O,T&&!i&&(O.constructor=k),o({global:!0,constructor:!0,wrap:!0,forced:T},{Number:k}),n=function(t,r){for(var e,n=a?y(r):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),o=0;n.length>o;o++)l(r,e=n[o])&&!l(t,e)&&b(t,e,m(r,e))},i&&E&&n(c[S],E),(T||i)&&n(c[S],A)},function(t,r,e){var n=e(14);t.exports=n(1..valueOf)},function(t,r,e){var n=e(14),o=e(16),i=e(69),a=e(274),u=n("".replace),c=RegExp("^["+a+"]+"),f=RegExp("(^|[^"+a+"])["+a+"]+$"),createMethod=function(t){return function(r){var e=i(o(r));return 1&t&&(e=u(e,c,"")),2&t&&(e=u(e,f,"$1")),e}};t.exports={start:createMethod(1),end:createMethod(2),trim:createMethod(3)}},function(t,r){t.exports="\t\n\x0B\f\r                 \u2028\u2029\ufeff"},function(t,r,e){e(3)({target:"Number",stat:!0,nonConfigurable:!0,nonWritable:!0},{EPSILON:Math.pow(2,-52)})},function(t,r,e){e(3)({target:"Number",stat:!0},{isFinite:e(277)})},function(t,r,e){var n=e(4).isFinite;t.exports=Number.isFinite||function isFinite(t){return"number"==typeof t&&n(t)}},function(t,r,e){e(3)({target:"Number",stat:!0},{isInteger:e(279)})},function(t,r,e){var n=e(20),o=Math.floor;t.exports=Number.isInteger||function isInteger(t){return!n(t)&&isFinite(t)&&o(t)===t}},function(t,r,e){e(3)({target:"Number",stat:!0},{isNaN:function isNaN(t){return t!=t}})},function(t,r,e){var n=e(3),o=e(279),i=Math.abs;n({target:"Number",stat:!0},{isSafeInteger:function isSafeInteger(t){return o(t)&&i(t)<=9007199254740991}})},function(t,r,e){e(3)({target:"Number",stat:!0,nonConfigurable:!0,nonWritable:!0},{MAX_SAFE_INTEGER:9007199254740991})},function(t,r,e){e(3)({target:"Number",stat:!0,nonConfigurable:!0,nonWritable:!0},{MIN_SAFE_INTEGER:-9007199254740991})},function(t,r,e){var n=e(3),o=e(285);n({target:"Number",stat:!0,forced:Number.parseFloat!=o},{parseFloat:o})},function(t,r,e){var n=e(4),o=e(7),i=e(14),a=e(69),u=e(273).trim,c=e(274),f=i("".charAt),s=n.parseFloat,l=n.Symbol,h=l&&l.iterator,p=1/s(c+"-0")!=-Infinity||h&&!o(function(){s(Object(h))});t.exports=p?function parseFloat(t){var r=u(a(t)),e=s(r);return 0===e&&"-"==f(r,0)?-0:e}:s},function(t,r,e){var n=e(3),o=e(287);n({target:"Number",stat:!0,forced:Number.parseInt!=o},{parseInt:o})},function(t,r,e){var n=e(4),o=e(7),i=e(14),a=e(69),u=e(273).trim,c=e(274),f=n.parseInt,s=n.Symbol,l=s&&s.iterator,h=/^[+-]?0x/i,p=i(h.exec),g=8!==f(c+"08")||22!==f(c+"0x16")||l&&!o(function(){f(Object(l))});t.exports=g?function parseInt(t,r){var e=u(a(t));return f(e,r>>>0||(p(h,e)?16:10))}:f},function(r,e,n){var o=n(3),i=n(14),a=n(62),u=n(272),c=n(228),f=n(263),s=n(7),l=RangeError,h=String,p=isFinite,g=Math.abs,v=Math.floor,d=Math.pow,y=Math.round,m=i(1..toExponential),b=i(c),x=i("".slice),w="-6.9000e-11"===m(-69e-12,4)&&"1.25e+0"===m(1.255,2)&&"1.235e+4"===m(12345,3)&&"3e+1"===m(25,0);o({target:"Number",proto:!0,forced:!w||!(s(function(){m(1,Infinity)})&&s(function(){m(1,-Infinity)}))||!!s(function(){m(Infinity,Infinity),m(NaN,Infinity)})},{toExponential:function toExponential(r){var e,n,o,i,c,s,S,A,E,O=u(this);if(r===t)return m(O);if(e=a(r),!p(O))return String(O);if(e<0||e>20)throw l("Incorrect fraction digits");return w?m(O,e):(n="",o="",i=0,c="",s="",O<0&&(n="-",O=-O),0===O?(i=0,o=b("0",e+1)):(S=f(O),i=v(S),A=0,E=d(10,i-e),2*O>=(2*(A=y(O/E))+1)*E&&(A+=1),A>=d(10,e+1)&&(A/=10,i+=1),o=h(A)),0!==e&&(o=x(o,0,1)+"."+x(o,1)),0===i?(c="+",s="0"):(c=i>0?"+":"-",s=h(g(i))),n+(o+="e"+c+s))}})},function(t,r,e){var n=e(3),o=e(14),i=e(62),a=e(272),u=e(228),c=e(7),f=RangeError,s=String,l=Math.floor,h=o(u),p=o("".slice),g=o(1..toFixed),pow=function(t,r,e){return 0===r?e:r%2==1?pow(t,r-1,e*t):pow(t*t,r/2,e)},multiply=function(t,r,e){for(var n=-1,o=e;++n<6;)t[n]=(o+=r*t[n])%1e7,o=l(o/1e7)},divide=function(t,r){for(var e=6,n=0;--e>=0;)t[e]=l((n+=t[e])/r),n=n%r*1e7},dataToString=function(t){for(var r,e=6,n="";--e>=0;)""===n&&0!==e&&0===t[e]||(r=s(t[e]),n=""===n?r:n+h("0",7-r.length)+r);return n};n({target:"Number",proto:!0,forced:c(function(){return"0.000"!==g(8e-5,3)||"1"!==g(.9,0)||"1.25"!==g(1.255,2)||"1000000000000000128"!==g(0xde0b6b3a7640080,0)})||!c(function(){g({})})},{toFixed:function toFixed(t){var r,e,n,o,u=a(this),c=i(t),l=[0,0,0,0,0,0],g="",v="0";if(c<0||c>20)throw f("Incorrect fraction digits");if(u!=u)return"NaN";if(u<=-1e21||u>=1e21)return s(u);if(u<0&&(g="-",u=-u),u>1e-21)if(e=(r=function(t){for(var r=0,e=t;e>=4096;)r+=12,e/=4096;for(;e>=2;)r+=1,e/=2;return r}(u*pow(2,69,1))-69)<0?u*pow(2,-r,1):u/pow(2,r,1),e*=4503599627370496,(r=52-r)>0){for(multiply(l,0,e),n=c;n>=7;)multiply(l,1e7,0),n-=7;for(multiply(l,pow(10,n,1),0),n=r-1;n>=23;)divide(l,1<<23),n-=23;divide(l,1<0?g+((o=v.length)<=c?"0."+h("0",c-o)+v:p(v,0,o-c)+"."+p(v,o-c)):g+v}})},function(r,e,n){var o=n(3),i=n(14),a=n(7),u=n(272),c=i(1..toPrecision);o({target:"Number",proto:!0,forced:a(function(){return"1"!==c(1,t)})||!a(function(){c({})})},{toPrecision:function toPrecision(r){return r===t?c(u(this)):c(u(this),r)}})},function(t,r,e){var n=e(3),o=e(292);n({target:"Object",stat:!0,arity:2,forced:Object.assign!==o},{assign:o})},function(t,r,e){var n=e(6),o=e(14),i=e(8),a=e(7),u=e(74),c=e(67),f=e(10),s=e(40),l=e(13),h=Object.assign,p=Object.defineProperty,g=o([].concat);t.exports=!h||a(function(){var t,r,e,o;return!(!n||1===h({b:1},h(p({},"a",{enumerable:!0,get:function(){p(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)||(r={},o="abcdefghijklmnopqrst",(t={})[e=Symbol()]=7,o.split("").forEach(function(t){r[t]=t}),7!=h({},t)[e]||u(h({},r)).join("")!=o)})?function assign(t,r){for(var e,o,a,h,p,v=s(t),d=arguments.length,y=1,m=c.f,b=f.f;d>y;)for(e=l(arguments[y++]),a=(o=m?g(u(e),m(e)):u(e)).length,h=0;a>h;)p=o[h++],n&&!i(b,e,p)||(v[p]=e[p]);return v}:h},function(t,r,e){e(3)({target:"Object",stat:!0,sham:!e(6)},{create:e(72)})},function(t,r,e){var n=e(3),o=e(6),i=e(295),a=e(31),u=e(40),c=e(45);o&&n({target:"Object",proto:!0,forced:i},{__defineGetter__:function __defineGetter__(t,r){c.f(u(this),t,{get:a(r),enumerable:!0,configurable:!0})}})},function(t,r,e){var n=e(36),o=e(4),i=e(7),a=e(192);t.exports=n||!i(function(){if(!(a&&a<535)){var t=Math.random();__defineSetter__.call(null,t,function(){}),delete o[t]}})},function(t,r,e){var n=e(3),o=e(6),i=e(73).f;n({target:"Object",stat:!0,forced:Object.defineProperties!==i,sham:!o},{defineProperties:i})},function(t,r,e){var n=e(3),o=e(6),i=e(45).f;n({target:"Object",stat:!0,forced:Object.defineProperty!==i,sham:!o},{defineProperty:i})},function(t,r,e){var n=e(3),o=e(6),i=e(295),a=e(31),u=e(40),c=e(45);o&&n({target:"Object",proto:!0,forced:i},{__defineSetter__:function __defineSetter__(t,r){c.f(u(this),t,{set:a(r),enumerable:!0,configurable:!0})}})},function(t,r,e){var n=e(3),o=e(300).entries;n({target:"Object",stat:!0},{entries:function entries(t){return o(t)}})},function(t,r,e){var n=e(6),o=e(7),i=e(14),a=e(130),u=e(74),c=e(12),f=i(e(10).f),s=i([].push),l=n&&o(function(){var t=Object.create(null);return t[2]=2,!f(t,2)}),createMethod=function(t){return function(r){for(var e,o=c(r),i=u(o),h=l&&null===a(o),p=i.length,g=0,v=[];p>g;)e=i[g++],n&&!(h?e in o:f(o,e))||s(v,t?[e,o[e]]:o[e]);return v}};t.exports={entries:createMethod(!0),values:createMethod(!1)}},function(t,r,e){var n=e(3),o=e(246),i=e(7),a=e(20),u=e(243).onFreeze,c=Object.freeze;n({target:"Object",stat:!0,forced:i(function(){c(1)}),sham:!o},{freeze:function freeze(t){return c&&a(t)?c(u(t)):t}})},function(t,r,e){var n=e(3),o=e(132),i=e(78);n({target:"Object",stat:!0},{fromEntries:function fromEntries(t){var r={};return o(t,function(t,e){i(r,t,e)},{AS_ENTRIES:!0}),r}})},function(t,r,e){var n=e(3),o=e(7),i=e(12),a=e(5).f,u=e(6);n({target:"Object",stat:!0,forced:!u||o(function(){a(1)}),sham:!u},{getOwnPropertyDescriptor:function getOwnPropertyDescriptor(t,r){return a(i(t),r)}})},function(r,e,n){var o=n(3),i=n(6),a=n(57),u=n(12),c=n(5),f=n(78);o({target:"Object",stat:!0,sham:!i},{getOwnPropertyDescriptors:function getOwnPropertyDescriptors(r){for(var e,n,o=u(r),i=c.f,s=a(o),l={},h=0;s.length>h;)(n=i(o,e=s[h++]))!==t&&f(l,e,n);return l}})},function(t,r,e){var n=e(3),o=e(7),i=e(76).f;n({target:"Object",stat:!0,forced:o(function(){return!Object.getOwnPropertyNames(1)})},{getOwnPropertyNames:i})},function(t,r,e){var n=e(3),o=e(7),i=e(40),a=e(130),u=e(131);n({target:"Object",stat:!0,forced:o(function(){a(1)}),sham:!u},{getPrototypeOf:function getPrototypeOf(t){return a(i(t))}})},function(t,r,e){e(3)({target:"Object",stat:!0},{hasOwn:e(39)})},function(t,r,e){e(3)({target:"Object",stat:!0},{is:e(309)})},function(t,r){t.exports=Object.is||function is(t,r){return t===r?0!==t||1/t==1/r:t!=t&&r!=r}},function(t,r,e){var n=e(3),o=e(244);n({target:"Object",stat:!0,forced:Object.isExtensible!==o},{isExtensible:o})},function(t,r,e){var n=e(3),o=e(7),i=e(20),a=e(15),u=e(245),c=Object.isFrozen;n({target:"Object",stat:!0,forced:u||o(function(){c(1)})},{isFrozen:function isFrozen(t){return!i(t)||!(!u||"ArrayBuffer"!=a(t))||!!c&&c(t)}})},function(t,r,e){var n=e(3),o=e(7),i=e(20),a=e(15),u=e(245),c=Object.isSealed;n({target:"Object",stat:!0,forced:u||o(function(){c(1)})},{isSealed:function isSealed(t){return!i(t)||!(!u||"ArrayBuffer"!=a(t))||!!c&&c(t)}})},function(t,r,e){var n=e(3),o=e(40),i=e(74);n({target:"Object",stat:!0,forced:e(7)(function(){i(1)})},{keys:function keys(t){return i(o(t))}})},function(t,r,e){var n=e(3),o=e(6),i=e(295),a=e(40),u=e(18),c=e(130),f=e(5).f;o&&n({target:"Object",proto:!0,forced:i},{__lookupGetter__:function __lookupGetter__(t){var r,e=a(this),n=u(t);do{if(r=f(e,n))return r.get}while(e=c(e))}})},function(t,r,e){var n=e(3),o=e(6),i=e(295),a=e(40),u=e(18),c=e(130),f=e(5).f;o&&n({target:"Object",proto:!0,forced:i},{__lookupSetter__:function __lookupSetter__(t){var r,e=a(this),n=u(t);do{if(r=f(e,n))return r.set}while(e=c(e))}})},function(t,r,e){var n=e(3),o=e(20),i=e(243).onFreeze,a=e(246),u=e(7),c=Object.preventExtensions;n({target:"Object",stat:!0,forced:u(function(){c(1)}),sham:!a},{preventExtensions:function preventExtensions(t){return c&&o(t)?c(i(t)):t}})},function(t,r,e){var n=e(6),o=e(79),i=e(20),a=e(40),u=e(16),c=Object.getPrototypeOf,f=Object.setPrototypeOf,s=Object.prototype,l="__proto__";if(n&&c&&f&&!(l in s))try{o(s,l,{configurable:!0,get:function __proto__(){return c(a(this))},set:function __proto__(t){var r=u(this);(i(t)||null===t)&&i(r)&&f(r,t)}})}catch(h){}},function(t,r,e){var n=e(3),o=e(20),i=e(243).onFreeze,a=e(246),u=e(7),c=Object.seal;n({target:"Object",stat:!0,forced:u(function(){c(1)}),sham:!a},{seal:function seal(t){return c&&o(t)?c(i(t)):t}})},function(t,r,e){e(3)({target:"Object",stat:!0},{setPrototypeOf:e(116)})},function(t,r,e){var n=e(71),o=e(48),i=e(321);n||o(Object.prototype,"toString",i,{unsafe:!0})},function(t,r,e){var n=e(71),o=e(70);t.exports=n?{}.toString:function toString(){return"[object "+o(this)+"]"}},function(t,r,e){var n=e(3),o=e(300).values;n({target:"Object",stat:!0},{values:function values(t){return o(t)}})},function(t,r,e){var n=e(3),o=e(285);n({global:!0,forced:parseFloat!=o},{parseFloat:o})},function(t,r,e){var n=e(3),o=e(287);n({global:!0,forced:parseInt!=o},{parseInt:o})},function(t,r,e){e(326),e(341),e(343),e(344),e(345),e(346)},function(r,e,n){var o,i,a,u=n(3),c=n(36),f=n(183),s=n(4),l=n(8),h=n(48),p=n(116),g=n(84),v=n(194),d=n(31),y=n(21),m=n(20),b=n(211),x=n(217),w=n(327).set,S=n(330),A=n(334),E=n(335),O=n(331),I=n(52),R=n(336),M=n(337),T=n(340),k="Promise",P=M.CONSTRUCTOR,j=M.REJECTION_EVENT,C=M.SUBCLASSING,N=I.getterFor(k),D=I.set,_=R&&R.prototype,U=R,L=_,B=s.TypeError,z=s.document,W=s.process,V=T.f,H=V,q=!!(z&&z.createEvent&&s.dispatchEvent),G="unhandledrejection",isThenable=function(t){var r;return!(!m(t)||!y(r=t.then))&&r},callReaction=function(t,r){var e,n,o,i=r.value,a=1==r.state,u=a?t.ok:t.fail,c=t.resolve,f=t.reject,s=t.domain;try{u?(a||(2===r.rejection&&onHandleUnhandled(r),r.rejection=1),!0===u?e=i:(s&&s.enter(),e=u(i),s&&(s.exit(),o=!0)),e===t.promise?f(B("Promise-chain cycle")):(n=isThenable(e))?l(n,e,c,f):c(e)):f(i)}catch(h){s&&!o&&s.exit(),f(h)}},notify=function(t,r){t.notified||(t.notified=!0,S(function(){for(var e,n=t.reactions;e=n.get();)callReaction(e,t);t.notified=!1,r&&!t.rejection&&onUnhandled(t)}))},dispatchEvent=function(t,r,e){var n,o;q?((n=z.createEvent("Event")).promise=r,n.reason=e,n.initEvent(t,!1,!0),s.dispatchEvent(n)):n={promise:r,reason:e},!j&&(o=s["on"+t])?o(n):t===G&&A("Unhandled promise rejection",e)},onUnhandled=function(t){l(w,s,function(){var r,e=t.facade,n=t.value;if(isUnhandled(t)&&(r=E(function(){f?W.emit("unhandledRejection",n,e):dispatchEvent(G,e,n)}),t.rejection=f||isUnhandled(t)?2:1,r.error))throw r.value})},isUnhandled=function(t){return 1!==t.rejection&&!t.parent},onHandleUnhandled=function(t){l(w,s,function(){var r=t.facade;f?W.emit("rejectionHandled",r):dispatchEvent("rejectionhandled",r,t.value)})},bind=function(t,r,e){return function(n){t(r,n,e)}},internalReject=function(t,r,e){t.done||(t.done=!0,e&&(t=e),t.value=r,t.state=2,notify(t,!0))},internalResolve=function(t,r,e){if(!t.done){t.done=!0,e&&(t=e);try{if(t.facade===r)throw B("Promise can't be resolved itself");var n=isThenable(r);n?S(function(){var e={done:!1};try{l(n,r,bind(internalResolve,e,t),bind(internalReject,e,t))}catch(o){internalReject(e,o,t)}}):(t.value=r,t.state=1,notify(t,!1))}catch(o){internalReject({done:!1},o,t)}}};if(P&&(U=function Promise(t){b(this,L),d(t),l(o,this);var r=N(this);try{t(bind(internalResolve,r),bind(internalReject,r))}catch(e){internalReject(r,e)}},(o=function Promise(r){D(this,{type:k,done:!1,notified:!1,parent:!1,reactions:new O,rejection:!1,state:0,value:t})}).prototype=h(L=U.prototype,"then",function then(r,e){var n=N(this),o=V(x(this,U));return n.parent=!0,o.ok=!y(r)||r,o.fail=y(e)&&e,o.domain=f?W.domain:t,0==n.state?n.reactions.add(o):S(function(){callReaction(o,n)}),o.promise}),i=function(){var t=new o,r=N(t);this.promise=t,this.resolve=bind(internalResolve,r),this.reject=bind(internalReject,r)},T.f=V=function(r){return r===U||t===r?new i(r):H(r)},!c&&y(R)&&_!==Object.prototype)){a=_.then,C||h(_,"then",function then(t,r){var e=this;return new U(function(t,r){l(a,e,t,r)}).then(t,r)},{unsafe:!0});try{delete _.constructor}catch(K){}p&&p(_,L)}u({global:!0,constructor:!0,wrap:!0,forced:P},{Promise:U}),g(U,k,!1,!0),v(k)},function(r,e,n){var o,i,a,u,c,f,s,l,h=n(4),p=n(96),g=n(86),v=n(21),d=n(39),y=n(7),m=n(75),b=n(97),x=n(43),w=n(328),S=n(329),A=n(183),E=h.setImmediate,O=h.clearImmediate,I=h.process,R=h.Dispatch,M=h.Function,T=h.MessageChannel,k=h.String,P=0,j={},C="onreadystatechange";y(function(){o=h.location}),c=function(t){if(d(j,t)){var r=j[t];delete j[t],r()}},f=function(t){return function(){c(t)}},s=function(t){c(t.data)},l=function(t){h.postMessage(k(t),o.protocol+"//"+o.host)},E&&O||(E=function setImmediate(r){var e,n;return w(arguments.length,1),e=v(r)?r:M(r),n=b(arguments,1),j[++P]=function(){p(e,t,n)},i(P),P},O=function clearImmediate(t){delete j[t]},A?i=function(t){I.nextTick(f(t))}:R&&R.now?i=function(t){R.now(f(t))}:T&&!S?(u=(a=new T).port2,a.port1.onmessage=s,i=g(u.postMessage,u)):h.addEventListener&&v(h.postMessage)&&!h.importScripts&&o&&"file:"!==o.protocol&&!y(l)?(i=l,h.addEventListener("message",s,!1)):i=C in x("script")?function(t){m.appendChild(x("script"))[C]=function(){m.removeChild(this),c(t)}}:function(t){setTimeout(f(t),0)}),r.exports={set:E,clear:O}},function(t,r){var e=TypeError;t.exports=function(t,r){if(t@^][^\s!#%&*+<=>@^]*>/,L=/a/g,B=/a/g,z=new T(L)!==L,W=m.MISSED_STICKY,V=m.UNSUPPORTED_Y,H=u&&(!z||W||I||R||w(function(){return B[M]=!1,T(L)!=L||T(B)==B||"/a/i"!=T(L,"i")}));if(s("RegExp",H)){for(o=function RegExp(r,e){var n,i,a,u,c,f,s=g(k,this),p=v(r),m=e===t,b=[],x=r;if(!s&&p&&m&&r.constructor===o)return r;if((p||g(k,r))&&(r=r.source,m&&(e=y(x))),r=r===t?"":d(r),e=e===t?"":d(e),x=r,I&&"dotAll"in L&&(i=!!e&&D(e,"s")>-1)&&(e=N(e,/s/g,"")),n=e,W&&"sticky"in L&&(a=!!e&&D(e,"y")>-1)&&V&&(e=N(e,/y/g,"")),R&&(r=(u=function(t){for(var r,e=t.length,n=0,o="",i=[],a={},u=!1,c=!1,f=0,s="";n<=e;n++){if("\\"===(r=C(t,n)))r+=C(t,++n);else if("]"===r)u=!1;else if(!u)switch(!0){case"["===r:u=!0;break;case"("===r:j(U,_(t,n+1))&&(n+=2,c=!0),o+=r,f++;continue;case">"===r&&c:if(""===s||S(a,s))throw new P("Invalid capture group name");a[s]=!0,i[i.length]=[s,f],c=!1,s="";continue}c?s+=r:o+=r}return[o,i]}(r))[0],b=u[1]),c=l(T(r,e),s?this:k,o),(i||a||b.length)&&(f=A(c),i&&(f.dotAll=!0,f.raw=o(function(t){for(var r,e=t.length,n=0,o="",i=!1;n<=e;n++)"\\"!==(r=C(t,n))?i||"."!==r?("["===r?i=!0:"]"===r&&(i=!1),o+=r):o+="[\\s\\S]":o+=r+C(t,++n);return o}(r),n)),a&&(f.sticky=!0),b.length&&(f.groups=b)),r!==x)try{h(c,"source",""===x?"(?:)":x)}catch(w){}return c},i=p(T),a=0;i.length>a;)b(o,T,i[a++]);k.constructor=o,o.prototype=k,x(c,"RegExp",o,{constructor:!0})}E("RegExp")},function(r,e,n){var o=n(20),i=n(15),a=n(34)("match");r.exports=function(r){var e;return o(r)&&((e=r[a])!==t?!!e:"RegExp"==i(r))}},function(r,e,n){var o=n(8),i=n(39),a=n(25),u=n(369),c=RegExp.prototype;r.exports=function(r){var e=r.flags;return e!==t||"flags"in c||i(r,"flags")||!a(c,r)?e:o(u,r)}},function(t,r,e){var n=e(47);t.exports=function(){var t=n(this),r="";return t.hasIndices&&(r+="d"),t.global&&(r+="g"),t.ignoreCase&&(r+="i"),t.multiline&&(r+="m"),t.dotAll&&(r+="s"),t.unicode&&(r+="u"),t.unicodeSets&&(r+="v"),t.sticky&&(r+="y"),r}},function(t,r,e){var n=e(7),o=e(4).RegExp,i=n(function(){var t=o("a","y");return t.lastIndex=2,null!=t.exec("abcd")}),a=i||n(function(){return!o("a","y").sticky}),u=i||n(function(){var t=o("^r","gy");return t.lastIndex=2,null!=t.exec("str")});t.exports={BROKEN_CARET:u,MISSED_STICKY:a,UNSUPPORTED_Y:i}},function(t,r,e){var n=e(7),o=e(4).RegExp;t.exports=n(function(){var t=o(".","s");return!(t.dotAll&&t.exec("\n")&&"s"===t.flags)})},function(t,r,e){var n=e(7),o=e(4).RegExp;t.exports=n(function(){var t=o("(?b)","g");return"b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$c")})},function(r,e,n){var o=n(6),i=n(371),a=n(15),u=n(79),c=n(52).get,f=RegExp.prototype,s=TypeError;o&&i&&u(f,"dotAll",{configurable:!0,get:function dotAll(){if(this===f)return t;if("RegExp"===a(this))return!!c(this).dotAll;throw s("Incompatible receiver, RegExp required")}})},function(t,r,e){var n=e(3),o=e(375);n({target:"RegExp",proto:!0,forced:/./.exec!==o},{exec:o})},function(r,e,n){var o,i,a=n(8),u=n(14),c=n(69),f=n(369),s=n(370),l=n(35),h=n(72),p=n(52).get,g=n(371),v=n(372),d=l("native-string-replace","".replace),y=/t/.exec,m=y,b=u("".charAt),x=u("".indexOf),w=u("".replace),S=u("".slice),A=(i=/b*/g,a(y,o=/a/,"a"),a(y,i,"a"),0!==o.lastIndex||0!==i.lastIndex),E=s.BROKEN_CARET,O=/()??/.exec("")[1]!==t;(A||O||E||g||v)&&(m=function exec(r){var e,n,o,i,u,s,l,g,v,I,R,M,T,k=this,P=p(k),j=c(r),C=P.raw;if(C)return C.lastIndex=k.lastIndex,e=a(m,C,j),k.lastIndex=C.lastIndex,e;if(g=P.groups,v=E&&k.sticky,I=a(f,k),R=k.source,M=0,T=j,v&&(I=w(I,"y",""),-1===x(I,"g")&&(I+="g"),T=S(j,k.lastIndex),k.lastIndex>0&&(!k.multiline||k.multiline&&"\n"!==b(j,k.lastIndex-1))&&(R="(?: "+R+")",T=" "+T,M++),n=new RegExp("^(?:"+R+")",I)),O&&(n=new RegExp("^"+R+"$(?!\\s)",I)),A&&(o=k.lastIndex),i=a(y,v?n:k,T),v?i?(i.input=S(i.input,M),i[0]=S(i[0],M),i.index=k.lastIndex,k.lastIndex+=i[0].length):k.lastIndex=0:A&&i&&(k.lastIndex=k.global?i.index+i[0].length:o),O&&i&&i.length>1&&a(d,i[0],n,function(){for(u=1;u=0?o:n+o;return i<0||i>=n?t:s(e,i)}})},function(t,r,e){var n=e(3),o=e(384).codeAt;n({target:"String",proto:!0},{codePointAt:function codePointAt(t){return o(this,t)}})},function(r,e,n){var o=n(14),i=n(62),a=n(69),u=n(16),c=o("".charAt),f=o("".charCodeAt),s=o("".slice),createMethod=function(r){return function(e,n){var o,l,h=a(u(e)),p=i(n),g=h.length;return p<0||p>=g?r?"":t:(o=f(h,p))<55296||o>56319||p+1===g||(l=f(h,p+1))<56320||l>57343?r?c(h,p):o:r?s(h,p,p+2):l-56320+(o-55296<<10)+65536}};r.exports={codeAt:createMethod(!1),charAt:createMethod(!0)}},function(r,e,n){var o,i=n(3),a=n(87),u=n(5).f,c=n(65),f=n(69),s=n(386),l=n(16),h=n(387),p=n(36),g=a("".endsWith),v=a("".slice),d=Math.min,y=h("endsWith");i({target:"String",proto:!0,forced:!!(p||y||(o=u(String.prototype,"endsWith"),!o||o.writable))&&!y},{endsWith:function endsWith(r){var e,n,o,i,a=f(l(this));return s(r),n=a.length,o=(e=arguments.length>1?arguments[1]:t)===t?n:d(c(e),n),i=f(r),g?g(a,i,o):v(a,o-i.length,o)===i}})},function(t,r,e){var n=e(367),o=TypeError;t.exports=function(t){if(n(t))throw o("The method doesn't accept regular expressions");return t}},function(t,r,e){var n=e(34)("match");t.exports=function(t){var r=/./;try{"/./"[t](r)}catch(e){try{return r[n]=!1,"/./"[t](r)}catch(o){}}return!1}},function(t,r,e){var n=e(3),o=e(14),i=e(61),a=RangeError,u=String.fromCharCode,c=String.fromCodePoint,f=o([].join);n({target:"String",stat:!0,arity:1,forced:!!c&&1!=c.length},{fromCodePoint:function fromCodePoint(t){for(var r,e=[],n=arguments.length,o=0;n>o;){if(r=+arguments[o++],i(r,1114111)!==r)throw a(r+" is not a valid code point");e[o]=r<65536?u(r):u(55296+((r-=65536)>>10),r%1024+56320)}return f(e,"")}})},function(r,e,n){var o=n(3),i=n(14),a=n(386),u=n(16),c=n(69),f=n(387),s=i("".indexOf);o({target:"String",proto:!0,forced:!f("includes")},{includes:function includes(r){return!!~s(c(u(this)),c(a(r)),arguments.length>1?arguments[1]:t)}})},function(t,r,e){var n=e(3),o=e(14),i=e(16),a=e(69),u=o("".charCodeAt);n({target:"String",proto:!0},{isWellFormed:function isWellFormed(){var t,r,e=a(i(this)),n=e.length;for(t=0;t=56320||++t>=n||56320!=(64512&u(e,t))))return!1;return!0}})},function(r,e,n){var o=n(384).charAt,i=n(69),a=n(52),u=n(170),c=n(173),f="String Iterator",s=a.set,l=a.getterFor(f);u(String,"String",function(t){s(this,{type:f,string:i(t),index:0})},function next(){var r,e=l(this),n=e.string,i=e.index;return i>=n.length?c(t,!0):(r=o(n,i),e.index+=r.length,c(r,!1))})},function(r,e,n){var o=n(8),i=n(393),a=n(47),u=n(17),c=n(65),f=n(69),s=n(16),l=n(30),h=n(394),p=n(395);i("match",function(r,e,n){return[function match(e){var n=s(this),i=u(e)?t:l(e,r);return i?o(i,e,n):new RegExp(e)[r](f(n))},function(t){var r,o,i,u,s,l=a(this),g=f(t),v=n(e,l,g);if(v.done)return v.value;if(!l.global)return p(l,g);for(r=l.unicode,l.lastIndex=0,o=[],i=0;null!==(u=p(l,g));)s=f(u[0]),o[i]=s,""===s&&(l.lastIndex=h(g,c(l.lastIndex),r)),i++;return 0===i?null:o}]})},function(t,r,e){var n,o,i,a,u,c,f,s;e(374),n=e(87),o=e(48),i=e(375),a=e(7),u=e(34),c=e(44),f=u("species"),s=RegExp.prototype,t.exports=function(t,r,e,l){var h,p,g=u(t),v=!a(function(){var r={};return r[g]=function(){return 7},7!=""[t](r)}),d=v&&!a(function(){var r=!1,e=/a/;return"split"===t&&((e={}).constructor={},e.constructor[f]=function(){return e},e.flags="",e[g]=/./[g]),e.exec=function(){return r=!0,null},e[g](""),!r});v&&d&&!e||(h=n(/./[g]),p=r(g,""[t],function(t,r,e,o,a){var u=n(t),c=r.exec;return c===i||c===s.exec?v&&!a?{done:!0,value:h(r,e,o)}:{done:!0,value:u(e,r,o)}:{done:!1}}),o(String.prototype,t,p[0]),o(s,g,p[1])),l&&c(s[g],"sham",!0)}},function(t,r,e){var n=e(384).charAt;t.exports=function(t,r,e){return r+(e?n(t,r).length:1)}},function(t,r,e){var n=e(8),o=e(47),i=e(21),a=e(15),u=e(375),c=TypeError;t.exports=function(t,r){var e,f=t.exec;if(i(f))return null!==(e=n(f,t,r))&&o(e),e;if("RegExp"===a(t))return n(u,t,r);throw c("RegExp#exec called on incompatible receiver")}},function(r,e,n){var o=n(3),i=n(8),a=n(87),u=n(171),c=n(173),f=n(16),s=n(65),l=n(69),h=n(47),p=n(17),g=n(15),v=n(367),d=n(368),y=n(30),m=n(48),b=n(7),x=n(34),w=n(217),S=n(394),A=n(395),E=n(52),O=n(36),I=x("matchAll"),R="RegExp String",M=R+" Iterator",T=E.set,k=E.getterFor(M),P=RegExp.prototype,j=TypeError,C=a("".indexOf),N=a("".matchAll),D=!!N&&!b(function(){N("a",/./)}),_=u(function RegExpStringIterator(t,r,e,n){T(this,{type:M,regexp:t,string:r,global:e,unicode:n,done:!1})},R,function next(){var r,e,n,o=k(this);return o.done?c(t,!0):null===(n=A(r=o.regexp,e=o.string))?(o.done=!0,c(t,!0)):o.global?(""===l(n[0])&&(r.lastIndex=S(e,s(r.lastIndex),o.unicode)),c(n,!1)):(o.done=!0,c(n,!1))}),$matchAll=function(t){var r=h(this),e=l(t),n=w(r,RegExp),o=l(d(r)),i=new n(n===RegExp?r.source:r,o),a=!!~C(o,"g"),u=!!~C(o,"u");return i.lastIndex=s(r.lastIndex),new _(i,e,a,u)};o({target:"String",proto:!0,forced:D},{matchAll:function matchAll(r){var e,n,o,a,u=f(this);if(p(r)){if(D)return N(u,r)}else{if(v(r)&&(e=l(f(d(r))),!~C(e,"g")))throw j("`.matchAll` does not allow non-global regexes");if(D)return N(u,r);if((o=y(r,I))===t&&O&&"RegExp"==g(r)&&(o=$matchAll),o)return i(o,r,u)}return n=l(u),a=new RegExp(r,"g"),O?i($matchAll,a,n):a[I](n)}}),O||I in P||m(P,I,$matchAll)},function(r,e,n){var o=n(3),i=n(227).end;o({target:"String",proto:!0,forced:n(398)},{padEnd:function padEnd(r){return i(this,r,arguments.length>1?arguments[1]:t)}})},function(t,r,e){var n=e(29);t.exports=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(n)},function(r,e,n){var o=n(3),i=n(227).start;o({target:"String",proto:!0,forced:n(398)},{padStart:function padStart(r){return i(this,r,arguments.length>1?arguments[1]:t)}})},function(t,r,e){var n=e(3),o=e(14),i=e(12),a=e(40),u=e(69),c=e(64),f=o([].push),s=o([].join);n({target:"String",stat:!0},{raw:function raw(t){var r,e,n,o=i(a(t).raw),l=c(o);if(!l)return"";for(r=arguments.length,e=[],n=0;;){if(f(e,u(o[n++])),n===l)return s(e,"");n=M&&(R+=I(B,M,P)+_,M=P+k.length)}return R+I(B,M)}]},!!c(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$")})||!R||M)},function(r,e,n){var o=n(14),i=n(40),a=Math.floor,u=o("".charAt),c=o("".replace),f=o("".slice),s=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,l=/\$([$&'`]|\d{1,2})/g;r.exports=function(r,e,n,o,h,p){var g=n+r.length,v=o.length,d=l;return h!==t&&(h=i(h),d=s),c(p,d,function(i,c){var s,l,p;switch(u(c,0)){case"$":return"$";case"&":return r;case"`":return f(e,0,n);case"'":return f(e,g);case"<":s=h[f(c,1,-1)];break;default:if(0==(l=+c))return i;if(l>v)return 0===(p=a(l/10))?i:p<=v?o[p-1]===t?u(c,1):o[p-1]+u(c,1):i;s=o[l-1]}return s===t?"":s})}},function(r,e,n){var o=n(3),i=n(8),a=n(14),u=n(16),c=n(21),f=n(17),s=n(367),l=n(69),h=n(30),p=n(368),g=n(403),v=n(34),d=n(36),y=v("replace"),m=TypeError,b=a("".indexOf),x=a("".replace),w=a("".slice),S=Math.max,stringIndexOf=function(t,r,e){return e>t.length?-1:""===r?e:b(t,r,e)};o({target:"String",proto:!0},{replaceAll:function replaceAll(r,e){var n,o,a,v,A,E,O,I,R,M=u(this),T=0,k=0,P="";if(!f(r)){if((n=s(r))&&(o=l(u(p(r))),!~b(o,"g")))throw m("`.replaceAll` does not allow non-global regexes");if(a=h(r,y))return i(a,r,M,e);if(d&&n)return x(l(M),r,e)}for(v=l(M),A=l(r),(E=c(e))||(e=l(e)),I=S(1,O=A.length),T=stringIndexOf(v,A,0);-1!==T;)R=E?l(e(A,T,v)):g(A,v,T,[],t,e),P+=w(v,k,T)+R,k=T+O,T=stringIndexOf(v,A,T+I);return k1||"".split(/.?/).length?function(r,n){var a,u,c,f,h,p,g=v(l(this)),d=n===t?A:n>>>0;if(0===d)return[];if(r===t)return[g];if(!s(r))return i(e,g,r,d);for(a=[],u=0,c=new RegExp(r.source,(r.ignoreCase?"i":"")+(r.multiline?"m":"")+(r.unicode?"u":"")+(r.sticky?"y":"")+"g");(f=i(b,c,g))&&!((h=c.lastIndex)>u&&(R(a,M(g,u,f.index)),f.length>1&&f.index=d));)c.lastIndex===f.index&&c.lastIndex++;return u===g.length?!p&&I(c,"")||R(a,""):R(a,M(g,u)),a.length>d?y(a,0,d):a}:"0".split(t,0).length?function(r,n){return r===t&&0===n?[]:i(e,this,r,n)}:e,[function split(e,n){var o=l(this),u=f(e)?t:d(e,r);return u?i(u,e,o,n):i(a,v(o),e,n)},function(r,o){var i,u,f,s,l,d,y,b,x,w,O=c(this),I=v(r),T=n(a,O,I,o,a!==e);if(T.done)return T.value;if(i=h(O,RegExp),u=O.unicode,f=new i(S?"^(?:"+O.source+")":O,(O.ignoreCase?"i":"")+(O.multiline?"m":"")+(O.unicode?"u":"")+(S?"g":"y")),0===(s=o===t?A:o>>>0))return[];if(0===I.length)return null===m(f,I)?[I]:[];for(l=0,d=0,y=[];d1?arguments[1]:t,o.length)),n=f(r),g?g(o,n,e):v(o,e,e+n.length)===n}})},function(r,e,n){var o=n(3),i=n(14),a=n(16),u=n(62),c=n(69),f=i("".slice),s=Math.max,l=Math.min;o({target:"String",proto:!0,forced:!"".substr||"b"!=="ab".substr(-1)},{substr:function substr(r,e){var n,o,i=c(a(this)),h=i.length,p=u(r);return p===Infinity&&(p=0),p<0&&(p=s(h+p,0)),(n=e===t?h:u(e))<=0||n===Infinity||p>=(o=l(p+n,h))?"":f(i,p,o)}})},function(t,r,e){var n=e(3),o=e(8),i=e(14),a=e(16),u=e(69),c=e(7),f=Array,s=i("".charAt),l=i("".charCodeAt),h=i([].join),p="".toWellFormed,g=p&&c(function(){return"1"!==o(p,1)});n({target:"String",proto:!0,forced:g},{toWellFormed:function toWellFormed(){var t,r,e,n,i=u(a(this));if(g)return o(p,i);for(r=f(t=i.length),e=0;e=56320||e+1>=t||56320!=(64512&l(i,e+1))?r[e]="�":(r[e]=s(i,e),r[++e]=s(i,e));return h(r,"")}})},function(t,r,e){var n=e(3),o=e(273).trim;n({target:"String",proto:!0,forced:e(411)("trim")},{trim:function trim(){return o(this)}})},function(t,r,e){var n=e(50).PROPER,o=e(7),i=e(274);t.exports=function(t){return o(function(){return!!i[t]()||"​…᠎"!=="​…᠎"[t]()||n&&i[t].name!==t})}},function(t,r,e){var n,o;e(413),n=e(3),o=e(414),n({target:"String",proto:!0,name:"trimEnd",forced:"".trimEnd!==o},{trimEnd:o})},function(t,r,e){var n=e(3),o=e(414);n({target:"String",proto:!0,name:"trimEnd",forced:"".trimRight!==o},{trimRight:o})},function(t,r,e){var n=e(273).end,o=e(411);t.exports=o("trimEnd")?function trimEnd(){return n(this)}:"".trimEnd},function(t,r,e){var n,o;e(416),n=e(3),o=e(417),n({target:"String",proto:!0,name:"trimStart",forced:"".trimStart!==o},{trimStart:o})},function(t,r,e){var n=e(3),o=e(417);n({target:"String",proto:!0,name:"trimStart",forced:"".trimLeft!==o},{trimLeft:o})},function(t,r,e){var n=e(273).start,o=e(411);t.exports=o("trimStart")?function trimStart(){return n(this)}:"".trimStart},function(t,r,e){var n=e(3),o=e(419);n({target:"String",proto:!0,forced:e(420)("anchor")},{anchor:function anchor(t){return o(this,"a","name",t)}})},function(t,r,e){var n=e(14),o=e(16),i=e(69),a=/"/g,u=n("".replace);t.exports=function(t,r,e,n){var c=i(o(t)),f="<"+r;return""!==e&&(f+=" "+e+'="'+u(i(n),a,""")+'"'),f+">"+c+""}},function(t,r,e){var n=e(7);t.exports=function(t){return n(function(){var r=""[t]('"');return r!==r.toLowerCase()||r.split('"').length>3})}},function(t,r,e){var n=e(3),o=e(419);n({target:"String",proto:!0,forced:e(420)("big")},{big:function big(){return o(this,"big","","")}})},function(t,r,e){var n=e(3),o=e(419);n({target:"String",proto:!0,forced:e(420)("blink")},{blink:function blink(){return o(this,"blink","","")}})},function(t,r,e){var n=e(3),o=e(419);n({target:"String",proto:!0,forced:e(420)("bold")},{bold:function bold(){return o(this,"b","","")}})},function(t,r,e){var n=e(3),o=e(419);n({target:"String",proto:!0,forced:e(420)("fixed")},{fixed:function fixed(){return o(this,"tt","","")}})},function(t,r,e){var n=e(3),o=e(419);n({target:"String",proto:!0,forced:e(420)("fontcolor")},{fontcolor:function fontcolor(t){return o(this,"font","color",t)}})},function(t,r,e){var n=e(3),o=e(419);n({target:"String",proto:!0,forced:e(420)("fontsize")},{fontsize:function fontsize(t){return o(this,"font","size",t)}})},function(t,r,e){var n=e(3),o=e(419);n({target:"String",proto:!0,forced:e(420)("italics")},{italics:function italics(){return o(this,"i","","")}})},function(t,r,e){var n=e(3),o=e(419);n({target:"String",proto:!0,forced:e(420)("link")},{link:function link(t){return o(this,"a","href",t)}})},function(t,r,e){var n=e(3),o=e(419);n({target:"String",proto:!0,forced:e(420)("small")},{small:function small(){return o(this,"small","","")}})},function(t,r,e){var n=e(3),o=e(419);n({target:"String",proto:!0,forced:e(420)("strike")},{strike:function strike(){return o(this,"strike","","")}})},function(t,r,e){var n=e(3),o=e(419);n({target:"String",proto:!0,forced:e(420)("sub")},{sub:function sub(){return o(this,"sub","","")}})},function(t,r,e){var n=e(3),o=e(419);n({target:"String",proto:!0,forced:e(420)("sup")},{sup:function sup(){return o(this,"sup","","")}})},function(t,r,e){e(434)("Float32",function(t){return function Float32Array(r,e,n){return t(this,r,e,n)}})},function(r,e,n){var o=n(3),i=n(4),a=n(8),u=n(6),c=n(435),f=n(215),s=n(208),l=n(211),h=n(11),p=n(44),g=n(279),v=n(65),d=n(212),y=n(436),m=n(18),b=n(39),x=n(70),w=n(20),S=n(23),A=n(72),E=n(25),O=n(116),I=n(58).f,R=n(438),M=n(85).forEach,T=n(194),k=n(79),P=n(45),j=n(5),C=n(52),N=n(120),D=C.get,_=C.set,U=C.enforce,L=P.f,B=j.f,z=Math.round,W=i.RangeError,V=s.ArrayBuffer,H=V.prototype,q=s.DataView,G=f.NATIVE_ARRAY_BUFFER_VIEWS,K=f.TYPED_ARRAY_TAG,J=f.TypedArray,Y=f.TypedArrayPrototype,$=f.aTypedArrayConstructor,X=f.isTypedArray,Q="BYTES_PER_ELEMENT",Z="Wrong length",fromList=function(t,r){var e,n,o;for($(t),e=0,o=new t(n=r.length);n>e;)o[e]=r[e++];return o},addGetter=function(t,r){k(t,r,{configurable:!0,get:function(){return D(this)[r]}})},isArrayBuffer=function(t){var r;return E(H,t)||"ArrayBuffer"==(r=x(t))||"SharedArrayBuffer"==r},isTypedArrayIndex=function(t,r){return X(t)&&!S(r)&&r in t&&g(+r)&&r>=0},tt=function getOwnPropertyDescriptor(t,r){return r=m(r),isTypedArrayIndex(t,r)?h(2,t[r]):B(t,r)},rt=function defineProperty(t,r,e){return r=m(r),!(isTypedArrayIndex(t,r)&&w(e)&&b(e,"value"))||b(e,"get")||b(e,"set")||e.configurable||b(e,"writable")&&!e.writable||b(e,"enumerable")&&!e.enumerable?L(t,r,e):(t[r]=e.value,t)};u?(G||(j.f=tt,P.f=rt,addGetter(Y,"buffer"),addGetter(Y,"byteOffset"),addGetter(Y,"byteLength"),addGetter(Y,"length")),o({target:"Object",stat:!0,forced:!G},{getOwnPropertyDescriptor:tt,defineProperty:rt}),r.exports=function(r,e,n){var u,f=r.match(/\d+/)[0]/8,s=r+(n?"Clamped":"")+"Array",h="get"+r,g="set"+r,m=i[s],b=m,x=b&&b.prototype,S={},addElement=function(t,r){L(t,r,{get:function(){return function(t,r){var e=D(t);return e.view[h](r*f+e.byteOffset,!0)}(this,r)},set:function(t){return function(t,r,e){var o=D(t);n&&(e=(e=z(e))<0?0:e>255?255:255&e),o.view[g](r*f+o.byteOffset,e,!0)}(this,r,t)},enumerable:!0})};G?c&&(b=e(function(r,e,n,o){return l(r,x),N(w(e)?isArrayBuffer(e)?o!==t?new m(e,y(n,f),o):n!==t?new m(e,y(n,f)):new m(e):X(e)?fromList(b,e):a(R,b,e):new m(d(e)),r,b)}),O&&O(b,J),M(I(m),function(t){t in b||p(b,t,m[t])}),b.prototype=x):(b=e(function(r,e,n,o){var i,u,c,s,h,p;if(l(r,x),i=0,u=0,w(e)){if(!isArrayBuffer(e))return X(e)?fromList(b,e):a(R,b,e);if(c=e,u=y(n,f),p=e.byteLength,o===t){if(p%f)throw W(Z);if((s=p-u)<0)throw W(Z)}else if((s=v(o)*f)+u>p)throw W(Z);h=s/f}else h=d(e),c=new V(s=h*f);for(_(r,{buffer:c,byteOffset:u,byteLength:s,length:h,view:new q(c)});i1?arguments[1]:t,O=E!==t,I=s(S);if(I&&!l(I))for(x=(b=f(S,I)).next,S=[];!(m=i(x,b)).done;)S.push(m.value);for(O&&A>2&&(E=o(E,arguments[2])),n=c(S),v=new(p(w))(n),d=h(v),e=0;n>e;e++)y=O?E(S[e],e):S[e],v[e]=d?g(y):+y;return v}},function(t,r,e){var n=e(70);t.exports=function(t){var r=n(t);return"BigInt64Array"==r||"BigUint64Array"==r}},function(t,r,e){var n=e(19),o=TypeError;t.exports=function(t){var r=n(t,"number");if("number"==typeof r)throw o("Can't convert number to bigint");return BigInt(r)}},function(t,r,e){e(434)("Float64",function(t){return function Float64Array(r,e,n){return t(this,r,e,n)}})},function(t,r,e){e(434)("Int8",function(t){return function Int8Array(r,e,n){return t(this,r,e,n)}})},function(t,r,e){e(434)("Int16",function(t){return function Int16Array(r,e,n){return t(this,r,e,n)}})},function(t,r,e){e(434)("Int32",function(t){return function Int32Array(r,e,n){return t(this,r,e,n)}})},function(t,r,e){e(434)("Uint8",function(t){return function Uint8Array(r,e,n){return t(this,r,e,n)}})},function(t,r,e){e(434)("Uint8",function(t){return function Uint8ClampedArray(r,e,n){return t(this,r,e,n)}},!0)},function(t,r,e){e(434)("Uint16",function(t){return function Uint16Array(r,e,n){return t(this,r,e,n)}})},function(t,r,e){e(434)("Uint32",function(t){return function Uint32Array(r,e,n){return t(this,r,e,n)}})},function(r,e,n){var o=n(215),i=n(64),a=n(62),u=o.aTypedArray;(0,o.exportTypedArrayMethod)("at",function at(r){var e=u(this),n=i(e),o=a(r),c=o>=0?o:n+o;return c<0||c>=n?t:e[c]})},function(r,e,n){var o=n(14),i=n(215),a=o(n(145)),u=i.aTypedArray;(0,i.exportTypedArrayMethod)("copyWithin",function copyWithin(r,e){return a(u(this),r,e,arguments.length>2?arguments[2]:t)})},function(r,e,n){var o=n(215),i=n(85).every,a=o.aTypedArray;(0,o.exportTypedArrayMethod)("every",function every(r){return i(a(this),r,arguments.length>1?arguments[1]:t)})},function(r,e,n){var o=n(215),i=n(150),a=n(440),u=n(70),c=n(8),f=n(14),s=n(7),l=o.aTypedArray,h=o.exportTypedArrayMethod,p=f("".slice);h("fill",function fill(r){var e,n=arguments.length;return l(this),e="Big"===p(u(this),0,3)?a(r):+r,c(i,this,e,n>1?arguments[1]:t,n>2?arguments[2]:t)},s(function(){var t=0;return new Int8Array(2).fill({valueOf:function(){return t++}}),1!==t}))},function(r,e,n){var o=n(215),i=n(85).filter,a=n(454),u=o.aTypedArray;(0,o.exportTypedArrayMethod)("filter",function filter(r){var e=i(u(this),r,arguments.length>1?arguments[1]:t);return a(this,e)})},function(t,r,e){var n=e(199),o=e(455);t.exports=function(t,r){return n(o(t),r)}},function(t,r,e){var n=e(215),o=e(217),i=n.aTypedArrayConstructor,a=n.getTypedArrayConstructor;t.exports=function(t){return i(o(t,a(t)))}},function(r,e,n){var o=n(215),i=n(85).find,a=o.aTypedArray;(0,o.exportTypedArrayMethod)("find",function find(r){return i(a(this),r,arguments.length>1?arguments[1]:t)})},function(r,e,n){var o=n(215),i=n(85).findIndex,a=o.aTypedArray;(0,o.exportTypedArrayMethod)("findIndex",function findIndex(r){return i(a(this),r,arguments.length>1?arguments[1]:t)})},function(r,e,n){var o=n(215),i=n(155).findLast,a=o.aTypedArray;(0,o.exportTypedArrayMethod)("findLast",function findLast(r){return i(a(this),r,arguments.length>1?arguments[1]:t)})},function(r,e,n){var o=n(215),i=n(155).findLastIndex,a=o.aTypedArray;(0,o.exportTypedArrayMethod)("findLastIndex",function findLastIndex(r){return i(a(this),r,arguments.length>1?arguments[1]:t)})},function(r,e,n){var o=n(215),i=n(85).forEach,a=o.aTypedArray;(0,o.exportTypedArrayMethod)("forEach",function forEach(r){i(a(this),r,arguments.length>1?arguments[1]:t)})},function(t,r,e){var n=e(435);(0,e(215).exportTypedArrayStaticMethod)("from",e(438),n)},function(r,e,n){var o=n(215),i=n(60).includes,a=o.aTypedArray;(0,o.exportTypedArrayMethod)("includes",function includes(r){return i(a(this),r,arguments.length>1?arguments[1]:t)})},function(r,e,n){var o=n(215),i=n(60).indexOf,a=o.aTypedArray;(0,o.exportTypedArrayMethod)("indexOf",function indexOf(r){return i(a(this),r,arguments.length>1?arguments[1]:t)})},function(t,r,e){var n=e(4),o=e(7),i=e(14),a=e(215),u=e(169),c=e(34)("iterator"),f=n.Uint8Array,s=i(u.values),l=i(u.keys),h=i(u.entries),p=a.aTypedArray,g=a.exportTypedArrayMethod,v=f&&f.prototype,d=!o(function(){v[c].call([1])}),y=!!v&&v.values&&v[c]===v.values&&"values"===v.values.name,m=function values(){return s(p(this))};g("entries",function entries(){return h(p(this))},d),g("keys",function keys(){return l(p(this))},d),g("values",m,d||!y,{name:"values"}),g(c,m,d||!y,{name:"values"})},function(t,r,e){var n=e(215),o=e(14),i=n.aTypedArray,a=n.exportTypedArrayMethod,u=o([].join);a("join",function join(t){return u(i(this),t)})},function(t,r,e){var n=e(215),o=e(96),i=e(176),a=n.aTypedArray;(0,n.exportTypedArrayMethod)("lastIndexOf",function lastIndexOf(t){var r=arguments.length;return o(i,a(this),r>1?[t,arguments[1]]:[t])})},function(r,e,n){var o=n(215),i=n(85).map,a=n(455),u=o.aTypedArray;(0,o.exportTypedArrayMethod)("map",function map(r){return i(u(this),r,arguments.length>1?arguments[1]:t,function(t,r){return new(a(t))(r)})})},function(t,r,e){var n=e(215),o=e(435),i=n.aTypedArrayConstructor;(0,n.exportTypedArrayStaticMethod)("of",function of(){for(var t=0,r=arguments.length,e=new(i(this))(r);r>t;)e[t]=arguments[t++];return e},o)},function(r,e,n){var o=n(215),i=n(182).left,a=o.aTypedArray;(0,o.exportTypedArrayMethod)("reduce",function reduce(r){var e=arguments.length;return i(a(this),r,e,e>1?arguments[1]:t)})},function(r,e,n){var o=n(215),i=n(182).right,a=o.aTypedArray;(0,o.exportTypedArrayMethod)("reduceRight",function reduceRight(r){var e=arguments.length;return i(a(this),r,e,e>1?arguments[1]:t)})},function(t,r,e){var n=e(215),o=n.aTypedArray,i=Math.floor;(0,n.exportTypedArrayMethod)("reverse",function reverse(){for(var t,r=this,e=o(r).length,n=i(e/2),a=0;a1?arguments[1]:t,1),n=f(r),y)return i(g,this,n,e);if(o=this.length,s=0,(a=u(n))+e>o)throw l("Wrong length");for(;si;)f[i]=e[i++];return f},i(function(){new Int8Array(1).slice()}))},function(r,e,n){var o=n(215),i=n(85).some,a=o.aTypedArray;(0,o.exportTypedArrayMethod)("some",function some(r){return i(a(this),r,arguments.length>1?arguments[1]:t)})},function(r,e,n){var o=n(4),i=n(87),a=n(7),u=n(31),c=n(189),f=n(215),s=n(190),l=n(191),h=n(28),p=n(192),g=f.aTypedArray,v=f.exportTypedArrayMethod,d=o.Uint16Array,y=d&&i(d.prototype.sort),m=!(!y||a(function(){y(new d(2),null)})&&a(function(){y(new d(2),{})})),b=!!y&&!a(function(){var t,r,e,n;if(h)return h<74;if(s)return s<67;if(l)return!0;if(p)return p<602;for(t=new d(516),r=Array(516),e=0;e<516;e++)n=e%4,t[e]=515-e,r[e]=e-2*n+3;for(y(t,function(t,r){return(t/4|0)-(r/4|0)}),e=0;e<516;e++)if(t[e]!==r[e])return!0});v("sort",function sort(r){return r!==t&&u(r),b?y(this,r):c(g(this),function(r){return function(e,n){return r!==t?+r(e,n)||0:n!=n?-1:e!=e?1:0===e&&0===n?1/e>0&&1/n<0?1:-1:e>n}}(r))},!b||m)},function(r,e,n){var o=n(215),i=n(65),a=n(61),u=n(455),c=o.aTypedArray;(0,o.exportTypedArrayMethod)("subarray",function subarray(r,e){var n=c(this),o=n.length,f=a(r,o);return new(u(n))(n.buffer,n.byteOffset+f*n.BYTES_PER_ELEMENT,i((e===t?o:a(e,o))-f))})},function(t,r,e){var n=e(4),o=e(96),i=e(215),a=e(7),u=e(97),c=n.Int8Array,f=i.aTypedArray,s=i.exportTypedArrayMethod,l=[].toLocaleString,h=!!c&&a(function(){l.call(new c(1))});s("toLocaleString",function toLocaleString(){return o(l,h?u(f(this)):f(this),u(arguments))},a(function(){return[1,2].toLocaleString()!=new c([1,2]).toLocaleString()})||!a(function(){c.prototype.toLocaleString.call([1,2])}))},function(t,r,e){var n=e(197),o=e(215),i=o.aTypedArray,a=o.getTypedArrayConstructor;(0,o.exportTypedArrayMethod)("toReversed",function toReversed(){return n(i(this),a(this))})},function(r,e,n){var o=n(215),i=n(14),a=n(31),u=n(199),c=o.aTypedArray,f=o.getTypedArrayConstructor,s=o.exportTypedArrayMethod,l=i(o.TypedArrayPrototype.sort);s("toSorted",function toSorted(r){var e,n;return r!==t&&a(r),e=c(this),n=u(f(e),e),l(n,r)})},function(t,r,e){var n=e(215).exportTypedArrayMethod,o=e(7),i=e(4),a=e(14),u=i.Uint8Array,c=u&&u.prototype||{},f=[].toString,s=a([].join);o(function(){f.call({})})&&(f=function toString(){return s(this)}),n("toString",f,c.toString!=f)},function(t,r,e){var n=e(206),o=e(215),i=e(439),a=e(62),u=e(440),c=o.aTypedArray,f=o.getTypedArrayConstructor,s=o.exportTypedArrayMethod,l=!!function(){try{new Int8Array(1)["with"](2,{valueOf:function(){throw 8}})}catch(t){return 8===t}}();s("with",{"with":function(t,r){var e=c(this),o=a(t),s=i(e)?u(r):+r;return n(e,f(e),o,s)}}["with"],!l)},function(t,r,e){var n=e(3),o=e(14),i=e(69),a=String.fromCharCode,u=o("".charAt),c=o(/./.exec),f=o("".slice),s=/^[\da-f]{2}$/i,l=/^[\da-f]{4}$/i;n({global:!0},{unescape:function unescape(t){for(var r,e,n=i(t),o="",h=n.length,p=0;p1?arguments[1]:t,p=n>2?arguments[2]:t;return new(g("Promise"))(function(n){var g,v,b,x,w=a(r);i!==t&&(i=o(i,p)),v=(g=h(w,m))?t:l(w)||safeArrayIterator,b=u(e)?new e:[],x=g?c(w,g):new d(s(f(w,v))),n(y(x,i,b))})}},function(t,r,e){var n=e(8),o=e(492),i=e(47),a=e(135),u=e(494),c=e(30),f=e(34)("asyncIterator");t.exports=function(t,r){var e=arguments.length<2?c(t,f):r;return e?i(n(e,t)):new o(u(a(t)))}},function(r,e,n){var o=n(8),i=n(47),a=n(72),u=n(30),c=n(210),f=n(52),s=n(24),l=n(493),h=n(173),p=s("Promise"),g="AsyncFromSyncIterator",v=f.set,d=f.getterFor(g),asyncFromSyncIteratorContinuation=function(t,r,e){var n=t.done;p.resolve(t.value).then(function(t){r(h(t,n))},e)},y=function AsyncIterator(t){t.type=g,v(this,t)};y.prototype=c(a(l),{next:function next(){var t=d(this);return new p(function(r,e){var n=i(o(t.next,t.iterator));asyncFromSyncIteratorContinuation(n,r,e)})},"return":function(){var r=d(this).iterator;return new p(function(e,n){var a,c=u(r,"return");if(c===t)return e(h(t,!0));a=i(o(c,r)),asyncFromSyncIteratorContinuation(a,e,n)})}}),r.exports=y},function(t,r,e){var n,o,i=e(4),a=e(37),u=e(21),c=e(72),f=e(130),s=e(48),l=e(34),h=e(36),p="USE_FUNCTION_CONSTRUCTOR",g=l("asyncIterator"),v=i.AsyncIterator,d=a.AsyncIteratorPrototype;if(d)n=d;else if(u(v))n=v.prototype;else if(a[p]||i[p])try{o=f(f(f(Function("return async function*(){}()")()))),f(o)===Object.prototype&&(n=o)}catch(y){}n?h&&(n=c(n)):n={},u(n[g])||s(n,g,function(){return this}),t.exports=n},function(t,r){t.exports=function(t){return{iterator:t,next:t.next,done:!1}}},function(r,e,n){var o=n(8),i=n(31),a=n(47),u=n(20),c=n(142),f=n(24),s=n(494),l=n(496),createMethod=function(r){var e=0==r,n=1==r,h=2==r,p=3==r;return function(r,g,v){var d,y,m,b,x,w;return a(r),!(d=g!==t)&&e||i(g),y=s(r),m=f("Promise"),b=y.iterator,x=y.next,w=0,new m(function(r,i){var ifAbruptCloseAsyncIterator=function(t){l(b,i,t,i)},loop=function(){try{if(d)try{c(w)}catch(f){ifAbruptCloseAsyncIterator(f)}m.resolve(a(o(x,b))).then(function(o){var c,f,s;try{if(a(o).done)e?(v.length=w,r(v)):r(!p&&(h||t));else{c=o.value;try{d?(f=g(c,w),s=function(t){if(n)loop();else if(h)t?loop():l(b,r,!1,i);else if(e)try{v[w++]=t,loop()}catch(o){ifAbruptCloseAsyncIterator(o)}else t?l(b,r,p||c,i):loop()},u(f)?m.resolve(f).then(s,ifAbruptCloseAsyncIterator):s(f)):(v[w++]=c,loop())}catch(y){ifAbruptCloseAsyncIterator(y)}}}catch(x){i(x)}},i)}catch(s){i(s)}};loop()})}};r.exports={toArray:createMethod(0),forEach:createMethod(1),every:createMethod(2),some:createMethod(3),find:createMethod(4)}},function(t,r,e){var n=e(8),o=e(24),i=e(30);t.exports=function(t,r,e,a){try{var u=i(t,"return");if(u)return o("Promise").resolve(n(u,t)).then(function(){r(e)},function(t){a(t)})}catch(c){return a(c)}r(e)}},function(r,e,n){var o=n(3),i=n(85).filterReject,a=n(140);o({target:"Array",proto:!0,forced:!0},{filterOut:function filterOut(r){return i(this,r,arguments.length>1?arguments[1]:t)}}),a("filterOut")},function(r,e,n){var o=n(3),i=n(85).filterReject,a=n(140);o({target:"Array",proto:!0,forced:!0},{filterReject:function filterReject(r){return i(this,r,arguments.length>1?arguments[1]:t)}}),a("filterReject")},function(r,e,n){var o=n(3),i=n(500),a=n(140);o({target:"Array",proto:!0},{group:function group(r){return i(this,r,arguments.length>1?arguments[1]:t)}}),a("group")},function(t,r,e){var n=e(86),o=e(14),i=e(13),a=e(40),u=e(18),c=e(64),f=e(72),s=e(199),l=Array,h=o([].push);t.exports=function(t,r,e,o){for(var p,g,v,d=a(t),y=i(d),m=n(r,e),b=f(null),x=c(y),w=0;x>w;w++)(g=u(m(v=y[w],w,d)))in b?h(b[g],v):b[g]=[v];if(o&&(p=o(d))!==l)for(g in b)b[g]=s(p,b[g]);return b}},function(r,e,n){var o=n(3),i=n(500),a=n(148),u=n(140);o({target:"Array",proto:!0,forced:!a("groupBy")},{groupBy:function groupBy(r){return i(this,r,arguments.length>1?arguments[1]:t)}}),u("groupBy")},function(t,r,e){var n=e(3),o=e(148),i=e(140),a=e(503);n({target:"Array",proto:!0,name:"groupToMap",forced:e(36)||!o("groupByToMap")},{groupByToMap:a}),i("groupByToMap")},function(r,e,n){var o=n(86),i=n(14),a=n(13),u=n(40),c=n(64),f=n(504),s=f.Map,l=f.get,h=f.has,p=f.set,g=i([].push);r.exports=function groupToMap(r){for(var e,n,i=u(this),f=a(i),v=o(r,arguments.length>1?arguments[1]:t),d=new s,y=c(f),m=0;y>m;m++)e=v(n=f[m],m,i),h(d,e)?g(l(d,e),n):p(d,e,[n]);return d}},function(t,r,e){var n=e(14),o=Map.prototype;t.exports={Map:Map,set:n(o.set),get:n(o.get),has:n(o.has),remove:n(o["delete"]),proto:o}},function(t,r,e){var n=e(3),o=e(140),i=e(503);n({target:"Array",proto:!0,forced:e(36)},{groupToMap:i}),o("groupToMap")},function(r,e,n){var o=n(3),i=n(90),a=Object.isFrozen,isFrozenStringArray=function(r,e){var n,o,u;if(!a||!i(r)||!a(r))return!1;for(n=0,o=r.length;n=O&&(!n||I))return m(o,0,O);for(i=n&&!I&&x?{maxByteLength:x(o)}:t,a=new p(O,i),s=new g(o),d=new g(a),y=v(O,E),A=0;A92||c&&i>94||a&&i>97)&&(t=new ArrayBuffer(8),r=f(t,{transfer:[t]}),0!=t.byteLength||8!=r.byteLength)})},function(r,e,n){var o=n(3),i=n(517);i&&o({target:"ArrayBuffer",proto:!0},{transferToFixedLength:function transferToFixedLength(){return i(this,arguments.length?arguments[0]:t,!1)}})},function(r,e,n){var o=n(3),i=n(6),a=n(24),u=n(31),c=n(211),f=n(48),s=n(210),l=n(79),h=n(34),p=n(52),g=n(521),v=a("Promise"),d=a("SuppressedError"),y=ReferenceError,m=h("asyncDispose"),b=h("toStringTag"),x="AsyncDisposableStack",w=p.set,S=p.getterFor(x),A="async-dispose",E="disposed",getPendingAsyncDisposableStackInternalState=function(t){var r=S(t);if(r.state==E)throw y(x+" already disposed");return r},O=function AsyncDisposableStack(){w(c(this,I),{type:x,state:"pending",stack:[]}),i||(this.disposed=!1)},I=O.prototype;s(I,{disposeAsync:function disposeAsync(){var r=this;return new v(function(e,n){var o,a,u,c,f,s,l=S(r);if(l.state==E)return e(t);l.state=E,i||(r.disposed=!0),a=(o=l.stack).length,u=!1,f=function(t){u?c=new d(t,c):(u=!0,c=t),s()},(s=function(){if(a){var r=o[--a];o[a]=null;try{v.resolve(r()).then(s,f)}catch(i){f(i)}}else l.stack=null,u?n(c):e(t)})()})},use:function use(t){return g(getPendingAsyncDisposableStackInternalState(this),t,A),t},adopt:function adopt(r,e){var n=getPendingAsyncDisposableStackInternalState(this);return u(e),g(n,t,A,function(){return e(r)}),r},defer:function defer(r){var e=getPendingAsyncDisposableStackInternalState(this);u(r),g(e,t,A,r)},move:function move(){var t=getPendingAsyncDisposableStackInternalState(this),r=new O;return S(r).stack=t.stack,t.stack=[],t.state=E,i||(this.disposed=!0),r}}),i&&l(I,"disposed",{configurable:!0,get:function disposed(){return S(this).state==E}}),f(I,m,I.disposeAsync,{name:"disposeAsync"}),f(I,b,x,{nonWritable:!0}),o({global:!0,constructor:!0,forced:!0},{AsyncDisposableStack:O})},function(r,e,n){var o=n(14),i=n(86),a=n(47),u=n(17),c=n(30),f=n(34),s=f("asyncDispose"),l=f("dispose"),h=o([].push),createDisposableResource=function(t,r,e){return i(e||function(t,r){return"async-dispose"==r&&c(t,s)||c(t,l)}(t,r),t)};r.exports=function(r,e,n,o){var i;if(o)i=createDisposableResource(t,n,o);else{if(u(e))return;i=createDisposableResource(a(e),n)}h(r.stack,i)}},function(t,r,e){var n=e(3),o=e(211),i=e(44),a=e(39),u=e(34),c=e(493),f=e(36),s=u("toStringTag"),l=function AsyncIterator(){o(this,c)};l.prototype=c,a(c,s)||i(c,s,"AsyncIterator"),!f&&a(c,"constructor")&&c.constructor!==Object||i(c,"constructor",l),n({global:!0,constructor:!0,forced:f},{AsyncIterator:l})},function(t,r,e){e(3)({target:"AsyncIterator",name:"indexed",proto:!0,real:!0,forced:!0},{asIndexedPairs:e(524)})},function(t,r,e){var n=e(8),o=e(525),callback=function(t,r){return[r,t]};t.exports=function indexed(){return n(o,this,callback)}},function(r,e,n){var o=n(8),i=n(31),a=n(47),u=n(20),c=n(494),f=n(526),s=n(173),l=n(496),h=f(function(r){var e=this,n=e.iterator,i=e.mapper;return new r(function(c,f){var doneAndReject=function(t){e.done=!0,f(t)},ifAbruptCloseAsyncIterator=function(t){l(n,doneAndReject,t,doneAndReject)};r.resolve(a(o(e.next,n))).then(function(n){var o,f,l;try{if(a(n).done)e.done=!0,c(s(t,!0));else{o=n.value;try{f=i(o,e.counter++),l=function(t){c(s(t,!1))},u(f)?r.resolve(f).then(l,ifAbruptCloseAsyncIterator):l(f)}catch(h){ifAbruptCloseAsyncIterator(h)}}}catch(p){doneAndReject(p)}},doneAndReject)})});r.exports=function map(t){return a(this),i(t),new h(c(this),{mapper:t})}},function(r,e,n){var o=n(8),i=n(335),a=n(47),u=n(72),c=n(44),f=n(210),s=n(34),l=n(52),h=n(24),p=n(30),g=n(493),v=n(173),d=n(137),y=h("Promise"),m=s("toStringTag"),b="AsyncIteratorHelper",x="WrapForValidAsyncIterator",w=l.set,createAsyncIteratorProxyPrototype=function(r){var e=!r,n=l.getterFor(r?x:b),getStateOrEarlyExit=function(r){var o=i(function(){return n(r)}),a=o.error,u=o.value;return a||e&&u.done?{exit:!0,value:a?y.reject(u):y.resolve(v(t,!0))}:{exit:!1,value:u}};return f(u(g),{next:function next(){var t,r,e,n=getStateOrEarlyExit(this),o=n.value;return n.exit?o:(e=(t=i(function(){return a(o.nextHandler(y))})).value,(r=t.error)&&(o.done=!0),r?y.reject(e):y.resolve(e))},"return":function(){var e,n,u,c,f=getStateOrEarlyExit(this),s=f.value;return f.exit?s:(s.done=!0,e=s.iterator,c=i(function(){if(s.inner)try{d(s.inner.iterator,"normal")}catch(t){return d(e,"throw",t)}return p(e,"return")}),n=u=c.value,c.error?y.reject(u):n===t?y.resolve(v(t,!0)):(u=(c=i(function(){return o(n,e)})).value,c.error?y.reject(u):r?y.resolve(u):y.resolve(u).then(function(r){return a(r),v(t,!0)})))}})},S=createAsyncIteratorProxyPrototype(!0),A=createAsyncIteratorProxyPrototype(!1);c(A,m,"Async Iterator Helper"),r.exports=function(t,r){var e=function AsyncIterator(e,n){n?(n.iterator=e.iterator,n.next=e.next):n=e,n.type=r?x:b,n.nextHandler=t,n.counter=0,n.done=!1,w(this,n)};return e.prototype=r?S:A,e}},function(r,e,n){var o=n(8),i=n(48),a=n(24),u=n(30),c=n(39),f=n(34),s=n(493),l=f("asyncDispose"),h=a("Promise");c(s,l)||i(s,l,function(){var r=this;return new h(function(e,n){var i=u(r,"return");i?h.resolve(o(i,r)).then(function(){e(t)},n):e(t)})})},function(r,e,n){var o=n(3),i=n(8),a=n(47),u=n(494),c=n(529),f=n(437),s=n(526),l=n(173),h=s(function(r){var e=this;return new r(function(n,o){var doneAndReject=function(t){e.done=!0,o(t)},loop=function(){try{r.resolve(a(i(e.next,e.iterator))).then(function(r){try{a(r).done?(e.done=!0,n(l(t,!0))):e.remaining?(e.remaining--,loop()):n(l(r.value,!1))}catch(o){doneAndReject(o)}},doneAndReject)}catch(o){doneAndReject(o)}};loop()})});o({target:"AsyncIterator",proto:!0,real:!0},{drop:function drop(t){a(this);var r=f(c(+t));return new h(u(this),{remaining:r})}})},function(t,r){var e=RangeError;t.exports=function(t){if(t==t)return t;throw e("NaN is not allowed")}},function(t,r,e){var n=e(3),o=e(495).every;n({target:"AsyncIterator",proto:!0,real:!0},{every:function every(t){return o(this,t)}})},function(r,e,n){var o=n(3),i=n(8),a=n(31),u=n(47),c=n(20),f=n(494),s=n(526),l=n(173),h=n(496),p=s(function(r){var e=this,n=e.iterator,o=e.predicate;return new r(function(a,f){var doneAndReject=function(t){e.done=!0,f(t)},ifAbruptCloseAsyncIterator=function(t){h(n,doneAndReject,t,doneAndReject)},loop=function(){try{r.resolve(u(i(e.next,n))).then(function(n){var i,f,s;try{if(u(n).done)e.done=!0,a(l(t,!0));else{i=n.value;try{f=o(i,e.counter++),s=function(t){t?a(l(i,!1)):loop()},c(f)?r.resolve(f).then(s,ifAbruptCloseAsyncIterator):s(f)}catch(h){ifAbruptCloseAsyncIterator(h)}}}catch(p){doneAndReject(p)}},doneAndReject)}catch(f){doneAndReject(f)}};loop()})});o({target:"AsyncIterator",proto:!0,real:!0},{filter:function filter(t){return u(this),a(t),new p(f(this),{predicate:t})}})},function(t,r,e){var n=e(3),o=e(495).find;n({target:"AsyncIterator",proto:!0,real:!0},{find:function find(t){return o(this,t)}})},function(r,e,n){var o=n(3),i=n(8),a=n(31),u=n(47),c=n(20),f=n(494),s=n(526),l=n(173),h=n(534),p=n(496),g=s(function(r){var e=this,n=e.iterator,o=e.mapper;return new r(function(a,f){var doneAndReject=function(t){e.done=!0,f(t)},ifAbruptCloseAsyncIterator=function(t){p(n,doneAndReject,t,doneAndReject)},outerLoop=function(){try{r.resolve(u(i(e.next,n))).then(function(n){var i,f,s;try{if(u(n).done)e.done=!0,a(l(t,!0));else{i=n.value;try{f=o(i,e.counter++),s=function(t){try{e.inner=h(t),innerLoop()}catch(r){ifAbruptCloseAsyncIterator(r)}},c(f)?r.resolve(f).then(s,ifAbruptCloseAsyncIterator):s(f)}catch(p){ifAbruptCloseAsyncIterator(p)}}}catch(g){doneAndReject(g)}},doneAndReject)}catch(f){doneAndReject(f)}},innerLoop=function(){var t=e.inner;if(t)try{r.resolve(u(i(t.next,t.iterator))).then(function(t){try{u(t).done?(e.inner=null,outerLoop()):a(l(t.value,!1))}catch(r){ifAbruptCloseAsyncIterator(r)}},ifAbruptCloseAsyncIterator)}catch(n){ifAbruptCloseAsyncIterator(n)}else outerLoop()};innerLoop()})});o({target:"AsyncIterator",proto:!0,real:!0},{flatMap:function flatMap(t){return u(this),a(t),new g(f(this),{mapper:t,inner:null})}})},function(r,e,n){var o=n(8),i=n(21),a=n(47),u=n(494),c=n(136),f=n(30),s=n(34),l=n(492),h=s("asyncIterator");r.exports=function from(r){var e,n=a(r),s=!0,p=f(n,h);return i(p)||(p=c(n),s=!1),p!==t?e=o(p,n):(e=n,s=!0),a(e),u(s?e:new l(u(e)))}},function(t,r,e){var n=e(3),o=e(495).forEach;n({target:"AsyncIterator",proto:!0,real:!0},{forEach:function forEach(t){return o(this,t)}})},function(t,r,e){var n=e(3),o=e(40),i=e(25),a=e(534),u=e(493),c=e(537);n({target:"AsyncIterator",stat:!0},{from:function from(t){var r=a("string"==typeof t?o(t):t);return i(u,r.iterator)?r.iterator:new c(r)}})},function(t,r,e){var n=e(8),o=e(526);t.exports=o(function(){return n(this.next,this.iterator)},!0)},function(t,r,e){e(3)({target:"AsyncIterator",proto:!0,real:!0,forced:!0},{indexed:e(524)})},function(t,r,e){e(3)({target:"AsyncIterator",proto:!0,real:!0},{map:e(525)})},function(r,e,n){var o=n(3),i=n(8),a=n(31),u=n(47),c=n(20),f=n(24),s=n(494),l=n(496),h=f("Promise"),p=TypeError;o({target:"AsyncIterator",proto:!0,real:!0},{reduce:function reduce(r){var e,n,o,f,g,v;return u(this),a(r),e=s(this),n=e.iterator,o=e.next,g=(f=arguments.length<2)?t:arguments[1],v=0,new h(function(t,e){var ifAbruptCloseAsyncIterator=function(t){l(n,e,t,e)},loop=function(){try{h.resolve(u(i(o,n))).then(function(n){var o,i,a;try{if(u(n).done)f?e(p("Reduce of empty iterator with no initial value")):t(g);else if(o=n.value,f)f=!1,g=o,loop();else try{i=r(g,o,v),a=function(t){g=t,loop()},c(i)?h.resolve(i).then(a,ifAbruptCloseAsyncIterator):a(i)}catch(s){ifAbruptCloseAsyncIterator(s)}v++}catch(l){e(l)}},e)}catch(a){e(a)}};loop()})}})},function(t,r,e){var n=e(3),o=e(495).some;n({target:"AsyncIterator",proto:!0,real:!0},{some:function some(t){return o(this,t)}})},function(r,e,n){var o=n(3),i=n(8),a=n(47),u=n(494),c=n(529),f=n(437),s=n(526),l=n(173),h=s(function(r){var e,n,o=this,u=o.iterator;return o.remaining--?r.resolve(i(o.next,u)).then(function(r){return a(r).done?(o.done=!0,l(t,!0)):l(r.value,!1)}).then(null,function(t){throw o.done=!0,t}):(n=l(t,!0),o.done=!0,(e=u["return"])!==t?r.resolve(i(e,u,t)).then(function(){return n}):n)});o({target:"AsyncIterator",proto:!0,real:!0},{take:function take(t){a(this);var r=f(c(+t));return new h(u(this),{remaining:r})}})},function(r,e,n){var o=n(3),i=n(495).toArray;o({target:"AsyncIterator",proto:!0,real:!0},{toArray:function toArray(){return i(this,t,[])}})},function(t,r,e){var n=e(3),o=e(545);"function"==typeof BigInt&&n({target:"BigInt",stat:!0,forced:!0},{range:function range(t,r,e){return new o(t,r,e,"bigint",BigInt(0),BigInt(1))}})},function(r,e,n){var o=n(52),i=n(171),a=n(173),u=n(17),c=n(20),f=n(79),s=n(6),l="Incorrect Iterator.range arguments",h="NumericRangeIterator",p=o.set,g=o.getterFor(h),v=RangeError,d=TypeError,y=i(function NumericRangeIterator(r,e,n,o,i,a){var f,g,y;if(typeof r!=o||e!==Infinity&&e!==-Infinity&&typeof e!=o)throw d(l);if(r===Infinity||r===-Infinity)throw v(l);if(f=e>r,g=!1,n===t)y=t;else if(c(n))y=n.step,g=!!n.inclusive;else{if(typeof n!=o)throw d(l);y=n}if(u(y)&&(y=f?a:-a),typeof y!=o)throw d(l);if(y===Infinity||y===-Infinity||y===i&&r!==e)throw v(l);p(this,{type:h,start:r,end:e,step:y,inclusive:g,hitsEnd:r!=r||e!=e||y!=y||e>r!=y>i,currentCount:i,zero:i}),s||(this.start=r,this.end=e,this.step=y,this.inclusive=g)},h,function next(){var r,e,n,o,i=g(this);return i.hitsEnd?a(t,!0):(e=i.end,(n=(r=i.start)+i.step*i.currentCount++)===e&&(i.hitsEnd=!0),o=i.inclusive,(e>r?o?n>e:n>=e:o?e>n:e>=n)?(i.hitsEnd=!0,a(t,!0)):a(n,!1))}),addGetter=function(t){f(y.prototype,t,{get:function(){return g(this)[t]},set:function(){},configurable:!0,enumerable:!1})};s&&(addGetter("start"),addGetter("end"),addGetter("inclusive"),addGetter("step")),r.exports=y},function(t,r,e){var n=e(3),o=e(96),i=e(547),a=e(24),u=e(72),c=Object,initializer=function(){var t=a("Object","freeze");return t?t(u(null)):u(null)};n({global:!0,forced:!0},{compositeKey:function compositeKey(){return o(i,c,arguments).get("object",initializer)}})},function(t,r,e){var n,o,i,a,u,c,f,s,l;e(240),e(483),n=e(24),o=e(72),i=e(20),a=Object,u=TypeError,c=n("Map"),f=n("WeakMap"),(s=function(){this.object=null,this.symbol=null,this.primitives=null,this.objectsByIndex=o(null)}).prototype.get=function(t,r){return this[t]||(this[t]=r())},s.prototype.next=function(t,r,e){var n=e?this.objectsByIndex[t]||(this.objectsByIndex[t]=new f):this.primitives||(this.primitives=new c),o=n.get(r);return o||n.set(r,o=new s),o},l=new s,t.exports=function(){var t,r,e=l,n=arguments.length;for(t=0;t1?arguments[1]:t);return!1!==u(e,function(t,r){if(!n(t,r,e))return!1},!0)}})},function(r,e,n){var o=n(3),i=n(86),a=n(585),u=n(504),c=n(511),f=u.Map,s=u.set;o({target:"Map",proto:!0,real:!0,forced:!0},{filter:function filter(r){var e=a(this),n=i(r,arguments.length>1?arguments[1]:t),o=new f;return c(e,function(t,r){n(t,r,e)&&s(o,r,t)}),o}})},function(r,e,n){var o=n(3),i=n(86),a=n(585),u=n(511);o({target:"Map",proto:!0,real:!0,forced:!0},{find:function find(r){var e=a(this),n=i(r,arguments.length>1?arguments[1]:t),o=u(e,function(t,r){if(n(t,r,e))return{value:t}},!0);return o&&o.value}})},function(r,e,n){var o=n(3),i=n(86),a=n(585),u=n(511);o({target:"Map",proto:!0,real:!0,forced:!0},{findKey:function findKey(r){var e=a(this),n=i(r,arguments.length>1?arguments[1]:t),o=u(e,function(t,r){if(n(t,r,e))return{key:r}},!0);return o&&o.key}})},function(t,r,e){e(3)({target:"Map",stat:!0,forced:!0},{from:e(592)})},function(r,e,n){var o=n(86),i=n(8),a=n(31),u=n(218),c=n(17),f=n(132),s=[].push;r.exports=function from(r){var e,n,l,h,p=arguments.length,g=p>1?arguments[1]:t;return u(this),(e=g!==t)&&a(g),c(r)?new this:(n=[],e?(l=0,h=o(g,p>2?arguments[2]:t),f(r,function(t){i(s,n,h(t,l++))})):f(r,s,{that:n}),new this(n))}},function(t,r,e){var n=e(3),o=e(14),i=e(31),a=e(16),u=e(132),c=e(504),f=c.Map,s=c.has,l=c.get,h=c.set,p=o([].push);n({target:"Map",stat:!0,forced:!0},{groupBy:function groupBy(t,r){var e,n;return a(t),i(r),e=new f,n=0,u(t,function(t){var o=r(t,n++);s(e,o)?p(l(e,o),t):h(e,o,[t])}),e}})},function(t,r,e){var n=e(3),o=e(595),i=e(585),a=e(511);n({target:"Map",proto:!0,real:!0,forced:!0},{includes:function includes(t){return!0===a(i(this),function(r){if(o(r,t))return!0},!0)}})},function(t,r){t.exports=function(t,r){return t===r||t!=t&&r!=r}},function(t,r,e){var n=e(3),o=e(8),i=e(132),a=e(21),u=e(31),c=e(504).Map;n({target:"Map",stat:!0,forced:!0},{keyBy:function keyBy(t,r){var e,n=new(a(this)?this:c);return u(r),e=u(n.set),i(t,function(t){o(e,n,r(t),t)}),n}})},function(t,r,e){var n=e(3),o=e(585),i=e(511);n({target:"Map",proto:!0,real:!0,forced:!0},{keyOf:function keyOf(t){var r=i(o(this),function(r,e){if(r===t)return{key:e}},!0);return r&&r.key}})},function(r,e,n){var o=n(3),i=n(86),a=n(585),u=n(504),c=n(511),f=u.Map,s=u.set;o({target:"Map",proto:!0,real:!0,forced:!0},{mapKeys:function mapKeys(r){var e=a(this),n=i(r,arguments.length>1?arguments[1]:t),o=new f;return c(e,function(t,r){s(o,n(t,r,e),t)}),o}})},function(r,e,n){var o=n(3),i=n(86),a=n(585),u=n(504),c=n(511),f=u.Map,s=u.set;o({target:"Map",proto:!0,real:!0,forced:!0},{mapValues:function mapValues(r){var e=a(this),n=i(r,arguments.length>1?arguments[1]:t),o=new f;return c(e,function(t,r){s(o,r,n(t,r,e))}),o}})},function(t,r,e){var n=e(3),o=e(585),i=e(132),a=e(504).set;n({target:"Map",proto:!0,real:!0,arity:1,forced:!0},{merge:function merge(t){for(var r=o(this),e=arguments.length,n=0;n1?arguments[1]:t);return!0===u(e,function(t,r){if(n(t,r,e))return!0},!0)}})},function(r,e,n){var o=n(3),i=n(31),a=n(585),u=n(504),c=TypeError,f=u.get,s=u.has,l=u.set;o({target:"Map",proto:!0,real:!0,forced:!0},{update:function update(r,e){var n,o,u=a(this),h=arguments.length;if(i(e),!(n=s(u,r))&&h<3)throw c("Updating absent value");return o=n?f(u,r):i(h>2?arguments[2]:t)(r,u),l(u,r,e(o,r,u)),u}})},function(t,r,e){e(3)({target:"Map",proto:!0,real:!0,name:"upsert",forced:!0},{updateOrInsert:e(607)})},function(r,e,n){var o=n(8),i=n(31),a=n(21),u=n(47),c=TypeError;r.exports=function upsert(r,e){var n,f=u(this),s=i(f.get),l=i(f.has),h=i(f.set),p=arguments.length>2?arguments[2]:t;if(!a(e)&&!a(p))throw c("At least one callback required");return o(l,f,r)?(n=o(s,f,r),a(e)&&(n=e(n),o(h,f,r,n))):a(p)&&(n=p(),o(h,f,r,n)),n}},function(t,r,e){e(3)({target:"Map",proto:!0,real:!0,forced:!0},{upsert:e(607)})},function(t,r,e){var n=e(3),o=Math.min,i=Math.max;n({target:"Math",stat:!0,forced:!0},{clamp:function clamp(t,r,e){return o(e,i(r,t))}})},function(t,r,e){e(3)({target:"Math",stat:!0,nonConfigurable:!0,nonWritable:!0},{DEG_PER_RAD:Math.PI/180})},function(t,r,e){var n=e(3),o=180/Math.PI;n({target:"Math",stat:!0,forced:!0},{degrees:function degrees(t){return t*o}})},function(t,r,e){var n=e(3),o=e(613),i=e(259);n({target:"Math",stat:!0,forced:!0},{fscale:function fscale(t,r,e,n,a){return i(o(t,r,e,n,a))}})},function(t,r){t.exports=Math.scale||function scale(t,r,e,n,o){var i=+t,a=+r,u=+e,c=+n,f=+o;return i!=i||a!=a||u!=u||c!=c||f!=f?NaN:i===Infinity||i===-Infinity?i:(i-a)*(f-c)/(u-a)+c}},function(t,r,e){e(3)({target:"Math",stat:!0,forced:!0},{iaddh:function iaddh(t,r,e,n){var o=t>>>0,i=e>>>0;return(r>>>0)+(n>>>0)+((o&i|(o|i)&~(o+i>>>0))>>>31)|0}})},function(t,r,e){e(3)({target:"Math",stat:!0,forced:!0},{imulh:function imulh(t,r){var e=65535,n=+t,o=+r,i=n&e,a=o&e,u=n>>16,c=o>>16,f=(u*a>>>0)+(i*a>>>16);return u*c+(f>>16)+((i*c>>>0)+(f&e)>>16)}})},function(t,r,e){e(3)({target:"Math",stat:!0,forced:!0},{isubh:function isubh(t,r,e,n){var o=t>>>0,i=e>>>0;return(r>>>0)-(n>>>0)-((~o&i|~(o^i)&o-i>>>0)>>>31)|0}})},function(t,r,e){e(3)({target:"Math",stat:!0,nonConfigurable:!0,nonWritable:!0},{RAD_PER_DEG:180/Math.PI})},function(t,r,e){var n=e(3),o=Math.PI/180;n({target:"Math",stat:!0,forced:!0},{radians:function radians(t){return t*o}})},function(t,r,e){e(3)({target:"Math",stat:!0,forced:!0},{scale:e(613)})},function(t,r,e){var n=e(3),o=e(47),i=e(277),a=e(171),u=e(173),c=e(52),f="Seeded Random",s=f+" Generator",l=c.set,h=c.getterFor(s),p=TypeError,g=a(function SeededRandomGenerator(t){l(this,{type:s,seed:t%2147483647})},f,function next(){var t=h(this),r=t.seed=(1103515245*t.seed+12345)%2147483647;return u((1073741823&r)/1073741823,!1)});n({target:"Math",stat:!0,forced:!0},{seededPRNG:function seededPRNG(t){var r=o(t).seed;if(!i(r))throw p('Math.seededPRNG() argument should have a "seed" field with a finite value.');return new g(r)}})},function(t,r,e){e(3)({target:"Math",stat:!0,forced:!0},{signbit:function signbit(t){var r=+t;return r==r&&0==r?1/r==-Infinity:r<0}})},function(t,r,e){e(3)({target:"Math",stat:!0,forced:!0},{umulh:function umulh(t,r){var e=65535,n=+t,o=+r,i=n&e,a=o&e,u=n>>>16,c=o>>>16,f=(u*a>>>0)+(i*a>>>16);return u*c+(f>>>16)+((i*c>>>0)+(f&e)>>>16)}})},function(r,e,n){var o=n(3),i=n(14),a=n(62),u=n(287),c="Invalid number representation",f=RangeError,s=SyntaxError,l=TypeError,h=/^[\da-z]+$/,p=i("".charAt),g=i(h.exec),v=i(1..toString),d=i("".slice);o({target:"Number",stat:!0,forced:!0},{fromString:function fromString(r,e){var n,o,i=1;if("string"!=typeof r)throw l(c);if(!r.length)throw s(c);if("-"==p(r,0)&&(i=-1,!(r=d(r,1)).length))throw s(c);if((n=e===t?10:a(e))<2||n>36)throw f("Invalid radix");if(!g(h,r)||v(o=u(r,n),n)!==r)throw s(c);return i*o}})},function(t,r,e){var n=e(3),o=e(545);n({target:"Number",stat:!0,forced:!0},{range:function range(t,r,e){return new o(t,r,e,"number",0,1)}})},function(t,r,e){var n=e(3),o=e(626);n({target:"Object",stat:!0,forced:!0},{iterateEntries:function iterateEntries(t){return new o(t,"entries")}})},function(r,e,n){var o=n(52),i=n(171),a=n(173),u=n(39),c=n(74),f=n(40),s="Object Iterator",l=o.set,h=o.getterFor(s);r.exports=i(function ObjectIterator(t,r){var e=f(t);l(this,{type:s,mode:r,object:e,keys:c(e),index:0})},"Object",function next(){for(var r,e,n=h(this),o=n.keys;;){if(null===o||n.index>=o.length)return n.object=n.keys=null,a(t,!0);if(r=o[n.index++],u(e=n.object,r)){switch(n.mode){case"keys":return a(r,!1);case"values":return a(e[r],!1)}return a([r,e[r]],!1)}}})},function(t,r,e){var n=e(3),o=e(626);n({target:"Object",stat:!0,forced:!0},{iterateKeys:function iterateKeys(t){return new o(t,"keys")}})},function(t,r,e){var n=e(3),o=e(626);n({target:"Object",stat:!0,forced:!0},{iterateValues:function iterateValues(t){return new o(t,"values")}})},function(t,r,e){var n=e(3),o=e(24),i=e(14),a=e(31),u=e(16),c=e(18),f=e(132),s=o("Object","create"),l=i([].push);n({target:"Object",stat:!0,forced:!0},{groupBy:function groupBy(t,r){var e,n;return u(t),a(r),e=s(null),n=0,f(t,function(t){var o=c(r(t,n++));o in e?l(e[o],t):e[o]=[t]}),e}})},function(t,r,e){e(631),e(633),e(634)},function(r,e,n){var o,i,a,u,c=n(3),f=n(8),s=n(6),l=n(194),h=n(31),p=n(47),g=n(211),v=n(21),d=n(17),y=n(20),m=n(30),b=n(48),x=n(210),w=n(79),S=n(334),A=n(34),E=n(52),O=n(632),I=A("observable"),R="Observable",M="Subscription",T="SubscriptionObserver",k=E.getterFor,P=E.set,j=k(R),C=k(M),N=k(T),SubscriptionState=function(r){this.observer=p(r),this.cleanup=t,this.subscriptionObserver=t};SubscriptionState.prototype={type:M,clean:function(){var r=this.cleanup;if(r){this.cleanup=t;try{r()}catch(e){S(e)}}},close:function(){var r;s||(r=this.subscriptionObserver,this.facade.closed=!0,r&&(r.closed=!0)),this.observer=t},isClosed:function(){return this.observer===t}},(o=function(t,r){var e,n,o,a,u=P(this,new SubscriptionState(t));s||(this.closed=!1);try{(e=m(t,"start"))&&f(e,t,this)}catch(c){S(c)}if(!u.isClosed()){n=u.subscriptionObserver=new i(u);try{o=r(n),a=o,d(o)||(u.cleanup=v(o.unsubscribe)?function(){a.unsubscribe()}:h(o))}catch(c){return void n.error(c)}u.isClosed()&&u.clean()}}).prototype=x({},{unsubscribe:function unsubscribe(){var t=C(this);t.isClosed()||(t.close(),t.clean())}}),s&&w(o.prototype,"closed",{configurable:!0,get:function closed(){return C(this).isClosed()}}),(i=function(t){P(this,{type:T,subscriptionState:t}),s||(this.closed=!1)}).prototype=x({},{next:function next(t){var r,e,n=N(this).subscriptionState;if(!n.isClosed()){r=n.observer;try{(e=m(r,"next"))&&f(e,r,t)}catch(o){S(o)}}},error:function error(t){var r,e,n=N(this).subscriptionState;if(!n.isClosed()){r=n.observer,n.close();try{(e=m(r,"error"))?f(e,r,t):S(t)}catch(o){S(o)}n.clean()}},complete:function complete(){var t,r,e=N(this).subscriptionState;if(!e.isClosed()){t=e.observer,e.close();try{(r=m(t,"complete"))&&f(r,t)}catch(n){S(n)}e.clean()}}}),s&&w(i.prototype,"closed",{configurable:!0,get:function closed(){return N(this).subscriptionState.isClosed()}}),x(u=(a=function Observable(t){g(this,u),P(this,{type:R,subscriber:h(t)})}).prototype,{subscribe:function subscribe(r){var e=arguments.length;return new o(v(r)?{next:r,error:e>1?arguments[1]:t,complete:e>2?arguments[2]:t}:y(r)?r:{},j(this).subscriber)}}),b(u,I,function(){return this}),c({global:!0,constructor:!0,forced:O},{Observable:a}),l(R)},function(t,r,e){var n=e(4),o=e(21),i=e(34)("observable"),a=n.Observable,u=a&&a.prototype;t.exports=!(o(a)&&o(a.from)&&o(a.of)&&o(u.subscribe)&&o(u[i]))},function(t,r,e){var n=e(3),o=e(24),i=e(8),a=e(47),u=e(91),c=e(135),f=e(30),s=e(132),l=e(34),h=e(632),p=l("observable");n({target:"Observable",stat:!0,forced:h},{from:function from(t){var r,e,n=u(this)?this:o("Observable"),l=f(a(t),p);return l?(r=a(i(l,t))).constructor===n?r:new n(function(t){return r.subscribe(t)}):(e=c(t),new n(function(t){s(e,function(r,e){if(t.next(r),t.closed)return e()},{IS_ITERATOR:!0,INTERRUPTED:!0}),t.complete()}))}})},function(t,r,e){var n=e(3),o=e(24),i=e(91),a=e(632),u=o("Array");n({target:"Observable",stat:!0,forced:a},{of:function of(){for(var t=i(this)?this:o("Observable"),r=arguments.length,e=u(r),n=0;n1?arguments[1]:t);return!1!==u(e,function(t){if(!n(t,t,e))return!1},!0)}})},function(r,e,n){var o=n(3),i=n(86),a=n(648),u=n(649),c=n(654),f=u.Set,s=u.add;o({target:"Set",proto:!0,real:!0,forced:!0},{filter:function filter(r){var e=a(this),n=i(r,arguments.length>1?arguments[1]:t),o=new f;return c(e,function(t){n(t,t,e)&&s(o,t)}),o}})},function(r,e,n){var o=n(3),i=n(86),a=n(648),u=n(654);o({target:"Set",proto:!0,real:!0,forced:!0},{find:function find(r){var e=a(this),n=i(r,arguments.length>1?arguments[1]:t),o=u(e,function(t){if(n(t,t,e))return{value:t}},!0);return o&&o.value}})},function(t,r,e){e(3)({target:"Set",stat:!0,forced:!0},{from:e(592)})},function(t,r,e){var n=e(3),o=e(7),i=e(666);n({target:"Set",proto:!0,real:!0,forced:!e(657)("intersection")||o(function(){return"3,2"!=Array.from(new Set([1,2,3]).intersection(new Set([3,2])))})},{intersection:i})},function(t,r,e){var n=e(648),o=e(649),i=e(655),a=e(656),u=e(654),c=e(512),f=o.Set,s=o.add,l=o.has;t.exports=function intersection(t){var r=n(this),e=a(t),o=new f;return i(r)>e.size?c(e.getIterator(),function(t){l(r,t)&&s(o,t)}):u(r,function(t){e.includes(t)&&s(o,t)}),o}},function(t,r,e){var n=e(3),o=e(8),i=e(659),a=e(666);n({target:"Set",proto:!0,real:!0,forced:!0},{intersection:function intersection(t){return o(a,this,i(t))}})},function(t,r,e){var n=e(3),o=e(669);n({target:"Set",proto:!0,real:!0,forced:!e(657)("isDisjointFrom")},{isDisjointFrom:o})},function(t,r,e){var n=e(648),o=e(649).has,i=e(655),a=e(656),u=e(654),c=e(512),f=e(137);t.exports=function isDisjointFrom(t){var r,e=n(this),s=a(t);return i(e)<=s.size?!1!==u(e,function(t){if(s.includes(t))return!1},!0):(r=s.getIterator(),!1!==c(r,function(t){if(o(e,t))return f(r,"normal",!1)}))}},function(t,r,e){var n=e(3),o=e(8),i=e(659),a=e(669);n({target:"Set",proto:!0,real:!0,forced:!0},{isDisjointFrom:function isDisjointFrom(t){return o(a,this,i(t))}})},function(t,r,e){var n=e(3),o=e(672);n({target:"Set",proto:!0,real:!0,forced:!e(657)("isSubsetOf")},{isSubsetOf:o})},function(t,r,e){var n=e(648),o=e(655),i=e(654),a=e(656);t.exports=function isSubsetOf(t){var r=n(this),e=a(t);return!(o(r)>e.size)&&!1!==i(r,function(t){if(!e.includes(t))return!1},!0)}},function(t,r,e){var n=e(3),o=e(8),i=e(659),a=e(672);n({target:"Set",proto:!0,real:!0,forced:!0},{isSubsetOf:function isSubsetOf(t){return o(a,this,i(t))}})},function(t,r,e){var n=e(3),o=e(675);n({target:"Set",proto:!0,real:!0,forced:!e(657)("isSupersetOf")},{isSupersetOf:o})},function(t,r,e){var n=e(648),o=e(649).has,i=e(655),a=e(656),u=e(512),c=e(137);t.exports=function isSupersetOf(t){var r,e=n(this),f=a(t);return!(i(e)1?arguments[1]:t),o=new f;return c(e,function(t){s(o,n(t,t,e))}),o}})},function(t,r,e){e(3)({target:"Set",stat:!0,forced:!0},{of:e(602)})},function(r,e,n){ +var o=n(3),i=n(31),a=n(648),u=n(654),c=TypeError;o({target:"Set",proto:!0,real:!0,forced:!0},{reduce:function reduce(r){var e=a(this),n=arguments.length<2,o=n?t:arguments[1];if(i(r),u(e,function(t){n?(n=!1,o=t):o=r(o,t,t,e)}),n)throw c("Reduce of empty set with no initial value");return o}})},function(r,e,n){var o=n(3),i=n(86),a=n(648),u=n(654);o({target:"Set",proto:!0,real:!0,forced:!0},{some:function some(r){var e=a(this),n=i(r,arguments.length>1?arguments[1]:t);return!0===u(e,function(t){if(n(t,t,e))return!0},!0)}})},function(t,r,e){var n=e(3),o=e(683);n({target:"Set",proto:!0,real:!0,forced:!e(657)("symmetricDifference")},{symmetricDifference:o})},function(t,r,e){var n=e(648),o=e(649),i=e(653),a=e(656),u=e(512),c=o.add,f=o.has,s=o.remove;t.exports=function symmetricDifference(t){var r=n(this),e=a(t).getIterator(),o=i(r);return u(e,function(t){f(r,t)?s(o,t):c(o,t)}),o}},function(t,r,e){var n=e(3),o=e(8),i=e(659),a=e(683);n({target:"Set",proto:!0,real:!0,forced:!0},{symmetricDifference:function symmetricDifference(t){return o(a,this,i(t))}})},function(t,r,e){var n=e(3),o=e(686);n({target:"Set",proto:!0,real:!0,forced:!e(657)("union")},{union:o})},function(t,r,e){var n=e(648),o=e(649).add,i=e(653),a=e(656),u=e(512);t.exports=function union(t){var r=n(this),e=a(t).getIterator(),c=i(r);return u(e,function(t){o(c,t)}),c}},function(t,r,e){var n=e(3),o=e(8),i=e(659),a=e(686);n({target:"Set",proto:!0,real:!0,forced:!0},{union:function union(t){return o(a,this,i(t))}})},function(r,e,n){var o=n(3),i=n(384).charAt,a=n(16),u=n(62),c=n(69);o({target:"String",proto:!0,forced:!0},{at:function at(r){var e=c(a(this)),n=e.length,o=u(r),f=o>=0?o:n+o;return f<0||f>=n?t:i(e,f)}})},function(t,r,e){e(3)({target:"String",stat:!0,forced:!0},{cooked:e(690)})},function(r,e,n){var o=n(14),i=n(12),a=n(69),u=n(64),c=TypeError,f=o([].push),s=o([].join);r.exports=function cooked(r){var e,n,o,l,h=i(r),p=u(h);if(!p)return"";for(e=arguments.length,n=[],o=0;;){if((l=h[o++])===t)throw c("Incorrect template");if(f(n,a(l)),o===p)return s(n,"");o=n.length?a(t,!0):(r=h(n,o),e.index+=r.length,a({codePoint:l(r,0),position:o},!1))});o({target:"String",proto:!0,forced:!0},{codePoints:function codePoints(){return new d(c(u(this)))}})},function(r,e,n){var o,i,a,u,c,f,s,l,h,p,g,v,d,y,m,b,x,w,S,A=n(246),E=n(3),O=n(35),I=n(24),R=n(49),M=n(14),T=n(96),k=n(47),P=n(40),j=n(21),C=n(64),N=n(45).f,D=n(77),_=n(690),U=n(693),L=n(274),B=O("GlobalDedentRegistry",new(I("WeakMap")));B.has=B.has,B.get=B.get,B.set=B.set,o=Array,i=TypeError,a=Object.freeze||Object,u=Object.isFrozen,c=Math.min,f=M("".charAt),s=M("".slice),l=M("".split),h=M(/./.exec),p=/([\n\u2028\u2029]|\r\n?)/g,g=RegExp("^["+L+"]*"),v=RegExp("[^"+L+"]"),d="Invalid tag",y=function(t){var r,e,n=t.raw;if(A&&!u(n))throw i("Raw template should be frozen");return B.has(n)?B.get(n):(r=m(n),e=x(r),N(e,"raw",{value:a(r)}),a(e),B.set(n,e),e)},m=function(t){var r,e,n,a,u,c,f,y,m,x,w,S=P(t),A=C(S),E=o(A),O=o(A),I=0;if(!A)throw i(d);for(;I0)throw i("Invalid opening line");r[1]=""}if(a){if(1===r.length||h(v,r[r.length-1]))throw i("Invalid closing line");r[r.length-2]="",r[r.length-1]=""}for(u=2;u=48&&e<=57},parseHex=function(t,r,e){var n,o;if(e>=t.length)return-1;for(n=0;r=48&&t<=57?t-48:t>=97&&t<=102?t-97+10:t>=65&&t<=70?t-65+10:-1};t.exports=function(t){for(var r,e,n,o="",c=0,l=0;(l=f(t,"\\",l))>-1;){if(o+=s(t,c,l),++l===t.length)return;switch(e=u(t,l++)){case"b":o+="\b";break;case"t":o+="\t";break;case"n":o+="\n";break;case"v":o+="\x0B";break;case"f":o+="\f";break;case"r":o+="\r";break;case"\r":l1114111)return;o+=a(r);break;default:if(isDigit(e,0))return;o+=e}c=l}return o+s(t,c)}},function(t,r,e){e(81)("asyncDispose")},function(t,r,e){e(81)("dispose")},function(t,r,e){e(3)({target:"Symbol",stat:!0},{isRegisteredSymbol:e(697)})},function(r,e,n){var o=n(24),i=n(14),a=o("Symbol"),u=a.keyFor,c=i(a.prototype.valueOf);r.exports=a.isRegisteredSymbol||function isRegisteredSymbol(r){try{return u(c(r))!==t}catch(e){return!1}}},function(t,r,e){e(3)({target:"Symbol",stat:!0,name:"isRegisteredSymbol"},{isRegistered:e(697)})},function(t,r,e){e(3)({target:"Symbol",stat:!0,forced:!0},{isWellKnownSymbol:e(700)})},function(t,r,e){var n,o,i,a,u=e(35),c=e(24),f=e(14),s=e(23),l=e(34),h=c("Symbol"),p=h.isWellKnownSymbol,g=c("Object","getOwnPropertyNames"),v=f(h.prototype.valueOf),d=u("wks");for(n=0,i=(o=g(h)).length;n1?arguments[1]:t,s=n>2?arguments[2]:t;return new(o("Promise"))(function(t){i(e),t(a(r,u,s))}).then(function(t){return c(f(e),t)})},!0)},function(r,e,n){var o=n(215),i=n(85).filterReject,a=n(454),u=o.aTypedArray;(0,o.exportTypedArrayMethod)("filterOut",function filterOut(r){var e=i(u(this),r,arguments.length>1?arguments[1]:t);return a(this,e)},!0)},function(r,e,n){var o=n(215),i=n(85).filterReject,a=n(454),u=o.aTypedArray;(0,o.exportTypedArrayMethod)("filterReject",function filterReject(r){var e=i(u(this),r,arguments.length>1?arguments[1]:t);return a(this,e)},!0)},function(r,e,n){var o=n(215),i=n(500),a=n(455),u=o.aTypedArray;(0,o.exportTypedArrayMethod)("groupBy",function groupBy(r){var e=arguments.length>1?arguments[1]:t;return i(u(this),r,e,a)},!0)},function(t,r,e){var n=e(215),o=e(64),i=e(439),a=e(61),u=e(440),c=e(62),f=e(7),s=n.aTypedArray,l=n.getTypedArrayConstructor,h=Math.max,p=Math.min;(0,n.exportTypedArrayMethod)("toSpliced",function toSpliced(t,r){var e,n,f,g,v,d,y,m,b=s(this),x=l(b),w=o(b),S=a(t,w),A=arguments.length,E=0;if(0===A)e=n=0;else if(1===A)e=0,n=w-S;else if(n=p(h(c(r),0),w-S),e=A-2)for(g=new x(e),f=i(g),m=2;m>(-2*a&6))));return e}})},function(t,r){var e,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o={};for(e=0;e<66;e++)o[n.charAt(e)]=e;t.exports={itoc:n,ctoi:o}},function(t,r,e){var n=e(3),o=e(4),i=e(24),a=e(14),u=e(8),c=e(7),f=e(69),s=e(328),l=e(728).itoc,h=i("btoa"),p=a("".charAt),g=a("".charCodeAt),v=!!h&&!c(function(){h()}),d=!!h&&c(function(){return"bnVsbA=="!==h(null)}),y=!!h&&1!==h.length;n({global:!0,bind:!0,enumerable:!0,forced:v||d||y},{btoa:function btoa(t){var r,e,n,a,c,m;if(s(arguments.length,1),v||d||y)return u(h,o,f(t));for(r=f(t),e="",n=0,a=l;p(r,n)||(a="=",n%1);){if((m=g(r,n+=3/4))>255)throw new(i("DOMException"))("The string contains characters outside of the Latin1 range","InvalidCharacterError");e+=p(a,63&(c=c<<8|m)>>8-n%1*8)}return e}})},function(t,r,e){var n,o=e(4),i=e(731),a=e(732),u=e(161),c=e(44),handlePrototype=function(t){if(t&&t.forEach!==u)try{c(t,"forEach",u)}catch(r){t.forEach=u}};for(n in i)i[n]&&handlePrototype(o[n]&&o[n].prototype);handlePrototype(a)},function(t,r){t.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},function(r,e,n){var o=n(43)("span").classList,i=o&&o.constructor&&o.constructor.prototype;r.exports=i===Object.prototype?t:i},function(t,r,e){var n,o=e(4),i=e(731),a=e(732),u=e(169),c=e(44),f=e(34),s=f("iterator"),l=f("toStringTag"),h=u.values,handlePrototype=function(t,r){if(t){if(t[s]!==h)try{c(t,s,h)}catch(n){t[s]=h}if(t[l]||c(t,l,r),i[r])for(var e in u)if(t[e]!==u[e])try{c(t,e,u[e])}catch(n){t[e]=u[e]}}};for(n in i)handlePrototype(o[n]&&o[n].prototype,n);handlePrototype(a,"DOMTokenList")},function(r,e,n){var o,i,a,u,c,f,s,l,h,p,g=n(3),v=n(735),d=n(24),y=n(7),m=n(72),b=n(11),x=n(45).f,w=n(48),S=n(79),A=n(39),E=n(211),O=n(47),I=n(127),R=n(121),M=n(736),T=n(124),k=n(52),P=n(6),j=n(36),C="DOMException",N="DATA_CLONE_ERR",D=d("Error"),_=d(C)||function(){try{(new(d("MessageChannel")||v("worker_threads").MessageChannel)).port1.postMessage(new WeakMap)}catch(t){if(t.name==N&&25==t.code)return t.constructor}}(),U=_&&_.prototype,L=D.prototype,B=k.set,z=k.getterFor(C),W="stack"in D(C),codeFor=function(t){return A(M,t)&&M[t].m?M[t].c:0},V=function DOMException(){var r,e,n,o,i;E(this,H),e=R((r=arguments.length)<1?t:arguments[0]),n=R(r<2?t:arguments[1],"Error"),o=codeFor(n),B(this,{type:C,name:n,message:e,code:o}),P||(this.name=n,this.message=e,this.code=o),W&&((i=D(e)).name=C,x(this,"stack",b(1,T(i.stack,1))))},H=V.prototype=m(L),createGetterDescriptor=function(t){return{enumerable:!0,configurable:!0,get:t}},getterFor=function(t){return createGetterDescriptor(function(){return z(this)[t]})};for(s in P&&(S(H,"code",getterFor("code")),S(H,"message",getterFor("message")),S(H,"name",getterFor("name"))),x(H,"constructor",b(1,V)),i=(o=y(function(){return!(new _ instanceof D)}))||y(function(){return L.toString!==I||"2: 1"!==String(new _(1,2))}),a=o||y(function(){return 25!==new _(1,"DataCloneError").code}),g({global:!0,constructor:!0,forced:u=j?i||a||o||25!==_[N]||25!==U[N]:o},{DOMException:u?V:_}),f=(c=d(C)).prototype,i&&(j||_===c)&&w(f,"toString",I),a&&P&&_===c&&S(f,"code",createGetterDescriptor(function(){return codeFor(O(this).name)})),M)A(M,s)&&(h=(l=M[s]).s,p=b(6,l.c),A(c,h)||x(c,h,p),A(f,h)||x(f,h,p))},function(t,r,e){var n=e(183);t.exports=function(t){try{if(n)return Function('return require("'+t+'")')()}catch(r){}}},function(t,r){t.exports={IndexSizeError:{s:"INDEX_SIZE_ERR",c:1,m:1},DOMStringSizeError:{s:"DOMSTRING_SIZE_ERR",c:2,m:0},HierarchyRequestError:{s:"HIERARCHY_REQUEST_ERR",c:3,m:1},WrongDocumentError:{s:"WRONG_DOCUMENT_ERR",c:4,m:1},InvalidCharacterError:{s:"INVALID_CHARACTER_ERR",c:5,m:1},NoDataAllowedError:{s:"NO_DATA_ALLOWED_ERR",c:6,m:0},NoModificationAllowedError:{s:"NO_MODIFICATION_ALLOWED_ERR",c:7,m:1},NotFoundError:{s:"NOT_FOUND_ERR",c:8,m:1},NotSupportedError:{s:"NOT_SUPPORTED_ERR",c:9,m:1},InUseAttributeError:{s:"INUSE_ATTRIBUTE_ERR",c:10,m:1},InvalidStateError:{s:"INVALID_STATE_ERR",c:11,m:1},SyntaxError:{s:"SYNTAX_ERR",c:12,m:1},InvalidModificationError:{s:"INVALID_MODIFICATION_ERR",c:13,m:1},NamespaceError:{s:"NAMESPACE_ERR",c:14,m:1},InvalidAccessError:{s:"INVALID_ACCESS_ERR",c:15,m:1},ValidationError:{s:"VALIDATION_ERR",c:16,m:0},TypeMismatchError:{s:"TYPE_MISMATCH_ERR",c:17,m:1},SecurityError:{s:"SECURITY_ERR",c:18,m:1},NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1},InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}}},function(r,e,n){var o,i,a,u,c,f=n(3),s=n(4),l=n(24),h=n(11),p=n(45).f,g=n(39),v=n(211),d=n(120),y=n(121),m=n(736),b=n(124),x=n(6),w=n(36),S="DOMException",A=l("Error"),E=l(S),O=function DOMException(){var r,e,n,o,i;return v(this,I),e=y((r=arguments.length)<1?t:arguments[0]),n=y(r<2?t:arguments[1],"Error"),o=new E(e,n),(i=A(e)).name=S,p(o,"stack",h(1,b(i.stack,1))),d(o,this,O),o},I=O.prototype=E.prototype,R="stack"in A(S),M="stack"in new E(1,2),T=E&&x&&Object.getOwnPropertyDescriptor(s,S),k=R&&!!(!T||T.writable&&T.configurable)&&!M;if(f({global:!0,constructor:!0,forced:w||k},{DOMException:k?O:E}),(i=(o=l(S)).prototype).constructor!==o)for(a in w||p(i,"constructor",h(1,o)),m)g(m,a)&&(g(o,c=(u=m[a]).s)||p(o,c,h(6,u.c)))},function(t,r,e){var n=e(24),o="DOMException";e(84)(n(o),o)},function(t,r,e){e(740),e(741)},function(t,r,e){var n=e(3),o=e(4),i=e(327).clear;n({global:!0,bind:!0,enumerable:!0,forced:o.clearImmediate!==i},{clearImmediate:i})},function(t,r,e){var n=e(3),o=e(4),i=e(327).set,a=e(742),u=o.setImmediate?a(i,!1):i;n({global:!0,bind:!0,enumerable:!0,forced:o.setImmediate!==u},{setImmediate:u})},function(t,r,e){var n,o=e(4),i=e(96),a=e(21),u=e(743),c=e(29),f=e(97),s=e(328),l=o.Function,h=/MSIE .\./.test(c)||u&&((n=o.Bun.version.split(".")).length<3||0==n[0]&&(n[1]<3||3==n[1]&&0==n[2]));t.exports=function(t,r){var e=r?2:1;return h?function(n,o){var u=s(arguments.length,1)>e,c=a(n)?n:l(n),h=u?f(arguments,e):[],p=u?function(){i(c,this,h)}:c;return r?t(p,o):t(p)}:t}},function(t,r){t.exports="function"==typeof Bun&&Bun&&"string"==typeof Bun.version},function(t,r,e){var n=e(3),o=e(4),i=e(330),a=e(31),u=e(328),c=e(183),f=o.process;n({global:!0,enumerable:!0,dontCallGetSet:!0},{queueMicrotask:function queueMicrotask(t){u(arguments.length,1),a(t);var r=c&&f.domain;i(r?r.bind(t):t)}})},function(t,r,e){var n,o=e(3),i=e(4),a=e(79),u=e(6),c=TypeError,f=Object.defineProperty,s=i.self!==i;try{u?(n=Object.getOwnPropertyDescriptor(i,"self"),!s&&n&&n.get&&n.enumerable||a(i,"self",{get:function self(){return i},set:function self(t){if(this!==i)throw c("Illegal invocation");f(i,"self",{value:t,writable:!0,configurable:!0,enumerable:!0})},configurable:!0,enumerable:!0})):o({global:!0,simple:!0,forced:s},{self:i})}catch(l){}},function(r,e,n){var o,i=n(36),a=n(3),u=n(4),c=n(24),f=n(14),s=n(7),l=n(41),h=n(21),p=n(91),g=n(17),v=n(20),d=n(23),y=n(132),m=n(47),b=n(70),x=n(39),w=n(78),S=n(44),A=n(64),E=n(328),O=n(368),I=n(504),R=n(649),M=n(125),T=n(518),k=u.Object,P=u.Array,j=u.Date,C=u.Error,N=u.EvalError,D=u.RangeError,_=u.ReferenceError,U=u.SyntaxError,L=u.TypeError,B=u.URIError,z=u.PerformanceMark,W=u.WebAssembly,V=W&&W.CompileError||C,H=W&&W.LinkError||C,q=W&&W.RuntimeError||C,G=c("DOMException"),K=I.Map,J=I.has,Y=I.get,$=I.set,X=R.Set,Q=R.add,Z=c("Object","keys"),tt=f([].push),rt=f((!0).valueOf),et=f(1..valueOf),nt=f("".valueOf),ot=f(j.prototype.getTime),it=l("structuredClone"),ut="DataCloneError",ct="Transferring",checkBasicSemantic=function(t){return!s(function(){var r=new u.Set([7]),e=t(r),n=t(k(7));return e==r||!e.has(7)||"object"!=typeof n||7!=n})&&t},checkErrorsCloning=function(t,r){return!s(function(){var e=new r,n=t({a:e,b:e});return!(n&&n.a===n.b&&n.a instanceof r&&n.a.stack===e.stack)})},ft=u.structuredClone,st=i||!checkErrorsCloning(ft,C)||!checkErrorsCloning(ft,G)||(o=ft,!!s(function(){var t=o(new u.AggregateError([1],it,{cause:3}));return"AggregateError"!=t.name||1!=t.errors[0]||t.message!=it||3!=t.cause})),lt=!ft&&checkBasicSemantic(function(t){return new z(it,{detail:t}).detail}),ht=checkBasicSemantic(ft)||lt,throwUncloneable=function(t){throw new G("Uncloneable type: "+t,ut)},throwUnpolyfillable=function(t,r){throw new G((r||"Cloning")+" of "+t+" cannot be properly polyfilled in this engine",ut)},tryNativeRestrictedStructuredClone=function(t,r){return ht||throwUnpolyfillable(r),ht(t)},cloneBuffer=function(r,e,n){var o,i,a,c,f,s;if(J(e,r))return Y(e,r);if("SharedArrayBuffer"===(n||b(r)))o=ht?ht(r):r;else{(s=u.DataView)||"function"==typeof r.slice||throwUnpolyfillable("ArrayBuffer");try{if("function"!=typeof r.slice||r.resizable){i=r.byteLength,o=new ArrayBuffer(i,"maxByteLength"in r?{maxByteLength:r.maxByteLength}:t),a=new s(r),c=new s(o);for(f=0;f1&&!g(arguments[1])?m(arguments[1]):t,a=i?i.transfer:t,c=!1;return a!==t&&(n=function(r,e){var n,o,i,a,c,f,s,l,g;if(!v(r))throw L("Transfer option cannot be converted to a sequence");for(n=[],y(r,function(t){tt(n,m(t))}),o=0,i=A(n),a=[];o?@[\\\]^|]/,nt=/[\0\t\n\r #/:<>?@[\\\]^|]/,ot=/^[\u0000-\u0020]+/,it=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,ut=/[\t\n\r]/g,ft=function(t){var r,e,n,o,i,a,u,c=W(t,".");if(c.length&&""==c[c.length-1]&&c.length--,(r=c.length)>4)return t;for(e=[],n=0;n1&&"0"==C(o,0)&&(i=N(Q,o)?16:8,o=V(o,8==i?1:2)),""===o)a=0;else{if(!N(10==i?tt:8==i?Z:rt,o))return t;a=k(o,i)}L(e,a)}for(n=0;n=j(256,5-r))return null}else if(a>255)return null;for(u=U(e),n=0;n6)return;for(n=0;chr();){if(o=null,n>0){if(!("."==chr()&&n<4))return;l++}if(!N(X,chr()))return;for(;N(X,chr());){if(i=k(chr(),10),null===o)o=i;else{if(0==o)return;o=10*o+i}if(o>255)return;l++}c[f]=256*c[f]+o,2!=++n&&4!=n||f++}if(4!=n)return;break}if(":"==chr()){if(l++,!chr())return}else if(chr())return;c[f++]=r}else{if(null!==s)return;l++,s=++f}}if(null!==s)for(a=f-s,f=7;0!=f&&a>0;)u=c[f],c[f--]=c[s+a-1],c[s+--a]=u;else if(8!=f)return;return c},lt=function(t){for(var r=null,e=1,n=null,o=0,i=0;i<8;i++)0!==t[i]?(o>e&&(r=n,e=o),n=null,o=0):(null===n&&(n=i),++o);return o>e&&(r=n,e=o),r},ht=function(t){var r,e,n,o;if("number"==typeof t){for(r=[],e=0;e<4;e++)q(r,t%256),t=P(t/256);return D(r,".")}if("object"==typeof t){for(r="",n=lt(t),e=0;e<8;e++)o&&0===t[e]||(o&&(o=!1),n===e?(r+=e?":":"::",o=!0):(r+=_(t[e],16),e<7&&(r+=":")));return"["+r+"]"}return t},gt=g({},pt={},{" ":1,'"':1,"<":1,">":1,"`":1}),vt=g({},gt,{"#":1,"?":1,"{":1,"}":1}),dt=g({},vt,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),yt=function(t,r){var e=y(t,0);return e>32&&e<127&&!p(r,t)?t:encodeURIComponent(t)},mt={ftp:21,file:null,http:80,https:443,ws:80,wss:443},bt=function(t,r){var e;return 2==t.length&&N(Y,C(t,0))&&(":"==(e=C(t,1))||!r&&"|"==e)},xt=function(t){var r;return t.length>1&&bt(V(t,0,2))&&(2==t.length||"/"===(r=C(t,2))||"\\"===r||"?"===r||"#"===r)},wt=function(t){return"."===t||"%2e"===H(t)},St=function(t){return".."===(t=H(t))||"%2e."===t||".%2e"===t||"%2e%2e"===t},At={},Et={},Ot={},It={},Rt={},Mt={},Tt={},kt={},Pt={},jt={},Ct={},Nt={},Dt={},_t={},Ft={},Ut={},Lt={},Bt={},zt={},Wt={},Vt={},(Ht=function(r,e,n){var o,i,a,u=b(r);if(e){if(i=this.parse(u))throw T(i);this.searchParams=null}else{if(n!==t&&(o=new Ht(n,!0)),i=this.parse(u,null,o))throw T(i);(a=R(new I)).bindURL(this),this.searchParams=a}}).prototype={type:"URL",parse:function(t,r,e){var n,o,i,a,u,c,f,s,l=this,h=r||At,g=0,y="",m=!1,x=!1,w=!1;for(t=b(t),r||(l.scheme="",l.username="",l.password="",l.host=null,l.port=null,l.path=[],l.query=null,l.fragment=null,l.cannotBeABaseURL=!1,t=B(t,ot,""),t=B(t,it,"$1")),t=B(t,ut,""),n=v(t);g<=n.length;){switch(o=n[g],h){case At:if(!o||!N(Y,o)){if(r)return G;h=Ot;continue}y+=H(o),h=Et;break;case Et:if(o&&(N($,o)||"+"==o||"-"==o||"."==o))y+=H(o);else{if(":"!=o){if(r)return G;y="",h=Ot,g=0;continue}if(r&&(l.isSpecial()!=p(mt,y)||"file"==y&&(l.includesCredentials()||null!==l.port)||"file"==l.scheme&&!l.host))return;if(l.scheme=y,r)return void(l.isSpecial()&&mt[l.scheme]==l.port&&(l.port=null));y="","file"==l.scheme?h=_t:l.isSpecial()&&e&&e.scheme==l.scheme?h=It:l.isSpecial()?h=kt:"/"==n[g+1]?(h=Rt,g++):(l.cannotBeABaseURL=!0,L(l.path,""),h=zt)}break;case Ot:if(!e||e.cannotBeABaseURL&&"#"!=o)return G;if(e.cannotBeABaseURL&&"#"==o){l.scheme=e.scheme,l.path=d(e.path),l.query=e.query,l.fragment="",l.cannotBeABaseURL=!0,h=Vt;break}h="file"==e.scheme?_t:Mt;continue;case It:if("/"!=o||"/"!=n[g+1]){h=Mt;continue}h=Pt,g++;break;case Rt:if("/"==o){h=jt;break}h=Bt;continue;case Mt:if(l.scheme=e.scheme,o==ct)l.username=e.username,l.password=e.password,l.host=e.host,l.port=e.port,l.path=d(e.path),l.query=e.query;else if("/"==o||"\\"==o&&l.isSpecial())h=Tt;else if("?"==o)l.username=e.username,l.password=e.password,l.host=e.host,l.port=e.port,l.path=d(e.path),l.query="",h=Wt;else{if("#"!=o){l.username=e.username, +l.password=e.password,l.host=e.host,l.port=e.port,l.path=d(e.path),l.path.length--,h=Bt;continue}l.username=e.username,l.password=e.password,l.host=e.host,l.port=e.port,l.path=d(e.path),l.query=e.query,l.fragment="",h=Vt}break;case Tt:if(!l.isSpecial()||"/"!=o&&"\\"!=o){if("/"!=o){l.username=e.username,l.password=e.password,l.host=e.host,l.port=e.port,h=Bt;continue}h=jt}else h=Pt;break;case kt:if(h=Pt,"/"!=o||"/"!=C(y,g+1))continue;g++;break;case Pt:if("/"!=o&&"\\"!=o){h=jt;continue}break;case jt:if("@"==o){for(m&&(y="%40"+y),m=!0,i=v(y),u=0;u65535)return J;l.port=l.isSpecial()&&s===mt[l.scheme]?null:s,y=""}if(r)return;h=Lt;continue}return J}y+=o;break;case _t:if(l.scheme="file","/"==o||"\\"==o)h=Ft;else{if(!e||"file"!=e.scheme){h=Bt;continue}if(o==ct)l.host=e.host,l.path=d(e.path),l.query=e.query;else if("?"==o)l.host=e.host,l.path=d(e.path),l.query="",h=Wt;else{if("#"!=o){xt(D(d(n,g),""))||(l.host=e.host,l.path=d(e.path),l.shortenPath()),h=Bt;continue}l.host=e.host,l.path=d(e.path),l.query=e.query,l.fragment="",h=Vt}}break;case Ft:if("/"==o||"\\"==o){h=Ut;break}e&&"file"==e.scheme&&!xt(D(d(n,g),""))&&(bt(e.path[0],!0)?L(l.path,e.path[0]):l.host=e.host),h=Bt;continue;case Ut:if(o==ct||"/"==o||"\\"==o||"?"==o||"#"==o){if(!r&&bt(y))h=Bt;else if(""==y){if(l.host="",r)return;h=Lt}else{if(a=l.parseHost(y))return a;if("localhost"==l.host&&(l.host=""),r)return;y="",h=Lt}continue}y+=o;break;case Lt:if(l.isSpecial()){if(h=Bt,"/"!=o&&"\\"!=o)continue}else if(r||"?"!=o)if(r||"#"!=o){if(o!=ct&&(h=Bt,"/"!=o))continue}else l.fragment="",h=Vt;else l.query="",h=Wt;break;case Bt:if(o==ct||"/"==o||"\\"==o&&l.isSpecial()||!r&&("?"==o||"#"==o)){if(St(y)?(l.shortenPath(),"/"==o||"\\"==o&&l.isSpecial()||L(l.path,"")):wt(y)?"/"==o||"\\"==o&&l.isSpecial()||L(l.path,""):("file"==l.scheme&&!l.path.length&&bt(y)&&(l.host&&(l.host=""),y=C(y,0)+":"),L(l.path,y)),y="","file"==l.scheme&&(o==ct||"?"==o||"#"==o))for(;l.path.length>1&&""===l.path[0];)z(l.path);"?"==o?(l.query="",h=Wt):"#"==o&&(l.fragment="",h=Vt)}else y+=yt(o,vt);break;case zt:"?"==o?(l.query="",h=Wt):"#"==o?(l.fragment="",h=Vt):o!=ct&&(l.path[0]+=yt(o,pt));break;case Wt:r||"#"!=o?o!=ct&&("'"==o&&l.isSpecial()?l.query+="%27":l.query+="#"==o?"%23":yt(o,pt)):(l.fragment="",h=Vt);break;case Vt:o!=ct&&(l.fragment+=yt(o,gt))}g++}},parseHost:function(t){var r,e,n;if("["==C(t,0)){if("]"!=C(t,t.length-1))return K;if(!(r=st(V(t,1,-1))))return K;this.host=r}else if(this.isSpecial()){if(t=m(t),N(et,t))return K;if(null===(r=ft(t)))return K;this.host=r}else{if(N(nt,t))return K;for(r="",e=v(t),n=0;n1?arguments[1]:t,o=E(e,new Ht(r,!1,n));i||(e.href=o.serialize(),e.origin=o.getOrigin(),e.protocol=o.getProtocol(),e.username=o.getUsername(),e.password=o.getPassword(),e.host=o.getHost(),e.hostname=o.getHostname(),e.port=o.getPort(),e.pathname=o.getPathname(),e.search=o.getSearch(),e.searchParams=o.getSearchParams(),e.hash=o.getHash())},Gt=qt.prototype,Kt=function(t,r){return{get:function(){return O(this)[t]()},set:r&&function(t){return O(this)[r](t)},configurable:!0,enumerable:!0}},i&&(l(Gt,"href",Kt("serialize","setHref")),l(Gt,"origin",Kt("getOrigin")),l(Gt,"protocol",Kt("getProtocol","setProtocol")),l(Gt,"username",Kt("getUsername","setUsername")),l(Gt,"password",Kt("getPassword","setPassword")),l(Gt,"host",Kt("getHost","setHost")),l(Gt,"hostname",Kt("getHostname","setHostname")),l(Gt,"port",Kt("getPort","setPort")),l(Gt,"pathname",Kt("getPathname","setPathname")),l(Gt,"search",Kt("getSearch","setSearch")),l(Gt,"searchParams",Kt("getSearchParams")),l(Gt,"hash",Kt("getHash","setHash"))),s(Gt,"toJSON",function toJSON(){return O(this).serialize()},{enumerable:!0}),s(Gt,"toString",function toString(){return O(this).serialize()},{enumerable:!0}),M&&(Yt=M.revokeObjectURL,(Jt=M.createObjectURL)&&s(qt,"createObjectURL",c(Jt,M)),Yt&&s(qt,"revokeObjectURL",c(Yt,M))),x(qt,"URL"),o({global:!0,constructor:!0,forced:!a,sham:!i},{URL:qt})},function(r,e,n){var o=n(7),i=n(34),a=n(6),u=n(36),c=i("iterator");r.exports=!o(function(){var r=new URL("b?a=1&b=2&c=3","http://a"),e=r.searchParams,n=new URLSearchParams("a=1&a=2"),o="";return r.pathname="c%20d",e.forEach(function(t,r){e["delete"]("b"),o+=r+t}),n["delete"]("a",2),u&&(!r.toJSON||!n.has("a",1)||n.has("a",2))||!e.size&&(u||!a)||!e.sort||"http://a/c%20d?a=1&c=3"!==r.href||"3"!==e.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!e[c]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==o||"x"!==new URL("http://x",t).host})},function(t,r,e){var n=e(14),o=2147483647,i=/[^\0-\u007E]/,a=/[.\u3002\uFF0E\uFF61]/g,u="Overflow: input needs wider integers to process",c=RangeError,f=n(a.exec),s=Math.floor,l=String.fromCharCode,h=n("".charCodeAt),p=n([].join),g=n([].push),v=n("".replace),d=n("".split),y=n("".toLowerCase),digitToBasic=function(t){return t+22+75*(t<26)},adapt=function(t,r,e){var n=0;for(t=e?s(t/700):t>>1,t+=s(t/r);t>455;)t=s(t/35),n+=36;return s(n+36*t/(t+38))},encode=function(t){var r,e,n,i,a,f,v,d,y,m,b,x,w,S,A,E=[];for(r=(t=function(t){for(var r,e,n=[],o=0,i=t.length;o=55296&&r<=56319&&o=e&&fs((o-n)/(m=d+1)))throw c(u);for(n+=(y-e)*m,e=y,a=0;ao)throw c(u);if(f==e){for(b=n,x=36;!(b<(w=x<=i?1:x>=i+26?26:x-i));)g(E,l(digitToBasic(w+(S=b-w)%(A=36-w)))),b=s(S/A),x+=36;g(E,l(digitToBasic(b))),i=adapt(n,m,d==v),n=0,d++}}n++,e++}return p(E,"")};t.exports=function(t){var r,e,n=[],o=d(v(y(t),a,"."),".");for(r=0;r0?arguments[0]:t)),c||(this.size=r.entries.length)},h(dt=vt.prototype,{append:function append(t,r){var e=D(this);M(arguments.length,2),X(e.entries,{key:A(t),value:A(r)}),c||this.length++,e.updateURL()},"delete":function(r){for(var e,n=D(this),o=M(arguments.length,1),i=n.entries,a=A(r),u=o<2?t:arguments[1],f=u===t?u:A(u),s=0;sr.key?1:-1}),t.updateURL()},forEach:function forEach(r){for(var e,n=D(this).entries,o=b(r,arguments.length>1?arguments[1]:t),i=0;i1?bt(arguments[1]):{})}}),y(z)&&(xt=function Request(t){return d(this,V),new z(t,arguments.length>1?bt(arguments[1]):{})},V.constructor=xt,xt.prototype=V,o({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:xt}))),r.exports={URLSearchParams:vt,getState:D}},function(r,e,n){var o=n(3),i=n(24),a=n(7),u=n(328),c=n(69),f=n(752),s=i("URL");o({target:"URL",stat:!0,forced:!(f&&a(function(){s.canParse()}))},{canParse:function canParse(r){var e=u(arguments.length,1),n=c(r),o=e<2||arguments[1]===t?t:c(arguments[1]);try{return!!new s(n,o)}catch(i){return!1}}})},function(t,r,e){var n=e(3),o=e(8);n({target:"URL",proto:!0,enumerable:!0},{toJSON:function toJSON(){return o(URL.prototype.toString,this)}})},function(t,r,e){e(754)},function(r,e,n){var o=n(48),i=n(14),a=n(69),u=n(328),c=URLSearchParams,f=c.prototype,s=i(f.append),l=i(f["delete"]),h=i(f.forEach),p=i([].push),g=new c("a=1&a=2");g["delete"]("a",1),g+""!="a=2"&&o(f,"delete",function(r){var e,n,o,i,c,f,g,v,d=arguments.length,y=d<2?t:arguments[1];if(d&&y===t)return l(this,r);for(e=[],h(this,function(t,r){p(e,{key:r,value:t})}),u(d,1),n=a(r),o=a(y),i=0,c=0,f=!1,g=e.length;ir)throw new a("fromIndex("+e+") > toIndex("+r+")");if(e<0)throw new g(e);if(r>t)throw new g(r)}static asList(...t){return t}static create(t,e,r){return Array.from({length:t}).map((t=>Array.from({length:e}).fill(r)))}static createInt32Array(t,e,r){return Array.from({length:t}).map((t=>Int32Array.from({length:e}).fill(r)))}static equals(t,e){if(!t)return!1;if(!e)return!1;if(!t.length)return!1;if(!e.length)return!1;if(t.length!==e.length)return!1;for(let r=0,n=t.length;r>1,o=r(e,t[s]);if(o>0)n=s+1;else{if(!(o<0))return s;i=s-1}}return-n-1}static numberComparator(t,e){return t-e}}class w{static numberOfTrailingZeros(t){let e;if(0===t)return 32;let r=31;return e=t<<16,0!==e&&(r-=16,t=e),e=t<<8,0!==e&&(r-=8,t=e),e=t<<4,0!==e&&(r-=4,t=e),e=t<<2,0!==e&&(r-=2,t=e),r-(t<<1>>>31)}static numberOfLeadingZeros(t){if(0===t)return 32;let e=1;return t>>>16==0&&(e+=16,t<<=16),t>>>24==0&&(e+=8,t<<=8),t>>>28==0&&(e+=4,t<<=4),t>>>30==0&&(e+=2,t<<=2),e-=t>>>31,e}static toHexString(t){return t.toString(16)}static toBinaryString(t){return String(parseInt(String(t),2))}static bitCount(t){return t=(t=(858993459&(t-=t>>>1&1431655765))+(t>>>2&858993459))+(t>>>4)&252645135,t+=t>>>8,63&(t+=t>>>16)}static truncDivision(t,e){return Math.trunc(t/e)}static parseInt(t,e=void 0){return parseInt(t,e)}}w.MIN_VALUE_32_BITS=-2147483648,w.MAX_VALUE=Number.MAX_SAFE_INTEGER;class C{constructor(t,e){void 0===t?(this.size=0,this.bits=new Int32Array(1)):(this.size=t,this.bits=null==e?C.makeArray(t):e)}getSize(){return this.size}getSizeInBytes(){return Math.floor((this.size+7)/8)}ensureCapacity(t){if(t>32*this.bits.length){const e=C.makeArray(t);d.arraycopy(this.bits,0,e,0,this.bits.length),this.bits=e}}get(t){return!!(this.bits[Math.floor(t/32)]&1<<(31&t))}set(t){this.bits[Math.floor(t/32)]|=1<<(31&t)}flip(t){this.bits[Math.floor(t/32)]^=1<<(31&t)}getNextSet(t){const e=this.size;if(t>=e)return e;const r=this.bits;let n=Math.floor(t/32),i=r[n];i&=~((1<<(31&t))-1);const s=r.length;for(;0===i;){if(++n===s)return e;i=r[n]}const o=32*n+w.numberOfTrailingZeros(i);return o>e?e:o}getNextUnset(t){const e=this.size;if(t>=e)return e;const r=this.bits;let n=Math.floor(t/32),i=~r[n];i&=~((1<<(31&t))-1);const s=r.length;for(;0===i;){if(++n===s)return e;i=~r[n]}const o=32*n+w.numberOfTrailingZeros(i);return o>e?e:o}setBulk(t,e){this.bits[Math.floor(t/32)]=e}setRange(t,e){if(ethis.size)throw new a;if(e===t)return;e--;const r=Math.floor(t/32),n=Math.floor(e/32),i=this.bits;for(let s=r;s<=n;s++){const o=(2<<(sr?0:31&t));i[s]|=o}}clear(){const t=this.bits.length,e=this.bits;for(let r=0;rthis.size)throw new a;if(e===t)return!0;e--;const n=Math.floor(t/32),i=Math.floor(e/32),s=this.bits;for(let o=n;o<=i;o++){const a=(2<<(on?0:31&t))&4294967295;if((s[o]&a)!==(r?a:0))return!1}return!0}appendBit(t){this.ensureCapacity(this.size+1),t&&(this.bits[Math.floor(this.size/32)]|=1<<(31&this.size)),this.size++}appendBits(t,e){if(e<0||e>32)throw new a("Num bits must be between 0 and 32");this.ensureCapacity(this.size+e);for(let r=e;r>0;r--)this.appendBit(1==(t>>r-1&1))}appendBitArray(t){const e=t.size;this.ensureCapacity(this.size+e);for(let r=0;r>1&1431655765|(1431655765&r)<<1,r=r>>2&858993459|(858993459&r)<<2,r=r>>4&252645135|(252645135&r)<<4,r=r>>8&16711935|(16711935&r)<<8,r=r>>16&65535|(65535&r)<<16,t[e-i]=r}if(this.size!==32*r){const e=32*r-this.size;let n=t[0]>>>e;for(let i=1;i>>e}t[r-1]=n}this.bits=t}static makeArray(t){return new Int32Array(Math.floor((t+31)/32))}equals(t){if(!(t instanceof C))return!1;const e=t;return this.size===e.size&&f.equals(this.bits,e.bits)}hashCode(){return 31*this.size+f.hashCode(this.bits)}toString(){let t="";for(let e=0,r=this.size;e=900)throw new m("incorect value");const e=I.VALUES_TO_ECI.get(t);if(void 0===e)throw new m("incorect value");return e}static getCharacterSetECIByName(t){const e=I.NAME_TO_ECI.get(t);if(void 0===e)throw new m("incorect value");return e}equals(t){if(!(t instanceof I))return!1;const e=t;return this.getName()===e.getName()}}I.VALUE_IDENTIFIER_TO_ECI=new Map,I.VALUES_TO_ECI=new Map,I.NAME_TO_ECI=new Map,I.Cp437=new I(A.Cp437,Int32Array.from([0,2]),"Cp437"),I.ISO8859_1=new I(A.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),I.ISO8859_2=new I(A.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),I.ISO8859_3=new I(A.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),I.ISO8859_4=new I(A.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),I.ISO8859_5=new I(A.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),I.ISO8859_6=new I(A.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),I.ISO8859_7=new I(A.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),I.ISO8859_8=new I(A.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),I.ISO8859_9=new I(A.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),I.ISO8859_10=new I(A.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),I.ISO8859_11=new I(A.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),I.ISO8859_13=new I(A.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),I.ISO8859_14=new I(A.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),I.ISO8859_15=new I(A.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),I.ISO8859_16=new I(A.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),I.SJIS=new I(A.SJIS,20,"SJIS","Shift_JIS"),I.Cp1250=new I(A.Cp1250,21,"Cp1250","windows-1250"),I.Cp1251=new I(A.Cp1251,22,"Cp1251","windows-1251"),I.Cp1252=new I(A.Cp1252,23,"Cp1252","windows-1252"),I.Cp1256=new I(A.Cp1256,24,"Cp1256","windows-1256"),I.UnicodeBigUnmarked=new I(A.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),I.UTF8=new I(A.UTF8,26,"UTF8","UTF-8"),I.ASCII=new I(A.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),I.Big5=new I(A.Big5,28,"Big5"),I.GB18030=new I(A.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),I.EUC_KR=new I(A.EUC_KR,30,"EUC_KR","EUC-KR");class _ extends s{}_.kind="UnsupportedOperationException";class S{static decode(t,e){const r=this.encodingName(e);return this.customDecoder?this.customDecoder(t,r):"undefined"==typeof TextDecoder||this.shouldDecodeOnFallback(r)?this.decodeFallback(t,r):new TextDecoder(r).decode(t)}static shouldDecodeOnFallback(t){return!S.isBrowser()&&"ISO-8859-1"===t}static encode(t,e){const r=this.encodingName(e);return this.customEncoder?this.customEncoder(t,r):"undefined"==typeof TextEncoder?this.encodeFallback(t):(new TextEncoder).encode(t)}static isBrowser(){return"undefined"!=typeof window&&"[object Window]"==={}.toString.call(window)}static encodingName(t){return"string"==typeof t?t:t.getName()}static encodingCharacterSet(t){return t instanceof I?t:I.getCharacterSetECIByName(t)}static decodeFallback(t,e){const r=this.encodingCharacterSet(e);if(S.isDecodeFallbackSupported(r)){let e="";for(let r=0,n=t.length;r3&&239===t[0]&&187===t[1]&&191===t[2];for(let e=0;e0?128&r?o--:s=!1:128&r&&(64&r?(o++,32&r?(o++,16&r?(o++,8&r?s=!1:l++):h++):a++):s=!1)),n&&(r>127&&r<160?n=!1:r>159&&(r<192||215===r||247===r)&&C++),i&&(c>0?r<64||127===r||r>252?i=!1:c--:128===r||160===r||r>239?i=!1:r>160&&r<224?(d++,g=0,u++,u>f&&(f=u)):r>127?(c++,u=0,g++,g>w&&(w=g)):(u=0,g=0))}return s&&o>0&&(s=!1),i&&c>0&&(i=!1),s&&(A||a+h+l>0)?p.UTF8:i&&(p.ASSUME_SHIFT_JIS||f>=3||w>=3)?p.SHIFT_JIS:n&&i?2===f&&2===d||10*C>=r?p.SHIFT_JIS:p.ISO88591:n?p.ISO88591:i?p.SHIFT_JIS:s?p.UTF8:p.PLATFORM_DEFAULT_ENCODING}static format(t,...e){let r=-1;return t.replace(/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g,(function(t,n,i,s,o,a){if("%%"===t)return"%";if(void 0===e[++r])return;t=s?parseInt(s.substr(1)):void 0;let h,l=o?parseInt(o.substr(1)):void 0;switch(a){case"s":h=e[r];break;case"c":h=e[r][0];break;case"f":h=parseFloat(e[r]).toFixed(t);break;case"p":h=parseFloat(e[r]).toPrecision(t);break;case"e":h=parseFloat(e[r]).toExponential(t);break;case"x":h=parseInt(e[r]).toString(l||16);break;case"d":h=parseFloat(parseInt(e[r],l||10).toPrecision(t)).toFixed(0)}h="object"==typeof h?JSON.stringify(h):(+h).toString(l);let c=parseInt(i),d=i&&i[0]+""=="0"?"0":" ";for(;h.lengths){if(-1===o)o=i-s;else if(i-s!==o)throw new a("row lengths do not match");s=i,h++}l++}else if(t.substring(l,l+e.length)===e)l+=e.length,n[i]=!0,i++;else{if(t.substring(l,l+r.length)!==r)throw new a("illegal character encountered: "+t.substring(l));l+=r.length,n[i]=!1,i++}if(i>s){if(-1===o)o=i-s;else if(i-s!==o)throw new a("row lengths do not match");h++}const c=new R(o,h);for(let t=0;t>>(31&t)&1)}set(t,e){const r=e*this.rowSize+Math.floor(t/32);this.bits[r]|=1<<(31&t)&4294967295}unset(t,e){const r=e*this.rowSize+Math.floor(t/32);this.bits[r]&=~(1<<(31&t)&4294967295)}flip(t,e){const r=e*this.rowSize+Math.floor(t/32);this.bits[r]^=1<<(31&t)&4294967295}xor(t){if(this.width!==t.getWidth()||this.height!==t.getHeight()||this.rowSize!==t.getRowSize())throw new a("input matrix dimensions do not match");const e=new C(Math.floor(this.width/32)+1),r=this.rowSize,n=this.bits;for(let i=0,s=this.height;ithis.height||i>this.width)throw new a("The region must fit inside the matrix");const o=this.rowSize,h=this.bits;for(let r=e;ra&&(a=t),32*eo){let t=31;for(;h>>>t==0;)t--;32*e+t>o&&(o=32*e+t)}}}return o=0&&0===e[r];)r--;if(r<0)return null;const n=Math.floor(r/t);let i=32*Math.floor(r%t);const s=e[r];let o=31;for(;s>>>o==0;)o--;return i+=o,Int32Array.from([i,n])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(t){if(!(t instanceof R))return!1;const e=t;return this.width===e.width&&this.height===e.height&&this.rowSize===e.rowSize&&f.equals(this.bits,e.bits)}hashCode(){let t=this.width;return t=31*t+this.width,t=31*t+this.height,t=31*t+this.rowSize,t=31*t+f.hashCode(this.bits),t}toString(t="X ",e=" ",r="\n"){return this.buildToString(t,e,r)}buildToString(t,e,r){let n=new T;for(let i=0,s=this.height;i>y.LUMINANCE_SHIFT]++;const o=y.estimateBlackPoint(s);if(n<3)for(let t=0;t>y.LUMINANCE_SHIFT]++}}const s=y.estimateBlackPoint(i),o=t.getMatrix();for(let t=0;ti&&(n=s,i=t[s]),t[s]>r&&(r=t[s]);let s=0,o=0;for(let r=0;ro&&(s=r,o=i)}if(n>s){const t=n;n=s,s=t}if(s-n<=e/16)throw new N;let a=s-1,h=-1;for(let e=s-1;e>n;e--){const i=e-n,o=i*i*(s-e)*(r-t[e]);o>h&&(a=e,h=o)}return a<=D.MINIMUM_DIMENSION&&r>=D.MINIMUM_DIMENSION){const n=t.getMatrix();let i=e>>D.BLOCK_SIZE_POWER;e&D.BLOCK_SIZE_MASK&&i++;let s=r>>D.BLOCK_SIZE_POWER;r&D.BLOCK_SIZE_MASK&&s++;const o=D.calculateBlackPoints(n,i,s,e,r),a=new R(e,r);D.calculateThresholdForBlock(n,i,s,e,r,o,a),this.matrix=a}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(t){return new D(t)}static calculateThresholdForBlock(t,e,r,n,i,s,o){const a=i-D.BLOCK_SIZE,h=n-D.BLOCK_SIZE;for(let i=0;ia&&(l=a);const c=D.cap(i,2,r-3);for(let r=0;rh&&(i=h);const a=D.cap(r,2,e-3);let d=0;for(let t=-2;t<=2;t++){const e=s[c+t];d+=e[a-2]+e[a-1]+e[a]+e[a+1]+e[a+2]}const u=d/25;D.thresholdBlock(t,i,l,u,n,o)}}}static cap(t,e,r){return tr?r:t}static thresholdBlock(t,e,r,n,i,s){for(let o=0,a=r*i+e;os&&(r=s);for(let s=0;so&&(e=o);let h=0,l=255,c=0;for(let i=0,s=r*n+e;ic&&(c=r)}if(c-l>D.MIN_DYNAMIC_RANGE)for(i++,s+=n;i>2*D.BLOCK_SIZE_POWER;if(c-l<=D.MIN_DYNAMIC_RANGE&&(d=l/2,i>0&&s>0)){const t=(a[i-1][s]+2*a[i][s-1]+a[i-1][s-1])/4;l>10}n[r]=i}else for(let e=0,r=0,i=t.length;e>10}n[r]=255-i}return n}getRow(t,e){if(t<0||t>=this.getHeight())throw new a("Requested row is outside the image: "+t);const r=this.getWidth(),n=t*r;return null===e?e=this.buffer.slice(n,n+r):(e.lengthnew B(t.deviceId,t.label)))}))}findDeviceById(t){return L(this,void 0,void 0,(function*(){const e=yield this.listVideoInputDevices();return e?e.find((e=>e.deviceId===t)):null}))}decodeFromInputVideoDevice(t,e){return L(this,void 0,void 0,(function*(){return yield this.decodeOnceFromVideoDevice(t,e)}))}decodeOnceFromVideoDevice(t,e){return L(this,void 0,void 0,(function*(){let r;this.reset(),r=t?{deviceId:{exact:t}}:{facingMode:"environment"};const n={video:r};return yield this.decodeOnceFromConstraints(n,e)}))}decodeOnceFromConstraints(t,e){return L(this,void 0,void 0,(function*(){const r=yield navigator.mediaDevices.getUserMedia(t);return yield this.decodeOnceFromStream(r,e)}))}decodeOnceFromStream(t,e){return L(this,void 0,void 0,(function*(){this.reset();const r=yield this.attachStreamToVideo(t,e);return yield this.decodeOnce(r)}))}decodeFromInputVideoDeviceContinuously(t,e,r){return L(this,void 0,void 0,(function*(){return yield this.decodeFromVideoDevice(t,e,r)}))}decodeFromVideoDevice(t,e,r){return L(this,void 0,void 0,(function*(){let n;n=t?{deviceId:{exact:t}}:{facingMode:"environment"};const i={video:n};return yield this.decodeFromConstraints(i,e,r)}))}decodeFromConstraints(t,e,r){return L(this,void 0,void 0,(function*(){const n=yield navigator.mediaDevices.getUserMedia(t);return yield this.decodeFromStream(n,e,r)}))}decodeFromStream(t,e,r){return L(this,void 0,void 0,(function*(){this.reset();const n=yield this.attachStreamToVideo(t,e);return yield this.decodeContinuously(n,r)}))}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(t,e){return L(this,void 0,void 0,(function*(){const r=this.prepareVideoElement(e);return this.addVideoSource(r,t),this.videoElement=r,this.stream=t,yield this.playVideoOnLoadAsync(r),r}))}playVideoOnLoadAsync(t){return new Promise(((e,r)=>this.playVideoOnLoad(t,(()=>e()))))}playVideoOnLoad(t,e){this.videoEndedListener=()=>this.stopStreams(),this.videoCanPlayListener=()=>this.tryPlayVideo(t),t.addEventListener("ended",this.videoEndedListener),t.addEventListener("canplay",this.videoCanPlayListener),t.addEventListener("playing",e),this.tryPlayVideo(t)}isVideoPlaying(t){return t.currentTime>0&&!t.paused&&!t.ended&&t.readyState>2}tryPlayVideo(t){return L(this,void 0,void 0,(function*(){if(this.isVideoPlaying(t))console.warn("Trying to play video that is already playing.");else try{yield t.play()}catch(t){console.warn("It was not possible to play the video.")}}))}getMediaElement(t,e){const r=document.getElementById(t);if(!r)throw new o(`element with id '${t}' not found`);if(r.nodeName.toLowerCase()!==e.toLowerCase())throw new o(`element with id '${t}' must be an ${e} element`);return r}decodeFromImage(t,e){if(!t&&!e)throw new o("either imageElement with a src set or an url must be provided");return e&&!t?this.decodeFromImageUrl(e):this.decodeFromImageElement(t)}decodeFromVideo(t,e){if(!t&&!e)throw new o("Either an element with a src set or an URL must be provided");return e&&!t?this.decodeFromVideoUrl(e):this.decodeFromVideoElement(t)}decodeFromVideoContinuously(t,e,r){if(void 0===t&&void 0===e)throw new o("Either an element with a src set or an URL must be provided");return e&&!t?this.decodeFromVideoUrlContinuously(e,r):this.decodeFromVideoElementContinuously(t,r)}decodeFromImageElement(t){if(!t)throw new o("An image element must be provided.");this.reset();const e=this.prepareImageElement(t);let r;return this.imageElement=e,r=this.isImageLoaded(e)?this.decodeOnce(e,!1,!0):this._decodeOnLoadImage(e),r}decodeFromVideoElement(t){const e=this._decodeFromVideoElementSetup(t);return this._decodeOnLoadVideo(e)}decodeFromVideoElementContinuously(t,e){const r=this._decodeFromVideoElementSetup(t);return this._decodeOnLoadVideoContinuously(r,e)}_decodeFromVideoElementSetup(t){if(!t)throw new o("A video element must be provided.");this.reset();const e=this.prepareVideoElement(t);return this.videoElement=e,e}decodeFromImageUrl(t){if(!t)throw new o("An URL must be provided.");this.reset();const e=this.prepareImageElement();this.imageElement=e;const r=this._decodeOnLoadImage(e);return e.src=t,r}decodeFromVideoUrl(t){if(!t)throw new o("An URL must be provided.");this.reset();const e=this.prepareVideoElement(),r=this.decodeFromVideoElement(e);return e.src=t,r}decodeFromVideoUrlContinuously(t,e){if(!t)throw new o("An URL must be provided.");this.reset();const r=this.prepareVideoElement(),n=this.decodeFromVideoElementContinuously(r,e);return r.src=t,n}_decodeOnLoadImage(t){return new Promise(((e,r)=>{this.imageLoadedListener=()=>this.decodeOnce(t,!1,!0).then(e,r),t.addEventListener("load",this.imageLoadedListener)}))}_decodeOnLoadVideo(t){return L(this,void 0,void 0,(function*(){return yield this.playVideoOnLoadAsync(t),yield this.decodeOnce(t)}))}_decodeOnLoadVideoContinuously(t,e){return L(this,void 0,void 0,(function*(){yield this.playVideoOnLoadAsync(t),this.decodeContinuously(t,e)}))}isImageLoaded(t){return!!t.complete&&0!==t.naturalWidth}prepareImageElement(t){let e;return void 0===t&&(e=document.createElement("img"),e.width=200,e.height=200),"string"==typeof t&&(e=this.getMediaElement(t,"img")),t instanceof HTMLImageElement&&(e=t),e}prepareVideoElement(t){let e;return t||"undefined"==typeof document||(e=document.createElement("video"),e.width=200,e.height=200),"string"==typeof t&&(e=this.getMediaElement(t,"video")),t instanceof HTMLVideoElement&&(e=t),e.setAttribute("autoplay","true"),e.setAttribute("muted","true"),e.setAttribute("playsinline","true"),e}decodeOnce(t,e=!0,r=!0){this._stopAsyncDecode=!1;const n=(i,s)=>{if(this._stopAsyncDecode)return s(new N("Video stream has ended before any code could be detected.")),void(this._stopAsyncDecode=void 0);try{i(this.decode(t))}catch(t){if(e&&t instanceof N||(t instanceof l||t instanceof m)&&r)return setTimeout(n,this._timeBetweenDecodingAttempts,i,s);s(t)}};return new Promise(((t,e)=>n(t,e)))}decodeContinuously(t,e){this._stopContinuousDecode=!1;const r=()=>{if(this._stopContinuousDecode)this._stopContinuousDecode=void 0;else try{const n=this.decode(t);e(n,null),setTimeout(r,this.timeBetweenScansMillis)}catch(t){e(null,t);(t instanceof l||t instanceof m||t instanceof N)&&setTimeout(r,this._timeBetweenDecodingAttempts)}};r()}decode(t){const e=this.createBinaryBitmap(t);return this.decodeBitmap(e)}createBinaryBitmap(t){this.getCaptureCanvasContext(t),t instanceof HTMLVideoElement?this.drawFrameOnCanvas(t):this.drawImageOnCanvas(t);const e=this.getCaptureCanvas(t),r=new b(e),n=new D(r);return new h(n)}getCaptureCanvasContext(t){if(!this.captureCanvasContext){const e=this.getCaptureCanvas(t);let r;try{r=e.getContext("2d",{willReadFrequently:!0})}catch(t){r=e.getContext("2d")}this.captureCanvasContext=r}return this.captureCanvasContext}getCaptureCanvas(t){if(!this.captureCanvas){const e=this.createCaptureCanvas(t);this.captureCanvas=e}return this.captureCanvas}drawFrameOnCanvas(t,e={sx:0,sy:0,sWidth:t.videoWidth,sHeight:t.videoHeight,dx:0,dy:0,dWidth:t.videoWidth,dHeight:t.videoHeight},r=this.captureCanvasContext){r.drawImage(t,e.sx,e.sy,e.sWidth,e.sHeight,e.dx,e.dy,e.dWidth,e.dHeight)}drawImageOnCanvas(t,e={sx:0,sy:0,sWidth:t.naturalWidth,sHeight:t.naturalHeight,dx:0,dy:0,dWidth:t.naturalWidth,dHeight:t.naturalHeight},r=this.captureCanvasContext){r.drawImage(t,e.sx,e.sy,e.sWidth,e.sHeight,e.dx,e.dy,e.dWidth,e.dHeight)}decodeBitmap(t){return this.reader.decode(t,this._hints)}createCaptureCanvas(t){if("undefined"==typeof document)return this._destroyCaptureCanvas(),null;const e=document.createElement("canvas");let r,n;return void 0!==t&&(t instanceof HTMLVideoElement?(r=t.videoWidth,n=t.videoHeight):t instanceof HTMLImageElement&&(r=t.naturalWidth||t.width,n=t.naturalHeight||t.height)),e.style.width=r+"px",e.style.height=n+"px",e.width=r,e.height=n,e}stopStreams(){this.stream&&(this.stream.getVideoTracks().forEach((t=>t.stop())),this.stream=void 0),!1===this._stopAsyncDecode&&this.stopAsyncDecode(),!1===this._stopContinuousDecode&&this.stopContinuousDecode()}reset(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()}_destroyVideoElement(){this.videoElement&&(void 0!==this.videoEndedListener&&this.videoElement.removeEventListener("ended",this.videoEndedListener),void 0!==this.videoPlayingEventListener&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),void 0!==this.videoCanPlayListener&&this.videoElement.removeEventListener("loadedmetadata",this.videoCanPlayListener),this.cleanVideoSource(this.videoElement),this.videoElement=void 0)}_destroyImageElement(){this.imageElement&&(void 0!==this.imageLoadedListener&&this.imageElement.removeEventListener("load",this.imageLoadedListener),this.imageElement.src=void 0,this.imageElement.removeAttribute("src"),this.imageElement=void 0)}_destroyCaptureCanvas(){this.captureCanvasContext=void 0,this.captureCanvas=void 0}addVideoSource(t,e){try{t.srcObject=e}catch(r){t.src=URL.createObjectURL(e)}}cleanVideoSource(t){try{t.srcObject=null}catch(e){t.src=""}this.videoElement.removeAttribute("src")}}class v{constructor(t,e,r=(null==e?0:8*e.length),n,i,s=d.currentTimeMillis()){this.text=t,this.rawBytes=e,this.numBits=r,this.resultPoints=n,this.format=i,this.timestamp=s,this.text=t,this.rawBytes=e,this.numBits=null==r?null==e?0:8*e.length:r,this.resultPoints=n,this.format=i,this.resultMetadata=null,this.timestamp=null==s?d.currentTimeMillis():s}getText(){return this.text}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}getResultPoints(){return this.resultPoints}getBarcodeFormat(){return this.format}getResultMetadata(){return this.resultMetadata}putMetadata(t,e){null===this.resultMetadata&&(this.resultMetadata=new Map),this.resultMetadata.set(t,e)}putAllMetadata(t){null!==t&&(null===this.resultMetadata?this.resultMetadata=t:this.resultMetadata=new Map(t))}addResultPoints(t){const e=this.resultPoints;if(null===e)this.resultPoints=t;else if(null!==t&&t.length>0){const r=new Array(e.length+t.length);d.arraycopy(e,0,r,0,e.length),d.arraycopy(t,0,r,e.length,t.length),this.resultPoints=r}}getTimestamp(){return this.timestamp}toString(){return this.text}}!function(t){t[t.AZTEC=0]="AZTEC",t[t.CODABAR=1]="CODABAR",t[t.CODE_39=2]="CODE_39",t[t.CODE_93=3]="CODE_93",t[t.CODE_128=4]="CODE_128",t[t.DATA_MATRIX=5]="DATA_MATRIX",t[t.EAN_8=6]="EAN_8",t[t.EAN_13=7]="EAN_13",t[t.ITF=8]="ITF",t[t.MAXICODE=9]="MAXICODE",t[t.PDF_417=10]="PDF_417",t[t.QR_CODE=11]="QR_CODE",t[t.RSS_14=12]="RSS_14",t[t.RSS_EXPANDED=13]="RSS_EXPANDED",t[t.UPC_A=14]="UPC_A",t[t.UPC_E=15]="UPC_E",t[t.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"}(P||(P={}));var k,x=P;!function(t){t[t.OTHER=0]="OTHER",t[t.ORIENTATION=1]="ORIENTATION",t[t.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",t[t.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",t[t.ISSUE_NUMBER=4]="ISSUE_NUMBER",t[t.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",t[t.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",t[t.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",t[t.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",t[t.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",t[t.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"}(k||(k={}));var V,H,U,X,G,W,z=k;class Y{constructor(t,e,r,n,i=-1,s=-1){this.rawBytes=t,this.text=e,this.byteSegments=r,this.ecLevel=n,this.structuredAppendSequenceNumber=i,this.structuredAppendParity=s,this.numBits=null==t?0:8*t.length}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}setNumBits(t){this.numBits=t}getText(){return this.text}getByteSegments(){return this.byteSegments}getECLevel(){return this.ecLevel}getErrorsCorrected(){return this.errorsCorrected}setErrorsCorrected(t){this.errorsCorrected=t}getErasures(){return this.erasures}setErasures(t){this.erasures=t}getOther(){return this.other}setOther(t){this.other=t}hasStructuredAppend(){return this.structuredAppendParity>=0&&this.structuredAppendSequenceNumber>=0}getStructuredAppendParity(){return this.structuredAppendParity}getStructuredAppendSequenceNumber(){return this.structuredAppendSequenceNumber}}class Z{exp(t){return this.expTable[t]}log(t){if(0===t)throw new a;return this.logTable[t]}static addOrSubtract(t,e){return t^e}}class K{constructor(t,e){if(0===e.length)throw new a;this.field=t;const r=e.length;if(r>1&&0===e[0]){let t=1;for(;tr.length){const t=e;e=r,r=t}let n=new Int32Array(r.length);const i=r.length-e.length;d.arraycopy(r,0,n,0,i);for(let t=i;t=t.getDegree()&&!n.isZero();){const i=n.getDegree()-t.getDegree(),o=e.multiply(n.getCoefficient(n.getDegree()),s),a=t.multiplyByMonomial(i,o),h=e.buildMonomial(i,o);r=r.addOrSubtract(h),n=n.addOrSubtract(a)}return[r,n]}toString(){let t="";for(let e=this.getDegree();e>=0;e--){let r=this.getCoefficient(e);if(0!==r){if(r<0?(t+=" - ",r=-r):t.length>0&&(t+=" + "),0===e||1!==r){const e=this.field.log(r);0===e?t+="1":1===e?t+="a":(t+="a^",t+=e)}0!==e&&(1===e?t+="x":(t+="x^",t+=e))}}return t}}class q extends s{}q.kind="ArithmeticException";class Q extends Z{constructor(t,e,r){super(),this.primitive=t,this.size=e,this.generatorBase=r;const n=new Int32Array(e);let i=1;for(let r=0;r=e&&(i^=t,i&=e-1);this.expTable=n;const s=new Int32Array(e);for(let t=0;t=(r/2|0);){let t=i,e=o;if(i=s,o=a,i.isZero())throw new j("r_{i-1} was zero");s=t;let r=n.getZero();const h=i.getCoefficient(i.getDegree()),l=n.inverse(h);for(;s.getDegree()>=i.getDegree()&&!s.isZero();){const t=s.getDegree()-i.getDegree(),e=n.multiply(s.getCoefficient(s.getDegree()),l);r=r.addOrSubtract(n.buildMonomial(t,e)),s=s.addOrSubtract(i.multiplyByMonomial(t,e))}if(a=r.multiply(o).addOrSubtract(e),s.getDegree()>=i.getDegree())throw new J("Division algorithm failed to reduce polynomial?")}const h=a.getCoefficient(0);if(0===h)throw new j("sigmaTilde(0) was zero");const l=n.inverse(h);return[a.multiplyScalar(l),s.multiplyScalar(l)]}findErrorLocations(t){const e=t.getDegree();if(1===e)return Int32Array.from([t.getCoefficient(1)]);const r=new Int32Array(e);let n=0;const i=this.field;for(let s=1;s1,c,c+r-1),c+=r-1;else for(let t=r-1;t>=0;--t)l[c++]=!!(e&1<=8?tt.readCode(t,e,8):tt.readCode(t,e,r)<<8-r}static convertBoolArrayToByteArray(t){let e=new Uint8Array((t.length+7)/8);for(let r=0;r","?","[","]","{","}","CTRL_UL"],tt.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class et{constructor(){}static round(t){return isNaN(t)?0:t<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:t>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:t+(t<0?-.5:.5)|0}static distance(t,e,r,n){const i=t-r,s=e-n;return Math.sqrt(i*i+s*s)}static sum(t){let e=0;for(let r=0,n=t.length;r!==n;r++){e+=t[r]}return e}}class rt{static floatToIntBits(t){return t}}rt.MAX_VALUE=Number.MAX_SAFE_INTEGER;class nt{constructor(t,e){this.x=t,this.y=e}getX(){return this.x}getY(){return this.y}equals(t){if(t instanceof nt){const e=t;return this.x===e.x&&this.y===e.y}return!1}hashCode(){return 31*rt.floatToIntBits(this.x)+rt.floatToIntBits(this.y)}toString(){return"("+this.x+","+this.y+")"}static orderBestPatterns(t){const e=this.distance(t[0],t[1]),r=this.distance(t[1],t[2]),n=this.distance(t[0],t[2]);let i,s,o;if(r>=e&&r>=n?(s=t[0],i=t[1],o=t[2]):n>=r&&n>=e?(s=t[1],i=t[0],o=t[2]):(s=t[2],i=t[0],o=t[1]),this.crossProductZ(i,s,o)<0){const t=i;i=o,o=t}t[0]=i,t[1]=s,t[2]=o}static distance(t,e){return et.distance(t.x,t.y,e.x,e.y)}static crossProductZ(t,e,r){const n=e.x,i=e.y;return(r.x-n)*(t.y-i)-(r.y-i)*(t.x-n)}}class it{constructor(t,e){this.bits=t,this.points=e}getBits(){return this.bits}getPoints(){return this.points}}class st extends it{constructor(t,e,r,n,i){super(t,e),this.compact=r,this.nbDatablocks=n,this.nbLayers=i}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class ot{constructor(t,e,r,n){this.image=t,this.height=t.getHeight(),this.width=t.getWidth(),null==e&&(e=ot.INIT_SIZE),null==r&&(r=t.getWidth()/2|0),null==n&&(n=t.getHeight()/2|0);const i=e/2|0;if(this.leftInit=r-i,this.rightInit=r+i,this.upInit=n-i,this.downInit=n+i,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new N}detect(){let t=this.leftInit,e=this.rightInit,r=this.upInit,n=this.downInit,i=!1,s=!0,o=!1,a=!1,h=!1,l=!1,c=!1;const d=this.width,u=this.height;for(;s;){s=!1;let g=!0;for(;(g||!a)&&e=d){i=!0;break}let f=!0;for(;(f||!h)&&n=u){i=!0;break}let w=!0;for(;(w||!l)&&t>=0;)w=this.containsBlackPoint(r,n,t,!1),w?(t--,s=!0,l=!0):l||t--;if(t<0){i=!0;break}let C=!0;for(;(C||!c)&&r>=0;)C=this.containsBlackPoint(t,e,r,!0),C?(r--,s=!0,c=!0):c||r--;if(r<0){i=!0;break}s&&(o=!0)}if(!i&&o){const i=e-t;let s=null;for(let e=1;null===s&&er||o<-1||o>n)throw new N;i=!1,-1===s?(e[t]=0,i=!0):s===r&&(e[t]=r-1,i=!0),-1===o?(e[t+1]=0,i=!0):o===n&&(e[t+1]=n-1,i=!0)}i=!0;for(let t=e.length-2;t>=0&&i;t-=2){const s=Math.floor(e[t]),o=Math.floor(e[t+1]);if(s<-1||s>r||o<-1||o>n)throw new N;i=!1,-1===s?(e[t]=0,i=!0):s===r&&(e[t]=r-1,i=!0),-1===o?(e[t+1]=0,i=!0):o===n&&(e[t+1]=n-1,i=!0)}}}class ht{constructor(t,e,r,n,i,s,o,a,h){this.a11=t,this.a21=e,this.a31=r,this.a12=n,this.a22=i,this.a32=s,this.a13=o,this.a23=a,this.a33=h}static quadrilateralToQuadrilateral(t,e,r,n,i,s,o,a,h,l,c,d,u,g,f,w){const C=ht.quadrilateralToSquare(t,e,r,n,i,s,o,a);return ht.squareToQuadrilateral(h,l,c,d,u,g,f,w).times(C)}transformPoints(t){const e=t.length,r=this.a11,n=this.a12,i=this.a13,s=this.a21,o=this.a22,a=this.a23,h=this.a31,l=this.a32,c=this.a33;for(let d=0;d>1&127):(n<<=10,n+=(e>>2&992)+(e>>1&31))}let i=this.getCorrectedParameterData(n,this.compact);this.compact?(this.nbLayers=1+(i>>6),this.nbDataBlocks=1+(63&i)):(this.nbLayers=1+(i>>11),this.nbDataBlocks=1+(2047&i))}getRotation(t,e){let r=0;t.forEach(((t,n,i)=>{r=(r<<3)+((t>>e-2<<1)+(1&t))})),r=((1&r)<<11)+(r>>1);for(let t=0;t<4;t++)if(w.bitCount(r^this.EXPECTED_CORNER_BITS[t])<=2)return t;throw new N}getCorrectedParameterData(t,e){let r,n;e?(r=7,n=2):(r=10,n=4);let i=r-n,s=new Int32Array(r);for(let e=r-1;e>=0;--e)s[e]=15&t,t>>=4;try{new $(Q.AZTEC_PARAM).decode(s,i)}catch(t){throw new N}let o=0;for(let t=0;t2){let r=this.distancePoint(h,t)*this.nbCenterLayers/(this.distancePoint(i,e)*(this.nbCenterLayers+2));if(r<.75||r>1.25||!this.isWhiteOrBlackRectangle(t,o,a,h))break}e=t,r=o,n=a,i=h,s=!s}if(5!==this.nbCenterLayers&&7!==this.nbCenterLayers)throw new N;this.compact=5===this.nbCenterLayers;let o=new nt(e.getX()+.5,e.getY()-.5),a=new nt(r.getX()+.5,r.getY()+.5),h=new nt(n.getX()-.5,n.getY()+.5),l=new nt(i.getX()-.5,i.getY()-.5);return this.expandSquare([o,a,h,l],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let t,e,r,n;try{let i=new ot(this.image).detect();t=i[0],e=i[1],r=i[2],n=i[3]}catch(i){let s=this.image.getWidth()/2,o=this.image.getHeight()/2;t=this.getFirstDifferent(new dt(s+7,o-7),!1,1,-1).toResultPoint(),e=this.getFirstDifferent(new dt(s+7,o+7),!1,1,1).toResultPoint(),r=this.getFirstDifferent(new dt(s-7,o+7),!1,-1,1).toResultPoint(),n=this.getFirstDifferent(new dt(s-7,o-7),!1,-1,-1).toResultPoint()}let i=et.round((t.getX()+n.getX()+e.getX()+r.getX())/4),s=et.round((t.getY()+n.getY()+e.getY()+r.getY())/4);try{let o=new ot(this.image,15,i,s).detect();t=o[0],e=o[1],r=o[2],n=o[3]}catch(o){t=this.getFirstDifferent(new dt(i+7,s-7),!1,1,-1).toResultPoint(),e=this.getFirstDifferent(new dt(i+7,s+7),!1,1,1).toResultPoint(),r=this.getFirstDifferent(new dt(i-7,s+7),!1,-1,1).toResultPoint(),n=this.getFirstDifferent(new dt(i-7,s-7),!1,-1,-1).toResultPoint()}return i=et.round((t.getX()+n.getX()+e.getX()+r.getX())/4),s=et.round((t.getY()+n.getY()+e.getY()+r.getY())/4),new dt(i,s)}getMatrixCornerPoints(t){return this.expandSquare(t,2*this.nbCenterLayers,this.getDimension())}sampleGrid(t,e,r,n,i){let s=ct.getInstance(),o=this.getDimension(),a=o/2-this.nbCenterLayers,h=o/2+this.nbCenterLayers;return s.sampleGrid(t,o,o,a,a,h,a,h,h,a,h,e.getX(),e.getY(),r.getX(),r.getY(),n.getX(),n.getY(),i.getX(),i.getY())}sampleLine(t,e,r){let n=0,i=this.distanceResultPoint(t,e),s=i/r,o=t.getX(),a=t.getY(),h=s*(e.getX()-t.getX())/i,l=s*(e.getY()-t.getY())/i;for(let t=0;t.1&&c<.9?0:c<=.1===h?1:-1}getFirstDifferent(t,e,r,n){let i=t.getX()+r,s=t.getY()+n;for(;this.isValid(i,s)&&this.image.get(i,s)===e;)i+=r,s+=n;for(i-=r,s-=n;this.isValid(i,s)&&this.image.get(i,s)===e;)i+=r;for(i-=r;this.isValid(i,s)&&this.image.get(i,s)===e;)s+=n;return s-=n,new dt(i,s)}expandSquare(t,e,r){let n=r/(2*e),i=t[0].getX()-t[2].getX(),s=t[0].getY()-t[2].getY(),o=(t[0].getX()+t[2].getX())/2,a=(t[0].getY()+t[2].getY())/2,h=new nt(o+n*i,a+n*s),l=new nt(o-n*i,a-n*s);return i=t[1].getX()-t[3].getX(),s=t[1].getY()-t[3].getY(),o=(t[1].getX()+t[3].getX())/2,a=(t[1].getY()+t[3].getY())/2,[h,new nt(o+n*i,a+n*s),l,new nt(o-n*i,a-n*s)]}isValid(t,e){return t>=0&&t0&&e{r.foundPossibleResultPoint(t)}))}}reset(){}}class ft{decode(t,e){try{return this.doDecode(t,e)}catch(r){if(e&&!0===e.get(E.TRY_HARDER)&&t.isRotateSupported()){const r=t.rotateCounterClockwise(),n=this.doDecode(r,e),i=n.getResultMetadata();let s=270;null!==i&&!0===i.get(z.ORIENTATION)&&(s+=i.get(z.ORIENTATION)%360),n.putMetadata(z.ORIENTATION,s);const o=n.getResultPoints();if(null!==o){const t=r.getHeight();for(let e=0;e>(s?8:5));let a;a=s?n:15;const h=Math.trunc(n/2);for(let s=0;s=n)break;try{i=t.getBlackRow(l,i)}catch(t){continue}for(let t=0;t<2;t++){if(1===t&&(i.reverse(),e&&!0===e.get(E.NEED_RESULT_POINT_CALLBACK))){const t=new Map;e.forEach(((e,r)=>t.set(r,e))),t.delete(E.NEED_RESULT_POINT_CALLBACK),e=t}try{const n=this.decodeRow(l,i,e);if(1===t){n.putMetadata(z.ORIENTATION,180);const t=n.getResultPoints();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()))}return n}catch(t){}}}throw new N}static recordPattern(t,e,r){const n=r.length;for(let t=0;t=i)throw new N;let s=!t.get(e),o=0,a=e;for(;a0&&n>=0;)t.get(--e)!==i&&(n--,i=!i);if(n>=0)throw new N;ft.recordPattern(t,e+1,r)}static patternMatchVariance(t,e,r){const n=t.length;let i=0,s=0;for(let r=0;rs?n-s:s-n;if(h>r)return Number.POSITIVE_INFINITY;a+=h}return a/i}}class wt extends ft{static findStartPattern(t){const e=t.getSize(),r=t.getNextSet(0);let n=0,i=Int32Array.from([0,0,0,0,0,0]),s=r,o=!1;for(let a=r;a=0&&t.isRange(Math.max(0,s-(a-s)/2),s,!1))return Int32Array.from([s,a,r]);s+=i[0]+i[1],i=i.slice(2,i.length),i[n-1]=0,i[n]=0,n--}else n++;i[n]=1,o=!o}throw new N}static decodeCode(t,e,r){ft.recordPattern(t,r,e);let n=wt.MAX_AVG_VARIANCE,i=-1;for(let t=0;t=0)return i;throw new N}decodeRow(t,e,r){const n=r&&!0===r.get(E.ASSUME_GS1),i=wt.findStartPattern(e),s=i[2];let o=0;const a=new Uint8Array(20);let h;switch(a[o++]=s,s){case wt.CODE_START_A:h=wt.CODE_CODE_A;break;case wt.CODE_START_B:h=wt.CODE_CODE_B;break;case wt.CODE_START_C:h=wt.CODE_CODE_C;break;default:throw new m}let c=!1,d=!1,u="",g=i[0],f=i[1];const w=Int32Array.from([0,0,0,0,0,0]);let C=0,A=0,I=s,_=0,S=!0,p=!1,T=!1;for(;!c;){const t=d;switch(d=!1,C=A,A=wt.decodeCode(e,w,f),a[o++]=A,A!==wt.CODE_STOP&&(S=!0),A!==wt.CODE_STOP&&(_++,I+=_*A),g=f,f+=w.reduce(((t,e)=>t+e),0),A){case wt.CODE_START_A:case wt.CODE_START_B:case wt.CODE_START_C:throw new m}switch(h){case wt.CODE_CODE_A:if(A<64)u+=T===p?String.fromCharCode(" ".charCodeAt(0)+A):String.fromCharCode(" ".charCodeAt(0)+A+128),T=!1;else if(A<96)u+=T===p?String.fromCharCode(A-64):String.fromCharCode(A+64),T=!1;else switch(A!==wt.CODE_STOP&&(S=!1),A){case wt.CODE_FNC_1:n&&(0===u.length?u+="]C1":u+=String.fromCharCode(29));break;case wt.CODE_FNC_2:case wt.CODE_FNC_3:break;case wt.CODE_FNC_4_A:!p&&T?(p=!0,T=!1):p&&T?(p=!1,T=!1):T=!0;break;case wt.CODE_SHIFT:d=!0,h=wt.CODE_CODE_B;break;case wt.CODE_CODE_B:h=wt.CODE_CODE_B;break;case wt.CODE_CODE_C:h=wt.CODE_CODE_C;break;case wt.CODE_STOP:c=!0}break;case wt.CODE_CODE_B:if(A<96)u+=T===p?String.fromCharCode(" ".charCodeAt(0)+A):String.fromCharCode(" ".charCodeAt(0)+A+128),T=!1;else switch(A!==wt.CODE_STOP&&(S=!1),A){case wt.CODE_FNC_1:n&&(0===u.length?u+="]C1":u+=String.fromCharCode(29));break;case wt.CODE_FNC_2:case wt.CODE_FNC_3:break;case wt.CODE_FNC_4_B:!p&&T?(p=!0,T=!1):p&&T?(p=!1,T=!1):T=!0;break;case wt.CODE_SHIFT:d=!0,h=wt.CODE_CODE_A;break;case wt.CODE_CODE_A:h=wt.CODE_CODE_A;break;case wt.CODE_CODE_C:h=wt.CODE_CODE_C;break;case wt.CODE_STOP:c=!0}break;case wt.CODE_CODE_C:if(A<100)A<10&&(u+="0"),u+=A;else switch(A!==wt.CODE_STOP&&(S=!1),A){case wt.CODE_FNC_1:n&&(0===u.length?u+="]C1":u+=String.fromCharCode(29));break;case wt.CODE_CODE_A:h=wt.CODE_CODE_A;break;case wt.CODE_CODE_B:h=wt.CODE_CODE_B;break;case wt.CODE_STOP:c=!0}}t&&(h=h===wt.CODE_CODE_A?wt.CODE_CODE_B:wt.CODE_CODE_A)}const R=f-g;if(f=e.getNextUnset(f),!e.isRange(f,Math.min(e.getSize(),f+(f-g)/2),!1))throw new N;if(I-=_*C,I%103!==C)throw new l;const y=u.length;if(0===y)throw new N;y>0&&S&&(u=h===wt.CODE_CODE_C?u.substring(0,y-2):u.substring(0,y-1));const D=(i[1]+i[0])/2,O=g+R/2,M=a.length,b=new Uint8Array(M);for(let t=0;tn&&(i=e);n=i,e=0;let s=0,o=0;for(let i=0;in&&(o|=1<0;i++){let r=t[i];if(r>n&&(e--,2*r>=s))return-1}return o}}while(e>3);return-1}static patternToChar(t){for(let e=0;e="A"&&i<="Z"))throw new m;s=String.fromCharCode(i.charCodeAt(0)+32);break;case"$":if(!(i>="A"&&i<="Z"))throw new m;s=String.fromCharCode(i.charCodeAt(0)-64);break;case"%":if(i>="A"&&i<="E")s=String.fromCharCode(i.charCodeAt(0)-38);else if(i>="F"&&i<="J")s=String.fromCharCode(i.charCodeAt(0)-11);else if(i>="K"&&i<="O")s=String.fromCharCode(i.charCodeAt(0)+16);else if(i>="P"&&i<="T")s=String.fromCharCode(i.charCodeAt(0)+43);else if("U"===i)s="\0";else if("V"===i)s="@";else if("W"===i)s="`";else{if("X"!==i&&"Y"!==i&&"Z"!==i)throw new m;s=""}break;case"/":if(i>="A"&&i<="O")s=String.fromCharCode(i.charCodeAt(0)-32);else{if("Z"!==i)throw new m;s=":"}}r+=s,n++}else r+=e}return r}}Ct.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",Ct.CHARACTER_ENCODINGS=[52,289,97,352,49,304,112,37,292,100,265,73,328,25,280,88,13,268,76,28,259,67,322,19,274,82,7,262,70,22,385,193,448,145,400,208,133,388,196,168,162,138,42],Ct.ASTERISK_ENCODING=148;class At extends ft{constructor(){super(),this.decodeRowResult="",this.counters=new Int32Array(6)}decodeRow(t,e,r){let n,i,s=this.findAsteriskPattern(e),o=e.getNextSet(s[1]),a=e.getSize(),h=this.counters;h.fill(0),this.decodeRowResult="";do{At.recordPattern(e,o,h);let t=this.toPattern(h);if(t<0)throw new N;n=this.patternToChar(t),this.decodeRowResult+=n,i=o;for(let t of h)o+=t;o=e.getNextSet(o)}while("*"!==n);this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let l=0;for(let t of h)l+=t;if(o===a||!e.get(o))throw new N;if(this.decodeRowResult.length<2)throw new N;this.checkChecksums(this.decodeRowResult),this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-2);let c=this.decodeExtended(this.decodeRowResult),d=(s[1]+s[0])/2,u=i+l/2;return new v(c,null,0,[new nt(d,t),new nt(u,t)],x.CODE_93,(new Date).getTime())}findAsteriskPattern(t){let e=t.getSize(),r=t.getNextSet(0);this.counters.fill(0);let n=this.counters,i=r,s=!1,o=n.length,a=0;for(let h=r;h4)return-1;if(1&i)r<<=n;else for(let t=0;t="a"&&i<="d"){if(n>=e-1)throw new m;let s=t.charAt(n+1),o="\0";switch(i){case"d":if(!(s>="A"&&s<="Z"))throw new m;o=String.fromCharCode(s.charCodeAt(0)+32);break;case"a":if(!(s>="A"&&s<="Z"))throw new m;o=String.fromCharCode(s.charCodeAt(0)-64);break;case"b":if(s>="A"&&s<="E")o=String.fromCharCode(s.charCodeAt(0)-38);else if(s>="F"&&s<="J")o=String.fromCharCode(s.charCodeAt(0)-11);else if(s>="K"&&s<="O")o=String.fromCharCode(s.charCodeAt(0)+16);else if(s>="P"&&s<="T")o=String.fromCharCode(s.charCodeAt(0)+43);else if("U"===s)o="\0";else if("V"===s)o="@";else if("W"===s)o="`";else{if(!(s>="X"&&s<="Z"))throw new m;o=String.fromCharCode(127)}break;case"c":if(s>="A"&&s<="O")o=String.fromCharCode(s.charCodeAt(0)-32);else{if("Z"!==s)throw new m;o=":"}}r+=o,n++}else r+=i}return r}checkChecksums(t){let e=t.length;this.checkOneChecksum(t,e-2,20),this.checkOneChecksum(t,e-1,15)}checkOneChecksum(t,e,r){let n=1,i=0;for(let s=e-1;s>=0;s--)i+=n*At.ALPHABET_STRING.indexOf(t.charAt(s)),++n>r&&(n=1);if(t.charAt(e)!==At.ALPHABET_STRING[i%47])throw new l}}At.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*",At.CHARACTER_ENCODINGS=[276,328,324,322,296,292,290,336,274,266,424,420,418,404,402,394,360,356,354,308,282,344,332,326,300,278,436,434,428,422,406,410,364,358,310,314,302,468,466,458,366,374,430,294,474,470,306,350],At.ASTERISK_ENCODING=At.CHARACTER_ENCODINGS[47];class Et extends ft{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(t,e,r){let n=this.decodeStart(e),i=this.decodeEnd(e),s=new T;Et.decodeMiddle(e,n[1],i[0],s);let o=s.toString(),a=null;null!=r&&(a=r.get(E.ALLOWED_LENGTHS)),null==a&&(a=Et.DEFAULT_ALLOWED_LENGTHS);let h=o.length,l=!1,c=0;for(let t of a){if(h===t){l=!0;break}t>c&&(c=t)}if(!l&&h>c&&(l=!0),!l)throw new m;const d=[new nt(n[1],t),new nt(i[0],t)];return new v(o,null,0,d,x.ITF,(new Date).getTime())}static decodeMiddle(t,e,r,n){let i=new Int32Array(10),s=new Int32Array(5),o=new Int32Array(5);for(i.fill(0),s.fill(0),o.fill(0);e0&&n>=0&&!t.get(n);n--)r--;if(0!==r)throw new N}static skipWhiteSpace(t){const e=t.getSize(),r=t.getNextSet(0);if(r===e)throw new N;return r}decodeEnd(t){t.reverse();try{let e,r=Et.skipWhiteSpace(t);try{e=Et.findGuardPattern(t,r,Et.END_PATTERN_REVERSED[0])}catch(n){n instanceof N&&(e=Et.findGuardPattern(t,r,Et.END_PATTERN_REVERSED[1]))}this.validateQuietZone(t,e[0]);let n=e[0];return e[0]=t.getSize()-e[1],e[1]=t.getSize()-n,e}finally{t.reverse()}}static findGuardPattern(t,e,r){let n=r.length,i=new Int32Array(n),s=t.getSize(),o=!1,a=0,h=e;i.fill(0);for(let l=e;l=0)return r%10;throw new N}}Et.PATTERNS=[Int32Array.from([1,1,2,2,1]),Int32Array.from([2,1,1,1,2]),Int32Array.from([1,2,1,1,2]),Int32Array.from([2,2,1,1,1]),Int32Array.from([1,1,2,1,2]),Int32Array.from([2,1,2,1,1]),Int32Array.from([1,2,2,1,1]),Int32Array.from([1,1,1,2,2]),Int32Array.from([2,1,1,2,1]),Int32Array.from([1,2,1,2,1]),Int32Array.from([1,1,3,3,1]),Int32Array.from([3,1,1,1,3]),Int32Array.from([1,3,1,1,3]),Int32Array.from([3,3,1,1,1]),Int32Array.from([1,1,3,1,3]),Int32Array.from([3,1,3,1,1]),Int32Array.from([1,3,3,1,1]),Int32Array.from([1,1,1,3,3]),Int32Array.from([3,1,1,3,1]),Int32Array.from([1,3,1,3,1])],Et.MAX_AVG_VARIANCE=.38,Et.MAX_INDIVIDUAL_VARIANCE=.5,Et.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],Et.START_PATTERN=Int32Array.from([1,1,1,1]),Et.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class mt extends ft{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(t){let e,r=!1,n=0,i=Int32Array.from([0,0,0]);for(;!r;){i=Int32Array.from([0,0,0]),e=mt.findGuardPattern(t,n,!1,this.START_END_PATTERN,i);let s=e[0];n=e[1];let o=s-(n-s);o>=0&&(r=t.isRange(o,s,!1))}return e}static checkChecksum(t){return mt.checkStandardUPCEANChecksum(t)}static checkStandardUPCEANChecksum(t){let e=t.length;if(0===e)return!1;let r=parseInt(t.charAt(e-1),10);return mt.getStandardUPCEANChecksum(t.substring(0,e-1))===r}static getStandardUPCEANChecksum(t){let e=t.length,r=0;for(let n=e-1;n>=0;n-=2){let e=t.charAt(n).charCodeAt(0)-"0".charCodeAt(0);if(e<0||e>9)throw new m;r+=e}r*=3;for(let n=e-2;n>=0;n-=2){let e=t.charAt(n).charCodeAt(0)-"0".charCodeAt(0);if(e<0||e>9)throw new m;r+=e}return(1e3-r)%10}static decodeEnd(t,e){return mt.findGuardPattern(t,e,!1,mt.START_END_PATTERN,new Int32Array(mt.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(t,e,r,n){return this.findGuardPattern(t,e,r,n,new Int32Array(n.length))}static findGuardPattern(t,e,r,n,i){let s=t.getSize(),o=0,a=e=r?t.getNextUnset(e):t.getNextSet(e),h=n.length,l=r;for(let r=e;r=0)return s;throw new N}}mt.MAX_AVG_VARIANCE=.48,mt.MAX_INDIVIDUAL_VARIANCE=.7,mt.START_END_PATTERN=Int32Array.from([1,1,1]),mt.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),mt.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),mt.L_PATTERNS=[Int32Array.from([3,2,1,1]),Int32Array.from([2,2,2,1]),Int32Array.from([2,1,2,2]),Int32Array.from([1,4,1,1]),Int32Array.from([1,1,3,2]),Int32Array.from([1,2,3,1]),Int32Array.from([1,1,1,4]),Int32Array.from([1,3,1,2]),Int32Array.from([1,2,1,3]),Int32Array.from([3,1,1,2])];class It{constructor(){this.CHECK_DIGIT_ENCODINGS=[24,20,18,17,12,6,3,10,9,5],this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(t,e,r){let n=this.decodeRowStringBuffer,i=this.decodeMiddle(e,r,n),s=n.toString(),o=It.parseExtensionString(s),a=[new nt((r[0]+r[1])/2,t),new nt(i,t)],h=new v(s,null,0,a,x.UPC_EAN_EXTENSION,(new Date).getTime());return null!=o&&h.putAllMetadata(o),h}decodeMiddle(t,e,r){let n=this.decodeMiddleCounters;n[0]=0,n[1]=0,n[2]=0,n[3]=0;let i=t.getSize(),s=e[1],o=0;for(let e=0;e<5&&s=10&&(o|=1<<4-e),4!==e&&(s=t.getNextSet(s),s=t.getNextUnset(s))}if(5!==r.length)throw new N;let a=this.determineCheckDigit(o);if(It.extensionChecksum(r.toString())!==a)throw new N;return s}static extensionChecksum(t){let e=t.length,r=0;for(let n=e-2;n>=0;n-=2)r+=t.charAt(n).charCodeAt(0)-"0".charCodeAt(0);r*=3;for(let n=e-1;n>=0;n-=2)r+=t.charAt(n).charCodeAt(0)-"0".charCodeAt(0);return r*=3,r%10}determineCheckDigit(t){for(let e=0;e<10;e++)if(t===this.CHECK_DIGIT_ENCODINGS[e])return e;throw new N}static parseExtensionString(t){if(5!==t.length)return null;let e=It.parseExtension5String(t);return null==e?null:new Map([[z.SUGGESTED_PRICE,e]])}static parseExtension5String(t){let e;switch(t.charAt(0)){case"0":e="£";break;case"5":e="$";break;case"9":switch(t){case"90000":return null;case"99991":return"0.00";case"99990":return"Used"}e="";break;default:e=""}let r=parseInt(t.substring(1)),n=r%100;return e+(r/100).toString()+"."+(n<10?"0"+n:n.toString())}}class _t{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(t,e,r){let n=this.decodeRowStringBuffer,i=this.decodeMiddle(e,r,n),s=n.toString(),o=_t.parseExtensionString(s),a=[new nt((r[0]+r[1])/2,t),new nt(i,t)],h=new v(s,null,0,a,x.UPC_EAN_EXTENSION,(new Date).getTime());return null!=o&&h.putAllMetadata(o),h}decodeMiddle(t,e,r){let n=this.decodeMiddleCounters;n[0]=0,n[1]=0,n[2]=0,n[3]=0;let i=t.getSize(),s=e[1],o=0;for(let e=0;e<2&&s=10&&(o|=1<<1-e),1!==e&&(s=t.getNextSet(s),s=t.getNextUnset(s))}if(2!==r.length)throw new N;if(parseInt(r.toString())%4!==o)throw new N;return s}static parseExtensionString(t){return 2!==t.length?null:new Map([[z.ISSUE_NUMBER,parseInt(t)]])}}class St{static decodeRow(t,e,r){let n=mt.findGuardPattern(e,r,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return(new It).decodeRow(t,e,n)}catch(r){return(new _t).decodeRow(t,e,n)}}}St.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class pt extends mt{constructor(){super(),this.decodeRowStringBuffer="",pt.L_AND_G_PATTERNS=pt.L_PATTERNS.map((t=>Int32Array.from(t)));for(let t=10;t<20;t++){let e=pt.L_PATTERNS[t-10],r=new Int32Array(e.length);for(let t=0;t=e.getSize()||!e.isRange(c,d,!1))throw new N;let u=a.toString();if(u.length<8)throw new m;if(!pt.checkChecksum(u))throw new l;let g=(n[1]+n[0])/2,f=(h[1]+h[0])/2,w=this.getBarcodeFormat(),C=[new nt(g,t),new nt(f,t)],A=new v(u,null,0,C,w,(new Date).getTime()),I=0;try{let r=St.decodeRow(t,e,h[1]);A.putMetadata(z.UPC_EAN_EXTENSION,r.getText()),A.putAllMetadata(r.getResultMetadata()),A.addResultPoints(r.getResultPoints()),I=r.getText().length}catch(t){}let _=null==r?null:r.get(E.ALLOWED_EAN_EXTENSIONS);if(null!=_){let t=!1;for(let e in _)if(I.toString()===e){t=!0;break}if(!t)throw new N}return w===x.EAN_13||x.UPC_A,A}static checkChecksum(t){return pt.checkStandardUPCEANChecksum(t)}static checkStandardUPCEANChecksum(t){let e=t.length;if(0===e)return!1;let r=parseInt(t.charAt(e-1),10);return pt.getStandardUPCEANChecksum(t.substring(0,e-1))===r}static getStandardUPCEANChecksum(t){let e=t.length,r=0;for(let n=e-1;n>=0;n-=2){let e=t.charAt(n).charCodeAt(0)-"0".charCodeAt(0);if(e<0||e>9)throw new m;r+=e}r*=3;for(let n=e-2;n>=0;n-=2){let e=t.charAt(n).charCodeAt(0)-"0".charCodeAt(0);if(e<0||e>9)throw new m;r+=e}return(1e3-r)%10}static decodeEnd(t,e){return pt.findGuardPattern(t,e,!1,pt.START_END_PATTERN,new Int32Array(pt.START_END_PATTERN.length).fill(0))}}class Tt extends pt{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(t,e,r){let n=this.decodeMiddleCounters;n[0]=0,n[1]=0,n[2]=0,n[3]=0;let i=t.getSize(),s=e[1],o=0;for(let e=0;e<6&&s=10&&(o|=1<<5-e)}r=Tt.determineFirstDigit(r,o),s=pt.findGuardPattern(t,s,!0,pt.MIDDLE_PATTERN,new Int32Array(pt.MIDDLE_PATTERN.length).fill(0))[1];for(let e=0;e<6&&st));n[0]=0,n[1]=0,n[2]=0,n[3]=0;const i=t.getSize();let s=e[1],o=0;for(let e=0;e<6&&s=10&&(o|=1<<5-e)}return yt.determineNumSysAndCheckDigit(new T(r),o),s}decodeEnd(t,e){return yt.findGuardPatternWithoutCounters(t,e,!0,yt.MIDDLE_END_PATTERN)}checkChecksum(t){return pt.checkChecksum(yt.convertUPCEtoUPCA(t))}static determineNumSysAndCheckDigit(t,e){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);throw N.getNotFoundInstance()}getBarcodeFormat(){return x.UPC_E}static convertUPCEtoUPCA(t){const e=t.slice(1,7).split("").map((t=>t.charCodeAt(0))),r=new T;r.append(t.charAt(0));let n=e[5];switch(n){case 0:case 1:case 2:r.appendChars(e,0,2),r.append(n),r.append("0000"),r.appendChars(e,2,3);break;case 3:r.appendChars(e,0,3),r.append("00000"),r.appendChars(e,3,2);break;case 4:r.appendChars(e,0,4),r.append("00000"),r.append(e[4]);break;default:r.appendChars(e,0,5),r.append("0000"),r.append(n)}return t.length>=8&&r.append(t.charAt(7)),r.toString()}}yt.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),yt.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])];class Dt extends ft{constructor(t){super();let e=null==t?null:t.get(E.POSSIBLE_FORMATS),r=[];null!=e&&(e.indexOf(x.EAN_13)>-1&&r.push(new Tt),e.indexOf(x.UPC_A)>-1&&r.push(new Nt),e.indexOf(x.EAN_8)>-1&&r.push(new Rt),e.indexOf(x.UPC_E)>-1&&r.push(new yt)),0===r.length&&(r.push(new Tt),r.push(new Nt),r.push(new Rt),r.push(new yt)),this.readers=r}decodeRow(t,e,r){for(let n of this.readers)try{const i=n.decodeRow(t,e,r),s=i.getBarcodeFormat()===x.EAN_13&&"0"===i.getText().charAt(0),o=null==r?null:r.get(E.POSSIBLE_FORMATS),a=null==o||o.includes(x.UPC_A);if(s&&a){const t=i.getRawBytes(),e=new v(i.getText().substring(1),t,t?t.length:null,i.getResultPoints(),x.UPC_A);return e.putAllMetadata(i.getResultMetadata()),e}return i}catch(t){}throw new N}reset(){for(let t of this.readers)t.reset()}}class Ot extends ft{constructor(){super(...arguments),this.CODA_BAR_CHAR_SET={nnnnnww:"0",nnnnwwn:"1",nnnwnnw:"2",wwnnnnn:"3",nnwnnwn:"4",wnnnnwn:"5",nwnnnnw:"6",nwnnwnn:"7",nwwnnnn:"8",wnnwnnn:"9",nnnwwnn:"-",nnwwnnn:"$",wnnnwnw:":",wnwnnnw:"/",wnwnwnn:".",nnwwwww:"+",nnwwnwn:"A",nwnwnnw:"B",nnnwnww:"C",nnnwwwn:"D"}}decodeRow(t,e,r){let n=this.getValidRowData(e);if(!n)throw new N;let i=this.codaBarDecodeRow(n.row);if(!i)throw new N;return new v(i,null,0,[new nt(n.left,t),new nt(n.right,t)],x.CODABAR,(new Date).getTime())}getValidRowData(t){let e=t.toArray(),r=e.indexOf(!0);if(-1===r)return null;let n=e.lastIndexOf(!0);if(n<=r)return null;e=e.slice(r,n+1);let i=[],s=e[0],o=1;for(let t=1;t(t+e)/2),0));for(;t.length>0;){const n=t.splice(0,8).splice(0,7).map((t=>tn&&(n=e[i],r=i);t[r]++}static decrement(t,e){let r=0,n=e[0];for(let i=1;i=Mt.MIN_FINDER_PATTERN_RATIO&&r<=Mt.MAX_FINDER_PATTERN_RATIO){let e=Number.MAX_SAFE_INTEGER,r=Number.MIN_SAFE_INTEGER;for(let n of t)n>r&&(r=n),n=o-a-1&&(t-=Pt.combins(n-h-(o-a),o-a-2)),o-a-1>1){let r=0;for(let t=n-h-(o-a-2);t>e;t--)r+=Pt.combins(n-h-t-1,o-a-3);t-=r*(o-1-a)}else n-h>e&&t--;i+=t}n-=h}return i}static combins(t,e){let r,n;t-e>e?(n=e,r=t-e):(n=t-e,r=e);let i=1,s=1;for(let e=t;e>r;e--)i*=e,s<=n&&(i/=s,s++);for(;s<=n;)i/=s,s++;return i}}class Lt{static buildBitArray(t){let e=2*t.length-1;null==t[t.length-1].getRightChar()&&(e-=1);let r=new C(12*e),n=0,i=t[0].getRightChar().getValue();for(let t=11;t>=0;--t)i&1<=0;--t)s&1<=0;--e)t&1<10||r<0||r>10)throw new m;this.firstDigit=e,this.secondDigit=r}getFirstDigit(){return this.firstDigit}getSecondDigit(){return this.secondDigit}getValue(){return 10*this.firstDigit+this.secondDigit}isFirstDigitFNC1(){return this.firstDigit===Vt.FNC1}isSecondDigitFNC1(){return this.secondDigit===Vt.FNC1}isAnyFNC1(){return this.firstDigit===Vt.FNC1||this.secondDigit===Vt.FNC1}}Vt.FNC1=10;class Ht{constructor(){}static parseFieldsInGeneralPurpose(t){if(!t)return null;if(t.length<2)throw new N;let e=t.substring(0,2);for(let r of Ht.TWO_DIGIT_DATA_LENGTH)if(r[0]===e)return r[1]===Ht.VARIABLE_LENGTH?Ht.processVariableAI(2,r[2],t):Ht.processFixedAI(2,r[1],t);if(t.length<3)throw new N;let r=t.substring(0,3);for(let e of Ht.THREE_DIGIT_DATA_LENGTH)if(e[0]===r)return e[1]===Ht.VARIABLE_LENGTH?Ht.processVariableAI(3,e[2],t):Ht.processFixedAI(3,e[1],t);for(let e of Ht.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(e[0]===r)return e[1]===Ht.VARIABLE_LENGTH?Ht.processVariableAI(4,e[2],t):Ht.processFixedAI(4,e[1],t);if(t.length<4)throw new N;let n=t.substring(0,4);for(let e of Ht.FOUR_DIGIT_DATA_LENGTH)if(e[0]===n)return e[1]===Ht.VARIABLE_LENGTH?Ht.processVariableAI(4,e[2],t):Ht.processFixedAI(4,e[1],t);throw new N}static processFixedAI(t,e,r){if(r.lengththis.information.getSize())return t+4<=this.information.getSize();for(let e=t;ethis.information.getSize()){let e=this.extractNumericValueFromBitArray(t,4);return new Vt(this.information.getSize(),0===e?Vt.FNC1:e-1,Vt.FNC1)}let e=this.extractNumericValueFromBitArray(t,7);return new Vt(t+7,(e-8)/11,(e-8)%11)}extractNumericValueFromBitArray(t,e){return Ut.extractNumericValueFromBitArray(this.information,t,e)}static extractNumericValueFromBitArray(t,e,r){let n=0;for(let i=0;ithis.information.getSize())return!1;let e=this.extractNumericValueFromBitArray(t,5);if(e>=5&&e<16)return!0;if(t+7>this.information.getSize())return!1;let r=this.extractNumericValueFromBitArray(t,7);if(r>=64&&r<116)return!0;if(t+8>this.information.getSize())return!1;let n=this.extractNumericValueFromBitArray(t,8);return n>=232&&n<253}decodeIsoIec646(t){let e=this.extractNumericValueFromBitArray(t,5);if(15===e)return new kt(t+5,kt.FNC1);if(e>=5&&e<15)return new kt(t+5,"0"+(e-5));let r,n=this.extractNumericValueFromBitArray(t,7);if(n>=64&&n<90)return new kt(t+7,""+(n+1));if(n>=90&&n<116)return new kt(t+7,""+(n+7));switch(this.extractNumericValueFromBitArray(t,8)){case 232:r="!";break;case 233:r='"';break;case 234:r="%";break;case 235:r="&";break;case 236:r="'";break;case 237:r="(";break;case 238:r=")";break;case 239:r="*";break;case 240:r="+";break;case 241:r=",";break;case 242:r="-";break;case 243:r=".";break;case 244:r="/";break;case 245:r=":";break;case 246:r=";";break;case 247:r="<";break;case 248:r="=";break;case 249:r=">";break;case 250:r="?";break;case 251:r="_";break;case 252:r=" ";break;default:throw new m}return new kt(t+8,r)}isStillAlpha(t){if(t+5>this.information.getSize())return!1;let e=this.extractNumericValueFromBitArray(t,5);if(e>=5&&e<16)return!0;if(t+6>this.information.getSize())return!1;let r=this.extractNumericValueFromBitArray(t,6);return r>=16&&r<63}decodeAlphanumeric(t){let e=this.extractNumericValueFromBitArray(t,5);if(15===e)return new kt(t+5,kt.FNC1);if(e>=5&&e<15)return new kt(t+5,"0"+(e-5));let r,n=this.extractNumericValueFromBitArray(t,6);if(n>=32&&n<58)return new kt(t+6,""+(n+33));switch(n){case 58:r="*";break;case 59:r=",";break;case 60:r="-";break;case 61:r=".";break;case 62:r="/";break;default:throw new J("Decoding invalid alphanumeric value: "+n)}return new kt(t+6,r)}isAlphaTo646ToAlphaLatch(t){if(t+1>this.information.getSize())return!1;for(let e=0;e<5&&e+tthis.information.getSize())return!1;for(let e=t;ethis.information.getSize())return!1;for(let e=0;e<4&&e+t{e.forEach((e=>{t.getLeftChar().getValue()===e.getLeftChar().getValue()&&t.getRightChar().getValue()===e.getRightChar().getValue()&&t.getFinderPatter().getValue()===e.getFinderPatter().getValue()&&(r=!0)}))})),r}}class re extends Mt{constructor(){super(...arguments),this.pairs=new Array(re.MAX_PAIRS),this.rows=new Array,this.startEnd=[2]}decodeRow(t,e,r){this.pairs.length=0,this.startFromEven=!1;try{return re.constructResult(this.decodeRow2pairs(t,e))}catch(t){}return this.pairs.length=0,this.startFromEven=!0,re.constructResult(this.decodeRow2pairs(t,e))}reset(){this.pairs.length=0,this.rows.length=0}decodeRow2pairs(t,e){let r,n=!1;for(;!n;)try{this.pairs.push(this.retrieveNextPair(e,this.pairs,t))}catch(t){if(t instanceof N){if(!this.pairs.length)throw new N;n=!0}}if(this.checkChecksum())return this.pairs;if(r=!!this.rows.length,this.storeRow(t,!1),r){let t=this.checkRowsBoolean(!1);if(null!=t)return t;if(t=this.checkRowsBoolean(!0),null!=t)return t}throw new N}checkRowsBoolean(t){if(this.rows.length>25)return this.rows.length=0,null;this.pairs.length=0,t&&(this.rows=this.rows.reverse());let e=null;try{e=this.checkRows(new Array,0)}catch(t){console.log(t)}return t&&(this.rows=this.rows.reverse()),e}checkRows(t,e){for(let r=e;re.length)continue;let r=!0;for(let n=0;nt){i=e.isEquivalent(this.pairs);break}n=e.isEquivalent(this.pairs),r++}i||n||re.isPartialRow(this.pairs,this.rows)||(this.rows.push(r,new ee(this.pairs,t,e)),this.removePartialRows(this.pairs,this.rows))}removePartialRows(t,e){for(let r of e)if(r.getPairs().length!==t.length)for(let e of r.getPairs())for(let r of t)if(te.equals(e,r))break}static isPartialRow(t,e){for(let r of e){let e=!0;for(let n of t){let t=!1;for(let e of r.getPairs())if(n.equals(e)){t=!0;break}if(!t){e=!1;break}}if(e)return!0}return!1}getRows(){return this.rows}static constructResult(t){let e=$t(Lt.buildBitArray(t)).parseInformation(),r=t[0].getFinderPattern().getResultPoints(),n=t[t.length-1].getFinderPattern().getResultPoints(),i=[r[0],r[1],n[0],n[1]];return new v(e,null,null,i,x.RSS_EXPANDED,null)}checkChecksum(){let t=this.pairs.get(0),e=t.getLeftChar(),r=t.getRightChar();if(null===r)return!1;let n=r.getChecksumPortion(),i=2;for(let t=1;t=0)i=r;else if(this.isEmptyPair(e))i=0;else{i=e[e.length-1].getFinderPattern().getStartEnd()[1]}let o=e.length%2!=0;this.startFromEven&&(o=!o);let a=!1;for(;i=0&&!t.get(e);)e--;e++,n=this.startEnd[0]-e,i=e,s=this.startEnd[1]}else i=this.startEnd[0],s=t.getNextUnset(this.startEnd[1]+1),n=s-this.startEnd[1];let o,a=this.getDecodeFinderCounters();d.arraycopy(a,0,a,1,a.length-1),a[0]=n;try{o=this.parseFinderValue(a,re.FINDER_PATTERNS)}catch(t){return null}return new Bt(o,[i,s],i,s,e)}decodeDataCharacter(t,e,r,n){let i=this.getDataCharacterCounters();for(let t=0;t.3)throw new N;let a=this.getOddCounts(),h=this.getEvenCounts(),l=this.getOddRoundingErrors(),c=this.getEvenRoundingErrors();for(let t=0;t8){if(e>8.7)throw new N;r=8}let n=t/2;1&t?(h[n]=r,c[n]=e-r):(a[n]=r,l[n]=e-r)}this.adjustOddEvenCounts(17);let d=4*e.getValue()+(r?0:2)+(n?0:1)-1,u=0,g=0;for(let t=a.length-1;t>=0;t--){if(re.isNotA1left(e,r,n)){let e=re.WEIGHTS[d][2*t];g+=a[t]*e}u+=a[t]}let f=0;for(let t=h.length-1;t>=0;t--)if(re.isNotA1left(e,r,n)){let e=re.WEIGHTS[d][2*t+1];f+=h[t]*e}let w=g+f;if(1&u||u>13||u<4)throw new N;let C=(13-u)/2,A=re.SYMBOL_WIDEST[C],E=9-A,m=Pt.getRSSvalue(a,A,!0),I=Pt.getRSSvalue(h,E,!1),_=re.EVEN_TOTAL_SUBSET[C],S=re.GSUM[C];return new bt(m*_+I+S,w)}static isNotA1left(t,e,r){return!(0===t.getValue()&&e&&r)}adjustOddEvenCounts(t){let e=et.sum(new Int32Array(this.getOddCounts())),r=et.sum(new Int32Array(this.getEvenCounts())),n=!1,i=!1;e>13?i=!0:e<4&&(n=!0);let s=!1,o=!1;r>13?o=!0:r<4&&(s=!0);let a=e+r-t,h=!(1&~e),l=!(1&r);if(1===a)if(h){if(l)throw new N;i=!0}else{if(!l)throw new N;o=!0}else if(-1===a)if(h){if(l)throw new N;n=!0}else{if(!l)throw new N;s=!0}else{if(0!==a)throw new N;if(h){if(!l)throw new N;e1)for(let e of this.possibleRightPairs)if(e.getCount()>1&&ie.checkChecksum(t,e))return ie.constructResult(t,e);throw new N}static addOrTally(t,e){if(null==e)return;let r=!1;for(let n of t)if(n.getValue()===e.getValue()){n.incrementCount(),r=!0;break}r||t.push(e)}reset(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0}static constructResult(t,e){let r=4537077*t.getValue()+e.getValue(),n=new String(r).toString(),i=new T;for(let t=13-n.length;t>0;t--)i.append("0");i.append(n);let s=0;for(let t=0;t<13;t++){let e=i.charAt(t).charCodeAt(0)-"0".charCodeAt(0);s+=1&t?e:3*e}s=10-s%10,10===s&&(s=0),i.append(s.toString());let o=t.getFinderPattern().getResultPoints(),a=e.getFinderPattern().getResultPoints();return new v(i.toString(),null,0,[o[0],o[1],a[0],a[1]],x.RSS_14,(new Date).getTime())}static checkChecksum(t,e){let r=(t.getChecksumPortion()+16*e.getChecksumPortion())%79,n=9*t.getFinderPattern().getValue()+e.getFinderPattern().getValue();return n>72&&n--,n>8&&n--,r===n}decodePair(t,e,r,n){try{let i=this.findFinderPattern(t,e),s=this.parseFoundFinderPattern(t,r,e,i),o=null==n?null:n.get(E.NEED_RESULT_POINT_CALLBACK);if(null!=o){let n=(i[0]+i[1])/2;e&&(n=t.getSize()-1-n),o.foundPossibleResultPoint(new nt(n,r))}let a=this.decodeDataCharacter(t,s,!0),h=this.decodeDataCharacter(t,s,!1);return new ne(1597*a.getValue()+h.getValue(),a.getChecksumPortion()+4*h.getChecksumPortion(),s)}catch(t){return null}}decodeDataCharacter(t,e,r){let n=this.getDataCharacterCounters();for(let t=0;t8&&(r=8);let i=Math.floor(t/2);1&t?(a[i]=r,l[i]=e-r):(o[i]=r,h[i]=e-r)}this.adjustOddEvenCounts(r,i);let c=0,d=0;for(let t=o.length-1;t>=0;t--)d*=9,d+=o[t],c+=o[t];let u=0,g=0;for(let t=a.length-1;t>=0;t--)u*=9,u+=a[t],g+=a[t];let f=d+3*u;if(r){if(1&c||c>12||c<4)throw new N;let t=(12-c)/2,e=ie.OUTSIDE_ODD_WIDEST[t],r=9-e,n=Pt.getRSSvalue(o,e,!1),i=Pt.getRSSvalue(a,r,!0),s=ie.OUTSIDE_EVEN_TOTAL_SUBSET[t],h=ie.OUTSIDE_GSUM[t];return new bt(n*s+i+h,f)}{if(1&g||g>10||g<4)throw new N;let t=(10-g)/2,e=ie.INSIDE_ODD_WIDEST[t],r=9-e,n=Pt.getRSSvalue(o,e,!0),i=Pt.getRSSvalue(a,r,!1),s=ie.INSIDE_ODD_TOTAL_SUBSET[t],h=ie.INSIDE_GSUM[t];return new bt(i*s+n+h,f)}}findFinderPattern(t,e){let r=this.getDecodeFinderCounters();r[0]=0,r[1]=0,r[2]=0,r[3]=0;let n=t.getSize(),i=!1,s=0;for(;s=0&&i!==t.get(s);)s--;s++;const o=n[0]-s,a=this.getDecodeFinderCounters(),h=new Int32Array(a.length);d.arraycopy(a,0,h,1,a.length-1),h[0]=o;const l=this.parseFinderValue(h,ie.FINDER_PATTERNS);let c=s,u=n[1];return r&&(c=t.getSize()-1-c,u=t.getSize()-1-u),new Bt(l,[s,n[1]],c,u,e)}adjustOddEvenCounts(t,e){let r=et.sum(new Int32Array(this.getOddCounts())),n=et.sum(new Int32Array(this.getEvenCounts())),i=!1,s=!1,o=!1,a=!1;t?(r>12?s=!0:r<4&&(i=!0),n>12?a=!0:n<4&&(o=!0)):(r>11?s=!0:r<5&&(i=!0),n>10?a=!0:n<4&&(o=!0));let h=r+n-e,l=(1&r)==(t?1:0),c=!(1&~n);if(1===h)if(l){if(c)throw new N;s=!0}else{if(!c)throw new N;a=!0}else if(-1===h)if(l){if(c)throw new N;i=!0}else{if(!c)throw new N;o=!0}else{if(0!==h)throw new N;if(l){if(!c)throw new N;rt.reset()))}}class oe{constructor(t,e,r){this.ecCodewords=t,this.ecBlocks=[e],r&&this.ecBlocks.push(r)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class ae{constructor(t,e){this.count=t,this.dataCodewords=e}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class he{constructor(t,e,r,n,i,s){this.versionNumber=t,this.symbolSizeRows=e,this.symbolSizeColumns=r,this.dataRegionSizeRows=n,this.dataRegionSizeColumns=i,this.ecBlocks=s;let o=0;const a=s.getECCodewords(),h=s.getECBlocks();for(let t of h)o+=t.getCount()*(t.getDataCodewords()+a);this.totalCodewords=o}getVersionNumber(){return this.versionNumber}getSymbolSizeRows(){return this.symbolSizeRows}getSymbolSizeColumns(){return this.symbolSizeColumns}getDataRegionSizeRows(){return this.dataRegionSizeRows}getDataRegionSizeColumns(){return this.dataRegionSizeColumns}getTotalCodewords(){return this.totalCodewords}getECBlocks(){return this.ecBlocks}static getVersionForDimensions(t,e){if(1&t||1&e)throw new m;for(let r of he.VERSIONS)if(r.symbolSizeRows===t&&r.symbolSizeColumns===e)return r;throw new m}toString(){return""+this.versionNumber}static buildVersions(){return[new he(1,10,10,8,8,new oe(5,new ae(1,3))),new he(2,12,12,10,10,new oe(7,new ae(1,5))),new he(3,14,14,12,12,new oe(10,new ae(1,8))),new he(4,16,16,14,14,new oe(12,new ae(1,12))),new he(5,18,18,16,16,new oe(14,new ae(1,18))),new he(6,20,20,18,18,new oe(18,new ae(1,22))),new he(7,22,22,20,20,new oe(20,new ae(1,30))),new he(8,24,24,22,22,new oe(24,new ae(1,36))),new he(9,26,26,24,24,new oe(28,new ae(1,44))),new he(10,32,32,14,14,new oe(36,new ae(1,62))),new he(11,36,36,16,16,new oe(42,new ae(1,86))),new he(12,40,40,18,18,new oe(48,new ae(1,114))),new he(13,44,44,20,20,new oe(56,new ae(1,144))),new he(14,48,48,22,22,new oe(68,new ae(1,174))),new he(15,52,52,24,24,new oe(42,new ae(2,102))),new he(16,64,64,14,14,new oe(56,new ae(2,140))),new he(17,72,72,16,16,new oe(36,new ae(4,92))),new he(18,80,80,18,18,new oe(48,new ae(4,114))),new he(19,88,88,20,20,new oe(56,new ae(4,144))),new he(20,96,96,22,22,new oe(68,new ae(4,174))),new he(21,104,104,24,24,new oe(56,new ae(6,136))),new he(22,120,120,18,18,new oe(68,new ae(6,175))),new he(23,132,132,20,20,new oe(62,new ae(8,163))),new he(24,144,144,22,22,new oe(62,new ae(8,156),new ae(2,155))),new he(25,8,18,6,16,new oe(7,new ae(1,5))),new he(26,8,32,6,14,new oe(11,new ae(1,10))),new he(27,12,26,10,24,new oe(14,new ae(1,16))),new he(28,12,36,10,16,new oe(18,new ae(1,22))),new he(29,16,36,14,16,new oe(24,new ae(1,32))),new he(30,16,48,14,22,new oe(28,new ae(1,49)))]}}he.VERSIONS=he.buildVersions();class le{constructor(t){const e=t.getHeight();if(e<8||e>144||1&e)throw new m;this.version=le.readVersion(t),this.mappingBitMatrix=this.extractDataRegion(t),this.readMappingMatrix=new R(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(t){const e=t.getHeight(),r=t.getWidth();return he.getVersionForDimensions(e,r)}readCodewords(){const t=new Int8Array(this.version.getTotalCodewords());let e=0,r=4,n=0;const i=this.mappingBitMatrix.getHeight(),s=this.mappingBitMatrix.getWidth();let o=!1,a=!1,h=!1,l=!1;do{if(r!==i||0!==n||o)if(r===i-2&&0===n&&3&s&&!a)t[e++]=255&this.readCorner2(i,s),r-=2,n+=2,a=!0;else if(r!==i+4||2!==n||7&s||h)if(r!==i-2||0!==n||4!=(7&s)||l){do{r=0&&!this.readMappingMatrix.get(n,r)&&(t[e++]=255&this.readUtah(r,n,i,s)),r-=2,n+=2}while(r>=0&&n=0&&n=0);r+=3,n+=1}else t[e++]=255&this.readCorner4(i,s),r-=2,n+=2,l=!0;else t[e++]=255&this.readCorner3(i,s),r-=2,n+=2,h=!0;else t[e++]=255&this.readCorner1(i,s),r-=2,n+=2,o=!0}while(r7?e-1:e;s[n].codewords[i]=t[c++]}if(c!==t.length)throw new a;return s}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class de{constructor(t){this.bytes=t,this.byteOffset=0,this.bitOffset=0}getBitOffset(){return this.bitOffset}getByteOffset(){return this.byteOffset}readBits(t){if(t<1||t>32||t>this.available())throw new a(""+t);let e=0,r=this.bitOffset,n=this.byteOffset;const i=this.bytes;if(r>0){const s=8-r,o=t>8-o<>a,t-=o,r+=o,8===r&&(r=0,n++)}if(t>0){for(;t>=8;)e=e<<8|255&i[n],n++,t-=8;if(t>0){const s=8-t,o=255>>s<>s,r+=t}}return this.bitOffset=r,this.byteOffset=n,e}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}!function(t){t[t.PAD_ENCODE=0]="PAD_ENCODE",t[t.ASCII_ENCODE=1]="ASCII_ENCODE",t[t.C40_ENCODE=2]="C40_ENCODE",t[t.TEXT_ENCODE=3]="TEXT_ENCODE",t[t.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",t[t.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",t[t.BASE256_ENCODE=6]="BASE256_ENCODE"}(H||(H={}));class ue{static decode(t){const e=new de(t),r=new T,n=new T,i=new Array;let s=H.ASCII_ENCODE;do{if(s===H.ASCII_ENCODE)s=this.decodeAsciiSegment(e,r,n);else{switch(s){case H.C40_ENCODE:this.decodeC40Segment(e,r);break;case H.TEXT_ENCODE:this.decodeTextSegment(e,r);break;case H.ANSIX12_ENCODE:this.decodeAnsiX12Segment(e,r);break;case H.EDIFACT_ENCODE:this.decodeEdifactSegment(e,r);break;case H.BASE256_ENCODE:this.decodeBase256Segment(e,r,i);break;default:throw new m}s=H.ASCII_ENCODE}}while(s!==H.PAD_ENCODE&&e.available()>0);return n.length()>0&&r.append(n.toString()),new Y(t,r.toString(),0===i.length?null:i,null)}static decodeAsciiSegment(t,e,r){let n=!1;do{let i=t.readBits(8);if(0===i)throw new m;if(i<=128)return n&&(i+=128),e.append(String.fromCharCode(i-1)),H.ASCII_ENCODE;if(129===i)return H.PAD_ENCODE;if(i<=229){const t=i-130;t<10&&e.append("0"),e.append(""+t)}else switch(i){case 230:return H.C40_ENCODE;case 231:return H.BASE256_ENCODE;case 232:e.append(String.fromCharCode(29));break;case 233:case 234:case 241:break;case 235:n=!0;break;case 236:e.append("[)>05"),r.insert(0,"");break;case 237:e.append("[)>06"),r.insert(0,"");break;case 238:return H.ANSIX12_ENCODE;case 239:return H.TEXT_ENCODE;case 240:return H.EDIFACT_ENCODE;default:if(254!==i||0!==t.available())throw new m}}while(t.available()>0);return H.ASCII_ENCODE}static decodeC40Segment(t,e){let r=!1;const n=[];let i=0;do{if(8===t.available())return;const s=t.readBits(8);if(254===s)return;this.parseTwoBytes(s,t.readBits(8),n);for(let t=0;t<3;t++){const s=n[t];switch(i){case 0:if(s<3)i=s+1;else{if(!(s0)}static decodeTextSegment(t,e){let r=!1,n=[],i=0;do{if(8===t.available())return;const s=t.readBits(8);if(254===s)return;this.parseTwoBytes(s,t.readBits(8),n);for(let t=0;t<3;t++){const s=n[t];switch(i){case 0:if(s<3)i=s+1;else{if(!(s0)}static decodeAnsiX12Segment(t,e){const r=[];do{if(8===t.available())return;const n=t.readBits(8);if(254===n)return;this.parseTwoBytes(n,t.readBits(8),r);for(let t=0;t<3;t++){const n=r[t];switch(n){case 0:e.append("\r");break;case 1:e.append("*");break;case 2:e.append(">");break;case 3:e.append(" ");break;default:if(n<14)e.append(String.fromCharCode(n+44));else{if(!(n<40))throw new m;e.append(String.fromCharCode(n+51))}}}}while(t.available()>0)}static parseTwoBytes(t,e,r){let n=(t<<8)+e-1,i=Math.floor(n/1600);r[0]=i,n-=1600*i,i=Math.floor(n/40),r[1]=i,r[2]=n-40*i}static decodeEdifactSegment(t,e){do{if(t.available()<=16)return;for(let r=0;r<4;r++){let r=t.readBits(6);if(31===r){const e=8-t.getBitOffset();return void(8!==e&&t.readBits(e))}32&r||(r|=64),e.append(String.fromCharCode(r))}}while(t.available()>0)}static decodeBase256Segment(t,e,r){let n=1+t.getByteOffset();const i=this.unrandomize255State(t.readBits(8),n++);let s;if(s=0===i?t.available()/8|0:i<250?i:250*(i-249)+this.unrandomize255State(t.readBits(8),n++),s<0)throw new m;const o=new Uint8Array(s);for(let e=0;e=0?r:r+256}}ue.C40_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],ue.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],ue.TEXT_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],ue.TEXT_SHIFT2_SET_CHARS=ue.C40_SHIFT2_SET_CHARS,ue.TEXT_SHIFT3_SET_CHARS=["`","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","{","|","}","~",String.fromCharCode(127)];class ge{constructor(){this.rsDecoder=new $(Q.DATA_MATRIX_FIELD_256)}decode(t){const e=new le(t),r=e.getVersion(),n=e.readCodewords(),i=ce.getDataBlocks(n,r);let s=0;for(let t of i)s+=t.getNumDataCodewords();const o=new Uint8Array(s),a=i.length;for(let t=0;to&&(l=o,c[0]=e,c[1]=r,c[2]=n,c[3]=i),l>a&&(l=a,c[0]=r,c[1]=n,c[2]=i,c[3]=e),l>h&&(c[0]=n,c[1]=i,c[2]=e,c[3]=r),c}detectSolid2(t){let e=t[0],r=t[1],n=t[2],i=t[3],s=this.transitionsBetween(e,i),o=fe.shiftPoint(r,n,4*(s+1)),a=fe.shiftPoint(n,r,4*(s+1));return this.transitionsBetween(o,e)this.transitionsBetween(a,c)+this.transitionsBetween(h,c)?l:c:l:this.isValid(c)?c:null}shiftToModuleCenter(t){let e=t[0],r=t[1],n=t[2],i=t[3],s=this.transitionsBetween(e,i)+1,o=this.transitionsBetween(n,i)+1,a=fe.shiftPoint(e,r,4*o),h=fe.shiftPoint(n,r,4*s);s=this.transitionsBetween(a,i)+1,o=this.transitionsBetween(h,i)+1,1&~s||(s+=1),1&~o||(o+=1);let l,c,d=(e.getX()+r.getX()+n.getX()+i.getX())/4,u=(e.getY()+r.getY()+n.getY()+i.getY())/4;return e=fe.moveAway(e,d,u),r=fe.moveAway(r,d,u),n=fe.moveAway(n,d,u),i=fe.moveAway(i,d,u),a=fe.shiftPoint(e,r,4*o),a=fe.shiftPoint(a,i,4*s),l=fe.shiftPoint(r,e,4*o),l=fe.shiftPoint(l,n,4*s),h=fe.shiftPoint(n,i,4*o),h=fe.shiftPoint(h,r,4*s),c=fe.shiftPoint(i,n,4*o),c=fe.shiftPoint(c,e,4*s),[a,l,h,c]}isValid(t){return t.getX()>=0&&t.getX()0&&t.getY()Math.abs(i-r);if(o){let t=r;r=n,n=t,t=i,i=s,s=t}let a=Math.abs(i-r),h=Math.abs(s-n),l=-a/2,c=n0){if(e===s)break;e+=c,l-=a}}return u}}class we{constructor(){this.decoder=new ge}decode(t,e=null){let r,n;if(null!=e&&e.has(E.PURE_BARCODE)){const e=we.extractPureBits(t.getBlackMatrix());r=this.decoder.decode(e),n=we.NO_POINTS}else{const e=new fe(t.getBlackMatrix()).detect();r=this.decoder.decode(e.getBits()),n=e.getPoints()}const i=r.getRawBytes(),s=new v(r.getText(),i,8*i.length,n,x.DATA_MATRIX,d.currentTimeMillis()),o=r.getByteSegments();null!=o&&s.putMetadata(z.BYTE_SEGMENTS,o);const a=r.getECLevel();return null!=a&&s.putMetadata(z.ERROR_CORRECTION_LEVEL,a),s}reset(){}static extractPureBits(t){const e=t.getTopLeftOnBit(),r=t.getBottomRightOnBit();if(null==e||null==r)throw new N;const n=this.moduleSize(e,t);let i=e[1];const s=r[1];let o=e[0];const a=(r[0]-o+1)/n,h=(s-i+1)/n;if(a<=0||h<=0)throw new N;const l=n/2;i+=l,o+=l;const c=new R(a,h);for(let e=0;e=Ce.FOR_BITS.size)throw new a;return Ce.FOR_BITS.get(t)}}Ce.FOR_BITS=new Map,Ce.FOR_VALUE=new Map,Ce.L=new Ce(U.L,"L",1),Ce.M=new Ce(U.M,"M",0),Ce.Q=new Ce(U.Q,"Q",3),Ce.H=new Ce(U.H,"H",2);class Ae{constructor(t){this.errorCorrectionLevel=Ce.forBits(t>>3&3),this.dataMask=7&t}static numBitsDiffering(t,e){return w.bitCount(t^e)}static decodeFormatInformation(t,e){const r=Ae.doDecodeFormatInformation(t,e);return null!==r?r:Ae.doDecodeFormatInformation(t^Ae.FORMAT_INFO_MASK_QR,e^Ae.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(t,e){let r=Number.MAX_SAFE_INTEGER,n=0;for(const i of Ae.FORMAT_INFO_DECODE_LOOKUP){const s=i[0];if(s===t||s===e)return new Ae(i[1]);let o=Ae.numBitsDiffering(t,s);o40)throw new a;return Ie.VERSIONS[t-1]}static decodeVersionInformation(t){let e=Number.MAX_SAFE_INTEGER,r=0;for(let n=0;n6&&(e.setRegion(t-11,0,3,6),e.setRegion(0,t-11,6,3)),e}toString(){return""+this.versionNumber}}Ie.VERSION_DECODE_INFO=Int32Array.from([31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017]),Ie.VERSIONS=[new Ie(1,new Int32Array(0),new Ee(7,new me(1,19)),new Ee(10,new me(1,16)),new Ee(13,new me(1,13)),new Ee(17,new me(1,9))),new Ie(2,Int32Array.from([6,18]),new Ee(10,new me(1,34)),new Ee(16,new me(1,28)),new Ee(22,new me(1,22)),new Ee(28,new me(1,16))),new Ie(3,Int32Array.from([6,22]),new Ee(15,new me(1,55)),new Ee(26,new me(1,44)),new Ee(18,new me(2,17)),new Ee(22,new me(2,13))),new Ie(4,Int32Array.from([6,26]),new Ee(20,new me(1,80)),new Ee(18,new me(2,32)),new Ee(26,new me(2,24)),new Ee(16,new me(4,9))),new Ie(5,Int32Array.from([6,30]),new Ee(26,new me(1,108)),new Ee(24,new me(2,43)),new Ee(18,new me(2,15),new me(2,16)),new Ee(22,new me(2,11),new me(2,12))),new Ie(6,Int32Array.from([6,34]),new Ee(18,new me(2,68)),new Ee(16,new me(4,27)),new Ee(24,new me(4,19)),new Ee(28,new me(4,15))),new Ie(7,Int32Array.from([6,22,38]),new Ee(20,new me(2,78)),new Ee(18,new me(4,31)),new Ee(18,new me(2,14),new me(4,15)),new Ee(26,new me(4,13),new me(1,14))),new Ie(8,Int32Array.from([6,24,42]),new Ee(24,new me(2,97)),new Ee(22,new me(2,38),new me(2,39)),new Ee(22,new me(4,18),new me(2,19)),new Ee(26,new me(4,14),new me(2,15))),new Ie(9,Int32Array.from([6,26,46]),new Ee(30,new me(2,116)),new Ee(22,new me(3,36),new me(2,37)),new Ee(20,new me(4,16),new me(4,17)),new Ee(24,new me(4,12),new me(4,13))),new Ie(10,Int32Array.from([6,28,50]),new Ee(18,new me(2,68),new me(2,69)),new Ee(26,new me(4,43),new me(1,44)),new Ee(24,new me(6,19),new me(2,20)),new Ee(28,new me(6,15),new me(2,16))),new Ie(11,Int32Array.from([6,30,54]),new Ee(20,new me(4,81)),new Ee(30,new me(1,50),new me(4,51)),new Ee(28,new me(4,22),new me(4,23)),new Ee(24,new me(3,12),new me(8,13))),new Ie(12,Int32Array.from([6,32,58]),new Ee(24,new me(2,92),new me(2,93)),new Ee(22,new me(6,36),new me(2,37)),new Ee(26,new me(4,20),new me(6,21)),new Ee(28,new me(7,14),new me(4,15))),new Ie(13,Int32Array.from([6,34,62]),new Ee(26,new me(4,107)),new Ee(22,new me(8,37),new me(1,38)),new Ee(24,new me(8,20),new me(4,21)),new Ee(22,new me(12,11),new me(4,12))),new Ie(14,Int32Array.from([6,26,46,66]),new Ee(30,new me(3,115),new me(1,116)),new Ee(24,new me(4,40),new me(5,41)),new Ee(20,new me(11,16),new me(5,17)),new Ee(24,new me(11,12),new me(5,13))),new Ie(15,Int32Array.from([6,26,48,70]),new Ee(22,new me(5,87),new me(1,88)),new Ee(24,new me(5,41),new me(5,42)),new Ee(30,new me(5,24),new me(7,25)),new Ee(24,new me(11,12),new me(7,13))),new Ie(16,Int32Array.from([6,26,50,74]),new Ee(24,new me(5,98),new me(1,99)),new Ee(28,new me(7,45),new me(3,46)),new Ee(24,new me(15,19),new me(2,20)),new Ee(30,new me(3,15),new me(13,16))),new Ie(17,Int32Array.from([6,30,54,78]),new Ee(28,new me(1,107),new me(5,108)),new Ee(28,new me(10,46),new me(1,47)),new Ee(28,new me(1,22),new me(15,23)),new Ee(28,new me(2,14),new me(17,15))),new Ie(18,Int32Array.from([6,30,56,82]),new Ee(30,new me(5,120),new me(1,121)),new Ee(26,new me(9,43),new me(4,44)),new Ee(28,new me(17,22),new me(1,23)),new Ee(28,new me(2,14),new me(19,15))),new Ie(19,Int32Array.from([6,30,58,86]),new Ee(28,new me(3,113),new me(4,114)),new Ee(26,new me(3,44),new me(11,45)),new Ee(26,new me(17,21),new me(4,22)),new Ee(26,new me(9,13),new me(16,14))),new Ie(20,Int32Array.from([6,34,62,90]),new Ee(28,new me(3,107),new me(5,108)),new Ee(26,new me(3,41),new me(13,42)),new Ee(30,new me(15,24),new me(5,25)),new Ee(28,new me(15,15),new me(10,16))),new Ie(21,Int32Array.from([6,28,50,72,94]),new Ee(28,new me(4,116),new me(4,117)),new Ee(26,new me(17,42)),new Ee(28,new me(17,22),new me(6,23)),new Ee(30,new me(19,16),new me(6,17))),new Ie(22,Int32Array.from([6,26,50,74,98]),new Ee(28,new me(2,111),new me(7,112)),new Ee(28,new me(17,46)),new Ee(30,new me(7,24),new me(16,25)),new Ee(24,new me(34,13))),new Ie(23,Int32Array.from([6,30,54,78,102]),new Ee(30,new me(4,121),new me(5,122)),new Ee(28,new me(4,47),new me(14,48)),new Ee(30,new me(11,24),new me(14,25)),new Ee(30,new me(16,15),new me(14,16))),new Ie(24,Int32Array.from([6,28,54,80,106]),new Ee(30,new me(6,117),new me(4,118)),new Ee(28,new me(6,45),new me(14,46)),new Ee(30,new me(11,24),new me(16,25)),new Ee(30,new me(30,16),new me(2,17))),new Ie(25,Int32Array.from([6,32,58,84,110]),new Ee(26,new me(8,106),new me(4,107)),new Ee(28,new me(8,47),new me(13,48)),new Ee(30,new me(7,24),new me(22,25)),new Ee(30,new me(22,15),new me(13,16))),new Ie(26,Int32Array.from([6,30,58,86,114]),new Ee(28,new me(10,114),new me(2,115)),new Ee(28,new me(19,46),new me(4,47)),new Ee(28,new me(28,22),new me(6,23)),new Ee(30,new me(33,16),new me(4,17))),new Ie(27,Int32Array.from([6,34,62,90,118]),new Ee(30,new me(8,122),new me(4,123)),new Ee(28,new me(22,45),new me(3,46)),new Ee(30,new me(8,23),new me(26,24)),new Ee(30,new me(12,15),new me(28,16))),new Ie(28,Int32Array.from([6,26,50,74,98,122]),new Ee(30,new me(3,117),new me(10,118)),new Ee(28,new me(3,45),new me(23,46)),new Ee(30,new me(4,24),new me(31,25)),new Ee(30,new me(11,15),new me(31,16))),new Ie(29,Int32Array.from([6,30,54,78,102,126]),new Ee(30,new me(7,116),new me(7,117)),new Ee(28,new me(21,45),new me(7,46)),new Ee(30,new me(1,23),new me(37,24)),new Ee(30,new me(19,15),new me(26,16))),new Ie(30,Int32Array.from([6,26,52,78,104,130]),new Ee(30,new me(5,115),new me(10,116)),new Ee(28,new me(19,47),new me(10,48)),new Ee(30,new me(15,24),new me(25,25)),new Ee(30,new me(23,15),new me(25,16))),new Ie(31,Int32Array.from([6,30,56,82,108,134]),new Ee(30,new me(13,115),new me(3,116)),new Ee(28,new me(2,46),new me(29,47)),new Ee(30,new me(42,24),new me(1,25)),new Ee(30,new me(23,15),new me(28,16))),new Ie(32,Int32Array.from([6,34,60,86,112,138]),new Ee(30,new me(17,115)),new Ee(28,new me(10,46),new me(23,47)),new Ee(30,new me(10,24),new me(35,25)),new Ee(30,new me(19,15),new me(35,16))),new Ie(33,Int32Array.from([6,30,58,86,114,142]),new Ee(30,new me(17,115),new me(1,116)),new Ee(28,new me(14,46),new me(21,47)),new Ee(30,new me(29,24),new me(19,25)),new Ee(30,new me(11,15),new me(46,16))),new Ie(34,Int32Array.from([6,34,62,90,118,146]),new Ee(30,new me(13,115),new me(6,116)),new Ee(28,new me(14,46),new me(23,47)),new Ee(30,new me(44,24),new me(7,25)),new Ee(30,new me(59,16),new me(1,17))),new Ie(35,Int32Array.from([6,30,54,78,102,126,150]),new Ee(30,new me(12,121),new me(7,122)),new Ee(28,new me(12,47),new me(26,48)),new Ee(30,new me(39,24),new me(14,25)),new Ee(30,new me(22,15),new me(41,16))),new Ie(36,Int32Array.from([6,24,50,76,102,128,154]),new Ee(30,new me(6,121),new me(14,122)),new Ee(28,new me(6,47),new me(34,48)),new Ee(30,new me(46,24),new me(10,25)),new Ee(30,new me(2,15),new me(64,16))),new Ie(37,Int32Array.from([6,28,54,80,106,132,158]),new Ee(30,new me(17,122),new me(4,123)),new Ee(28,new me(29,46),new me(14,47)),new Ee(30,new me(49,24),new me(10,25)),new Ee(30,new me(24,15),new me(46,16))),new Ie(38,Int32Array.from([6,32,58,84,110,136,162]),new Ee(30,new me(4,122),new me(18,123)),new Ee(28,new me(13,46),new me(32,47)),new Ee(30,new me(48,24),new me(14,25)),new Ee(30,new me(42,15),new me(32,16))),new Ie(39,Int32Array.from([6,26,54,82,110,138,166]),new Ee(30,new me(20,117),new me(4,118)),new Ee(28,new me(40,47),new me(7,48)),new Ee(30,new me(43,24),new me(22,25)),new Ee(30,new me(10,15),new me(67,16))),new Ie(40,Int32Array.from([6,30,58,86,114,142,170]),new Ee(30,new me(19,118),new me(6,119)),new Ee(28,new me(18,47),new me(31,48)),new Ee(30,new me(34,24),new me(34,25)),new Ee(30,new me(20,15),new me(61,16)))],function(t){t[t.DATA_MASK_000=0]="DATA_MASK_000",t[t.DATA_MASK_001=1]="DATA_MASK_001",t[t.DATA_MASK_010=2]="DATA_MASK_010",t[t.DATA_MASK_011=3]="DATA_MASK_011",t[t.DATA_MASK_100=4]="DATA_MASK_100",t[t.DATA_MASK_101=5]="DATA_MASK_101",t[t.DATA_MASK_110=6]="DATA_MASK_110",t[t.DATA_MASK_111=7]="DATA_MASK_111"}(X||(X={}));class _e{constructor(t,e){this.value=t,this.isMasked=e}unmaskBitMatrix(t,e){for(let r=0;r!(t+e&1)))],[X.DATA_MASK_001,new _e(X.DATA_MASK_001,((t,e)=>!(1&t)))],[X.DATA_MASK_010,new _e(X.DATA_MASK_010,((t,e)=>e%3==0))],[X.DATA_MASK_011,new _e(X.DATA_MASK_011,((t,e)=>(t+e)%3==0))],[X.DATA_MASK_100,new _e(X.DATA_MASK_100,((t,e)=>!(Math.floor(t/2)+Math.floor(e/3)&1)))],[X.DATA_MASK_101,new _e(X.DATA_MASK_101,((t,e)=>t*e%6==0))],[X.DATA_MASK_110,new _e(X.DATA_MASK_110,((t,e)=>t*e%6<3))],[X.DATA_MASK_111,new _e(X.DATA_MASK_111,((t,e)=>!(t+e+t*e%3&1)))]]);class Se{constructor(t){const e=t.getHeight();if(e<21||1!=(3&e))throw new m;this.bitMatrix=t}readFormatInformation(){if(null!==this.parsedFormatInfo&&void 0!==this.parsedFormatInfo)return this.parsedFormatInfo;let t=0;for(let e=0;e<6;e++)t=this.copyBit(e,8,t);t=this.copyBit(7,8,t),t=this.copyBit(8,8,t),t=this.copyBit(8,7,t);for(let e=5;e>=0;e--)t=this.copyBit(8,e,t);const e=this.bitMatrix.getHeight();let r=0;const n=e-7;for(let t=e-1;t>=n;t--)r=this.copyBit(8,t,r);for(let t=e-8;t=0;e--)for(let i=t-9;i>=n;i--)r=this.copyBit(i,e,r);let i=Ie.decodeVersionInformation(r);if(null!==i&&i.getDimensionForVersion()===t)return this.parsedVersion=i,i;r=0;for(let e=5;e>=0;e--)for(let i=t-9;i>=n;i--)r=this.copyBit(e,i,r);if(i=Ie.decodeVersionInformation(r),null!==i&&i.getDimensionForVersion()===t)return this.parsedVersion=i,i;throw new m}copyBit(t,e,r){return(this.isMirror?this.bitMatrix.get(e,t):this.bitMatrix.get(t,e))?r<<1|1:r<<1}readCodewords(){const t=this.readFormatInformation(),e=this.readVersion(),r=_e.values.get(t.getDataMask()),n=this.bitMatrix.getHeight();r.unmaskBitMatrix(this.bitMatrix,n);const i=e.buildFunctionPattern();let s=!0;const o=new Uint8Array(e.getTotalCodewords());let a=0,h=0,l=0;for(let t=n-1;t>0;t-=2){6===t&&t--;for(let e=0;e=0;){if(o[c].codewords.length===l)break;c--}c++;const d=l-n.getECCodewordsPerBlock();let u=0;for(let e=0;et.available())throw new m;const n=new Uint8Array(2*r);let i=0;for(;r>0;){const e=t.readBits(13);let s=e/96<<8&4294967295|e%96;s+=s<959?41377:42657,n[i]=s>>8&255,n[i+1]=255&s,i+=2,r--}try{e.append(S.decode(n,p.GB2312))}catch(t){throw new m(t)}}static decodeKanjiSegment(t,e,r){if(13*r>t.available())throw new m;const n=new Uint8Array(2*r);let i=0;for(;r>0;){const e=t.readBits(13);let s=e/192<<8&4294967295|e%192;s+=s<7936?33088:49472,n[i]=s>>8,n[i+1]=s,i+=2,r--}try{e.append(S.decode(n,p.SHIFT_JIS))}catch(t){throw new m(t)}}static decodeByteSegment(t,e,r,n,i,s){if(8*r>t.available())throw new m;const o=new Uint8Array(r);for(let e=0;e=Re.ALPHANUMERIC_CHARS.length)throw new m;return Re.ALPHANUMERIC_CHARS[t]}static decodeAlphanumericSegment(t,e,r,n){const i=e.length();for(;r>1;){if(t.available()<11)throw new m;const n=t.readBits(11);e.append(Re.toAlphaNumericChar(Math.floor(n/45))),e.append(Re.toAlphaNumericChar(n%45)),r-=2}if(1===r){if(t.available()<6)throw new m;e.append(Re.toAlphaNumericChar(t.readBits(6)))}if(n)for(let t=i;t=3;){if(t.available()<10)throw new m;const n=t.readBits(10);if(n>=1e3)throw new m;e.append(Re.toAlphaNumericChar(Math.floor(n/100))),e.append(Re.toAlphaNumericChar(Math.floor(n/10)%10)),e.append(Re.toAlphaNumericChar(n%10)),r-=3}if(2===r){if(t.available()<7)throw new m;const r=t.readBits(7);if(r>=100)throw new m;e.append(Re.toAlphaNumericChar(Math.floor(r/10))),e.append(Re.toAlphaNumericChar(r%10))}else if(1===r){if(t.available()<4)throw new m;const r=t.readBits(4);if(r>=10)throw new m;e.append(Re.toAlphaNumericChar(r))}}static parseECIValue(t){const e=t.readBits(8);if(!(128&e))return 127&e;if(128==(192&e)){return(63&e)<<8&4294967295|t.readBits(8)}if(192==(224&e)){return(31&e)<<16&4294967295|t.readBits(16)}throw new m}}Re.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Re.GB2312_SUBSET=1;class Ne{constructor(t){this.mirrored=t}isMirrored(){return this.mirrored}applyMirroredCorrection(t){if(!this.mirrored||null===t||t.length<3)return;const e=t[0];t[0]=t[2],t[2]=e}}class ye{constructor(){this.rsDecoder=new $(Q.QR_CODE_FIELD_256)}decodeBooleanArray(t,e){return this.decodeBitMatrix(R.parseFromBooleanArray(t),e)}decodeBitMatrix(t,e){const r=new Se(t);let n=null;try{return this.decodeBitMatrixParser(r,e)}catch(t){n=t}try{r.remask(),r.setMirror(!0),r.readVersion(),r.readFormatInformation(),r.mirror();const t=this.decodeBitMatrixParser(r,e);return t.setOther(new Ne(!0)),t}catch(t){if(null!==n)throw n;throw t}}decodeBitMatrixParser(t,e){const r=t.readVersion(),n=t.readFormatInformation().getErrorCorrectionLevel(),i=t.readCodewords(),s=pe.getDataBlocks(i,r,n);let o=0;for(const t of s)o+=t.getNumDataCodewords();const a=new Uint8Array(o);let h=0;for(const t of s){const e=t.getCodewords(),r=t.getNumDataCodewords();this.correctErrors(e,r);for(let t=0;t=r)return!1;return!0}crossCheckVertical(t,e,r,n){const i=this.image,s=i.getHeight(),o=this.crossCheckStateCount;o[0]=0,o[1]=0,o[2]=0;let a=t;for(;a>=0&&i.get(e,a)&&o[1]<=r;)o[1]++,a--;if(a<0||o[1]>r)return NaN;for(;a>=0&&!i.get(e,a)&&o[0]<=r;)o[0]++,a--;if(o[0]>r)return NaN;for(a=t+1;ar)return NaN;for(;ar)return NaN;const h=o[0]+o[1]+o[2];return 5*Math.abs(h-n)>=2*n?NaN:this.foundPatternCross(o)?Oe.centerFromEnd(o,a):NaN}handlePossibleCenter(t,e,r){const n=t[0]+t[1]+t[2],i=Oe.centerFromEnd(t,r),s=this.crossCheckVertical(e,i,2*t[1],n);if(!isNaN(s)){const e=(t[0]+t[1]+t[2])/3;for(const t of this.possibleCenters)if(t.aboutEquals(e,s,i))return t.combineEstimate(s,i,e);const r=new De(i,s,e);this.possibleCenters.push(r),null!==this.resultPointCallback&&void 0!==this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(r)}return null}}class Me extends nt{constructor(t,e,r,n){super(t,e),this.estimatedModuleSize=r,this.count=n,void 0===n&&(this.count=1)}getEstimatedModuleSize(){return this.estimatedModuleSize}getCount(){return this.count}aboutEquals(t,e,r){if(Math.abs(e-this.getY())<=t&&Math.abs(r-this.getX())<=t){const e=Math.abs(t-this.estimatedModuleSize);return e<=1||e<=this.estimatedModuleSize}return!1}combineEstimate(t,e,r){const n=this.count+1,i=(this.count*this.getX()+e)/n,s=(this.count*this.getY()+t)/n,o=(this.count*this.estimatedModuleSize+r)/n;return new Me(i,s,o,n)}}class be{constructor(t){this.bottomLeft=t[0],this.topLeft=t[1],this.topRight=t[2]}getBottomLeft(){return this.bottomLeft}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}}class Be{constructor(t,e){this.image=t,this.resultPointCallback=e,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=e}getImage(){return this.image}getPossibleCenters(){return this.possibleCenters}find(t){const e=null!=t&&void 0!==t.get(E.TRY_HARDER),r=null!=t&&void 0!==t.get(E.PURE_BARCODE),n=this.image,i=n.getHeight(),s=n.getWidth();let o=Math.floor(3*i/(4*Be.MAX_MODULES));(oh[2]&&(t+=e-h[2]-o,i=s-1)}e=0,h[0]=0,h[1]=0,h[2]=0,h[3]=0,h[4]=0}else h[0]=h[2],h[1]=h[3],h[2]=h[4],h[3]=1,h[4]=0,e=3;else h[++e]++;if(Be.foundPatternCross(h)){!0===this.handlePossibleCenter(h,t,s,r)&&(o=h[0],this.hasSkipped&&(a=this.haveMultiplyConfirmedCenters()))}}const l=this.selectBestPatterns();return nt.orderBestPatterns(l),new be(l)}static centerFromEnd(t,e){return e-t[4]-t[3]-t[2]/2}static foundPatternCross(t){let e=0;for(let r=0;r<5;r++){const n=t[r];if(0===n)return!1;e+=n}if(e<7)return!1;const r=e/7,n=r/2;return Math.abs(r-t[0])=s&&e>=s&&o.get(e-s,t-s);)i[2]++,s++;if(t=s&&e>=s&&!o.get(e-s,t-s)&&i[1]<=r;)i[1]++,s++;if(tr)return!1;for(;t>=s&&e>=s&&o.get(e-s,t-s)&&i[0]<=r;)i[0]++,s++;if(i[0]>r)return!1;const a=o.getHeight(),h=o.getWidth();for(s=1;t+s=a||e+s>=h)return!1;for(;t+s=a||e+s>=h||i[3]>=r)return!1;for(;t+s=r)return!1;const l=i[0]+i[1]+i[2]+i[3]+i[4];return Math.abs(l-n)<2*n&&Be.foundPatternCross(i)}crossCheckVertical(t,e,r,n){const i=this.image,s=i.getHeight(),o=this.getCrossCheckStateCount();let a=t;for(;a>=0&&i.get(e,a);)o[2]++,a--;if(a<0)return NaN;for(;a>=0&&!i.get(e,a)&&o[1]<=r;)o[1]++,a--;if(a<0||o[1]>r)return NaN;for(;a>=0&&i.get(e,a)&&o[0]<=r;)o[0]++,a--;if(o[0]>r)return NaN;for(a=t+1;a=r)return NaN;for(;a=r)return NaN;const h=o[0]+o[1]+o[2]+o[3]+o[4];return 5*Math.abs(h-n)>=2*n?NaN:Be.foundPatternCross(o)?Be.centerFromEnd(o,a):NaN}crossCheckHorizontal(t,e,r,n){const i=this.image,s=i.getWidth(),o=this.getCrossCheckStateCount();let a=t;for(;a>=0&&i.get(a,e);)o[2]++,a--;if(a<0)return NaN;for(;a>=0&&!i.get(a,e)&&o[1]<=r;)o[1]++,a--;if(a<0||o[1]>r)return NaN;for(;a>=0&&i.get(a,e)&&o[0]<=r;)o[0]++,a--;if(o[0]>r)return NaN;for(a=t+1;a=r)return NaN;for(;a=r)return NaN;const h=o[0]+o[1]+o[2]+o[3]+o[4];return 5*Math.abs(h-n)>=n?NaN:Be.foundPatternCross(o)?Be.centerFromEnd(o,a):NaN}handlePossibleCenter(t,e,r,n){const i=t[0]+t[1]+t[2]+t[3]+t[4];let s=Be.centerFromEnd(t,r),o=this.crossCheckVertical(e,Math.floor(s),t[2],i);if(!isNaN(o)&&(s=this.crossCheckHorizontal(Math.floor(s),Math.floor(o),t[2],i),!isNaN(s)&&(!n||this.crossCheckDiagonal(Math.floor(o),Math.floor(s),t[2],i)))){const t=i/7;let e=!1;const r=this.possibleCenters;for(let n=0,i=r.length;n=Be.CENTER_QUORUM){if(null!=t)return this.hasSkipped=!0,Math.floor((Math.abs(t.getX()-e.getX())-Math.abs(t.getY()-e.getY()))/2);t=e}return 0}haveMultiplyConfirmedCenters(){let t=0,e=0;const r=this.possibleCenters.length;for(const r of this.possibleCenters)r.getCount()>=Be.CENTER_QUORUM&&(t++,e+=r.getEstimatedModuleSize());if(t<3)return!1;const n=e/r;let i=0;for(const t of this.possibleCenters)i+=Math.abs(t.getEstimatedModuleSize()-n);return i<=.05*e}selectBestPatterns(){const t=this.possibleCenters.length;if(t<3)throw new N;const e=this.possibleCenters;let r;if(t>3){let n=0,i=0;for(const t of this.possibleCenters){const e=t.getEstimatedModuleSize();n+=e,i+=e*e}r=n/t;let s=Math.sqrt(i/t-r*r);e.sort(((t,e)=>{const n=Math.abs(e.getEstimatedModuleSize()-r),i=Math.abs(t.getEstimatedModuleSize()-r);return ni?1:0}));const o=Math.max(.2*r,s);for(let t=0;t3;t++){const n=e[t];Math.abs(n.getEstimatedModuleSize()-r)>o&&(e.splice(t,1),t--)}}if(e.length>3){let t=0;for(const r of e)t+=r.getEstimatedModuleSize();r=t/e.length,e.sort(((t,e)=>{if(e.getCount()===t.getCount()){const n=Math.abs(e.getEstimatedModuleSize()-r),i=Math.abs(t.getEstimatedModuleSize()-r);return ni?-1:0}return e.getCount()-t.getCount()})),e.splice(3)}return[e[0],e[1],e[2]]}}Be.CENTER_QUORUM=2,Be.MIN_SKIP=3,Be.MAX_MODULES=57;class Pe{constructor(t){this.image=t}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(t){this.resultPointCallback=null==t?null:t.get(E.NEED_RESULT_POINT_CALLBACK);const e=new Be(this.image,this.resultPointCallback).find(t);return this.processFinderPatternInfo(e)}processFinderPatternInfo(t){const e=t.getTopLeft(),r=t.getTopRight(),n=t.getBottomLeft(),i=this.calculateModuleSize(e,r,n);if(i<1)throw new N("No pattern found in proccess finder.");const s=Pe.computeDimension(e,r,n,i),o=Ie.getProvisionalVersionForDimension(s),a=o.getDimensionForVersion()-7;let h=null;if(o.getAlignmentPatternCenters().length>0){const t=r.getX()-e.getX()+n.getX(),s=r.getY()-e.getY()+n.getY(),o=1-3/a,l=Math.floor(e.getX()+o*(t-e.getX())),c=Math.floor(e.getY()+o*(s-e.getY()));for(let t=4;t<=16;t<<=1)try{h=this.findAlignmentInRegion(i,l,c,t);break}catch(t){if(!(t instanceof N))throw t}}const l=Pe.createTransform(e,r,n,h,s),c=Pe.sampleGrid(this.image,l,s);let d;return d=null===h?[n,e,r]:[n,e,r,h],new it(c,d)}static createTransform(t,e,r,n,i){const s=i-3.5;let o,a,h,l;return null!==n?(o=n.getX(),a=n.getY(),h=s-3,l=h):(o=e.getX()-t.getX()+r.getX(),a=e.getY()-t.getY()+r.getY(),h=s,l=s),ht.quadrilateralToQuadrilateral(3.5,3.5,s,3.5,h,l,3.5,s,t.getX(),t.getY(),e.getX(),e.getY(),o,a,r.getX(),r.getY())}static sampleGrid(t,e,r){return ct.getInstance().sampleGridWithTransform(t,r,r,e)}static computeDimension(t,e,r,n){const i=et.round(nt.distance(t,e)/n),s=et.round(nt.distance(t,r)/n);let o=Math.floor((i+s)/2)+7;switch(3&o){case 0:o++;break;case 2:o--;break;case 3:throw new N("Dimensions could be not found.")}return o}calculateModuleSize(t,e,r){return(this.calculateModuleSizeOneWay(t,e)+this.calculateModuleSizeOneWay(t,r))/2}calculateModuleSizeOneWay(t,e){const r=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.getX()),Math.floor(t.getY()),Math.floor(e.getX()),Math.floor(e.getY())),n=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.getX()),Math.floor(e.getY()),Math.floor(t.getX()),Math.floor(t.getY()));return isNaN(r)?n/7:isNaN(n)?r/7:(r+n)/14}sizeOfBlackWhiteBlackRunBothWays(t,e,r,n){let i=this.sizeOfBlackWhiteBlackRun(t,e,r,n),s=1,o=t-(r-t);o<0?(s=t/(t-o),o=0):o>=this.image.getWidth()&&(s=(this.image.getWidth()-1-t)/(o-t),o=this.image.getWidth()-1);let a=Math.floor(e-(n-e)*s);return s=1,a<0?(s=e/(e-a),a=0):a>=this.image.getHeight()&&(s=(this.image.getHeight()-1-e)/(a-e),a=this.image.getHeight()-1),o=Math.floor(t+(o-t)*s),i+=this.sizeOfBlackWhiteBlackRun(t,e,o,a),i-1}sizeOfBlackWhiteBlackRun(t,e,r,n){const i=Math.abs(n-e)>Math.abs(r-t);if(i){let i=t;t=e,e=i,i=r,r=n,n=i}const s=Math.abs(r-t),o=Math.abs(n-e);let a=-s/2;const h=t0){if(u===n)break;u+=l,a-=s}}return 2===c?et.distance(r+h,n,t,e):NaN}findAlignmentInRegion(t,e,r,n){const i=Math.floor(n*t),s=Math.max(0,e-i),o=Math.min(this.image.getWidth()-1,e+i);if(o-s<3*t)throw new N("Alignment top exceeds estimated module size.");const a=Math.max(0,r-i),h=Math.min(this.image.getHeight()-1,r+i);if(h-a<3*t)throw new N("Alignment bottom exceeds estimated module size.");return new Oe(this.image,s,a,o-s,h-a,t,this.resultPointCallback).find()}}class Le{constructor(){this.decoder=new ye}getDecoder(){return this.decoder}decode(t,e){let r,n;if(null!=e&&void 0!==e.get(E.PURE_BARCODE)){const i=Le.extractPureBits(t.getBlackMatrix());r=this.decoder.decodeBitMatrix(i,e),n=Le.NO_POINTS}else{const i=new Pe(t.getBlackMatrix()).detect(e);r=this.decoder.decodeBitMatrix(i.getBits(),e),n=i.getPoints()}r.getOther()instanceof Ne&&r.getOther().applyMirroredCorrection(n);const i=new v(r.getText(),r.getRawBytes(),void 0,n,x.QR_CODE,void 0),s=r.getByteSegments();null!==s&&i.putMetadata(z.BYTE_SEGMENTS,s);const o=r.getECLevel();return null!==o&&i.putMetadata(z.ERROR_CORRECTION_LEVEL,o),r.hasStructuredAppend()&&(i.putMetadata(z.STRUCTURED_APPEND_SEQUENCE,r.getStructuredAppendSequenceNumber()),i.putMetadata(z.STRUCTURED_APPEND_PARITY,r.getStructuredAppendParity())),i}reset(){}static extractPureBits(t){const e=t.getTopLeftOnBit(),r=t.getBottomRightOnBit();if(null===e||null===r)throw new N;const n=this.moduleSize(e,t);let i=e[1],s=r[1],o=e[0],a=r[0];if(o>=a||i>=s)throw new N;if(s-i!=a-o&&(a=o+(s-i),a>=t.getWidth()))throw new N;const h=Math.round((a-o+1)/n),l=Math.round((s-i+1)/n);if(h<=0||l<=0)throw new N;if(l!==h)throw new N;const c=Math.floor(n/2);i+=c,o+=c;const d=o+Math.floor((h-1)*n)-a;if(d>0){if(d>c)throw new N;o-=d}const u=i+Math.floor((l-1)*n)-s;if(u>0){if(u>c)throw new N;i-=u}const g=new R(h,l);for(let e=0;e0;){const o=ke.findGuardPattern(t,i,--n,r,!1,s,h);if(null==o){n++;break}e=o}o[0]=new nt(e[0],n),o[1]=new nt(e[1],n),a=!0;break}}let l=n+1;if(a){let n=0,i=Int32Array.from([Math.trunc(o[0].getX()),Math.trunc(o[1].getX())]);for(;lke.SKIPPED_ROW_COUNT_MAX)break;n++}}l-=n+1,o[2]=new nt(i[0],l),o[3]=new nt(i[1],l)}return l-n0&&h++s?n-s:s-n;if(h>r)return 1/0;a+=h}return a/i}}ke.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),ke.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),ke.MAX_AVG_VARIANCE=.42,ke.MAX_INDIVIDUAL_VARIANCE=.8,ke.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),ke.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),ke.MAX_PIXEL_DRIFT=3,ke.MAX_PATTERN_DRIFT=5,ke.SKIPPED_ROW_COUNT_MAX=25,ke.ROW_STEP=5,ke.BARCODE_MIN_HEIGHT=10;class xe{constructor(t,e){if(0===e.length)throw new a;this.field=t;let r=e.length;if(r>1&&0===e[0]){let t=1;for(;tr.length){let t=e;e=r,r=t}let n=new Int32Array(r.length),i=r.length-e.length;d.arraycopy(r,0,n,0,i);for(let t=i;t=0;e--){let r=this.getCoefficient(e);0!==r&&(r<0?(t.append(" - "),r=-r):t.length()>0&&t.append(" + "),0!==e&&1===r||t.append(r),0!==e&&(1===e?t.append("x"):(t.append("x^"),t.append(e))))}return t.toString()}}class Ve{add(t,e){return(t+e)%this.modulus}subtract(t,e){return(this.modulus+t-e)%this.modulus}exp(t){return this.expTable[t]}log(t){if(0===t)throw new a;return this.logTable[t]}inverse(t){if(0===t)throw new q;return this.expTable[this.modulus-this.logTable[t]-1]}multiply(t,e){return 0===t||0===e?0:this.expTable[(this.logTable[t]+this.logTable[e])%(this.modulus-1)]}getSize(){return this.modulus}equals(t){return t===this}}class He extends Ve{constructor(t,e){super(),this.modulus=t,this.expTable=new Int32Array(t),this.logTable=new Int32Array(t);let r=1;for(let n=0;n0;t--){let r=n.evaluateAt(this.field.exp(t));i[e-t]=r,0!==r&&(s=!0)}if(!s)return 0;let o=this.field.getOne();if(null!=r)for(const e of r){let r=this.field.exp(t.length-1-e),n=new xe(this.field,new Int32Array([this.field.subtract(0,r),1]));o=o.multiply(n)}let a=new xe(this.field,i),h=this.runEuclideanAlgorithm(this.field.buildMonomial(e,1),a,e),c=h[0],d=h[1],u=this.findErrorLocations(c),g=this.findErrorMagnitudes(d,c,u);for(let e=0;e=Math.round(r/2);){let t=n,e=s;if(n=i,s=o,n.isZero())throw l.getChecksumInstance();i=t;let r=this.field.getZero(),a=n.getCoefficient(n.getDegree()),h=this.field.inverse(a);for(;i.getDegree()>=n.getDegree()&&!i.isZero();){let t=i.getDegree()-n.getDegree(),e=this.field.multiply(i.getCoefficient(i.getDegree()),h);r=r.add(this.field.buildMonomial(t,e)),i=i.subtract(n.multiplyByMonomial(t,e))}o=r.multiply(s).subtract(e).negative()}let a=o.getCoefficient(0);if(0===a)throw l.getChecksumInstance();let h=this.field.inverse(a);return[o.multiply(h),i.multiply(h)]}findErrorLocations(t){let e=t.getDegree(),r=new Int32Array(e),n=0;for(let i=1;i0){let e=r?this.topLeft:this.topRight,i=Math.trunc(e.getY()-t);i<0&&(i=0);let o=new nt(e.getX(),i);r?n=o:s=o}if(e>0){let t=r?this.bottomLeft:this.bottomRight,n=Math.trunc(t.getY()+e);n>=this.image.getHeight()&&(n=this.image.getHeight()-1);let s=new nt(t.getX(),n);r?i=s:o=s}return new Xe(this.image,n,i,s,o)}getMinX(){return this.minX}getMaxX(){return this.maxX}getMinY(){return this.minY}getMaxY(){return this.maxY}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}getBottomLeft(){return this.bottomLeft}getBottomRight(){return this.bottomRight}}class Ge{constructor(t,e,r,n){this.columnCount=t,this.errorCorrectionLevel=n,this.rowCountUpperPart=e,this.rowCountLowerPart=r,this.rowCount=e+r}getColumnCount(){return this.columnCount}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getRowCount(){return this.rowCount}getRowCountUpperPart(){return this.rowCountUpperPart}getRowCountLowerPart(){return this.rowCountLowerPart}}class We{constructor(){this.buffer=""}static form(t,e){let r=-1;return t.replace(/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g,(function(t,n,i,s,o,a){if("%%"===t)return"%";if(void 0===e[++r])return;t=s?parseInt(s.substr(1)):void 0;let h,l=o?parseInt(o.substr(1)):void 0;switch(a){case"s":h=e[r];break;case"c":h=e[r][0];break;case"f":h=parseFloat(e[r]).toFixed(t);break;case"p":h=parseFloat(e[r]).toPrecision(t);break;case"e":h=parseFloat(e[r]).toExponential(t);break;case"x":h=parseInt(e[r]).toString(l||16);break;case"d":h=parseFloat(parseInt(e[r],l||10).toPrecision(t)).toFixed(0)}h="object"==typeof h?JSON.stringify(h):(+h).toString(l);let c=parseInt(i),d=i&&i[0]+""=="0"?"0":" ";for(;h.length=0&&(e=this.codewords[n],null!=e))return e;if(n=this.imageRowToCodewordIndex(t)+r,nr,getValue:()=>n};i.getValue()>t?(t=i.getValue(),e=[],e.push(i.getKey())):i.getValue()===t&&e.push(i.getKey())}return Fe.toIntArray(e)}getConfidence(t){return this.values.get(t)}}class Ze extends ze{constructor(t,e){super(t),this._isLeft=e}setRowNumbers(){for(let t of this.getCodewords())null!=t&&t.setRowNumberAsRowIndicatorColumn()}adjustCompleteIndicatorColumnRowNumbers(t){let e=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(e,t);let r=this.getBoundingBox(),n=this._isLeft?r.getTopLeft():r.getTopRight(),i=this._isLeft?r.getBottomLeft():r.getBottomRight(),s=this.imageRowToCodewordIndex(Math.trunc(n.getY())),o=this.imageRowToCodewordIndex(Math.trunc(i.getY())),a=-1,h=1,l=0;for(let r=s;r=t.getRowCount()||i>r)e[r]=null;else{let t;t=h>2?(h-2)*i:i;let s=t>=r;for(let n=1;n<=t&&!s;n++)s=null!=e[r-n];s?e[r]=null:(a=n.getRowNumber(),l=1)}}}getRowHeights(){let t=this.getBarcodeMetadata();if(null==t)return null;this.adjustIncompleteIndicatorColumnRowNumbers(t);let e=new Int32Array(t.getRowCount());for(let t of this.getCodewords())if(null!=t){let r=t.getRowNumber();if(r>=e.length)continue;e[r]++}return e}adjustIncompleteIndicatorColumnRowNumbers(t){let e=this.getBoundingBox(),r=this._isLeft?e.getTopLeft():e.getTopRight(),n=this._isLeft?e.getBottomLeft():e.getBottomRight(),i=this.imageRowToCodewordIndex(Math.trunc(r.getY())),s=this.imageRowToCodewordIndex(Math.trunc(n.getY())),o=this.getCodewords(),a=-1;for(let e=i;e=t.getRowCount()?o[e]=null:a=r.getRowNumber())}}getBarcodeMetadata(){let t=this.getCodewords(),e=new Ye,r=new Ye,n=new Ye,i=new Ye;for(let s of t){if(null==s)continue;s.setRowNumberAsRowIndicatorColumn();let t=s.getValue()%30,o=s.getRowNumber();switch(this._isLeft||(o+=2),o%3){case 0:r.setValue(3*t+1);break;case 1:i.setValue(t/3),n.setValue(t%3);break;case 2:e.setValue(t+1)}}if(0===e.getValue().length||0===r.getValue().length||0===n.getValue().length||0===i.getValue().length||e.getValue()[0]<1||r.getValue()[0]+n.getValue()[0]Fe.MAX_ROWS_IN_BARCODE)return null;let s=new Ge(e.getValue()[0],r.getValue()[0],n.getValue()[0],i.getValue()[0]);return this.removeIncorrectCodewords(t,s),s}removeIncorrectCodewords(t,e){for(let r=0;re.getRowCount())t[r]=null;else switch(this._isLeft||(s+=2),s%3){case 0:3*i+1!==e.getRowCountUpperPart()&&(t[r]=null);break;case 1:Math.trunc(i/3)===e.getErrorCorrectionLevel()&&i%3===e.getRowCountLowerPart()||(t[r]=null);break;case 2:i+1!==e.getColumnCount()&&(t[r]=null)}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+"\n"+super.toString()}}class Ke{constructor(t,e){this.ADJUST_ROW_NUMBER_SKIP=2,this.barcodeMetadata=t,this.barcodeColumnCount=t.getColumnCount(),this.boundingBox=e,this.detectionResultColumns=new Array(this.barcodeColumnCount+2)}getDetectionResultColumns(){this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]),this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount+1]);let t,e=Fe.MAX_CODEWORDS_IN_BARCODE;do{t=e,e=this.adjustRowNumbersAndGetCount()}while(e>0&&e0&&i0&&(o[0]=r[e-1],o[4]=i[e-1],o[5]=s[e-1]),e>1&&(o[8]=r[e-2],o[10]=i[e-2],o[11]=s[e-2]),e>=1;r=1&e,Qe.RATIOS_TABLE[t]||(Qe.RATIOS_TABLE[t]=new Array(Fe.BARS_IN_MODULE)),Qe.RATIOS_TABLE[t][Fe.BARS_IN_MODULE-n-1]=Math.fround(i/Fe.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(t){let e=Qe.getDecodedCodewordValue(Qe.sampleBitCounts(t));return-1!==e?e:Qe.getClosestDecodedValue(t)}static sampleBitCounts(t){let e=et.sum(t),r=new Int32Array(Fe.BARS_IN_MODULE),n=0,i=0;for(let s=0;s1)for(let n=0;n=n)break}enew Array(Fe.BARS_IN_MODULE)));class je{constructor(){this.segmentCount=-1,this.fileSize=-1,this.timestamp=-1,this.checksum=-1}getSegmentIndex(){return this.segmentIndex}setSegmentIndex(t){this.segmentIndex=t}getFileId(){return this.fileId}setFileId(t){this.fileId=t}getOptionalData(){return this.optionalData}setOptionalData(t){this.optionalData=t}isLastSegment(){return this.lastSegment}setLastSegment(t){this.lastSegment=t}getSegmentCount(){return this.segmentCount}setSegmentCount(t){this.segmentCount=t}getSender(){return this.sender||null}setSender(t){this.sender=t}getAddressee(){return this.addressee||null}setAddressee(t){this.addressee=t}getFileName(){return this.fileName}setFileName(t){this.fileName=t}getFileSize(){return this.fileSize}setFileSize(t){this.fileSize=t}getChecksum(){return this.checksum}setChecksum(t){this.checksum=t}getTimestamp(){return this.timestamp}setTimestamp(t){this.timestamp=t}}class Je{static parseLong(t,e=void 0){return parseInt(t,e)}}class $e extends s{}$e.kind="NullPointerException";class tr{writeBytes(t){this.writeBytesOffset(t,0,t.length)}writeBytesOffset(t,e,r){if(null==t)throw new $e;if(e<0||e>t.length||r<0||e+r>t.length||e+r<0)throw new u;if(0!==r)for(let n=0;n0&&this.grow(t)}grow(t){let e=this.buf.length<<1;if(e-t<0&&(e=t),e<0){if(t<0)throw new er;e=w.MAX_VALUE}this.buf=f.copyOfUint8Array(this.buf,e)}write(t){this.ensureCapacity(this.count+1),this.buf[this.count]=t,this.count+=1}writeBytesOffset(t,e,r){if(e<0||e>t.length||r<0||e+r-t.length>0)throw new u;this.ensureCapacity(this.count+r),d.arraycopy(t,e,this.buf,this.count,r),this.count+=r}writeTo(t){t.writeBytesOffset(this.buf,0,this.count)}reset(){this.count=0}toByteArray(){return f.copyOfUint8Array(this.buf,this.count)}size(){return this.count}toString(t){return t?"string"==typeof t?this.toString_string(t):this.toString_number(t):this.toString_void()}toString_void(){return new String(this.buf).toString()}toString_string(t){return new String(this.buf).toString()}toString_number(t){return new String(this.buf).toString()}close(){}}function nr(){if("undefined"!=typeof window)return window.BigInt||null;if("undefined"!=typeof global)return global.BigInt||null;if("undefined"!=typeof self)return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let ir;function sr(t){if(void 0===ir&&(ir=nr()),null===ir)throw new Error("BigInt is not supported!");return ir(t)}!function(t){t[t.ALPHA=0]="ALPHA",t[t.LOWER=1]="LOWER",t[t.MIXED=2]="MIXED",t[t.PUNCT=3]="PUNCT",t[t.ALPHA_SHIFT=4]="ALPHA_SHIFT",t[t.PUNCT_SHIFT=5]="PUNCT_SHIFT"}(W||(W={}));class or{static decode(t,e){let r=new T(""),n=I.ISO8859_1;r.enableDecoding(n);let i=1,s=t[i++],o=new je;for(;it[0])throw m.getFormatInstance();let n=new Int32Array(or.NUMBER_OF_SEQUENCE_CODEWORDS);for(let r=0;r0){for(let t=0;t<6;++t)s.write(Number(sr(a)>>sr(8*(5-t))));a=0,o=0}}n===e[0]&&r0){for(let t=0;t<6;++t)s.write(Number(sr(a)>>sr(8*(5-t))));a=0,o=0}}}return i.append(S.decode(s.toByteArray(),r)),n}static numericCompaction(t,e,r){let n=0,i=!1,s=new Int32Array(or.MAX_NUMERIC_CODEWORDS);for(;e0&&(r.append(or.decodeBase900toBase10(s,n)),n=0)}return e}static decodeBase900toBase10(t,e){let r=sr(0);for(let n=0;n@[\\]_`~!\r\t,:\n-.$/\"|*()?{}'",or.MIXED_CHARS="0123456789&\r\t,:#-.$/+%*=^",or.EXP900=nr()?function(){let t=[];t[0]=sr(1);let e=sr(900);t[1]=e;for(let r=2;r<16;r++)t[r]=t[r-1]*e;return t}():[],or.NUMBER_OF_SEQUENCE_CODEWORDS=2;class ar{constructor(){}static decode(t,e,r,n,i,s,o){let a,h=new Xe(t,e,r,n,i),l=null,c=null;for(let r=!0;;r=!1){if(null!=e&&(l=ar.getRowIndicatorColumn(t,h,e,!0,s,o)),null!=n&&(c=ar.getRowIndicatorColumn(t,h,n,!1,s,o)),a=ar.merge(l,c),null==a)throw N.getNotFoundInstance();let i=a.getBoundingBox();if(!r||null==i||!(i.getMinY()h.getMaxY()))break;h=i}a.setBoundingBox(h);let d=a.getBarcodeColumnCount()+1;a.setDetectionResultColumn(0,l),a.setDetectionResultColumn(d,c);let u=null!=l;for(let e=1;e<=d;e++){let r,n=u?e:d-e;if(void 0!==a.getDetectionResultColumn(n))continue;r=0===n||n===d?new Ze(h,0===n):new ze(h),a.setDetectionResultColumn(n,r);let i=-1,l=i;for(let e=h.getMinY();e<=h.getMaxY();e++){if(i=ar.getStartColumn(a,n,e,u),i<0||i>h.getMaxX()){if(-1===l)continue;i=l}let c=ar.detectCodeword(t,h.getMinX(),h.getMaxX(),u,i,e,s,o);null!=c&&(r.setCodeword(e,c),l=i,s=Math.min(s,c.getWidth()),o=Math.max(o,c.getWidth()))}}return ar.createDecoderResult(a)}static merge(t,e){if(null==t&&null==e)return null;let r=ar.getBarcodeMetadata(t,e);if(null==r)return null;let n=Xe.merge(ar.adjustBoundingBox(t),ar.adjustBoundingBox(e));return new Ke(r,n)}static adjustBoundingBox(t){if(null==t)return null;let e=t.getRowHeights();if(null==e)return null;let r=ar.getMax(e),n=0;for(let t of e)if(n+=r-t,t>0)break;let i=t.getCodewords();for(let t=0;n>0&&null==i[t];t++)n--;let s=0;for(let t=e.length-1;t>=0&&(s+=r-e[t],!(e[t]>0));t--);for(let t=i.length-1;s>0&&null==i[t];t--)s--;return t.getBoundingBox().addMissingRows(n,s,t.isLeft())}static getMax(t){let e=-1;for(let r of t)e=Math.max(e,r);return e}static getBarcodeMetadata(t,e){let r,n;return null==t||null==(r=t.getBarcodeMetadata())?null==e?null:e.getBarcodeMetadata():null==e||null==(n=e.getBarcodeMetadata())?r:r.getColumnCount()!==n.getColumnCount()&&r.getErrorCorrectionLevel()!==n.getErrorCorrectionLevel()&&r.getRowCount()!==n.getRowCount()?null:r}static getRowIndicatorColumn(t,e,r,n,i,s){let o=new Ze(e,n);for(let a=0;a<2;a++){let h=0===a?1:-1,l=Math.trunc(Math.trunc(r.getX()));for(let a=Math.trunc(Math.trunc(r.getY()));a<=e.getMaxY()&&a>=e.getMinY();a+=h){let e=ar.detectCodeword(t,0,t.getWidth(),n,l,a,i,s);null!=e&&(o.setCodeword(a,e),l=n?e.getStartX():e.getEndX())}}return o}static adjustCodewordCount(t,e){let r=e[0][1],n=r.getValue(),i=t.getBarcodeColumnCount()*t.getBarcodeRowCount()-ar.getNumberOfECCodeWords(t.getBarcodeECLevel());if(0===n.length){if(i<1||i>Fe.MAX_CODEWORDS_IN_BARCODE)throw N.getNotFoundInstance();r.setValue(i)}else n[0]!==i&&r.setValue(i)}static createDecoderResult(t){let e=ar.createBarcodeMatrix(t);ar.adjustCodewordCount(t,e);let r=new Array,n=new Int32Array(t.getBarcodeRowCount()*t.getBarcodeColumnCount()),i=[],s=new Array;for(let o=0;o0;){for(let t=0;tnew Array(t.getBarcodeColumnCount()+2)));for(let t=0;t=0){if(n>=e.length)continue;e[n][r].setValue(t.getValue())}}r++}return e}static isValidBarcodeColumn(t,e){return e>=0&&e<=t.getBarcodeColumnCount()+1}static getStartColumn(t,e,r,n){let i=n?1:-1,s=null;if(ar.isValidBarcodeColumn(t,e-i)&&(s=t.getDetectionResultColumn(e-i).getCodeword(r)),null!=s)return n?s.getEndX():s.getStartX();if(s=t.getDetectionResultColumn(e).getCodewordNearby(r),null!=s)return n?s.getStartX():s.getEndX();if(ar.isValidBarcodeColumn(t,e-i)&&(s=t.getDetectionResultColumn(e-i).getCodewordNearby(r)),null!=s)return n?s.getEndX():s.getStartX();let o=0;for(;ar.isValidBarcodeColumn(t,e-i);){e-=i;for(let r of t.getDetectionResultColumn(e).getCodewords())if(null!=r)return(n?r.getEndX():r.getStartX())+i*o*(r.getEndX()-r.getStartX());o++}return n?t.getBoundingBox().getMinX():t.getBoundingBox().getMaxX()}static detectCodeword(t,e,r,n,i,s,o,a){i=ar.adjustCodewordStartColumn(t,e,r,n,i,s);let h,l=ar.getModuleBitCount(t,e,r,n,i,s);if(null==l)return null;let c=et.sum(l);if(n)h=i+c;else{for(let t=0;t=e)&&h=e:oar.CODEWORD_SKEW_SIZE)return i;o+=a}a=-a,n=!n}return o}static checkCodewordSkew(t,e,r){return e-ar.CODEWORD_SKEW_SIZE<=t&&t<=r+ar.CODEWORD_SKEW_SIZE}static decodeCodewords(t,e,r){if(0===t.length)throw m.getFormatInstance();let n=1<r/2+ar.MAX_ERRORS||r<0||r>ar.MAX_EC_CODEWORDS)throw l.getChecksumInstance();return ar.errorCorrection.decode(t,r,e)}static verifyCodewordCount(t,e){if(t.length<4)throw m.getFormatInstance();let r=t[0];if(r>t.length)throw m.getFormatInstance();if(0===r){if(!(e>=1;return e}static getCodewordBucketNumber(t){return t instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(t):this.getCodewordBucketNumber_number(t)}static getCodewordBucketNumber_number(t){return ar.getCodewordBucketNumber(ar.getBitCountForCodeword(t))}static getCodewordBucketNumber_Int32Array(t){return(t[0]-t[2]+t[4]-t[6]+9)%9}static toString(t){let e=new We;for(let r=0;rt))}static getMaxWidth(t,e){return null==t||null==e?0:Math.trunc(Math.abs(t.getX()-e.getX()))}static getMinWidth(t,e){return null==t||null==e?w.MAX_VALUE:Math.trunc(Math.abs(t.getX()-e.getX()))}static getMaxCodewordWidth(t){return Math.floor(Math.max(Math.max(hr.getMaxWidth(t[0],t[4]),hr.getMaxWidth(t[6],t[2])*Fe.MODULES_IN_CODEWORD/Fe.MODULES_IN_STOP_PATTERN),Math.max(hr.getMaxWidth(t[1],t[5]),hr.getMaxWidth(t[7],t[3])*Fe.MODULES_IN_CODEWORD/Fe.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(t){return Math.floor(Math.min(Math.min(hr.getMinWidth(t[0],t[4]),hr.getMinWidth(t[6],t[2])*Fe.MODULES_IN_CODEWORD/Fe.MODULES_IN_STOP_PATTERN),Math.min(hr.getMinWidth(t[1],t[5]),hr.getMinWidth(t[7],t[3])*Fe.MODULES_IN_CODEWORD/Fe.MODULES_IN_STOP_PATTERN)))}reset(){}}class lr extends s{}lr.kind="ReaderException";class cr{decode(t,e){return this.setHints(e),this.decodeInternal(t)}decodeWithState(t){return null!==this.readers&&void 0!==this.readers||this.setHints(null),this.decodeInternal(t)}setHints(t){this.hints=t;const e=null!=t&&void 0!==t.get(E.TRY_HARDER),r=null==t?null:t.get(E.POSSIBLE_FORMATS),n=new Array;if(null!=r){const i=r.some((t=>t===x.UPC_A||t===x.UPC_E||t===x.EAN_13||t===x.EAN_8||t===x.CODABAR||t===x.CODE_39||t===x.CODE_93||t===x.CODE_128||t===x.ITF||t===x.RSS_14||t===x.RSS_EXPANDED));i&&!e&&n.push(new se(t)),r.includes(x.QR_CODE)&&n.push(new Le),r.includes(x.DATA_MATRIX)&&n.push(new we),r.includes(x.AZTEC)&&n.push(new gt),r.includes(x.PDF_417)&&n.push(new hr),i&&e&&n.push(new se(t))}0===n.length&&(e||n.push(new se(t)),n.push(new Le),n.push(new we),n.push(new gt),n.push(new hr),e&&n.push(new se(t))),this.readers=n}reset(){if(null!==this.readers)for(const t of this.readers)t.reset()}decodeInternal(t){if(null===this.readers)throw new lr("No readers where selected, nothing can be read.");for(const e of this.readers)try{return e.decode(t,this.hints)}catch(t){if(t instanceof lr)continue}throw new N("No MultiFormat Readers were able to detect the code.")}}var dr;!function(t){t[t.ERROR_CORRECTION=0]="ERROR_CORRECTION",t[t.CHARACTER_SET=1]="CHARACTER_SET",t[t.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",t[t.DATA_MATRIX_COMPACT=3]="DATA_MATRIX_COMPACT",t[t.MIN_SIZE=4]="MIN_SIZE",t[t.MAX_SIZE=5]="MAX_SIZE",t[t.MARGIN=6]="MARGIN",t[t.PDF417_COMPACT=7]="PDF417_COMPACT",t[t.PDF417_COMPACTION=8]="PDF417_COMPACTION",t[t.PDF417_DIMENSIONS=9]="PDF417_DIMENSIONS",t[t.AZTEC_LAYERS=10]="AZTEC_LAYERS",t[t.QR_VERSION=11]="QR_VERSION",t[t.GS1_FORMAT=12]="GS1_FORMAT",t[t.FORCE_C40=13]="FORCE_C40"}(dr||(dr={}));var ur=dr;class gr{constructor(t){this.field=t,this.cachedGenerators=[],this.cachedGenerators.push(new K(t,Int32Array.from([1])))}buildGenerator(t){const e=this.cachedGenerators;if(t>=e.length){let r=e[e.length-1];const n=this.field;for(let i=e.length;i<=t;i++){const t=r.multiply(new K(n,Int32Array.from([1,n.exp(i-1+n.getGeneratorBase())])));e.push(t),r=t}}return e[t]}encode(t,e){if(0===e)throw new a("No error correction bytes");const r=t.length-e;if(r<=0)throw new a("No data bytes provided");const n=this.buildGenerator(e),i=new Int32Array(r);d.arraycopy(t,0,i,0,r);let s=new K(this.field,i);s=s.multiplyByMonomial(e,1);const o=s.divide(n)[1].getCoefficients(),h=e-o.length;for(let e=0;e=5&&(r+=fr.N1+(n-5)),n=1,o=i)}n>=5&&(r+=fr.N1+(n-5))}return r}}fr.N1=3,fr.N2=3,fr.N3=40,fr.N4=10;class wr{constructor(t,e){this.width=t,this.height=e;const r=new Array(e);for(let n=0;n!==e;n++)r[n]=new Uint8Array(t);this.bytes=r}getHeight(){return this.height}getWidth(){return this.width}get(t,e){return this.bytes[e][t]}getArray(){return this.bytes}setNumber(t,e,r){this.bytes[e][t]=r}setBoolean(t,e,r){this.bytes[e][t]=r?1:0}clear(t){for(const e of this.bytes)f.fill(e,t)}equals(t){if(!(t instanceof wr))return!1;const e=t;if(this.width!==e.width)return!1;if(this.height!==e.height)return!1;for(let t=0,r=this.height;t>\n"),t.toString()}setMode(t){this.mode=t}setECLevel(t){this.ecLevel=t}setVersion(t){this.version=t}setMaskPattern(t){this.maskPattern=t}setMatrix(t){this.matrix=t}static isValidMaskPattern(t){return t>=0&&t0;){for(6===s&&(s-=1);o>=0&&o=r;)t^=e<=0)for(let t=0;t!==r;t++){const r=n[t];r>=0&&Er.isEmpty(e.get(r,i))&&Er.embedPositionAdjustmentPattern(r-2,i-2,e)}}}}Er.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),Er.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),Er.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),Er.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),Er.VERSION_INFO_POLY=7973,Er.TYPE_INFO_POLY=1335,Er.TYPE_INFO_MASK_PATTERN=21522;class mr{constructor(t,e){this.dataBytes=t,this.errorCorrectionBytes=e}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class Ir{constructor(){}static calculateMaskPenalty(t){return fr.applyMaskPenaltyRule1(t)+fr.applyMaskPenaltyRule2(t)+fr.applyMaskPenaltyRule3(t)+fr.applyMaskPenaltyRule4(t)}static encode(t,e,r=null){let n=Ir.DEFAULT_BYTE_MODE_ENCODING;const i=null!==r&&void 0!==r.get(ur.CHARACTER_SET);i&&(n=r.get(ur.CHARACTER_SET).toString());const s=this.chooseMode(t,n),o=new C;if(s===Te.BYTE&&(i||Ir.DEFAULT_BYTE_MODE_ENCODING!==n)){const t=I.getCharacterSetECIByName(n);void 0!==t&&this.appendECI(t,o)}this.appendModeInfo(s,o);const a=new C;let h;if(this.appendBytes(t,s,a,n),null!==r&&void 0!==r.get(ur.QR_VERSION)){const t=Number.parseInt(r.get(ur.QR_VERSION).toString(),10);h=Ie.getVersionForNumber(t);const n=this.calculateBitsNeeded(s,o,a,h);if(!this.willFit(n,h,e))throw new Ar("Data too big for requested version")}else h=this.recommendVersion(e,s,o,a);const l=new C;l.appendBitArray(o);const c=s===Te.BYTE?a.getSizeInBytes():t.length;this.appendLengthInfo(c,h,s,l),l.appendBitArray(a);const d=h.getECBlocksForLevel(e),u=h.getTotalCodewords()-d.getTotalECCodewords();this.terminateBits(u,l);const g=this.interleaveWithECBytes(l,h.getTotalCodewords(),u,d.getNumBlocks()),f=new Cr;f.setECLevel(e),f.setMode(s),f.setVersion(h);const w=h.getDimensionForVersion(),A=new wr(w,w),E=this.chooseMaskPattern(g,e,h,A);return f.setMaskPattern(E),Er.buildMatrix(g,e,h,E,A),f.setMatrix(A),f}static recommendVersion(t,e,r,n){const i=this.calculateBitsNeeded(e,r,n,Ie.getVersionForNumber(1)),s=this.chooseVersion(i,t),o=this.calculateBitsNeeded(e,r,n,s);return this.chooseVersion(o,t)}static calculateBitsNeeded(t,e,r,n){return e.getSize()+t.getCharacterCountBits(n)+r.getSize()}static getAlphanumericCode(t){return t159)&&(r<224||r>235))return!1}return!0}static chooseMaskPattern(t,e,r,n){let i=Number.MAX_SAFE_INTEGER,s=-1;for(let o=0;o=(t+7)/8}static terminateBits(t,e){const r=8*t;if(e.getSize()>r)throw new Ar("data bits cannot fit in the QR Code"+e.getSize()+" > "+r);for(let t=0;t<4&&e.getSize()0)for(let t=n;t<8;t++)e.appendBit(!1);const i=t-e.getSizeInBytes();for(let t=0;t=r)throw new Ar("Block ID too large");const o=t%r,a=r-o,h=Math.floor(t/r),l=h+1,c=Math.floor(e/r),d=c+1,u=h-c,g=l-d;if(u!==g)throw new Ar("EC bytes mismatch");if(r!==a+o)throw new Ar("RS blocks mismatch");if(t!==(c+u)*a+(d+g)*o)throw new Ar("Total bytes mismatch");n=1<=0&&e<=9}static appendNumericBytes(t,e){const r=t.length;let n=0;for(;n=33088&&n<=40956?i=n-33088:n>=57408&&n<=60351&&(i=n-49472),-1===i)throw new Ar("Invalid byte sequence");const s=192*(i>>8)+(255&i);e.appendBits(s,13)}}static appendECI(t,e){e.appendBits(Te.ECI.getBits(),4),e.appendBits(t.getValue(),8)}}Ir.ALPHANUMERIC_TABLE=Int32Array.from([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,36,-1,-1,-1,37,38,-1,-1,-1,-1,39,40,-1,41,42,43,0,1,2,3,4,5,6,7,8,9,44,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1]),Ir.DEFAULT_BYTE_MODE_ENCODING=I.UTF8.getName();class _r{write(t,e,r,n=null){if(0===t.length)throw new a("Found empty contents");if(e<0||r<0)throw new a("Requested dimensions are too small: "+e+"x"+r);let i=Ce.L,s=_r.QUIET_ZONE_SIZE;null!==n&&(void 0!==n.get(ur.ERROR_CORRECTION)&&(i=Ce.fromString(n.get(ur.ERROR_CORRECTION).toString())),void 0!==n.get(ur.MARGIN)&&(s=Number.parseInt(n.get(ur.MARGIN).toString(),10)));const o=Ir.encode(t,i,n);return this.renderResult(o,e,r,s)}writeToDom(t,e,r,n,i=null){"string"==typeof t&&(t=document.querySelector(t));const s=this.write(e,r,n,i);t&&t.appendChild(s)}renderResult(t,e,r,n){const i=t.getMatrix();if(null===i)throw new J;const s=i.getWidth(),o=i.getHeight(),a=s+2*n,h=o+2*n,l=Math.max(e,a),c=Math.max(r,h),d=Math.min(Math.floor(l/a),Math.floor(c/h)),u=Math.floor((l-s*d)/2),g=Math.floor((c-o*d)/2),f=this.createSVGElement(l,c);for(let t=0,e=g;te||i+o>r)throw new a("Crop rectangle does not fit within image data.");h&&this.reverseHorizontal(s,o)}getRow(t,e){if(t<0||t>=this.getHeight())throw new a("Requested row is outside the image: "+t);const r=this.getWidth();(null==e||e.length>16&255,s=r>>7&510,o=255&r;i[e]=(n+s+o)/4&255}this.luminances=i}else this.luminances=t;if(void 0===n&&(this.dataWidth=e),void 0===i&&(this.dataHeight=r),void 0===s&&(this.left=0),void 0===o&&(this.top=0),this.left+e>this.dataWidth||this.top+r>this.dataHeight)throw new a("Crop rectangle does not fit within image data.")}getRow(t,e){if(t<0||t>=this.getHeight())throw new a("Requested row is outside the image: "+t);const r=this.getWidth();(null==e||e.length=0&&this.noBit(r,e)&&this.utah(e,r,t++),e-=2,r+=2}while(e>=0&&r=0&&r=0);e+=3,r++}while(e{let r=1;for(let n=0;n<255;n++)e[n]=r,t[r]=n,r*=2,r>=256&&(r^=301);return{LOG:t,ALOG:e}})([],[]);var Br;t.DataMatrixSymbolShapeHint=void 0,(Br=t.DataMatrixSymbolShapeHint||(t.DataMatrixSymbolShapeHint={}))[Br.FORCE_NONE=0]="FORCE_NONE",Br[Br.FORCE_SQUARE=1]="FORCE_SQUARE",Br[Br.FORCE_RECTANGLE=2]="FORCE_RECTANGLE";const Pr="[)>05",Lr="[)>06",Fr="";class vr{static encodeECC200(t,e){if(t.length!==e.getDataCapacity())throw new Error("The number of codewords does not match the selected symbol");const r=new T;r.append(t);const n=e.getInterleavedBlockCount();if(1===n){const n=this.createECCBlock(t,e.getErrorCodewords());r.append(n)}else{const i=[];for(let t=0;t0;t--)0!==s&&0!==n[t]?i[t]=i[t-1]^br[(Mr[s]+Mr[n[t]])%255]:i[t]=i[t-1];0!==s&&0!==n[0]?i[0]=br[(Mr[s]+Mr[n[0]])%255]:i[0]=0}const s=[];for(let t=0;tString.fromCharCode(t))).join("")}}class kr{getEncodingMode(){return 0}encode(t){if(Yr.determineConsecutiveDigitCount(t.getMessage(),t.pos)>=2)t.writeCodeword(this.encodeASCIIDigits(t.getMessage().charCodeAt(t.pos),t.getMessage().charCodeAt(t.pos+1))),t.pos+=2;else{const e=t.getCurrentChar(),r=Yr.lookAheadTest(t.getMessage(),t.pos,this.getEncodingMode());if(r!==this.getEncodingMode())switch(r){case 5:return t.writeCodeword(231),void t.signalEncoderChange(5);case 1:return t.writeCodeword(230),void t.signalEncoderChange(1);case 3:t.writeCodeword(238),t.signalEncoderChange(3);break;case 2:t.writeCodeword(239),t.signalEncoderChange(2);break;case 4:t.writeCodeword(240),t.signalEncoderChange(4);break;default:throw new Error("Illegal mode: "+r)}else Yr.isExtendedASCII(e)?(t.writeCodeword(235),t.writeCodeword(e-128+1),t.pos++):(t.writeCodeword(e+1),t.pos++)}}encodeASCIIDigits(t,e){if(Yr.isDigit(t)&&Yr.isDigit(e)){return 10*(t-48)+(e-48)+130}throw new Error("not digits: "+t+e)}}class xr{getEncodingMode(){return 5}encode(t){const e=new T;for(e.append(0);t.hasMoreCharacters();){const r=t.getCurrentChar();e.append(r),t.pos++;if(Yr.lookAheadTest(t.getMessage(),t.pos,this.getEncodingMode())!==this.getEncodingMode()){t.signalEncoderChange(0);break}}const r=e.length()-1,n=t.getCodewordCount()+r+1;t.updateSymbolInfo(n);const i=t.getSymbolInfo().getDataCapacity()-n>0;if(t.hasMoreCharacters()||i)if(r<=249)e.setCharAt(0,p.getCharAt(r));else{if(!(r<=1555))throw new Error("Message length not in valid ranges: "+r);e.setCharAt(0,p.getCharAt(Math.floor(r/250)+249)),e.insert(1,p.getCharAt(r%250))}for(let r=0,n=e.length();r3||1!==o))&&(t.pos=n)}e.length()>0&&t.writeCodeword(230),this.handleEOD(t,e)}encode(t){const e=new T;for(;t.hasMoreCharacters();){const r=t.getCurrentChar();t.pos++;let n=this.encodeChar(r,e);const i=2*Math.floor(e.length()/3),s=t.getCodewordCount()+i;t.updateSymbolInfo(s);const o=t.getSymbolInfo().getDataCapacity()-s;if(!t.hasMoreCharacters()){const r=new T;for(e.length()%3==2&&2!==o&&(n=this.backtrackOneCharacter(t,e,r,n));e.length()%3==1&&(n>3||1!==o);)n=this.backtrackOneCharacter(t,e,r,n);break}if(e.length()%3==0){if(Yr.lookAheadTest(t.getMessage(),t.pos,this.getEncodingMode())!==this.getEncodingMode()){t.signalEncoderChange(0);break}}}this.handleEOD(t,e)}backtrackOneCharacter(t,e,r,n){const i=e.length(),s=e.toString().substring(0,i-n);e.setLengthToZero(),e.append(s),t.pos--;const o=t.getCurrentChar();return n=this.encodeChar(o,r),t.resetSymbolInfo(),n}writeNextTriplet(t,e){t.writeCodewords(this.encodeToCodewords(e.toString()));const r=e.toString().substring(3);e.setLengthToZero(),e.append(r)}handleEOD(t,e){const r=Math.floor(e.length()/3*2),n=e.length()%3,i=t.getCodewordCount()+r;t.updateSymbolInfo(i);const s=t.getSymbolInfo().getDataCapacity()-i;if(2===n){for(e.append("\0");e.length()>=3;)this.writeNextTriplet(t,e);t.hasMoreCharacters()&&t.writeCodeword(254)}else if(1===s&&1===n){for(;e.length()>=3;)this.writeNextTriplet(t,e);t.hasMoreCharacters()&&t.writeCodeword(254),t.pos--}else{if(0!==n)throw new Error("Unexpected case. Please report!");for(;e.length()>=3;)this.writeNextTriplet(t,e);(s>0||t.hasMoreCharacters())&&t.writeCodeword(254)}t.signalEncoderChange(0)}encodeChar(t,e){if(t===" ".charCodeAt(0))return e.append(3),1;if(t>="0".charCodeAt(0)&&t<="9".charCodeAt(0))return e.append(t-48+4),1;if(t>="A".charCodeAt(0)&&t<="Z".charCodeAt(0))return e.append(t-65+14),1;if(t<" ".charCodeAt(0))return e.append(0),e.append(t),2;if(t<="/".charCodeAt(0))return e.append(1),e.append(t-33),2;if(t<="@".charCodeAt(0))return e.append(1),e.append(t-58+15),2;if(t<="_".charCodeAt(0))return e.append(1),e.append(t-91+22),2;if(t<=127)return e.append(2),e.append(t-96),2;e.append("1");let r=2;return r+=this.encodeChar(t-128,e),r}encodeToCodewords(t){const e=1600*t.charCodeAt(0)+40*t.charCodeAt(1)+t.charCodeAt(2)+1,r=e/256,n=e%256,i=new T;return i.append(r),i.append(n),i.toString()}}class Hr{getEncodingMode(){return 4}encode(t){const e=new T;for(;t.hasMoreCharacters();){const r=t.getCurrentChar();this.encodeChar(r,e),t.pos++;if(e.length()>=4){t.writeCodewords(this.encodeToCodewords(e.toString()));const r=e.toString().substring(4);e.setLengthToZero(),e.append(r);if(Yr.lookAheadTest(t.getMessage(),t.pos,this.getEncodingMode())!==this.getEncodingMode()){t.signalEncoderChange(0);break}}}e.append(p.getCharAt(31)),this.handleEOD(t,e)}handleEOD(t,e){try{const r=e.length();if(0===r)return;if(1===r){t.updateSymbolInfo();let e=t.getSymbolInfo().getDataCapacity()-t.getCodewordCount();const r=t.getRemainingCharacters();if(r>e&&(t.updateSymbolInfo(t.getCodewordCount()+1),e=t.getSymbolInfo().getDataCapacity()-t.getCodewordCount()),r<=e&&e<=2)return}if(r>4)throw new Error("Count must not exceed 4");const n=r-1,i=this.encodeToCodewords(e.toString());let s=!t.hasMoreCharacters()&&n<=2;if(n<=2){t.updateSymbolInfo(t.getCodewordCount()+n);t.getSymbolInfo().getDataCapacity()-t.getCodewordCount()>=3&&(s=!1,t.updateSymbolInfo(t.getCodewordCount()+i.length))}s?(t.resetSymbolInfo(),t.pos-=n):t.writeCodewords(i)}finally{t.signalEncoderChange(0)}}encodeChar(t,e){t>=" ".charCodeAt(0)&&t<="?".charCodeAt(0)?e.append(t):t>="@".charCodeAt(0)&&t<="^".charCodeAt(0)?e.append(p.getCharAt(t-64)):Yr.illegalCharacter(p.getCharAt(t))}encodeToCodewords(t){const e=t.length;if(0===e)throw new Error("StringBuilder must not be empty");const r=(t.charAt(0).charCodeAt(0)<<18)+((e>=2?t.charAt(1).charCodeAt(0):0)<<12)+((e>=3?t.charAt(2).charCodeAt(0):0)<<6)+(e>=4?t.charAt(3).charCodeAt(0):0),n=r>>16&255,i=r>>8&255,s=255&r,o=new T;return o.append(n),e>=2&&o.append(i),e>=3&&o.append(s),o.toString()}}class Ur{constructor(t,e,r,n,i,s,o=0,a=0){this.rectangular=t,this.dataCapacity=e,this.errorCodewords=r,this.matrixWidth=n,this.matrixHeight=i,this.dataRegions=s,this.rsBlockData=o,this.rsBlockError=a}static lookup(t,e=0,r=null,n=null,i=!0){for(const i of Xr)if((1!==e||!i.rectangular)&&(2!==e||i.rectangular)&&(null==r||!(i.getSymbolWidth()n.getWidth()||i.getSymbolHeight()>n.getHeight()))&&t<=i.dataCapacity)return i;if(i)throw new Error("Can't find a symbol arrangement that matches the message. Data codewords: "+t);return null}getHorizontalDataRegions(){switch(this.dataRegions){case 1:return 1;case 2:case 4:return 2;case 16:return 4;case 36:return 6;default:throw new Error("Cannot handle this number of data regions")}}getVerticalDataRegions(){switch(this.dataRegions){case 1:case 2:return 1;case 4:return 2;case 16:return 4;case 36:return 6;default:throw new Error("Cannot handle this number of data regions")}}getSymbolDataWidth(){return this.getHorizontalDataRegions()*this.matrixWidth}getSymbolDataHeight(){return this.getVerticalDataRegions()*this.matrixHeight}getSymbolWidth(){return this.getSymbolDataWidth()+2*this.getHorizontalDataRegions()}getSymbolHeight(){return this.getSymbolDataHeight()+2*this.getVerticalDataRegions()}getCodewordCount(){return this.dataCapacity+this.errorCodewords}getInterleavedBlockCount(){return this.rsBlockData?this.dataCapacity/this.rsBlockData:1}getDataCapacity(){return this.dataCapacity}getErrorCodewords(){return this.errorCodewords}getDataLengthForInterleavedBlock(t){return this.rsBlockData}getErrorLengthForInterleavedBlock(t){return this.rsBlockError}}const Xr=[new Ur(!1,3,5,8,8,1),new Ur(!1,5,7,10,10,1),new Ur(!0,5,7,16,6,1),new Ur(!1,8,10,12,12,1),new Ur(!0,10,11,14,6,2),new Ur(!1,12,12,14,14,1),new Ur(!0,16,14,24,10,1),new Ur(!1,18,14,16,16,1),new Ur(!1,22,18,18,18,1),new Ur(!0,22,18,16,10,2),new Ur(!1,30,20,20,20,1),new Ur(!0,32,24,16,14,2),new Ur(!1,36,24,22,22,1),new Ur(!1,44,28,24,24,1),new Ur(!0,49,28,22,14,2),new Ur(!1,62,36,14,14,4),new Ur(!1,86,42,16,16,4),new Ur(!1,114,48,18,18,4),new Ur(!1,144,56,20,20,4),new Ur(!1,174,68,22,22,4),new Ur(!1,204,84,24,24,4,102,42),new Ur(!1,280,112,14,14,16,140,56),new Ur(!1,368,144,16,16,16,92,36),new Ur(!1,456,192,18,18,16,114,48),new Ur(!1,576,224,20,20,16,144,56),new Ur(!1,696,272,22,22,16,174,68),new Ur(!1,816,336,24,24,16,136,56),new Ur(!1,1050,408,18,18,36,175,68),new Ur(!1,1304,496,20,20,36,163,62),new class extends Ur{constructor(){super(!1,1558,620,22,22,36,-1,62)}getInterleavedBlockCount(){return 10}getDataLengthForInterleavedBlock(t){return t<=8?156:155}}];class Gr{constructor(t){this.msg=t,this.pos=0,this.skipAtEnd=0;const e=t.split("").map((t=>t.charCodeAt(0))),r=new T;for(let n=0,i=e.length;nthis.symbolInfo.getDataCapacity())&&(this.symbolInfo=Ur.lookup(t,this.shape,this.minSize,this.maxSize,!0))}resetSymbolInfo(){this.symbolInfo=null}}class Wr extends Vr{getEncodingMode(){return 3}encode(t){const e=new T;for(;t.hasMoreCharacters();){const r=t.getCurrentChar();t.pos++,this.encodeChar(r,e);if(e.length()%3==0){this.writeNextTriplet(t,e);if(Yr.lookAheadTest(t.getMessage(),t.pos,this.getEncodingMode())!==this.getEncodingMode()){t.signalEncoderChange(0);break}}}this.handleEOD(t,e)}encodeChar(t,e){switch(t){case 13:e.append(0);break;case"*".charCodeAt(0):e.append(1);break;case">".charCodeAt(0):e.append(2);break;case" ".charCodeAt(0):e.append(3);break;default:t>="0".charCodeAt(0)&&t<="9".charCodeAt(0)?e.append(t-48+4):t>="A".charCodeAt(0)&&t<="Z".charCodeAt(0)?e.append(t-65+14):Yr.illegalCharacter(p.getCharAt(t))}return 1}handleEOD(t,e){t.updateSymbolInfo();const r=t.getSymbolInfo().getDataCapacity()-t.getCodewordCount(),n=e.length();t.pos-=n,(t.getRemainingCharacters()>1||r>1||t.getRemainingCharacters()!==r)&&t.writeCodeword(254),t.getNewEncoding()<0&&t.signalEncoderChange(0)}}class zr extends Vr{getEncodingMode(){return 2}encodeChar(t,e){if(t===" ".charCodeAt(0))return e.append(3),1;if(t>="0".charCodeAt(0)&&t<="9".charCodeAt(0))return e.append(t-48+4),1;if(t>="a".charCodeAt(0)&&t<="z".charCodeAt(0))return e.append(t-97+14),1;if(t<" ".charCodeAt(0))return e.append(0),e.append(t),2;if(t<="/".charCodeAt(0))return e.append(1),e.append(t-33),2;if(t<="@".charCodeAt(0))return e.append(1),e.append(t-58+15),2;if(t>="[".charCodeAt(0)&&t<="_".charCodeAt(0))return e.append(1),e.append(t-91+22),2;if(t==="`".charCodeAt(0))return e.append(2),e.append(0),2;if(t<="Z".charCodeAt(0))return e.append(2),e.append(t-65+1),2;if(t<=127)return e.append(2),e.append(t-123+27),2;e.append("1");let r=2;return r+=this.encodeChar(t-128,e),r}}class Yr{static randomize253State(t){const e=129+(149*t%253+1);return e<=254?e:e-254}static encodeHighLevel(t,e=0,r=null,n=null,i=!1){const s=new Vr,o=[new kr,s,new zr,new Wr,new Hr,new xr],a=new Gr(t);a.setSymbolShape(e),a.setSizeConstraints(r,n),t.startsWith(Pr)&&t.endsWith(Fr)?(a.writeCodeword(236),a.setSkipAtEnd(2),a.pos+=7):t.startsWith(Lr)&&t.endsWith(Fr)&&(a.writeCodeword(237),a.setSkipAtEnd(2),a.pos+=7);let h=0;for(i&&(s.encodeMaximal(a),h=a.getNewEncoding(),a.resetEncoderSignal());a.hasMoreCharacters();)o[h].encode(a),a.getNewEncoding()>=0&&(h=a.getNewEncoding(),a.resetEncoderSignal());const l=a.getCodewordCount();a.updateSymbolInfo();const c=a.getSymbolInfo().getDataCapacity();l=t.length)return r;let n;0===r?n=[0,1,1,1,1,1.25]:(n=[1,2,2,2,2,2.25],n[r]=0);let i=0;const s=new Uint8Array(6),o=[];for(;;){if(e+i===t.length){f.fill(s,0),f.fill(o,0);const t=this.findMinimums(n,o,w.MAX_VALUE,s),e=this.getMinimumCount(s);if(o[0]===t)return 0;if(1===e){if(s[5]>0)return 5;if(s[4]>0)return 4;if(s[2]>0)return 2;if(s[3]>0)return 3}return 1}const r=t.charCodeAt(e+i);if(i++,this.isDigit(r)?n[0]+=.5:this.isExtendedASCII(r)?(n[0]=Math.ceil(n[0]),n[0]+=2):(n[0]=Math.ceil(n[0]),n[0]++),this.isNativeC40(r)?n[1]+=2/3:this.isExtendedASCII(r)?n[1]+=8/3:n[1]+=4/3,this.isNativeText(r)?n[2]+=2/3:this.isExtendedASCII(r)?n[2]+=8/3:n[2]+=4/3,this.isNativeX12(r)?n[3]+=2/3:this.isExtendedASCII(r)?n[3]+=13/3:n[3]+=10/3,this.isNativeEDIFACT(r)?n[4]+=3/4:this.isExtendedASCII(r)?n[4]+=4.25:n[4]+=3.25,this.isSpecialB256(r)?n[5]+=4:n[5]++,i>=4){if(f.fill(s,0),f.fill(o,0),this.findMinimums(n,o,w.MAX_VALUE,s),o[0]s&&(r=s,f.fill(n,0)),r===s&&(n[i]=n[i]+1)}return r}static getMinimumCount(t){let e=0;for(let r=0;r<6;r++)e+=t[r];return e||0}static isDigit(t){return t>="0".charCodeAt(0)&&t<="9".charCodeAt(0)}static isExtendedASCII(t){return t>=128&&t<=255}static isNativeC40(t){return t===" ".charCodeAt(0)||t>="0".charCodeAt(0)&&t<="9".charCodeAt(0)||t>="A".charCodeAt(0)&&t<="Z".charCodeAt(0)}static isNativeText(t){return t===" ".charCodeAt(0)||t>="0".charCodeAt(0)&&t<="9".charCodeAt(0)||t>="a".charCodeAt(0)&&t<="z".charCodeAt(0)}static isNativeX12(t){return this.isX12TermSep(t)||t===" ".charCodeAt(0)||t>="0".charCodeAt(0)&&t<="9".charCodeAt(0)||t>="A".charCodeAt(0)&&t<="Z".charCodeAt(0)}static isX12TermSep(t){return 13===t||t==="*".charCodeAt(0)||t===">".charCodeAt(0)}static isNativeEDIFACT(t){return t>=" ".charCodeAt(0)&&t<="^".charCodeAt(0)}static isSpecialB256(t){return!1}static determineConsecutiveDigitCount(t,e=0){const r=t.length;let n=e;for(;nnew Zr(Rr.forName(t)))),this.encoders=[];const n=[];n.push(new Zr(Nr.ISO_8859_1));let i=null!=e&&e.name.startsWith("UTF");for(let e=0;e=this.bytes.length)return!1;for(let r=0;r=this.length())throw new Error(""+t);if(this.isECI(t))throw new Error("value at "+t+" is not a character but an ECI");return this.isFNC1(t)?this.fnc1:this.bytes[t]}subSequence(t,e){if(t<0||t>e||e>this.length())throw new Error(""+t);const r=new T;for(let n=t;n=this.length())throw new Error(""+t);return this.bytes[t]>255&&this.bytes[t]<=999}isFNC1(t){if(t<0||t>=this.length())throw new Error(""+t);return 1e3===this.bytes[t]}getECIValue(t){if(t<0||t>=this.length())throw new Error(""+t);if(!this.isECI(t))throw new Error("value at "+t+" is not an ECI but a character");return this.bytes[t]-256}addEdge(t,e,r){(null==t[e][r.encoderIndex]||t[e][r.encoderIndex].cachedTotalSize>r.cachedTotalSize)&&(t[e][r.encoderIndex]=r)}addEdges(t,e,r,n,i,s){const o=t.charAt(n).charCodeAt(0);let a=0,h=e.length();e.getPriorityEncoderIndex()>=0&&(o===s||e.canEncode(o,e.getPriorityEncoderIndex()))&&(a=e.getPriorityEncoderIndex(),h=a+1);for(let t=a;t=0;e--)a.unshift(255&t[e])}(null===h.previous?0:h.previous.encoderIndex)!==h.encoderIndex&&a.unshift(256+e.getECIValue(h.encoderIndex)),h=h.previous}const l=[];for(let t=0;t","?","@","[","\\","]","^","_"];class $r{static isExtendedASCII(t,e){return t!==e&&t>=128&&t<=255}static isInC40Shift1Set(t){return t<=31}static isInC40Shift2Set(t,e){for(const e of Jr)if(e.charCodeAt(0)===t)return!0;return t===e}static isInTextShift1Set(t){return this.isInC40Shift1Set(t)}static isInTextShift2Set(t,e){return this.isInC40Shift2Set(t,e)}static encodeHighLevel(t,e=null,r=-1,n=0){let i=0;return t.startsWith(Pr)&&t.endsWith(Fr)?(i=5,t=t.substring(7,t.length-2)):t.startsWith(Lr)&&t.endsWith(Fr)&&(i=6,t=t.substring(7,t.length-2)),decodeURIComponent(escape(String.fromCharCode(...this.encode(t,e,r,n,i))))}static encode(t,e,r,n,i){return this.encodeMinimally(new rn(t,e,r,n,i)).getBytes()}static addEdge(t,e){const r=e.fromPosition+e.characterLength;(null===t[r][e.getEndMode()]||t[r][e.getEndMode()].cachedTotalSize>e.cachedTotalSize)&&(t[r][e.getEndMode()]=e)}static getNumberOfC40Words(t,e,r,n){let i=0;for(let s=e;s=128&&(r&&Yr.isNativeC40(t-128)||!r&&Yr.isNativeText(t-128))?i+=3:i+=4}else i+=2;if(i%3==0||(i-2)%3==0&&s+1===t.length())return n[0]=s-e+1,Math.ceil(i/3)}return n[0]=0,0}static addEdges(t,e,r,n){if(t.isECI(r))return void this.addEdge(e,new en(t,jr.ASCII,r,1,n));const i=t.charAt(r);if(null===n||n.getEndMode()!==jr.EDF){Yr.isDigit(i)&&t.haveNCharacters(r,2)&&Yr.isDigit(t.charAt(r+1))?this.addEdge(e,new en(t,jr.ASCII,r,2,n)):this.addEdge(e,new en(t,jr.ASCII,r,1,n));const s=[jr.C40,jr.TEXT];for(const i of s){const s=[];$r.getNumberOfC40Words(t,r,i===jr.C40,s)>0&&this.addEdge(e,new en(t,i,r,s[0],n))}t.haveNCharacters(r,3)&&Yr.isNativeX12(t.charAt(r))&&Yr.isNativeX12(t.charAt(r+1))&&Yr.isNativeX12(t.charAt(r+2))&&this.addEdge(e,new en(t,jr.X12,r,3,n)),this.addEdge(e,new en(t,jr.B256,r,1,n))}let s;for(s=0;s<3;s++){const i=r+s;if(!t.haveNCharacters(i,1)||!Yr.isNativeEDIFACT(t.charAt(i)))break;this.addEdge(e,new en(t,jr.EDF,r,s+1,n))}3===s&&t.haveNCharacters(r,4)&&Yr.isNativeEDIFACT(t.charAt(r+3))&&this.addEdge(e,new en(t,jr.EDF,r,4,n))}static encodeMinimally(t){const e=t.length(),r=Array(e+1).fill(null).map((()=>Array(6).fill(0)));this.addEdges(t,r,0,null);for(let n=1;n<=e;n++){for(let i=0;i<6;i++)null!==r[n][i]&&n=1&&t<=3?s.cachedTotalSize+1:s.cachedTotalSize;o0&&(r+=this.prepend(en.getBytes(232),n));for(let t=0;t=0;r--)e.unshift(t[r]);return t.length}randomize253State(t){const e=129+(149*t%253+1);return e<=254?e:e-254}applyRandomPattern(t,e,r){for(let n=0;n0&&this.getCodewordsRemaining(this.cachedTotalSize+t)<=2-t)return jr.ASCII}if(this.mode===jr.C40||this.mode===jr.TEXT||this.mode===jr.X12){if(this.fromPosition+this.characterLength>=this.input.length()&&0===this.getCodewordsRemaining(this.cachedTotalSize))return jr.ASCII;if(1===this.getLastASCII()&&0===this.getCodewordsRemaining(this.cachedTotalSize+1))return jr.ASCII}return this.mode}getMode(){return this.mode}getLastASCII(){const t=this.input.length(),e=this.fromPosition+this.characterLength;return t-e>4||e>=t?0:t-e==1?$r.isExtendedASCII(this.input.charAt(e),this.input.getFNC1Character())?0:1:t-e==2?$r.isExtendedASCII(this.input.charAt(e),this.input.getFNC1Character())||$r.isExtendedASCII(this.input.charAt(e+1),this.input.getFNC1Character())?0:Yr.isDigit(this.input.charAt(e))&&Yr.isDigit(this.input.charAt(e+1))?1:2:t-e==3?Yr.isDigit(this.input.charAt(e))&&Yr.isDigit(this.input.charAt(e+1))&&!$r.isExtendedASCII(this.input.charAt(e+2),this.input.getFNC1Character())||Yr.isDigit(this.input.charAt(e+1))&&Yr.isDigit(this.input.charAt(e+2))&&!$r.isExtendedASCII(this.input.charAt(e),this.input.getFNC1Character())?2:0:Yr.isDigit(this.input.charAt(e))&&Yr.isDigit(this.input.charAt(e+1))&&Yr.isDigit(this.input.charAt(e+2))&&Yr.isDigit(this.input.charAt(e+3))?2:0}getMinSymbolSize(t){switch(this.input.getShapeHint()){case 1:for(const e of this.squareCodewordCapacities)if(e>=t)return e;break;case 2:for(const e of this.rectangularCodewordCapacities)if(e>=t)return e}for(const e of this.allCodewordCapacities)if(e>=t)return e;return this.allCodewordCapacities[this.allCodewordCapacities.length-1]}getCodewordsRemaining(t){return this.getMinSymbolSize(t)-t}static getBytes(t,e){const r=new Uint8Array(e?2:1);return r[0]=t,e&&(r[1]=e),r}setC40Word(t,e,r,n,i){const s=1600*(255&r)+40*(255&n)+(255&i)+1;t[e]=s/256,t[e+1]=s%256}getX12Value(t){return 13===t?0:42===t?1:62===t?2:32===t?3:t>=48&&t<=57?t-44:t>=65&&t<=90?t-51:t}getX12Words(){if(this.characterLength%3!=0)throw new Error("X12 words must be a multiple of 3");const t=new Uint8Array(this.characterLength/3*2);for(let e=0;e=33&&r<=47?r-33:r>=48&&r<=57?r-44:r>=58&&r<=64?r-43:r>=65&&r<=90?r-64:r>=91&&r<=95?r-69:96===r?0:r>=97&&r<=122?r-83:r>=123&&r<=127?r-96:r}getC40Words(t,e){const r=[];for(let n=0;n>16&255,e[i+1]=s>>8&255,e[i+2]=255&s}return e}getLatchBytes(){switch(this.getPreviousMode()){case jr.ASCII:case jr.B256:switch(this.mode){case jr.B256:return en.getBytes(231);case jr.C40:return en.getBytes(230);case jr.TEXT:return en.getBytes(239);case jr.X12:return en.getBytes(238);case jr.EDF:return en.getBytes(240)}break;case jr.C40:case jr.TEXT:case jr.X12:if(this.mode!==this.getPreviousMode())switch(this.mode){case jr.ASCII:return en.getBytes(254);case jr.B256:return en.getBytes(254,231);case jr.C40:return en.getBytes(254,230);case jr.TEXT:return en.getBytes(254,239);case jr.X12:return en.getBytes(254,238);case jr.EDF:return en.getBytes(254,240)}break;case jr.EDF:if(this.mode!==jr.EDF)throw new Error("Cannot switch from EDF to "+this.mode)}return new Uint8Array(0)}getDataBytes(){switch(this.mode){case jr.ASCII:return this.input.isECI(this.fromPosition)?en.getBytes(241,this.input.getECIValue(this.fromPosition)+1):$r.isExtendedASCII(this.input.charAt(this.fromPosition),this.input.getFNC1Character())?en.getBytes(235,this.input.charAt(this.fromPosition)-127):2===this.characterLength?en.getBytes(10*this.input.charAt(this.fromPosition)+this.input.charAt(this.fromPosition+1)+130):this.input.isFNC1(this.fromPosition)?en.getBytes(232):en.getBytes(this.input.charAt(this.fromPosition)+1);case jr.B256:return en.getBytes(this.input.charAt(this.fromPosition));case jr.C40:return this.getC40Words(!0,this.input.getFNC1Character());case jr.TEXT:return this.getC40Words(!1,this.input.getFNC1Character());case jr.X12:return this.getX12Words();case jr.EDF:return this.getEDFBytes()}}}class rn extends qr{constructor(t,e,r,n,i){super(t,e,r),this.shape=n,this.macroId=i}getMacroId(){return this.macroId}getShapeHint(){return this.shape}}class nn{isCompact(){return this.compact}setCompact(t){this.compact=t}getSize(){return this.size}setSize(t){this.size=t}getLayers(){return this.layers}setLayers(t){this.layers=t}getCodeWords(){return this.codeWords}setCodeWords(t){this.codeWords=t}getMatrix(){return this.matrix}setMatrix(t){this.matrix=t}}class sn{static singletonList(t){return[t]}static min(t,e){return t.sort(e)[0]}}class on{constructor(t){this.previous=t}getPrevious(){return this.previous}}class an extends on{constructor(t,e,r){super(t),this.value=e,this.bitCount=r}appendTo(t,e){t.appendBits(this.value,this.bitCount)}add(t,e){return new an(this,t,e)}addBinaryShift(t,e){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new an(this,t,e)}toString(){let t=this.value&(1<"}}class hn extends an{constructor(t,e,r){super(t,0,0),this.binaryShiftStart=e,this.binaryShiftByteCount=r}appendTo(t,e){for(let r=0;r62?t.appendBits(this.binaryShiftByteCount-31,16):0===r?t.appendBits(Math.min(this.binaryShiftByteCount,31),5):t.appendBits(this.binaryShiftByteCount-31,5)),t.appendBits(e[this.binaryShiftStart+r],8)}addBinaryShift(t,e){return new hn(this,t,e)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function ln(t,e,r){return new an(t,e,r)}const cn=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],dn=new an(null,0,0),un=[Int32Array.from([0,327708,327710,327709,656318]),Int32Array.from([590318,0,327710,327709,656318]),Int32Array.from([262158,590300,0,590301,932798]),Int32Array.from([327709,327708,656318,0,327710]),Int32Array.from([327711,656380,656382,656381,0])];const gn=function(t){for(let e of t)f.fill(e,-1);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}(f.createInt32Array(6,6));class fn{constructor(t,e,r,n){this.token=t,this.mode=e,this.binaryShiftByteCount=r,this.bitCount=n}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(t,e){let r=this.bitCount,n=this.token;if(t!==this.mode){let e=un[this.mode][t];n=ln(n,65535&e,e>>16),r+=e>>16}let i=2===t?4:5;return n=ln(n,e,i),new fn(n,t,0,r+i)}shiftAndAppend(t,e){let r=this.token,n=2===this.mode?4:5;return r=ln(r,gn[this.mode][t],n),r=ln(r,e,5),new fn(r,this.mode,0,this.bitCount+n+5)}addBinaryShiftChar(t){let e=this.token,r=this.mode,n=this.bitCount;if(4===this.mode||2===this.mode){let t=un[r][0];e=ln(e,65535&t,t>>16),n+=t>>16,r=0}let i=0===this.binaryShiftByteCount||31===this.binaryShiftByteCount?18:62===this.binaryShiftByteCount?9:8,s=new fn(e,r,this.binaryShiftByteCount+1,n+i);return 2078===s.binaryShiftByteCount&&(s=s.endBinaryShift(t+1)),s}endBinaryShift(t){if(0===this.binaryShiftByteCount)return this;let e=this.token;return e=function(t,e,r){return new hn(t,e,r)}(e,t-this.binaryShiftByteCount,this.binaryShiftByteCount),new fn(e,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(t){let e=this.bitCount+(un[this.mode][t.mode]>>16);return this.binaryShiftByteCountt.binaryShiftByteCount&&t.binaryShiftByteCount>0&&(e+=10),e<=t.bitCount}toBitArray(t){let e=[];for(let r=this.endBinaryShift(t.length).token;null!==r;r=r.getPrevious())e.unshift(r);let r=new C;for(const n of e)n.appendTo(r,t);return r}toString(){return p.format("%s bits=%d bytes=%d",cn[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(t){return t.binaryShiftByteCount>62?21:t.binaryShiftByteCount>31?20:t.binaryShiftByteCount>0?10:0}}fn.INITIAL_STATE=new fn(dn,0,0,0);const wn=function(t){const e=p.getCharCode(" "),r=p.getCharCode("."),n=p.getCharCode(",");t[0][e]=1;const i=p.getCharCode("Z"),s=p.getCharCode("A");for(let e=s;e<=i;e++)t[0][e]=e-s+2;t[1][e]=1;const o=p.getCharCode("z"),a=p.getCharCode("a");for(let e=a;e<=o;e++)t[1][e]=e-a+2;t[2][e]=1;const h=p.getCharCode("9"),l=p.getCharCode("0");for(let e=l;e<=h;e++)t[2][e]=e-l+2;t[2][n]=12,t[2][r]=13;const c=["\0"," ","","","","","","","","\b","\t","\n","\v","\f","\r","","","","","","@","\\","^","_","`","|","~",""];for(let e=0;e","?","[","]","{","}"];for(let e=0;e0&&(t[4][p.getCharCode(d[e])]=e);return t}(f.createInt32Array(5,256));class Cn{constructor(t){this.text=t}encode(){const t=p.getCharCode(" "),e=p.getCharCode("\n");let r=sn.singletonList(fn.INITIAL_STATE);for(let n=0;n0?(r=Cn.updateStateListForPair(r,n,i),n++):r=this.updateStateListForChar(r,n)}return sn.min(r,((t,e)=>t.getBitCount()-e.getBitCount())).toBitArray(this.text)}updateStateListForChar(t,e){const r=[];for(let n of t)this.updateStateForChar(n,e,r);return Cn.simplifyStates(r)}updateStateForChar(t,e,r){let n=255&this.text[e],i=wn[t.getMode()][n]>0,s=null;for(let o=0;o<=4;o++){let a=wn[o][n];if(a>0){if(null==s&&(s=t.endBinaryShift(e)),!i||o===t.getMode()||2===o){const t=s.latchAndAppend(o,a);r.push(t)}if(!i&&gn[t.getMode()][o]>=0){const t=s.shiftAndAppend(o,a);r.push(t)}}}if(t.getBinaryShiftByteCount()>0||0===wn[t.getMode()][n]){let n=t.addBinaryShiftChar(e);r.push(n)}}static updateStateListForPair(t,e,r){const n=[];for(let i of t)this.updateStateForPair(i,e,r,n);return this.simplifyStates(n)}static updateStateForPair(t,e,r,n){let i=t.endBinaryShift(e);if(n.push(i.latchAndAppend(4,r)),4!==t.getMode()&&n.push(i.shiftAndAppend(4,r)),3===r||4===r){let t=i.latchAndAppend(2,16-r).latchAndAppend(2,1);n.push(t)}if(t.getBinaryShiftByteCount()>0){let r=t.addBinaryShiftChar(e).addBinaryShiftChar(e+1);n.push(r)}}static simplifyStates(t){let e=[];for(const r of t){let t=!0;for(const n of e){if(n.isBetterThanOrEqualTo(r)){t=!1;break}r.isBetterThanOrEqualTo(n)&&(e=e.filter((t=>t!==n)))}t&&e.push(r)}return e}}class An{constructor(){}static encodeBytes(t){return An.encode(t,An.DEFAULT_EC_PERCENT,An.DEFAULT_AZTEC_LAYERS)}static encode(t,e,r){let n,i,s,o,h,l=new Cn(t).encode(),c=w.truncDivision(l.getSize()*e,100)+11,d=l.getSize()+c;if(r!==An.DEFAULT_AZTEC_LAYERS){if(n=r<0,i=Math.abs(r),i>(n?An.MAX_NB_BITS_COMPACT:An.MAX_NB_BITS))throw new a(p.format("Illegal value %s for layers",r));s=An.totalBitsInLayer(i,n),o=An.WORD_SIZE[i];let t=s-s%o;if(h=An.stuffBits(l,o),h.getSize()+c>t)throw new a("Data to large for user specified layer");if(n&&h.getSize()>64*o)throw new a("Data to large for user specified layer")}else{o=0,h=null;for(let t=0;;t++){if(t>An.MAX_NB_BITS)throw new a("Data too large for an Aztec code");if(n=t<=3,i=n?t+1:t,s=An.totalBitsInLayer(i,n),d>s)continue;null!=h&&o===An.WORD_SIZE[i]||(o=An.WORD_SIZE[i],h=An.stuffBits(l,o));let e=s-s%o;if(!(n&&h.getSize()>64*o)&&h.getSize()+c<=e)break}}let u,g=An.generateCheckWords(h,s,o),f=h.getSize()/o,C=An.generateModeMessage(n,i,f),A=(n?11:14)+4*i,E=new Int32Array(A);if(n){u=A;for(let t=0;t=n||t.get(s+r))&&(o|=1<r)throw new a("fromIndex("+e+") > toIndex("+r+")");if(e<0)throw new g(e);if(r>t)throw new g(r)}static asList(...t){return t}static create(t,e,r){return Array.from({length:t}).map((t=>Array.from({length:e}).fill(r)))}static createInt32Array(t,e,r){return Array.from({length:t}).map((t=>Int32Array.from({length:e}).fill(r)))}static equals(t,e){if(!t)return!1;if(!e)return!1;if(!t.length)return!1;if(!e.length)return!1;if(t.length!==e.length)return!1;for(let r=0,n=t.length;r>1,o=r(e,t[s]);if(o>0)n=s+1;else{if(!(o<0))return s;i=s-1}}return-n-1}static numberComparator(t,e){return t-e}}class w{static numberOfTrailingZeros(t){let e;if(0===t)return 32;let r=31;return e=t<<16,0!==e&&(r-=16,t=e),e=t<<8,0!==e&&(r-=8,t=e),e=t<<4,0!==e&&(r-=4,t=e),e=t<<2,0!==e&&(r-=2,t=e),r-(t<<1>>>31)}static numberOfLeadingZeros(t){if(0===t)return 32;let e=1;return t>>>16==0&&(e+=16,t<<=16),t>>>24==0&&(e+=8,t<<=8),t>>>28==0&&(e+=4,t<<=4),t>>>30==0&&(e+=2,t<<=2),e-=t>>>31,e}static toHexString(t){return t.toString(16)}static toBinaryString(t){return String(parseInt(String(t),2))}static bitCount(t){return t=(t=(858993459&(t-=t>>>1&1431655765))+(t>>>2&858993459))+(t>>>4)&252645135,t+=t>>>8,63&(t+=t>>>16)}static truncDivision(t,e){return Math.trunc(t/e)}static parseInt(t,e=void 0){return parseInt(t,e)}}w.MIN_VALUE_32_BITS=-2147483648,w.MAX_VALUE=Number.MAX_SAFE_INTEGER;class C{constructor(t,e){void 0===t?(this.size=0,this.bits=new Int32Array(1)):(this.size=t,this.bits=null==e?C.makeArray(t):e)}getSize(){return this.size}getSizeInBytes(){return Math.floor((this.size+7)/8)}ensureCapacity(t){if(t>32*this.bits.length){const e=C.makeArray(t);d.arraycopy(this.bits,0,e,0,this.bits.length),this.bits=e}}get(t){return!!(this.bits[Math.floor(t/32)]&1<<(31&t))}set(t){this.bits[Math.floor(t/32)]|=1<<(31&t)}flip(t){this.bits[Math.floor(t/32)]^=1<<(31&t)}getNextSet(t){const e=this.size;if(t>=e)return e;const r=this.bits;let n=Math.floor(t/32),i=r[n];i&=~((1<<(31&t))-1);const s=r.length;for(;0===i;){if(++n===s)return e;i=r[n]}const o=32*n+w.numberOfTrailingZeros(i);return o>e?e:o}getNextUnset(t){const e=this.size;if(t>=e)return e;const r=this.bits;let n=Math.floor(t/32),i=~r[n];i&=~((1<<(31&t))-1);const s=r.length;for(;0===i;){if(++n===s)return e;i=~r[n]}const o=32*n+w.numberOfTrailingZeros(i);return o>e?e:o}setBulk(t,e){this.bits[Math.floor(t/32)]=e}setRange(t,e){if(ethis.size)throw new a;if(e===t)return;e--;const r=Math.floor(t/32),n=Math.floor(e/32),i=this.bits;for(let s=r;s<=n;s++){const o=(2<<(sr?0:31&t));i[s]|=o}}clear(){const t=this.bits.length,e=this.bits;for(let r=0;rthis.size)throw new a;if(e===t)return!0;e--;const n=Math.floor(t/32),i=Math.floor(e/32),s=this.bits;for(let o=n;o<=i;o++){const a=(2<<(on?0:31&t))&4294967295;if((s[o]&a)!==(r?a:0))return!1}return!0}appendBit(t){this.ensureCapacity(this.size+1),t&&(this.bits[Math.floor(this.size/32)]|=1<<(31&this.size)),this.size++}appendBits(t,e){if(e<0||e>32)throw new a("Num bits must be between 0 and 32");this.ensureCapacity(this.size+e);for(let r=e;r>0;r--)this.appendBit(1==(t>>r-1&1))}appendBitArray(t){const e=t.size;this.ensureCapacity(this.size+e);for(let r=0;r>1&1431655765|(1431655765&r)<<1,r=r>>2&858993459|(858993459&r)<<2,r=r>>4&252645135|(252645135&r)<<4,r=r>>8&16711935|(16711935&r)<<8,r=r>>16&65535|(65535&r)<<16,t[e-i]=r}if(this.size!==32*r){const e=32*r-this.size;let n=t[0]>>>e;for(let i=1;i>>e}t[r-1]=n}this.bits=t}static makeArray(t){return new Int32Array(Math.floor((t+31)/32))}equals(t){if(!(t instanceof C))return!1;const e=t;return this.size===e.size&&f.equals(this.bits,e.bits)}hashCode(){return 31*this.size+f.hashCode(this.bits)}toString(){let t="";for(let e=0,r=this.size;e=900)throw new m("incorect value");const e=I.VALUES_TO_ECI.get(t);if(void 0===e)throw new m("incorect value");return e}static getCharacterSetECIByName(t){const e=I.NAME_TO_ECI.get(t);if(void 0===e)throw new m("incorect value");return e}equals(t){if(!(t instanceof I))return!1;const e=t;return this.getName()===e.getName()}}I.VALUE_IDENTIFIER_TO_ECI=new Map,I.VALUES_TO_ECI=new Map,I.NAME_TO_ECI=new Map,I.Cp437=new I(A.Cp437,Int32Array.from([0,2]),"Cp437"),I.ISO8859_1=new I(A.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),I.ISO8859_2=new I(A.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),I.ISO8859_3=new I(A.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),I.ISO8859_4=new I(A.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),I.ISO8859_5=new I(A.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),I.ISO8859_6=new I(A.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),I.ISO8859_7=new I(A.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),I.ISO8859_8=new I(A.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),I.ISO8859_9=new I(A.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),I.ISO8859_10=new I(A.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),I.ISO8859_11=new I(A.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),I.ISO8859_13=new I(A.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),I.ISO8859_14=new I(A.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),I.ISO8859_15=new I(A.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),I.ISO8859_16=new I(A.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),I.SJIS=new I(A.SJIS,20,"SJIS","Shift_JIS"),I.Cp1250=new I(A.Cp1250,21,"Cp1250","windows-1250"),I.Cp1251=new I(A.Cp1251,22,"Cp1251","windows-1251"),I.Cp1252=new I(A.Cp1252,23,"Cp1252","windows-1252"),I.Cp1256=new I(A.Cp1256,24,"Cp1256","windows-1256"),I.UnicodeBigUnmarked=new I(A.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),I.UTF8=new I(A.UTF8,26,"UTF8","UTF-8"),I.ASCII=new I(A.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),I.Big5=new I(A.Big5,28,"Big5"),I.GB18030=new I(A.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),I.EUC_KR=new I(A.EUC_KR,30,"EUC_KR","EUC-KR");class _ extends s{}_.kind="UnsupportedOperationException";class S{static decode(t,e){const r=this.encodingName(e);return this.customDecoder?this.customDecoder(t,r):"undefined"==typeof TextDecoder||this.shouldDecodeOnFallback(r)?this.decodeFallback(t,r):new TextDecoder(r).decode(t)}static shouldDecodeOnFallback(t){return!S.isBrowser()&&"ISO-8859-1"===t}static encode(t,e){const r=this.encodingName(e);return this.customEncoder?this.customEncoder(t,r):"undefined"==typeof TextEncoder?this.encodeFallback(t):(new TextEncoder).encode(t)}static isBrowser(){return"undefined"!=typeof window&&"[object Window]"==={}.toString.call(window)}static encodingName(t){return"string"==typeof t?t:t.getName()}static encodingCharacterSet(t){return t instanceof I?t:I.getCharacterSetECIByName(t)}static decodeFallback(t,e){const r=this.encodingCharacterSet(e);if(S.isDecodeFallbackSupported(r)){let e="";for(let r=0,n=t.length;r3&&239===t[0]&&187===t[1]&&191===t[2];for(let e=0;e0?128&r?o--:s=!1:128&r&&(64&r?(o++,32&r?(o++,16&r?(o++,8&r?s=!1:l++):h++):a++):s=!1)),n&&(r>127&&r<160?n=!1:r>159&&(r<192||215===r||247===r)&&C++),i&&(c>0?r<64||127===r||r>252?i=!1:c--:128===r||160===r||r>239?i=!1:r>160&&r<224?(d++,g=0,u++,u>f&&(f=u)):r>127?(c++,u=0,g++,g>w&&(w=g)):(u=0,g=0))}return s&&o>0&&(s=!1),i&&c>0&&(i=!1),s&&(A||a+h+l>0)?p.UTF8:i&&(p.ASSUME_SHIFT_JIS||f>=3||w>=3)?p.SHIFT_JIS:n&&i?2===f&&2===d||10*C>=r?p.SHIFT_JIS:p.ISO88591:n?p.ISO88591:i?p.SHIFT_JIS:s?p.UTF8:p.PLATFORM_DEFAULT_ENCODING}static format(t,...e){let r=-1;return t.replace(/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g,(function(t,n,i,s,o,a){if("%%"===t)return"%";if(void 0===e[++r])return;t=s?parseInt(s.substr(1)):void 0;let h,l=o?parseInt(o.substr(1)):void 0;switch(a){case"s":h=e[r];break;case"c":h=e[r][0];break;case"f":h=parseFloat(e[r]).toFixed(t);break;case"p":h=parseFloat(e[r]).toPrecision(t);break;case"e":h=parseFloat(e[r]).toExponential(t);break;case"x":h=parseInt(e[r]).toString(l||16);break;case"d":h=parseFloat(parseInt(e[r],l||10).toPrecision(t)).toFixed(0)}h="object"==typeof h?JSON.stringify(h):(+h).toString(l);let c=parseInt(i),d=i&&i[0]+""=="0"?"0":" ";for(;h.lengths){if(-1===o)o=i-s;else if(i-s!==o)throw new a("row lengths do not match");s=i,h++}l++}else if(t.substring(l,l+e.length)===e)l+=e.length,n[i]=!0,i++;else{if(t.substring(l,l+r.length)!==r)throw new a("illegal character encountered: "+t.substring(l));l+=r.length,n[i]=!1,i++}if(i>s){if(-1===o)o=i-s;else if(i-s!==o)throw new a("row lengths do not match");h++}const c=new R(o,h);for(let t=0;t>>(31&t)&1)}set(t,e){const r=e*this.rowSize+Math.floor(t/32);this.bits[r]|=1<<(31&t)&4294967295}unset(t,e){const r=e*this.rowSize+Math.floor(t/32);this.bits[r]&=~(1<<(31&t)&4294967295)}flip(t,e){const r=e*this.rowSize+Math.floor(t/32);this.bits[r]^=1<<(31&t)&4294967295}xor(t){if(this.width!==t.getWidth()||this.height!==t.getHeight()||this.rowSize!==t.getRowSize())throw new a("input matrix dimensions do not match");const e=new C(Math.floor(this.width/32)+1),r=this.rowSize,n=this.bits;for(let i=0,s=this.height;ithis.height||i>this.width)throw new a("The region must fit inside the matrix");const o=this.rowSize,h=this.bits;for(let r=e;ra&&(a=t),32*eo){let t=31;for(;h>>>t==0;)t--;32*e+t>o&&(o=32*e+t)}}}return o=0&&0===e[r];)r--;if(r<0)return null;const n=Math.floor(r/t);let i=32*Math.floor(r%t);const s=e[r];let o=31;for(;s>>>o==0;)o--;return i+=o,Int32Array.from([i,n])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(t){if(!(t instanceof R))return!1;const e=t;return this.width===e.width&&this.height===e.height&&this.rowSize===e.rowSize&&f.equals(this.bits,e.bits)}hashCode(){let t=this.width;return t=31*t+this.width,t=31*t+this.height,t=31*t+this.rowSize,t=31*t+f.hashCode(this.bits),t}toString(t="X ",e=" ",r="\n"){return this.buildToString(t,e,r)}buildToString(t,e,r){let n=new T;for(let i=0,s=this.height;i>y.LUMINANCE_SHIFT]++;const o=y.estimateBlackPoint(s);if(n<3)for(let t=0;t>y.LUMINANCE_SHIFT]++}}const s=y.estimateBlackPoint(i),o=t.getMatrix();for(let t=0;ti&&(n=s,i=t[s]),t[s]>r&&(r=t[s]);let s=0,o=0;for(let r=0;ro&&(s=r,o=i)}if(n>s){const t=n;n=s,s=t}if(s-n<=e/16)throw new N;let a=s-1,h=-1;for(let e=s-1;e>n;e--){const i=e-n,o=i*i*(s-e)*(r-t[e]);o>h&&(a=e,h=o)}return a<=D.MINIMUM_DIMENSION&&r>=D.MINIMUM_DIMENSION){const n=t.getMatrix();let i=e>>D.BLOCK_SIZE_POWER;e&D.BLOCK_SIZE_MASK&&i++;let s=r>>D.BLOCK_SIZE_POWER;r&D.BLOCK_SIZE_MASK&&s++;const o=D.calculateBlackPoints(n,i,s,e,r),a=new R(e,r);D.calculateThresholdForBlock(n,i,s,e,r,o,a),this.matrix=a}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(t){return new D(t)}static calculateThresholdForBlock(t,e,r,n,i,s,o){const a=i-D.BLOCK_SIZE,h=n-D.BLOCK_SIZE;for(let i=0;ia&&(l=a);const c=D.cap(i,2,r-3);for(let r=0;rh&&(i=h);const a=D.cap(r,2,e-3);let d=0;for(let t=-2;t<=2;t++){const e=s[c+t];d+=e[a-2]+e[a-1]+e[a]+e[a+1]+e[a+2]}const u=d/25;D.thresholdBlock(t,i,l,u,n,o)}}}static cap(t,e,r){return tr?r:t}static thresholdBlock(t,e,r,n,i,s){for(let o=0,a=r*i+e;os&&(r=s);for(let s=0;so&&(e=o);let h=0,l=255,c=0;for(let i=0,s=r*n+e;ic&&(c=r)}if(c-l>D.MIN_DYNAMIC_RANGE)for(i++,s+=n;i>2*D.BLOCK_SIZE_POWER;if(c-l<=D.MIN_DYNAMIC_RANGE&&(d=l/2,i>0&&s>0)){const t=(a[i-1][s]+2*a[i][s-1]+a[i-1][s-1])/4;l>10}n[r]=i}else for(let e=0,r=0,i=t.length;e>10}n[r]=255-i}return n}getRow(t,e){if(t<0||t>=this.getHeight())throw new a("Requested row is outside the image: "+t);const r=this.getWidth(),n=t*r;return null===e?e=this.buffer.slice(n,n+r):(e.lengthnew B(t.deviceId,t.label)))}))}findDeviceById(t){return L(this,void 0,void 0,(function*(){const e=yield this.listVideoInputDevices();return e?e.find((e=>e.deviceId===t)):null}))}decodeFromInputVideoDevice(t,e){return L(this,void 0,void 0,(function*(){return yield this.decodeOnceFromVideoDevice(t,e)}))}decodeOnceFromVideoDevice(t,e){return L(this,void 0,void 0,(function*(){let r;this.reset(),r=t?{deviceId:{exact:t}}:{facingMode:"environment"};const n={video:r};return yield this.decodeOnceFromConstraints(n,e)}))}decodeOnceFromConstraints(t,e){return L(this,void 0,void 0,(function*(){const r=yield navigator.mediaDevices.getUserMedia(t);return yield this.decodeOnceFromStream(r,e)}))}decodeOnceFromStream(t,e){return L(this,void 0,void 0,(function*(){this.reset();const r=yield this.attachStreamToVideo(t,e);return yield this.decodeOnce(r)}))}decodeFromInputVideoDeviceContinuously(t,e,r){return L(this,void 0,void 0,(function*(){return yield this.decodeFromVideoDevice(t,e,r)}))}decodeFromVideoDevice(t,e,r){return L(this,void 0,void 0,(function*(){let n;n=t?{deviceId:{exact:t}}:{facingMode:"environment"};const i={video:n};return yield this.decodeFromConstraints(i,e,r)}))}decodeFromConstraints(t,e,r){return L(this,void 0,void 0,(function*(){const n=yield navigator.mediaDevices.getUserMedia(t);return yield this.decodeFromStream(n,e,r)}))}decodeFromStream(t,e,r){return L(this,void 0,void 0,(function*(){this.reset();const n=yield this.attachStreamToVideo(t,e);return yield this.decodeContinuously(n,r)}))}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(t,e){return L(this,void 0,void 0,(function*(){const r=this.prepareVideoElement(e);return this.addVideoSource(r,t),this.videoElement=r,this.stream=t,yield this.playVideoOnLoadAsync(r),r}))}playVideoOnLoadAsync(t){return new Promise(((e,r)=>this.playVideoOnLoad(t,(()=>e()))))}playVideoOnLoad(t,e){this.videoEndedListener=()=>this.stopStreams(),this.videoCanPlayListener=()=>this.tryPlayVideo(t),t.addEventListener("ended",this.videoEndedListener),t.addEventListener("canplay",this.videoCanPlayListener),t.addEventListener("playing",e),this.tryPlayVideo(t)}isVideoPlaying(t){return t.currentTime>0&&!t.paused&&!t.ended&&t.readyState>2}tryPlayVideo(t){return L(this,void 0,void 0,(function*(){if(this.isVideoPlaying(t))console.warn("Trying to play video that is already playing.");else try{yield t.play()}catch(t){console.warn("It was not possible to play the video.")}}))}getMediaElement(t,e){const r=document.getElementById(t);if(!r)throw new o(`element with id '${t}' not found`);if(r.nodeName.toLowerCase()!==e.toLowerCase())throw new o(`element with id '${t}' must be an ${e} element`);return r}decodeFromImage(t,e){if(!t&&!e)throw new o("either imageElement with a src set or an url must be provided");return e&&!t?this.decodeFromImageUrl(e):this.decodeFromImageElement(t)}decodeFromVideo(t,e){if(!t&&!e)throw new o("Either an element with a src set or an URL must be provided");return e&&!t?this.decodeFromVideoUrl(e):this.decodeFromVideoElement(t)}decodeFromVideoContinuously(t,e,r){if(void 0===t&&void 0===e)throw new o("Either an element with a src set or an URL must be provided");return e&&!t?this.decodeFromVideoUrlContinuously(e,r):this.decodeFromVideoElementContinuously(t,r)}decodeFromImageElement(t){if(!t)throw new o("An image element must be provided.");this.reset();const e=this.prepareImageElement(t);let r;return this.imageElement=e,r=this.isImageLoaded(e)?this.decodeOnce(e,!1,!0):this._decodeOnLoadImage(e),r}decodeFromVideoElement(t){const e=this._decodeFromVideoElementSetup(t);return this._decodeOnLoadVideo(e)}decodeFromVideoElementContinuously(t,e){const r=this._decodeFromVideoElementSetup(t);return this._decodeOnLoadVideoContinuously(r,e)}_decodeFromVideoElementSetup(t){if(!t)throw new o("A video element must be provided.");this.reset();const e=this.prepareVideoElement(t);return this.videoElement=e,e}decodeFromImageUrl(t){if(!t)throw new o("An URL must be provided.");this.reset();const e=this.prepareImageElement();this.imageElement=e;const r=this._decodeOnLoadImage(e);return e.src=t,r}decodeFromVideoUrl(t){if(!t)throw new o("An URL must be provided.");this.reset();const e=this.prepareVideoElement(),r=this.decodeFromVideoElement(e);return e.src=t,r}decodeFromVideoUrlContinuously(t,e){if(!t)throw new o("An URL must be provided.");this.reset();const r=this.prepareVideoElement(),n=this.decodeFromVideoElementContinuously(r,e);return r.src=t,n}_decodeOnLoadImage(t){return new Promise(((e,r)=>{this.imageLoadedListener=()=>this.decodeOnce(t,!1,!0).then(e,r),t.addEventListener("load",this.imageLoadedListener)}))}_decodeOnLoadVideo(t){return L(this,void 0,void 0,(function*(){return yield this.playVideoOnLoadAsync(t),yield this.decodeOnce(t)}))}_decodeOnLoadVideoContinuously(t,e){return L(this,void 0,void 0,(function*(){yield this.playVideoOnLoadAsync(t),this.decodeContinuously(t,e)}))}isImageLoaded(t){return!!t.complete&&0!==t.naturalWidth}prepareImageElement(t){let e;return void 0===t&&(e=document.createElement("img"),e.width=200,e.height=200),"string"==typeof t&&(e=this.getMediaElement(t,"img")),t instanceof HTMLImageElement&&(e=t),e}prepareVideoElement(t){let e;return t||"undefined"==typeof document||(e=document.createElement("video"),e.width=200,e.height=200),"string"==typeof t&&(e=this.getMediaElement(t,"video")),t instanceof HTMLVideoElement&&(e=t),e.setAttribute("autoplay","true"),e.setAttribute("muted","true"),e.setAttribute("playsinline","true"),e}decodeOnce(t,e=!0,r=!0){this._stopAsyncDecode=!1;const n=(i,s)=>{if(this._stopAsyncDecode)return s(new N("Video stream has ended before any code could be detected.")),void(this._stopAsyncDecode=void 0);try{i(this.decode(t))}catch(t){if(e&&t instanceof N||(t instanceof l||t instanceof m)&&r)return setTimeout(n,this._timeBetweenDecodingAttempts,i,s);s(t)}};return new Promise(((t,e)=>n(t,e)))}decodeContinuously(t,e){this._stopContinuousDecode=!1;const r=()=>{if(this._stopContinuousDecode)this._stopContinuousDecode=void 0;else try{const n=this.decode(t);e(n,null),setTimeout(r,this.timeBetweenScansMillis)}catch(t){e(null,t);(t instanceof l||t instanceof m||t instanceof N)&&setTimeout(r,this._timeBetweenDecodingAttempts)}};r()}decode(t){const e=this.createBinaryBitmap(t);return this.decodeBitmap(e)}createBinaryBitmap(t){this.getCaptureCanvasContext(t),t instanceof HTMLVideoElement?this.drawFrameOnCanvas(t):this.drawImageOnCanvas(t);const e=this.getCaptureCanvas(t),r=new b(e),n=new D(r);return new h(n)}getCaptureCanvasContext(t){if(!this.captureCanvasContext){const e=this.getCaptureCanvas(t);let r;try{r=e.getContext("2d",{willReadFrequently:!0})}catch(t){r=e.getContext("2d")}this.captureCanvasContext=r}return this.captureCanvasContext}getCaptureCanvas(t){if(!this.captureCanvas){const e=this.createCaptureCanvas(t);this.captureCanvas=e}return this.captureCanvas}drawFrameOnCanvas(t,e={sx:0,sy:0,sWidth:t.videoWidth,sHeight:t.videoHeight,dx:0,dy:0,dWidth:t.videoWidth,dHeight:t.videoHeight},r=this.captureCanvasContext){r.drawImage(t,e.sx,e.sy,e.sWidth,e.sHeight,e.dx,e.dy,e.dWidth,e.dHeight)}drawImageOnCanvas(t,e={sx:0,sy:0,sWidth:t.naturalWidth,sHeight:t.naturalHeight,dx:0,dy:0,dWidth:t.naturalWidth,dHeight:t.naturalHeight},r=this.captureCanvasContext){r.drawImage(t,e.sx,e.sy,e.sWidth,e.sHeight,e.dx,e.dy,e.dWidth,e.dHeight)}decodeBitmap(t){return this.reader.decode(t,this._hints)}createCaptureCanvas(t){if("undefined"==typeof document)return this._destroyCaptureCanvas(),null;const e=document.createElement("canvas");let r,n;return void 0!==t&&(t instanceof HTMLVideoElement?(r=t.videoWidth,n=t.videoHeight):t instanceof HTMLImageElement&&(r=t.naturalWidth||t.width,n=t.naturalHeight||t.height)),e.style.width=r+"px",e.style.height=n+"px",e.width=r,e.height=n,e}stopStreams(){this.stream&&(this.stream.getVideoTracks().forEach((t=>t.stop())),this.stream=void 0),!1===this._stopAsyncDecode&&this.stopAsyncDecode(),!1===this._stopContinuousDecode&&this.stopContinuousDecode()}reset(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()}_destroyVideoElement(){this.videoElement&&(void 0!==this.videoEndedListener&&this.videoElement.removeEventListener("ended",this.videoEndedListener),void 0!==this.videoPlayingEventListener&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),void 0!==this.videoCanPlayListener&&this.videoElement.removeEventListener("loadedmetadata",this.videoCanPlayListener),this.cleanVideoSource(this.videoElement),this.videoElement=void 0)}_destroyImageElement(){this.imageElement&&(void 0!==this.imageLoadedListener&&this.imageElement.removeEventListener("load",this.imageLoadedListener),this.imageElement.src=void 0,this.imageElement.removeAttribute("src"),this.imageElement=void 0)}_destroyCaptureCanvas(){this.captureCanvasContext=void 0,this.captureCanvas=void 0}addVideoSource(t,e){try{t.srcObject=e}catch(r){t.src=URL.createObjectURL(e)}}cleanVideoSource(t){try{t.srcObject=null}catch(e){t.src=""}this.videoElement.removeAttribute("src")}}class v{constructor(t,e,r=(null==e?0:8*e.length),n,i,s=d.currentTimeMillis()){this.text=t,this.rawBytes=e,this.numBits=r,this.resultPoints=n,this.format=i,this.timestamp=s,this.text=t,this.rawBytes=e,this.numBits=null==r?null==e?0:8*e.length:r,this.resultPoints=n,this.format=i,this.resultMetadata=null,this.timestamp=null==s?d.currentTimeMillis():s}getText(){return this.text}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}getResultPoints(){return this.resultPoints}getBarcodeFormat(){return this.format}getResultMetadata(){return this.resultMetadata}putMetadata(t,e){null===this.resultMetadata&&(this.resultMetadata=new Map),this.resultMetadata.set(t,e)}putAllMetadata(t){null!==t&&(null===this.resultMetadata?this.resultMetadata=t:this.resultMetadata=new Map(t))}addResultPoints(t){const e=this.resultPoints;if(null===e)this.resultPoints=t;else if(null!==t&&t.length>0){const r=new Array(e.length+t.length);d.arraycopy(e,0,r,0,e.length),d.arraycopy(t,0,r,e.length,t.length),this.resultPoints=r}}getTimestamp(){return this.timestamp}toString(){return this.text}}!function(t){t[t.AZTEC=0]="AZTEC",t[t.CODABAR=1]="CODABAR",t[t.CODE_39=2]="CODE_39",t[t.CODE_93=3]="CODE_93",t[t.CODE_128=4]="CODE_128",t[t.DATA_MATRIX=5]="DATA_MATRIX",t[t.EAN_8=6]="EAN_8",t[t.EAN_13=7]="EAN_13",t[t.ITF=8]="ITF",t[t.MAXICODE=9]="MAXICODE",t[t.PDF_417=10]="PDF_417",t[t.QR_CODE=11]="QR_CODE",t[t.RSS_14=12]="RSS_14",t[t.RSS_EXPANDED=13]="RSS_EXPANDED",t[t.UPC_A=14]="UPC_A",t[t.UPC_E=15]="UPC_E",t[t.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"}(P||(P={}));var k,x=P;!function(t){t[t.OTHER=0]="OTHER",t[t.ORIENTATION=1]="ORIENTATION",t[t.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",t[t.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",t[t.ISSUE_NUMBER=4]="ISSUE_NUMBER",t[t.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",t[t.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",t[t.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",t[t.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",t[t.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",t[t.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"}(k||(k={}));var V,H,U,X,G,W,z=k;class Y{constructor(t,e,r,n,i=-1,s=-1){this.rawBytes=t,this.text=e,this.byteSegments=r,this.ecLevel=n,this.structuredAppendSequenceNumber=i,this.structuredAppendParity=s,this.numBits=null==t?0:8*t.length}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}setNumBits(t){this.numBits=t}getText(){return this.text}getByteSegments(){return this.byteSegments}getECLevel(){return this.ecLevel}getErrorsCorrected(){return this.errorsCorrected}setErrorsCorrected(t){this.errorsCorrected=t}getErasures(){return this.erasures}setErasures(t){this.erasures=t}getOther(){return this.other}setOther(t){this.other=t}hasStructuredAppend(){return this.structuredAppendParity>=0&&this.structuredAppendSequenceNumber>=0}getStructuredAppendParity(){return this.structuredAppendParity}getStructuredAppendSequenceNumber(){return this.structuredAppendSequenceNumber}}class Z{exp(t){return this.expTable[t]}log(t){if(0===t)throw new a;return this.logTable[t]}static addOrSubtract(t,e){return t^e}}class K{constructor(t,e){if(0===e.length)throw new a;this.field=t;const r=e.length;if(r>1&&0===e[0]){let t=1;for(;tr.length){const t=e;e=r,r=t}let n=new Int32Array(r.length);const i=r.length-e.length;d.arraycopy(r,0,n,0,i);for(let t=i;t=t.getDegree()&&!n.isZero();){const i=n.getDegree()-t.getDegree(),o=e.multiply(n.getCoefficient(n.getDegree()),s),a=t.multiplyByMonomial(i,o),h=e.buildMonomial(i,o);r=r.addOrSubtract(h),n=n.addOrSubtract(a)}return[r,n]}toString(){let t="";for(let e=this.getDegree();e>=0;e--){let r=this.getCoefficient(e);if(0!==r){if(r<0?(t+=" - ",r=-r):t.length>0&&(t+=" + "),0===e||1!==r){const e=this.field.log(r);0===e?t+="1":1===e?t+="a":(t+="a^",t+=e)}0!==e&&(1===e?t+="x":(t+="x^",t+=e))}}return t}}class q extends s{}q.kind="ArithmeticException";class Q extends Z{constructor(t,e,r){super(),this.primitive=t,this.size=e,this.generatorBase=r;const n=new Int32Array(e);let i=1;for(let r=0;r=e&&(i^=t,i&=e-1);this.expTable=n;const s=new Int32Array(e);for(let t=0;t=(r/2|0);){let t=i,e=o;if(i=s,o=a,i.isZero())throw new j("r_{i-1} was zero");s=t;let r=n.getZero();const h=i.getCoefficient(i.getDegree()),l=n.inverse(h);for(;s.getDegree()>=i.getDegree()&&!s.isZero();){const t=s.getDegree()-i.getDegree(),e=n.multiply(s.getCoefficient(s.getDegree()),l);r=r.addOrSubtract(n.buildMonomial(t,e)),s=s.addOrSubtract(i.multiplyByMonomial(t,e))}if(a=r.multiply(o).addOrSubtract(e),s.getDegree()>=i.getDegree())throw new J("Division algorithm failed to reduce polynomial?")}const h=a.getCoefficient(0);if(0===h)throw new j("sigmaTilde(0) was zero");const l=n.inverse(h);return[a.multiplyScalar(l),s.multiplyScalar(l)]}findErrorLocations(t){const e=t.getDegree();if(1===e)return Int32Array.from([t.getCoefficient(1)]);const r=new Int32Array(e);let n=0;const i=this.field;for(let s=1;s1,c,c+r-1),c+=r-1;else for(let t=r-1;t>=0;--t)l[c++]=!!(e&1<=8?tt.readCode(t,e,8):tt.readCode(t,e,r)<<8-r}static convertBoolArrayToByteArray(t){let e=new Uint8Array((t.length+7)/8);for(let r=0;r","?","[","]","{","}","CTRL_UL"],tt.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class et{constructor(){}static round(t){return isNaN(t)?0:t<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:t>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:t+(t<0?-.5:.5)|0}static distance(t,e,r,n){const i=t-r,s=e-n;return Math.sqrt(i*i+s*s)}static sum(t){let e=0;for(let r=0,n=t.length;r!==n;r++){e+=t[r]}return e}}class rt{static floatToIntBits(t){return t}}rt.MAX_VALUE=Number.MAX_SAFE_INTEGER;class nt{constructor(t,e){this.x=t,this.y=e}getX(){return this.x}getY(){return this.y}equals(t){if(t instanceof nt){const e=t;return this.x===e.x&&this.y===e.y}return!1}hashCode(){return 31*rt.floatToIntBits(this.x)+rt.floatToIntBits(this.y)}toString(){return"("+this.x+","+this.y+")"}static orderBestPatterns(t){const e=this.distance(t[0],t[1]),r=this.distance(t[1],t[2]),n=this.distance(t[0],t[2]);let i,s,o;if(r>=e&&r>=n?(s=t[0],i=t[1],o=t[2]):n>=r&&n>=e?(s=t[1],i=t[0],o=t[2]):(s=t[2],i=t[0],o=t[1]),this.crossProductZ(i,s,o)<0){const t=i;i=o,o=t}t[0]=i,t[1]=s,t[2]=o}static distance(t,e){return et.distance(t.x,t.y,e.x,e.y)}static crossProductZ(t,e,r){const n=e.x,i=e.y;return(r.x-n)*(t.y-i)-(r.y-i)*(t.x-n)}}class it{constructor(t,e){this.bits=t,this.points=e}getBits(){return this.bits}getPoints(){return this.points}}class st extends it{constructor(t,e,r,n,i){super(t,e),this.compact=r,this.nbDatablocks=n,this.nbLayers=i}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class ot{constructor(t,e,r,n){this.image=t,this.height=t.getHeight(),this.width=t.getWidth(),null==e&&(e=ot.INIT_SIZE),null==r&&(r=t.getWidth()/2|0),null==n&&(n=t.getHeight()/2|0);const i=e/2|0;if(this.leftInit=r-i,this.rightInit=r+i,this.upInit=n-i,this.downInit=n+i,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new N}detect(){let t=this.leftInit,e=this.rightInit,r=this.upInit,n=this.downInit,i=!1,s=!0,o=!1,a=!1,h=!1,l=!1,c=!1;const d=this.width,u=this.height;for(;s;){s=!1;let g=!0;for(;(g||!a)&&e=d){i=!0;break}let f=!0;for(;(f||!h)&&n=u){i=!0;break}let w=!0;for(;(w||!l)&&t>=0;)w=this.containsBlackPoint(r,n,t,!1),w?(t--,s=!0,l=!0):l||t--;if(t<0){i=!0;break}let C=!0;for(;(C||!c)&&r>=0;)C=this.containsBlackPoint(t,e,r,!0),C?(r--,s=!0,c=!0):c||r--;if(r<0){i=!0;break}s&&(o=!0)}if(!i&&o){const i=e-t;let s=null;for(let e=1;null===s&&er||o<-1||o>n)throw new N;i=!1,-1===s?(e[t]=0,i=!0):s===r&&(e[t]=r-1,i=!0),-1===o?(e[t+1]=0,i=!0):o===n&&(e[t+1]=n-1,i=!0)}i=!0;for(let t=e.length-2;t>=0&&i;t-=2){const s=Math.floor(e[t]),o=Math.floor(e[t+1]);if(s<-1||s>r||o<-1||o>n)throw new N;i=!1,-1===s?(e[t]=0,i=!0):s===r&&(e[t]=r-1,i=!0),-1===o?(e[t+1]=0,i=!0):o===n&&(e[t+1]=n-1,i=!0)}}}class ht{constructor(t,e,r,n,i,s,o,a,h){this.a11=t,this.a21=e,this.a31=r,this.a12=n,this.a22=i,this.a32=s,this.a13=o,this.a23=a,this.a33=h}static quadrilateralToQuadrilateral(t,e,r,n,i,s,o,a,h,l,c,d,u,g,f,w){const C=ht.quadrilateralToSquare(t,e,r,n,i,s,o,a);return ht.squareToQuadrilateral(h,l,c,d,u,g,f,w).times(C)}transformPoints(t){const e=t.length,r=this.a11,n=this.a12,i=this.a13,s=this.a21,o=this.a22,a=this.a23,h=this.a31,l=this.a32,c=this.a33;for(let d=0;d>1&127):(n<<=10,n+=(e>>2&992)+(e>>1&31))}let i=this.getCorrectedParameterData(n,this.compact);this.compact?(this.nbLayers=1+(i>>6),this.nbDataBlocks=1+(63&i)):(this.nbLayers=1+(i>>11),this.nbDataBlocks=1+(2047&i))}getRotation(t,e){let r=0;t.forEach(((t,n,i)=>{r=(r<<3)+((t>>e-2<<1)+(1&t))})),r=((1&r)<<11)+(r>>1);for(let t=0;t<4;t++)if(w.bitCount(r^this.EXPECTED_CORNER_BITS[t])<=2)return t;throw new N}getCorrectedParameterData(t,e){let r,n;e?(r=7,n=2):(r=10,n=4);let i=r-n,s=new Int32Array(r);for(let e=r-1;e>=0;--e)s[e]=15&t,t>>=4;try{new $(Q.AZTEC_PARAM).decode(s,i)}catch(t){throw new N}let o=0;for(let t=0;t2){let r=this.distancePoint(h,t)*this.nbCenterLayers/(this.distancePoint(i,e)*(this.nbCenterLayers+2));if(r<.75||r>1.25||!this.isWhiteOrBlackRectangle(t,o,a,h))break}e=t,r=o,n=a,i=h,s=!s}if(5!==this.nbCenterLayers&&7!==this.nbCenterLayers)throw new N;this.compact=5===this.nbCenterLayers;let o=new nt(e.getX()+.5,e.getY()-.5),a=new nt(r.getX()+.5,r.getY()+.5),h=new nt(n.getX()-.5,n.getY()+.5),l=new nt(i.getX()-.5,i.getY()-.5);return this.expandSquare([o,a,h,l],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let t,e,r,n;try{let i=new ot(this.image).detect();t=i[0],e=i[1],r=i[2],n=i[3]}catch(i){let s=this.image.getWidth()/2,o=this.image.getHeight()/2;t=this.getFirstDifferent(new dt(s+7,o-7),!1,1,-1).toResultPoint(),e=this.getFirstDifferent(new dt(s+7,o+7),!1,1,1).toResultPoint(),r=this.getFirstDifferent(new dt(s-7,o+7),!1,-1,1).toResultPoint(),n=this.getFirstDifferent(new dt(s-7,o-7),!1,-1,-1).toResultPoint()}let i=et.round((t.getX()+n.getX()+e.getX()+r.getX())/4),s=et.round((t.getY()+n.getY()+e.getY()+r.getY())/4);try{let o=new ot(this.image,15,i,s).detect();t=o[0],e=o[1],r=o[2],n=o[3]}catch(o){t=this.getFirstDifferent(new dt(i+7,s-7),!1,1,-1).toResultPoint(),e=this.getFirstDifferent(new dt(i+7,s+7),!1,1,1).toResultPoint(),r=this.getFirstDifferent(new dt(i-7,s+7),!1,-1,1).toResultPoint(),n=this.getFirstDifferent(new dt(i-7,s-7),!1,-1,-1).toResultPoint()}return i=et.round((t.getX()+n.getX()+e.getX()+r.getX())/4),s=et.round((t.getY()+n.getY()+e.getY()+r.getY())/4),new dt(i,s)}getMatrixCornerPoints(t){return this.expandSquare(t,2*this.nbCenterLayers,this.getDimension())}sampleGrid(t,e,r,n,i){let s=ct.getInstance(),o=this.getDimension(),a=o/2-this.nbCenterLayers,h=o/2+this.nbCenterLayers;return s.sampleGrid(t,o,o,a,a,h,a,h,h,a,h,e.getX(),e.getY(),r.getX(),r.getY(),n.getX(),n.getY(),i.getX(),i.getY())}sampleLine(t,e,r){let n=0,i=this.distanceResultPoint(t,e),s=i/r,o=t.getX(),a=t.getY(),h=s*(e.getX()-t.getX())/i,l=s*(e.getY()-t.getY())/i;for(let t=0;t.1&&c<.9?0:c<=.1===h?1:-1}getFirstDifferent(t,e,r,n){let i=t.getX()+r,s=t.getY()+n;for(;this.isValid(i,s)&&this.image.get(i,s)===e;)i+=r,s+=n;for(i-=r,s-=n;this.isValid(i,s)&&this.image.get(i,s)===e;)i+=r;for(i-=r;this.isValid(i,s)&&this.image.get(i,s)===e;)s+=n;return s-=n,new dt(i,s)}expandSquare(t,e,r){let n=r/(2*e),i=t[0].getX()-t[2].getX(),s=t[0].getY()-t[2].getY(),o=(t[0].getX()+t[2].getX())/2,a=(t[0].getY()+t[2].getY())/2,h=new nt(o+n*i,a+n*s),l=new nt(o-n*i,a-n*s);return i=t[1].getX()-t[3].getX(),s=t[1].getY()-t[3].getY(),o=(t[1].getX()+t[3].getX())/2,a=(t[1].getY()+t[3].getY())/2,[h,new nt(o+n*i,a+n*s),l,new nt(o-n*i,a-n*s)]}isValid(t,e){return t>=0&&t0&&e{r.foundPossibleResultPoint(t)}))}}reset(){}}class ft{decode(t,e){try{return this.doDecode(t,e)}catch(r){if(e&&!0===e.get(E.TRY_HARDER)&&t.isRotateSupported()){const r=t.rotateCounterClockwise(),n=this.doDecode(r,e),i=n.getResultMetadata();let s=270;null!==i&&!0===i.get(z.ORIENTATION)&&(s+=i.get(z.ORIENTATION)%360),n.putMetadata(z.ORIENTATION,s);const o=n.getResultPoints();if(null!==o){const t=r.getHeight();for(let e=0;e>(s?8:5));let a;a=s?n:15;const h=Math.trunc(n/2);for(let s=0;s=n)break;try{i=t.getBlackRow(l,i)}catch(t){continue}for(let t=0;t<2;t++){if(1===t&&(i.reverse(),e&&!0===e.get(E.NEED_RESULT_POINT_CALLBACK))){const t=new Map;e.forEach(((e,r)=>t.set(r,e))),t.delete(E.NEED_RESULT_POINT_CALLBACK),e=t}try{const n=this.decodeRow(l,i,e);if(1===t){n.putMetadata(z.ORIENTATION,180);const t=n.getResultPoints();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()))}return n}catch(t){}}}throw new N}static recordPattern(t,e,r){const n=r.length;for(let t=0;t=i)throw new N;let s=!t.get(e),o=0,a=e;for(;a0&&n>=0;)t.get(--e)!==i&&(n--,i=!i);if(n>=0)throw new N;ft.recordPattern(t,e+1,r)}static patternMatchVariance(t,e,r){const n=t.length;let i=0,s=0;for(let r=0;rs?n-s:s-n;if(h>r)return Number.POSITIVE_INFINITY;a+=h}return a/i}}class wt extends ft{static findStartPattern(t){const e=t.getSize(),r=t.getNextSet(0);let n=0,i=Int32Array.from([0,0,0,0,0,0]),s=r,o=!1;for(let a=r;a=0&&t.isRange(Math.max(0,s-(a-s)/2),s,!1))return Int32Array.from([s,a,r]);s+=i[0]+i[1],i=i.slice(2,i.length),i[n-1]=0,i[n]=0,n--}else n++;i[n]=1,o=!o}throw new N}static decodeCode(t,e,r){ft.recordPattern(t,r,e);let n=wt.MAX_AVG_VARIANCE,i=-1;for(let t=0;t=0)return i;throw new N}decodeRow(t,e,r){const n=r&&!0===r.get(E.ASSUME_GS1),i=wt.findStartPattern(e),s=i[2];let o=0;const a=new Uint8Array(20);let h;switch(a[o++]=s,s){case wt.CODE_START_A:h=wt.CODE_CODE_A;break;case wt.CODE_START_B:h=wt.CODE_CODE_B;break;case wt.CODE_START_C:h=wt.CODE_CODE_C;break;default:throw new m}let c=!1,d=!1,u="",g=i[0],f=i[1];const w=Int32Array.from([0,0,0,0,0,0]);let C=0,A=0,I=s,_=0,S=!0,p=!1,T=!1;for(;!c;){const t=d;switch(d=!1,C=A,A=wt.decodeCode(e,w,f),a[o++]=A,A!==wt.CODE_STOP&&(S=!0),A!==wt.CODE_STOP&&(_++,I+=_*A),g=f,f+=w.reduce(((t,e)=>t+e),0),A){case wt.CODE_START_A:case wt.CODE_START_B:case wt.CODE_START_C:throw new m}switch(h){case wt.CODE_CODE_A:if(A<64)u+=T===p?String.fromCharCode(" ".charCodeAt(0)+A):String.fromCharCode(" ".charCodeAt(0)+A+128),T=!1;else if(A<96)u+=T===p?String.fromCharCode(A-64):String.fromCharCode(A+64),T=!1;else switch(A!==wt.CODE_STOP&&(S=!1),A){case wt.CODE_FNC_1:n&&(0===u.length?u+="]C1":u+=String.fromCharCode(29));break;case wt.CODE_FNC_2:case wt.CODE_FNC_3:break;case wt.CODE_FNC_4_A:!p&&T?(p=!0,T=!1):p&&T?(p=!1,T=!1):T=!0;break;case wt.CODE_SHIFT:d=!0,h=wt.CODE_CODE_B;break;case wt.CODE_CODE_B:h=wt.CODE_CODE_B;break;case wt.CODE_CODE_C:h=wt.CODE_CODE_C;break;case wt.CODE_STOP:c=!0}break;case wt.CODE_CODE_B:if(A<96)u+=T===p?String.fromCharCode(" ".charCodeAt(0)+A):String.fromCharCode(" ".charCodeAt(0)+A+128),T=!1;else switch(A!==wt.CODE_STOP&&(S=!1),A){case wt.CODE_FNC_1:n&&(0===u.length?u+="]C1":u+=String.fromCharCode(29));break;case wt.CODE_FNC_2:case wt.CODE_FNC_3:break;case wt.CODE_FNC_4_B:!p&&T?(p=!0,T=!1):p&&T?(p=!1,T=!1):T=!0;break;case wt.CODE_SHIFT:d=!0,h=wt.CODE_CODE_A;break;case wt.CODE_CODE_A:h=wt.CODE_CODE_A;break;case wt.CODE_CODE_C:h=wt.CODE_CODE_C;break;case wt.CODE_STOP:c=!0}break;case wt.CODE_CODE_C:if(A<100)A<10&&(u+="0"),u+=A;else switch(A!==wt.CODE_STOP&&(S=!1),A){case wt.CODE_FNC_1:n&&(0===u.length?u+="]C1":u+=String.fromCharCode(29));break;case wt.CODE_CODE_A:h=wt.CODE_CODE_A;break;case wt.CODE_CODE_B:h=wt.CODE_CODE_B;break;case wt.CODE_STOP:c=!0}}t&&(h=h===wt.CODE_CODE_A?wt.CODE_CODE_B:wt.CODE_CODE_A)}const R=f-g;if(f=e.getNextUnset(f),!e.isRange(f,Math.min(e.getSize(),f+(f-g)/2),!1))throw new N;if(I-=_*C,I%103!==C)throw new l;const y=u.length;if(0===y)throw new N;y>0&&S&&(u=h===wt.CODE_CODE_C?u.substring(0,y-2):u.substring(0,y-1));const D=(i[1]+i[0])/2,O=g+R/2,M=a.length,b=new Uint8Array(M);for(let t=0;tn&&(i=e);n=i,e=0;let s=0,o=0;for(let i=0;in&&(o|=1<0;i++){let r=t[i];if(r>n&&(e--,2*r>=s))return-1}return o}}while(e>3);return-1}static patternToChar(t){for(let e=0;e="A"&&i<="Z"))throw new m;s=String.fromCharCode(i.charCodeAt(0)+32);break;case"$":if(!(i>="A"&&i<="Z"))throw new m;s=String.fromCharCode(i.charCodeAt(0)-64);break;case"%":if(i>="A"&&i<="E")s=String.fromCharCode(i.charCodeAt(0)-38);else if(i>="F"&&i<="J")s=String.fromCharCode(i.charCodeAt(0)-11);else if(i>="K"&&i<="O")s=String.fromCharCode(i.charCodeAt(0)+16);else if(i>="P"&&i<="T")s=String.fromCharCode(i.charCodeAt(0)+43);else if("U"===i)s="\0";else if("V"===i)s="@";else if("W"===i)s="`";else{if("X"!==i&&"Y"!==i&&"Z"!==i)throw new m;s=""}break;case"/":if(i>="A"&&i<="O")s=String.fromCharCode(i.charCodeAt(0)-32);else{if("Z"!==i)throw new m;s=":"}}r+=s,n++}else r+=e}return r}}Ct.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",Ct.CHARACTER_ENCODINGS=[52,289,97,352,49,304,112,37,292,100,265,73,328,25,280,88,13,268,76,28,259,67,322,19,274,82,7,262,70,22,385,193,448,145,400,208,133,388,196,168,162,138,42],Ct.ASTERISK_ENCODING=148;class At extends ft{constructor(){super(),this.decodeRowResult="",this.counters=new Int32Array(6)}decodeRow(t,e,r){let n,i,s=this.findAsteriskPattern(e),o=e.getNextSet(s[1]),a=e.getSize(),h=this.counters;h.fill(0),this.decodeRowResult="";do{At.recordPattern(e,o,h);let t=this.toPattern(h);if(t<0)throw new N;n=this.patternToChar(t),this.decodeRowResult+=n,i=o;for(let t of h)o+=t;o=e.getNextSet(o)}while("*"!==n);this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let l=0;for(let t of h)l+=t;if(o===a||!e.get(o))throw new N;if(this.decodeRowResult.length<2)throw new N;this.checkChecksums(this.decodeRowResult),this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-2);let c=this.decodeExtended(this.decodeRowResult),d=(s[1]+s[0])/2,u=i+l/2;return new v(c,null,0,[new nt(d,t),new nt(u,t)],x.CODE_93,(new Date).getTime())}findAsteriskPattern(t){let e=t.getSize(),r=t.getNextSet(0);this.counters.fill(0);let n=this.counters,i=r,s=!1,o=n.length,a=0;for(let h=r;h4)return-1;if(1&i)r<<=n;else for(let t=0;t="a"&&i<="d"){if(n>=e-1)throw new m;let s=t.charAt(n+1),o="\0";switch(i){case"d":if(!(s>="A"&&s<="Z"))throw new m;o=String.fromCharCode(s.charCodeAt(0)+32);break;case"a":if(!(s>="A"&&s<="Z"))throw new m;o=String.fromCharCode(s.charCodeAt(0)-64);break;case"b":if(s>="A"&&s<="E")o=String.fromCharCode(s.charCodeAt(0)-38);else if(s>="F"&&s<="J")o=String.fromCharCode(s.charCodeAt(0)-11);else if(s>="K"&&s<="O")o=String.fromCharCode(s.charCodeAt(0)+16);else if(s>="P"&&s<="T")o=String.fromCharCode(s.charCodeAt(0)+43);else if("U"===s)o="\0";else if("V"===s)o="@";else if("W"===s)o="`";else{if(!(s>="X"&&s<="Z"))throw new m;o=String.fromCharCode(127)}break;case"c":if(s>="A"&&s<="O")o=String.fromCharCode(s.charCodeAt(0)-32);else{if("Z"!==s)throw new m;o=":"}}r+=o,n++}else r+=i}return r}checkChecksums(t){let e=t.length;this.checkOneChecksum(t,e-2,20),this.checkOneChecksum(t,e-1,15)}checkOneChecksum(t,e,r){let n=1,i=0;for(let s=e-1;s>=0;s--)i+=n*At.ALPHABET_STRING.indexOf(t.charAt(s)),++n>r&&(n=1);if(t.charAt(e)!==At.ALPHABET_STRING[i%47])throw new l}}At.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*",At.CHARACTER_ENCODINGS=[276,328,324,322,296,292,290,336,274,266,424,420,418,404,402,394,360,356,354,308,282,344,332,326,300,278,436,434,428,422,406,410,364,358,310,314,302,468,466,458,366,374,430,294,474,470,306,350],At.ASTERISK_ENCODING=At.CHARACTER_ENCODINGS[47];class Et extends ft{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(t,e,r){let n=this.decodeStart(e),i=this.decodeEnd(e),s=new T;Et.decodeMiddle(e,n[1],i[0],s);let o=s.toString(),a=null;null!=r&&(a=r.get(E.ALLOWED_LENGTHS)),null==a&&(a=Et.DEFAULT_ALLOWED_LENGTHS);let h=o.length,l=!1,c=0;for(let t of a){if(h===t){l=!0;break}t>c&&(c=t)}if(!l&&h>c&&(l=!0),!l)throw new m;const d=[new nt(n[1],t),new nt(i[0],t)];return new v(o,null,0,d,x.ITF,(new Date).getTime())}static decodeMiddle(t,e,r,n){let i=new Int32Array(10),s=new Int32Array(5),o=new Int32Array(5);for(i.fill(0),s.fill(0),o.fill(0);e0&&n>=0&&!t.get(n);n--)r--;if(0!==r)throw new N}static skipWhiteSpace(t){const e=t.getSize(),r=t.getNextSet(0);if(r===e)throw new N;return r}decodeEnd(t){t.reverse();try{let e,r=Et.skipWhiteSpace(t);try{e=Et.findGuardPattern(t,r,Et.END_PATTERN_REVERSED[0])}catch(n){n instanceof N&&(e=Et.findGuardPattern(t,r,Et.END_PATTERN_REVERSED[1]))}this.validateQuietZone(t,e[0]);let n=e[0];return e[0]=t.getSize()-e[1],e[1]=t.getSize()-n,e}finally{t.reverse()}}static findGuardPattern(t,e,r){let n=r.length,i=new Int32Array(n),s=t.getSize(),o=!1,a=0,h=e;i.fill(0);for(let l=e;l=0)return r%10;throw new N}}Et.PATTERNS=[Int32Array.from([1,1,2,2,1]),Int32Array.from([2,1,1,1,2]),Int32Array.from([1,2,1,1,2]),Int32Array.from([2,2,1,1,1]),Int32Array.from([1,1,2,1,2]),Int32Array.from([2,1,2,1,1]),Int32Array.from([1,2,2,1,1]),Int32Array.from([1,1,1,2,2]),Int32Array.from([2,1,1,2,1]),Int32Array.from([1,2,1,2,1]),Int32Array.from([1,1,3,3,1]),Int32Array.from([3,1,1,1,3]),Int32Array.from([1,3,1,1,3]),Int32Array.from([3,3,1,1,1]),Int32Array.from([1,1,3,1,3]),Int32Array.from([3,1,3,1,1]),Int32Array.from([1,3,3,1,1]),Int32Array.from([1,1,1,3,3]),Int32Array.from([3,1,1,3,1]),Int32Array.from([1,3,1,3,1])],Et.MAX_AVG_VARIANCE=.38,Et.MAX_INDIVIDUAL_VARIANCE=.5,Et.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],Et.START_PATTERN=Int32Array.from([1,1,1,1]),Et.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class mt extends ft{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(t){let e,r=!1,n=0,i=Int32Array.from([0,0,0]);for(;!r;){i=Int32Array.from([0,0,0]),e=mt.findGuardPattern(t,n,!1,this.START_END_PATTERN,i);let s=e[0];n=e[1];let o=s-(n-s);o>=0&&(r=t.isRange(o,s,!1))}return e}static checkChecksum(t){return mt.checkStandardUPCEANChecksum(t)}static checkStandardUPCEANChecksum(t){let e=t.length;if(0===e)return!1;let r=parseInt(t.charAt(e-1),10);return mt.getStandardUPCEANChecksum(t.substring(0,e-1))===r}static getStandardUPCEANChecksum(t){let e=t.length,r=0;for(let n=e-1;n>=0;n-=2){let e=t.charAt(n).charCodeAt(0)-"0".charCodeAt(0);if(e<0||e>9)throw new m;r+=e}r*=3;for(let n=e-2;n>=0;n-=2){let e=t.charAt(n).charCodeAt(0)-"0".charCodeAt(0);if(e<0||e>9)throw new m;r+=e}return(1e3-r)%10}static decodeEnd(t,e){return mt.findGuardPattern(t,e,!1,mt.START_END_PATTERN,new Int32Array(mt.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(t,e,r,n){return this.findGuardPattern(t,e,r,n,new Int32Array(n.length))}static findGuardPattern(t,e,r,n,i){let s=t.getSize(),o=0,a=e=r?t.getNextUnset(e):t.getNextSet(e),h=n.length,l=r;for(let r=e;r=0)return s;throw new N}}mt.MAX_AVG_VARIANCE=.48,mt.MAX_INDIVIDUAL_VARIANCE=.7,mt.START_END_PATTERN=Int32Array.from([1,1,1]),mt.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),mt.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),mt.L_PATTERNS=[Int32Array.from([3,2,1,1]),Int32Array.from([2,2,2,1]),Int32Array.from([2,1,2,2]),Int32Array.from([1,4,1,1]),Int32Array.from([1,1,3,2]),Int32Array.from([1,2,3,1]),Int32Array.from([1,1,1,4]),Int32Array.from([1,3,1,2]),Int32Array.from([1,2,1,3]),Int32Array.from([3,1,1,2])];class It{constructor(){this.CHECK_DIGIT_ENCODINGS=[24,20,18,17,12,6,3,10,9,5],this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(t,e,r){let n=this.decodeRowStringBuffer,i=this.decodeMiddle(e,r,n),s=n.toString(),o=It.parseExtensionString(s),a=[new nt((r[0]+r[1])/2,t),new nt(i,t)],h=new v(s,null,0,a,x.UPC_EAN_EXTENSION,(new Date).getTime());return null!=o&&h.putAllMetadata(o),h}decodeMiddle(t,e,r){let n=this.decodeMiddleCounters;n[0]=0,n[1]=0,n[2]=0,n[3]=0;let i=t.getSize(),s=e[1],o=0;for(let e=0;e<5&&s=10&&(o|=1<<4-e),4!==e&&(s=t.getNextSet(s),s=t.getNextUnset(s))}if(5!==r.length)throw new N;let a=this.determineCheckDigit(o);if(It.extensionChecksum(r.toString())!==a)throw new N;return s}static extensionChecksum(t){let e=t.length,r=0;for(let n=e-2;n>=0;n-=2)r+=t.charAt(n).charCodeAt(0)-"0".charCodeAt(0);r*=3;for(let n=e-1;n>=0;n-=2)r+=t.charAt(n).charCodeAt(0)-"0".charCodeAt(0);return r*=3,r%10}determineCheckDigit(t){for(let e=0;e<10;e++)if(t===this.CHECK_DIGIT_ENCODINGS[e])return e;throw new N}static parseExtensionString(t){if(5!==t.length)return null;let e=It.parseExtension5String(t);return null==e?null:new Map([[z.SUGGESTED_PRICE,e]])}static parseExtension5String(t){let e;switch(t.charAt(0)){case"0":e="£";break;case"5":e="$";break;case"9":switch(t){case"90000":return null;case"99991":return"0.00";case"99990":return"Used"}e="";break;default:e=""}let r=parseInt(t.substring(1)),n=r%100;return e+(r/100).toString()+"."+(n<10?"0"+n:n.toString())}}class _t{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(t,e,r){let n=this.decodeRowStringBuffer,i=this.decodeMiddle(e,r,n),s=n.toString(),o=_t.parseExtensionString(s),a=[new nt((r[0]+r[1])/2,t),new nt(i,t)],h=new v(s,null,0,a,x.UPC_EAN_EXTENSION,(new Date).getTime());return null!=o&&h.putAllMetadata(o),h}decodeMiddle(t,e,r){let n=this.decodeMiddleCounters;n[0]=0,n[1]=0,n[2]=0,n[3]=0;let i=t.getSize(),s=e[1],o=0;for(let e=0;e<2&&s=10&&(o|=1<<1-e),1!==e&&(s=t.getNextSet(s),s=t.getNextUnset(s))}if(2!==r.length)throw new N;if(parseInt(r.toString())%4!==o)throw new N;return s}static parseExtensionString(t){return 2!==t.length?null:new Map([[z.ISSUE_NUMBER,parseInt(t)]])}}class St{static decodeRow(t,e,r){let n=mt.findGuardPattern(e,r,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return(new It).decodeRow(t,e,n)}catch(r){return(new _t).decodeRow(t,e,n)}}}St.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class pt extends mt{constructor(){super(),this.decodeRowStringBuffer="",pt.L_AND_G_PATTERNS=pt.L_PATTERNS.map((t=>Int32Array.from(t)));for(let t=10;t<20;t++){let e=pt.L_PATTERNS[t-10],r=new Int32Array(e.length);for(let t=0;t=e.getSize()||!e.isRange(c,d,!1))throw new N;let u=a.toString();if(u.length<8)throw new m;if(!pt.checkChecksum(u))throw new l;let g=(n[1]+n[0])/2,f=(h[1]+h[0])/2,w=this.getBarcodeFormat(),C=[new nt(g,t),new nt(f,t)],A=new v(u,null,0,C,w,(new Date).getTime()),I=0;try{let r=St.decodeRow(t,e,h[1]);A.putMetadata(z.UPC_EAN_EXTENSION,r.getText()),A.putAllMetadata(r.getResultMetadata()),A.addResultPoints(r.getResultPoints()),I=r.getText().length}catch(t){}let _=null==r?null:r.get(E.ALLOWED_EAN_EXTENSIONS);if(null!=_){let t=!1;for(let e in _)if(I.toString()===e){t=!0;break}if(!t)throw new N}return w===x.EAN_13||x.UPC_A,A}static checkChecksum(t){return pt.checkStandardUPCEANChecksum(t)}static checkStandardUPCEANChecksum(t){let e=t.length;if(0===e)return!1;let r=parseInt(t.charAt(e-1),10);return pt.getStandardUPCEANChecksum(t.substring(0,e-1))===r}static getStandardUPCEANChecksum(t){let e=t.length,r=0;for(let n=e-1;n>=0;n-=2){let e=t.charAt(n).charCodeAt(0)-"0".charCodeAt(0);if(e<0||e>9)throw new m;r+=e}r*=3;for(let n=e-2;n>=0;n-=2){let e=t.charAt(n).charCodeAt(0)-"0".charCodeAt(0);if(e<0||e>9)throw new m;r+=e}return(1e3-r)%10}static decodeEnd(t,e){return pt.findGuardPattern(t,e,!1,pt.START_END_PATTERN,new Int32Array(pt.START_END_PATTERN.length).fill(0))}}class Tt extends pt{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(t,e,r){let n=this.decodeMiddleCounters;n[0]=0,n[1]=0,n[2]=0,n[3]=0;let i=t.getSize(),s=e[1],o=0;for(let e=0;e<6&&s=10&&(o|=1<<5-e)}r=Tt.determineFirstDigit(r,o),s=pt.findGuardPattern(t,s,!0,pt.MIDDLE_PATTERN,new Int32Array(pt.MIDDLE_PATTERN.length).fill(0))[1];for(let e=0;e<6&&st));n[0]=0,n[1]=0,n[2]=0,n[3]=0;const i=t.getSize();let s=e[1],o=0;for(let e=0;e<6&&s=10&&(o|=1<<5-e)}return yt.determineNumSysAndCheckDigit(new T(r),o),s}decodeEnd(t,e){return yt.findGuardPatternWithoutCounters(t,e,!0,yt.MIDDLE_END_PATTERN)}checkChecksum(t){return pt.checkChecksum(yt.convertUPCEtoUPCA(t))}static determineNumSysAndCheckDigit(t,e){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);throw N.getNotFoundInstance()}getBarcodeFormat(){return x.UPC_E}static convertUPCEtoUPCA(t){const e=t.slice(1,7).split("").map((t=>t.charCodeAt(0))),r=new T;r.append(t.charAt(0));let n=e[5];switch(n){case 0:case 1:case 2:r.appendChars(e,0,2),r.append(n),r.append("0000"),r.appendChars(e,2,3);break;case 3:r.appendChars(e,0,3),r.append("00000"),r.appendChars(e,3,2);break;case 4:r.appendChars(e,0,4),r.append("00000"),r.append(e[4]);break;default:r.appendChars(e,0,5),r.append("0000"),r.append(n)}return t.length>=8&&r.append(t.charAt(7)),r.toString()}}yt.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),yt.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])];class Dt extends ft{constructor(t){super();let e=null==t?null:t.get(E.POSSIBLE_FORMATS),r=[];null!=e&&(e.indexOf(x.EAN_13)>-1&&r.push(new Tt),e.indexOf(x.UPC_A)>-1&&r.push(new Nt),e.indexOf(x.EAN_8)>-1&&r.push(new Rt),e.indexOf(x.UPC_E)>-1&&r.push(new yt)),0===r.length&&(r.push(new Tt),r.push(new Nt),r.push(new Rt),r.push(new yt)),this.readers=r}decodeRow(t,e,r){for(let n of this.readers)try{const i=n.decodeRow(t,e,r),s=i.getBarcodeFormat()===x.EAN_13&&"0"===i.getText().charAt(0),o=null==r?null:r.get(E.POSSIBLE_FORMATS),a=null==o||o.includes(x.UPC_A);if(s&&a){const t=i.getRawBytes(),e=new v(i.getText().substring(1),t,t?t.length:null,i.getResultPoints(),x.UPC_A);return e.putAllMetadata(i.getResultMetadata()),e}return i}catch(t){}throw new N}reset(){for(let t of this.readers)t.reset()}}class Ot extends ft{constructor(){super(...arguments),this.CODA_BAR_CHAR_SET={nnnnnww:"0",nnnnwwn:"1",nnnwnnw:"2",wwnnnnn:"3",nnwnnwn:"4",wnnnnwn:"5",nwnnnnw:"6",nwnnwnn:"7",nwwnnnn:"8",wnnwnnn:"9",nnnwwnn:"-",nnwwnnn:"$",wnnnwnw:":",wnwnnnw:"/",wnwnwnn:".",nnwwwww:"+",nnwwnwn:"A",nwnwnnw:"B",nnnwnww:"C",nnnwwwn:"D"}}decodeRow(t,e,r){let n=this.getValidRowData(e);if(!n)throw new N;let i=this.codaBarDecodeRow(n.row);if(!i)throw new N;return new v(i,null,0,[new nt(n.left,t),new nt(n.right,t)],x.CODABAR,(new Date).getTime())}getValidRowData(t){let e=t.toArray(),r=e.indexOf(!0);if(-1===r)return null;let n=e.lastIndexOf(!0);if(n<=r)return null;e=e.slice(r,n+1);let i=[],s=e[0],o=1;for(let t=1;t(t+e)/2),0));for(;t.length>0;){const n=t.splice(0,8).splice(0,7).map((t=>tn&&(n=e[i],r=i);t[r]++}static decrement(t,e){let r=0,n=e[0];for(let i=1;i=Mt.MIN_FINDER_PATTERN_RATIO&&r<=Mt.MAX_FINDER_PATTERN_RATIO){let e=Number.MAX_SAFE_INTEGER,r=Number.MIN_SAFE_INTEGER;for(let n of t)n>r&&(r=n),n=o-a-1&&(t-=Pt.combins(n-h-(o-a),o-a-2)),o-a-1>1){let r=0;for(let t=n-h-(o-a-2);t>e;t--)r+=Pt.combins(n-h-t-1,o-a-3);t-=r*(o-1-a)}else n-h>e&&t--;i+=t}n-=h}return i}static combins(t,e){let r,n;t-e>e?(n=e,r=t-e):(n=t-e,r=e);let i=1,s=1;for(let e=t;e>r;e--)i*=e,s<=n&&(i/=s,s++);for(;s<=n;)i/=s,s++;return i}}class Lt{static buildBitArray(t){let e=2*t.length-1;null==t[t.length-1].getRightChar()&&(e-=1);let r=new C(12*e),n=0,i=t[0].getRightChar().getValue();for(let t=11;t>=0;--t)i&1<=0;--t)s&1<=0;--e)t&1<10||r<0||r>10)throw new m;this.firstDigit=e,this.secondDigit=r}getFirstDigit(){return this.firstDigit}getSecondDigit(){return this.secondDigit}getValue(){return 10*this.firstDigit+this.secondDigit}isFirstDigitFNC1(){return this.firstDigit===Vt.FNC1}isSecondDigitFNC1(){return this.secondDigit===Vt.FNC1}isAnyFNC1(){return this.firstDigit===Vt.FNC1||this.secondDigit===Vt.FNC1}}Vt.FNC1=10;class Ht{constructor(){}static parseFieldsInGeneralPurpose(t){if(!t)return null;if(t.length<2)throw new N;let e=t.substring(0,2);for(let r of Ht.TWO_DIGIT_DATA_LENGTH)if(r[0]===e)return r[1]===Ht.VARIABLE_LENGTH?Ht.processVariableAI(2,r[2],t):Ht.processFixedAI(2,r[1],t);if(t.length<3)throw new N;let r=t.substring(0,3);for(let e of Ht.THREE_DIGIT_DATA_LENGTH)if(e[0]===r)return e[1]===Ht.VARIABLE_LENGTH?Ht.processVariableAI(3,e[2],t):Ht.processFixedAI(3,e[1],t);for(let e of Ht.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(e[0]===r)return e[1]===Ht.VARIABLE_LENGTH?Ht.processVariableAI(4,e[2],t):Ht.processFixedAI(4,e[1],t);if(t.length<4)throw new N;let n=t.substring(0,4);for(let e of Ht.FOUR_DIGIT_DATA_LENGTH)if(e[0]===n)return e[1]===Ht.VARIABLE_LENGTH?Ht.processVariableAI(4,e[2],t):Ht.processFixedAI(4,e[1],t);throw new N}static processFixedAI(t,e,r){if(r.lengththis.information.getSize())return t+4<=this.information.getSize();for(let e=t;ethis.information.getSize()){let e=this.extractNumericValueFromBitArray(t,4);return new Vt(this.information.getSize(),0===e?Vt.FNC1:e-1,Vt.FNC1)}let e=this.extractNumericValueFromBitArray(t,7);return new Vt(t+7,(e-8)/11,(e-8)%11)}extractNumericValueFromBitArray(t,e){return Ut.extractNumericValueFromBitArray(this.information,t,e)}static extractNumericValueFromBitArray(t,e,r){let n=0;for(let i=0;ithis.information.getSize())return!1;let e=this.extractNumericValueFromBitArray(t,5);if(e>=5&&e<16)return!0;if(t+7>this.information.getSize())return!1;let r=this.extractNumericValueFromBitArray(t,7);if(r>=64&&r<116)return!0;if(t+8>this.information.getSize())return!1;let n=this.extractNumericValueFromBitArray(t,8);return n>=232&&n<253}decodeIsoIec646(t){let e=this.extractNumericValueFromBitArray(t,5);if(15===e)return new kt(t+5,kt.FNC1);if(e>=5&&e<15)return new kt(t+5,"0"+(e-5));let r,n=this.extractNumericValueFromBitArray(t,7);if(n>=64&&n<90)return new kt(t+7,""+(n+1));if(n>=90&&n<116)return new kt(t+7,""+(n+7));switch(this.extractNumericValueFromBitArray(t,8)){case 232:r="!";break;case 233:r='"';break;case 234:r="%";break;case 235:r="&";break;case 236:r="'";break;case 237:r="(";break;case 238:r=")";break;case 239:r="*";break;case 240:r="+";break;case 241:r=",";break;case 242:r="-";break;case 243:r=".";break;case 244:r="/";break;case 245:r=":";break;case 246:r=";";break;case 247:r="<";break;case 248:r="=";break;case 249:r=">";break;case 250:r="?";break;case 251:r="_";break;case 252:r=" ";break;default:throw new m}return new kt(t+8,r)}isStillAlpha(t){if(t+5>this.information.getSize())return!1;let e=this.extractNumericValueFromBitArray(t,5);if(e>=5&&e<16)return!0;if(t+6>this.information.getSize())return!1;let r=this.extractNumericValueFromBitArray(t,6);return r>=16&&r<63}decodeAlphanumeric(t){let e=this.extractNumericValueFromBitArray(t,5);if(15===e)return new kt(t+5,kt.FNC1);if(e>=5&&e<15)return new kt(t+5,"0"+(e-5));let r,n=this.extractNumericValueFromBitArray(t,6);if(n>=32&&n<58)return new kt(t+6,""+(n+33));switch(n){case 58:r="*";break;case 59:r=",";break;case 60:r="-";break;case 61:r=".";break;case 62:r="/";break;default:throw new J("Decoding invalid alphanumeric value: "+n)}return new kt(t+6,r)}isAlphaTo646ToAlphaLatch(t){if(t+1>this.information.getSize())return!1;for(let e=0;e<5&&e+tthis.information.getSize())return!1;for(let e=t;ethis.information.getSize())return!1;for(let e=0;e<4&&e+t{e.forEach((e=>{t.getLeftChar().getValue()===e.getLeftChar().getValue()&&t.getRightChar().getValue()===e.getRightChar().getValue()&&t.getFinderPatter().getValue()===e.getFinderPatter().getValue()&&(r=!0)}))})),r}}class re extends Mt{constructor(){super(...arguments),this.pairs=new Array(re.MAX_PAIRS),this.rows=new Array,this.startEnd=[2]}decodeRow(t,e,r){this.pairs.length=0,this.startFromEven=!1;try{return re.constructResult(this.decodeRow2pairs(t,e))}catch(t){}return this.pairs.length=0,this.startFromEven=!0,re.constructResult(this.decodeRow2pairs(t,e))}reset(){this.pairs.length=0,this.rows.length=0}decodeRow2pairs(t,e){let r,n=!1;for(;!n;)try{this.pairs.push(this.retrieveNextPair(e,this.pairs,t))}catch(t){if(t instanceof N){if(!this.pairs.length)throw new N;n=!0}}if(this.checkChecksum())return this.pairs;if(r=!!this.rows.length,this.storeRow(t,!1),r){let t=this.checkRowsBoolean(!1);if(null!=t)return t;if(t=this.checkRowsBoolean(!0),null!=t)return t}throw new N}checkRowsBoolean(t){if(this.rows.length>25)return this.rows.length=0,null;this.pairs.length=0,t&&(this.rows=this.rows.reverse());let e=null;try{e=this.checkRows(new Array,0)}catch(t){console.log(t)}return t&&(this.rows=this.rows.reverse()),e}checkRows(t,e){for(let r=e;re.length)continue;let r=!0;for(let n=0;nt){i=e.isEquivalent(this.pairs);break}n=e.isEquivalent(this.pairs),r++}i||n||re.isPartialRow(this.pairs,this.rows)||(this.rows.push(r,new ee(this.pairs,t,e)),this.removePartialRows(this.pairs,this.rows))}removePartialRows(t,e){for(let r of e)if(r.getPairs().length!==t.length)for(let e of r.getPairs())for(let r of t)if(te.equals(e,r))break}static isPartialRow(t,e){for(let r of e){let e=!0;for(let n of t){let t=!1;for(let e of r.getPairs())if(n.equals(e)){t=!0;break}if(!t){e=!1;break}}if(e)return!0}return!1}getRows(){return this.rows}static constructResult(t){let e=$t(Lt.buildBitArray(t)).parseInformation(),r=t[0].getFinderPattern().getResultPoints(),n=t[t.length-1].getFinderPattern().getResultPoints(),i=[r[0],r[1],n[0],n[1]];return new v(e,null,null,i,x.RSS_EXPANDED,null)}checkChecksum(){let t=this.pairs.get(0),e=t.getLeftChar(),r=t.getRightChar();if(null===r)return!1;let n=r.getChecksumPortion(),i=2;for(let t=1;t=0)i=r;else if(this.isEmptyPair(e))i=0;else{i=e[e.length-1].getFinderPattern().getStartEnd()[1]}let o=e.length%2!=0;this.startFromEven&&(o=!o);let a=!1;for(;i=0&&!t.get(e);)e--;e++,n=this.startEnd[0]-e,i=e,s=this.startEnd[1]}else i=this.startEnd[0],s=t.getNextUnset(this.startEnd[1]+1),n=s-this.startEnd[1];let o,a=this.getDecodeFinderCounters();d.arraycopy(a,0,a,1,a.length-1),a[0]=n;try{o=this.parseFinderValue(a,re.FINDER_PATTERNS)}catch(t){return null}return new Bt(o,[i,s],i,s,e)}decodeDataCharacter(t,e,r,n){let i=this.getDataCharacterCounters();for(let t=0;t.3)throw new N;let a=this.getOddCounts(),h=this.getEvenCounts(),l=this.getOddRoundingErrors(),c=this.getEvenRoundingErrors();for(let t=0;t8){if(e>8.7)throw new N;r=8}let n=t/2;1&t?(h[n]=r,c[n]=e-r):(a[n]=r,l[n]=e-r)}this.adjustOddEvenCounts(17);let d=4*e.getValue()+(r?0:2)+(n?0:1)-1,u=0,g=0;for(let t=a.length-1;t>=0;t--){if(re.isNotA1left(e,r,n)){let e=re.WEIGHTS[d][2*t];g+=a[t]*e}u+=a[t]}let f=0;for(let t=h.length-1;t>=0;t--)if(re.isNotA1left(e,r,n)){let e=re.WEIGHTS[d][2*t+1];f+=h[t]*e}let w=g+f;if(1&u||u>13||u<4)throw new N;let C=(13-u)/2,A=re.SYMBOL_WIDEST[C],E=9-A,m=Pt.getRSSvalue(a,A,!0),I=Pt.getRSSvalue(h,E,!1),_=re.EVEN_TOTAL_SUBSET[C],S=re.GSUM[C];return new bt(m*_+I+S,w)}static isNotA1left(t,e,r){return!(0===t.getValue()&&e&&r)}adjustOddEvenCounts(t){let e=et.sum(new Int32Array(this.getOddCounts())),r=et.sum(new Int32Array(this.getEvenCounts())),n=!1,i=!1;e>13?i=!0:e<4&&(n=!0);let s=!1,o=!1;r>13?o=!0:r<4&&(s=!0);let a=e+r-t,h=!(1&~e),l=!(1&r);if(1===a)if(h){if(l)throw new N;i=!0}else{if(!l)throw new N;o=!0}else if(-1===a)if(h){if(l)throw new N;n=!0}else{if(!l)throw new N;s=!0}else{if(0!==a)throw new N;if(h){if(!l)throw new N;e1)for(let e of this.possibleRightPairs)if(e.getCount()>1&&ie.checkChecksum(t,e))return ie.constructResult(t,e);throw new N}static addOrTally(t,e){if(null==e)return;let r=!1;for(let n of t)if(n.getValue()===e.getValue()){n.incrementCount(),r=!0;break}r||t.push(e)}reset(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0}static constructResult(t,e){let r=4537077*t.getValue()+e.getValue(),n=new String(r).toString(),i=new T;for(let t=13-n.length;t>0;t--)i.append("0");i.append(n);let s=0;for(let t=0;t<13;t++){let e=i.charAt(t).charCodeAt(0)-"0".charCodeAt(0);s+=1&t?e:3*e}s=10-s%10,10===s&&(s=0),i.append(s.toString());let o=t.getFinderPattern().getResultPoints(),a=e.getFinderPattern().getResultPoints();return new v(i.toString(),null,0,[o[0],o[1],a[0],a[1]],x.RSS_14,(new Date).getTime())}static checkChecksum(t,e){let r=(t.getChecksumPortion()+16*e.getChecksumPortion())%79,n=9*t.getFinderPattern().getValue()+e.getFinderPattern().getValue();return n>72&&n--,n>8&&n--,r===n}decodePair(t,e,r,n){try{let i=this.findFinderPattern(t,e),s=this.parseFoundFinderPattern(t,r,e,i),o=null==n?null:n.get(E.NEED_RESULT_POINT_CALLBACK);if(null!=o){let n=(i[0]+i[1])/2;e&&(n=t.getSize()-1-n),o.foundPossibleResultPoint(new nt(n,r))}let a=this.decodeDataCharacter(t,s,!0),h=this.decodeDataCharacter(t,s,!1);return new ne(1597*a.getValue()+h.getValue(),a.getChecksumPortion()+4*h.getChecksumPortion(),s)}catch(t){return null}}decodeDataCharacter(t,e,r){let n=this.getDataCharacterCounters();for(let t=0;t8&&(r=8);let i=Math.floor(t/2);1&t?(a[i]=r,l[i]=e-r):(o[i]=r,h[i]=e-r)}this.adjustOddEvenCounts(r,i);let c=0,d=0;for(let t=o.length-1;t>=0;t--)d*=9,d+=o[t],c+=o[t];let u=0,g=0;for(let t=a.length-1;t>=0;t--)u*=9,u+=a[t],g+=a[t];let f=d+3*u;if(r){if(1&c||c>12||c<4)throw new N;let t=(12-c)/2,e=ie.OUTSIDE_ODD_WIDEST[t],r=9-e,n=Pt.getRSSvalue(o,e,!1),i=Pt.getRSSvalue(a,r,!0),s=ie.OUTSIDE_EVEN_TOTAL_SUBSET[t],h=ie.OUTSIDE_GSUM[t];return new bt(n*s+i+h,f)}{if(1&g||g>10||g<4)throw new N;let t=(10-g)/2,e=ie.INSIDE_ODD_WIDEST[t],r=9-e,n=Pt.getRSSvalue(o,e,!0),i=Pt.getRSSvalue(a,r,!1),s=ie.INSIDE_ODD_TOTAL_SUBSET[t],h=ie.INSIDE_GSUM[t];return new bt(i*s+n+h,f)}}findFinderPattern(t,e){let r=this.getDecodeFinderCounters();r[0]=0,r[1]=0,r[2]=0,r[3]=0;let n=t.getSize(),i=!1,s=0;for(;s=0&&i!==t.get(s);)s--;s++;const o=n[0]-s,a=this.getDecodeFinderCounters(),h=new Int32Array(a.length);d.arraycopy(a,0,h,1,a.length-1),h[0]=o;const l=this.parseFinderValue(h,ie.FINDER_PATTERNS);let c=s,u=n[1];return r&&(c=t.getSize()-1-c,u=t.getSize()-1-u),new Bt(l,[s,n[1]],c,u,e)}adjustOddEvenCounts(t,e){let r=et.sum(new Int32Array(this.getOddCounts())),n=et.sum(new Int32Array(this.getEvenCounts())),i=!1,s=!1,o=!1,a=!1;t?(r>12?s=!0:r<4&&(i=!0),n>12?a=!0:n<4&&(o=!0)):(r>11?s=!0:r<5&&(i=!0),n>10?a=!0:n<4&&(o=!0));let h=r+n-e,l=(1&r)==(t?1:0),c=!(1&~n);if(1===h)if(l){if(c)throw new N;s=!0}else{if(!c)throw new N;a=!0}else if(-1===h)if(l){if(c)throw new N;i=!0}else{if(!c)throw new N;o=!0}else{if(0!==h)throw new N;if(l){if(!c)throw new N;rt.reset()))}}class oe{constructor(t,e,r){this.ecCodewords=t,this.ecBlocks=[e],r&&this.ecBlocks.push(r)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class ae{constructor(t,e){this.count=t,this.dataCodewords=e}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class he{constructor(t,e,r,n,i,s){this.versionNumber=t,this.symbolSizeRows=e,this.symbolSizeColumns=r,this.dataRegionSizeRows=n,this.dataRegionSizeColumns=i,this.ecBlocks=s;let o=0;const a=s.getECCodewords(),h=s.getECBlocks();for(let t of h)o+=t.getCount()*(t.getDataCodewords()+a);this.totalCodewords=o}getVersionNumber(){return this.versionNumber}getSymbolSizeRows(){return this.symbolSizeRows}getSymbolSizeColumns(){return this.symbolSizeColumns}getDataRegionSizeRows(){return this.dataRegionSizeRows}getDataRegionSizeColumns(){return this.dataRegionSizeColumns}getTotalCodewords(){return this.totalCodewords}getECBlocks(){return this.ecBlocks}static getVersionForDimensions(t,e){if(1&t||1&e)throw new m;for(let r of he.VERSIONS)if(r.symbolSizeRows===t&&r.symbolSizeColumns===e)return r;throw new m}toString(){return""+this.versionNumber}static buildVersions(){return[new he(1,10,10,8,8,new oe(5,new ae(1,3))),new he(2,12,12,10,10,new oe(7,new ae(1,5))),new he(3,14,14,12,12,new oe(10,new ae(1,8))),new he(4,16,16,14,14,new oe(12,new ae(1,12))),new he(5,18,18,16,16,new oe(14,new ae(1,18))),new he(6,20,20,18,18,new oe(18,new ae(1,22))),new he(7,22,22,20,20,new oe(20,new ae(1,30))),new he(8,24,24,22,22,new oe(24,new ae(1,36))),new he(9,26,26,24,24,new oe(28,new ae(1,44))),new he(10,32,32,14,14,new oe(36,new ae(1,62))),new he(11,36,36,16,16,new oe(42,new ae(1,86))),new he(12,40,40,18,18,new oe(48,new ae(1,114))),new he(13,44,44,20,20,new oe(56,new ae(1,144))),new he(14,48,48,22,22,new oe(68,new ae(1,174))),new he(15,52,52,24,24,new oe(42,new ae(2,102))),new he(16,64,64,14,14,new oe(56,new ae(2,140))),new he(17,72,72,16,16,new oe(36,new ae(4,92))),new he(18,80,80,18,18,new oe(48,new ae(4,114))),new he(19,88,88,20,20,new oe(56,new ae(4,144))),new he(20,96,96,22,22,new oe(68,new ae(4,174))),new he(21,104,104,24,24,new oe(56,new ae(6,136))),new he(22,120,120,18,18,new oe(68,new ae(6,175))),new he(23,132,132,20,20,new oe(62,new ae(8,163))),new he(24,144,144,22,22,new oe(62,new ae(8,156),new ae(2,155))),new he(25,8,18,6,16,new oe(7,new ae(1,5))),new he(26,8,32,6,14,new oe(11,new ae(1,10))),new he(27,12,26,10,24,new oe(14,new ae(1,16))),new he(28,12,36,10,16,new oe(18,new ae(1,22))),new he(29,16,36,14,16,new oe(24,new ae(1,32))),new he(30,16,48,14,22,new oe(28,new ae(1,49)))]}}he.VERSIONS=he.buildVersions();class le{constructor(t){const e=t.getHeight();if(e<8||e>144||1&e)throw new m;this.version=le.readVersion(t),this.mappingBitMatrix=this.extractDataRegion(t),this.readMappingMatrix=new R(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(t){const e=t.getHeight(),r=t.getWidth();return he.getVersionForDimensions(e,r)}readCodewords(){const t=new Int8Array(this.version.getTotalCodewords());let e=0,r=4,n=0;const i=this.mappingBitMatrix.getHeight(),s=this.mappingBitMatrix.getWidth();let o=!1,a=!1,h=!1,l=!1;do{if(r!==i||0!==n||o)if(r===i-2&&0===n&&3&s&&!a)t[e++]=255&this.readCorner2(i,s),r-=2,n+=2,a=!0;else if(r!==i+4||2!==n||7&s||h)if(r!==i-2||0!==n||4!=(7&s)||l){do{r=0&&!this.readMappingMatrix.get(n,r)&&(t[e++]=255&this.readUtah(r,n,i,s)),r-=2,n+=2}while(r>=0&&n=0&&n=0);r+=3,n+=1}else t[e++]=255&this.readCorner4(i,s),r-=2,n+=2,l=!0;else t[e++]=255&this.readCorner3(i,s),r-=2,n+=2,h=!0;else t[e++]=255&this.readCorner1(i,s),r-=2,n+=2,o=!0}while(r7?e-1:e;s[n].codewords[i]=t[c++]}if(c!==t.length)throw new a;return s}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class de{constructor(t){this.bytes=t,this.byteOffset=0,this.bitOffset=0}getBitOffset(){return this.bitOffset}getByteOffset(){return this.byteOffset}readBits(t){if(t<1||t>32||t>this.available())throw new a(""+t);let e=0,r=this.bitOffset,n=this.byteOffset;const i=this.bytes;if(r>0){const s=8-r,o=t>8-o<>a,t-=o,r+=o,8===r&&(r=0,n++)}if(t>0){for(;t>=8;)e=e<<8|255&i[n],n++,t-=8;if(t>0){const s=8-t,o=255>>s<>s,r+=t}}return this.bitOffset=r,this.byteOffset=n,e}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}!function(t){t[t.PAD_ENCODE=0]="PAD_ENCODE",t[t.ASCII_ENCODE=1]="ASCII_ENCODE",t[t.C40_ENCODE=2]="C40_ENCODE",t[t.TEXT_ENCODE=3]="TEXT_ENCODE",t[t.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",t[t.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",t[t.BASE256_ENCODE=6]="BASE256_ENCODE"}(H||(H={}));class ue{static decode(t){const e=new de(t),r=new T,n=new T,i=new Array;let s=H.ASCII_ENCODE;do{if(s===H.ASCII_ENCODE)s=this.decodeAsciiSegment(e,r,n);else{switch(s){case H.C40_ENCODE:this.decodeC40Segment(e,r);break;case H.TEXT_ENCODE:this.decodeTextSegment(e,r);break;case H.ANSIX12_ENCODE:this.decodeAnsiX12Segment(e,r);break;case H.EDIFACT_ENCODE:this.decodeEdifactSegment(e,r);break;case H.BASE256_ENCODE:this.decodeBase256Segment(e,r,i);break;default:throw new m}s=H.ASCII_ENCODE}}while(s!==H.PAD_ENCODE&&e.available()>0);return n.length()>0&&r.append(n.toString()),new Y(t,r.toString(),0===i.length?null:i,null)}static decodeAsciiSegment(t,e,r){let n=!1;do{let i=t.readBits(8);if(0===i)throw new m;if(i<=128)return n&&(i+=128),e.append(String.fromCharCode(i-1)),H.ASCII_ENCODE;if(129===i)return H.PAD_ENCODE;if(i<=229){const t=i-130;t<10&&e.append("0"),e.append(""+t)}else switch(i){case 230:return H.C40_ENCODE;case 231:return H.BASE256_ENCODE;case 232:e.append(String.fromCharCode(29));break;case 233:case 234:case 241:break;case 235:n=!0;break;case 236:e.append("[)>05"),r.insert(0,"");break;case 237:e.append("[)>06"),r.insert(0,"");break;case 238:return H.ANSIX12_ENCODE;case 239:return H.TEXT_ENCODE;case 240:return H.EDIFACT_ENCODE;default:if(254!==i||0!==t.available())throw new m}}while(t.available()>0);return H.ASCII_ENCODE}static decodeC40Segment(t,e){let r=!1;const n=[];let i=0;do{if(8===t.available())return;const s=t.readBits(8);if(254===s)return;this.parseTwoBytes(s,t.readBits(8),n);for(let t=0;t<3;t++){const s=n[t];switch(i){case 0:if(s<3)i=s+1;else{if(!(s0)}static decodeTextSegment(t,e){let r=!1,n=[],i=0;do{if(8===t.available())return;const s=t.readBits(8);if(254===s)return;this.parseTwoBytes(s,t.readBits(8),n);for(let t=0;t<3;t++){const s=n[t];switch(i){case 0:if(s<3)i=s+1;else{if(!(s0)}static decodeAnsiX12Segment(t,e){const r=[];do{if(8===t.available())return;const n=t.readBits(8);if(254===n)return;this.parseTwoBytes(n,t.readBits(8),r);for(let t=0;t<3;t++){const n=r[t];switch(n){case 0:e.append("\r");break;case 1:e.append("*");break;case 2:e.append(">");break;case 3:e.append(" ");break;default:if(n<14)e.append(String.fromCharCode(n+44));else{if(!(n<40))throw new m;e.append(String.fromCharCode(n+51))}}}}while(t.available()>0)}static parseTwoBytes(t,e,r){let n=(t<<8)+e-1,i=Math.floor(n/1600);r[0]=i,n-=1600*i,i=Math.floor(n/40),r[1]=i,r[2]=n-40*i}static decodeEdifactSegment(t,e){do{if(t.available()<=16)return;for(let r=0;r<4;r++){let r=t.readBits(6);if(31===r){const e=8-t.getBitOffset();return void(8!==e&&t.readBits(e))}32&r||(r|=64),e.append(String.fromCharCode(r))}}while(t.available()>0)}static decodeBase256Segment(t,e,r){let n=1+t.getByteOffset();const i=this.unrandomize255State(t.readBits(8),n++);let s;if(s=0===i?t.available()/8|0:i<250?i:250*(i-249)+this.unrandomize255State(t.readBits(8),n++),s<0)throw new m;const o=new Uint8Array(s);for(let e=0;e=0?r:r+256}}ue.C40_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],ue.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],ue.TEXT_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],ue.TEXT_SHIFT2_SET_CHARS=ue.C40_SHIFT2_SET_CHARS,ue.TEXT_SHIFT3_SET_CHARS=["`","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","{","|","}","~",String.fromCharCode(127)];class ge{constructor(){this.rsDecoder=new $(Q.DATA_MATRIX_FIELD_256)}decode(t){const e=new le(t),r=e.getVersion(),n=e.readCodewords(),i=ce.getDataBlocks(n,r);let s=0;for(let t of i)s+=t.getNumDataCodewords();const o=new Uint8Array(s),a=i.length;for(let t=0;to&&(l=o,c[0]=e,c[1]=r,c[2]=n,c[3]=i),l>a&&(l=a,c[0]=r,c[1]=n,c[2]=i,c[3]=e),l>h&&(c[0]=n,c[1]=i,c[2]=e,c[3]=r),c}detectSolid2(t){let e=t[0],r=t[1],n=t[2],i=t[3],s=this.transitionsBetween(e,i),o=fe.shiftPoint(r,n,4*(s+1)),a=fe.shiftPoint(n,r,4*(s+1));return this.transitionsBetween(o,e)this.transitionsBetween(a,c)+this.transitionsBetween(h,c)?l:c:l:this.isValid(c)?c:null}shiftToModuleCenter(t){let e=t[0],r=t[1],n=t[2],i=t[3],s=this.transitionsBetween(e,i)+1,o=this.transitionsBetween(n,i)+1,a=fe.shiftPoint(e,r,4*o),h=fe.shiftPoint(n,r,4*s);s=this.transitionsBetween(a,i)+1,o=this.transitionsBetween(h,i)+1,1&~s||(s+=1),1&~o||(o+=1);let l,c,d=(e.getX()+r.getX()+n.getX()+i.getX())/4,u=(e.getY()+r.getY()+n.getY()+i.getY())/4;return e=fe.moveAway(e,d,u),r=fe.moveAway(r,d,u),n=fe.moveAway(n,d,u),i=fe.moveAway(i,d,u),a=fe.shiftPoint(e,r,4*o),a=fe.shiftPoint(a,i,4*s),l=fe.shiftPoint(r,e,4*o),l=fe.shiftPoint(l,n,4*s),h=fe.shiftPoint(n,i,4*o),h=fe.shiftPoint(h,r,4*s),c=fe.shiftPoint(i,n,4*o),c=fe.shiftPoint(c,e,4*s),[a,l,h,c]}isValid(t){return t.getX()>=0&&t.getX()0&&t.getY()Math.abs(i-r);if(o){let t=r;r=n,n=t,t=i,i=s,s=t}let a=Math.abs(i-r),h=Math.abs(s-n),l=-a/2,c=n0){if(e===s)break;e+=c,l-=a}}return u}}class we{constructor(){this.decoder=new ge}decode(t,e=null){let r,n;if(null!=e&&e.has(E.PURE_BARCODE)){const e=we.extractPureBits(t.getBlackMatrix());r=this.decoder.decode(e),n=we.NO_POINTS}else{const e=new fe(t.getBlackMatrix()).detect();r=this.decoder.decode(e.getBits()),n=e.getPoints()}const i=r.getRawBytes(),s=new v(r.getText(),i,8*i.length,n,x.DATA_MATRIX,d.currentTimeMillis()),o=r.getByteSegments();null!=o&&s.putMetadata(z.BYTE_SEGMENTS,o);const a=r.getECLevel();return null!=a&&s.putMetadata(z.ERROR_CORRECTION_LEVEL,a),s}reset(){}static extractPureBits(t){const e=t.getTopLeftOnBit(),r=t.getBottomRightOnBit();if(null==e||null==r)throw new N;const n=this.moduleSize(e,t);let i=e[1];const s=r[1];let o=e[0];const a=(r[0]-o+1)/n,h=(s-i+1)/n;if(a<=0||h<=0)throw new N;const l=n/2;i+=l,o+=l;const c=new R(a,h);for(let e=0;e=Ce.FOR_BITS.size)throw new a;return Ce.FOR_BITS.get(t)}}Ce.FOR_BITS=new Map,Ce.FOR_VALUE=new Map,Ce.L=new Ce(U.L,"L",1),Ce.M=new Ce(U.M,"M",0),Ce.Q=new Ce(U.Q,"Q",3),Ce.H=new Ce(U.H,"H",2);class Ae{constructor(t){this.errorCorrectionLevel=Ce.forBits(t>>3&3),this.dataMask=7&t}static numBitsDiffering(t,e){return w.bitCount(t^e)}static decodeFormatInformation(t,e){const r=Ae.doDecodeFormatInformation(t,e);return null!==r?r:Ae.doDecodeFormatInformation(t^Ae.FORMAT_INFO_MASK_QR,e^Ae.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(t,e){let r=Number.MAX_SAFE_INTEGER,n=0;for(const i of Ae.FORMAT_INFO_DECODE_LOOKUP){const s=i[0];if(s===t||s===e)return new Ae(i[1]);let o=Ae.numBitsDiffering(t,s);o40)throw new a;return Ie.VERSIONS[t-1]}static decodeVersionInformation(t){let e=Number.MAX_SAFE_INTEGER,r=0;for(let n=0;n6&&(e.setRegion(t-11,0,3,6),e.setRegion(0,t-11,6,3)),e}toString(){return""+this.versionNumber}}Ie.VERSION_DECODE_INFO=Int32Array.from([31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017]),Ie.VERSIONS=[new Ie(1,new Int32Array(0),new Ee(7,new me(1,19)),new Ee(10,new me(1,16)),new Ee(13,new me(1,13)),new Ee(17,new me(1,9))),new Ie(2,Int32Array.from([6,18]),new Ee(10,new me(1,34)),new Ee(16,new me(1,28)),new Ee(22,new me(1,22)),new Ee(28,new me(1,16))),new Ie(3,Int32Array.from([6,22]),new Ee(15,new me(1,55)),new Ee(26,new me(1,44)),new Ee(18,new me(2,17)),new Ee(22,new me(2,13))),new Ie(4,Int32Array.from([6,26]),new Ee(20,new me(1,80)),new Ee(18,new me(2,32)),new Ee(26,new me(2,24)),new Ee(16,new me(4,9))),new Ie(5,Int32Array.from([6,30]),new Ee(26,new me(1,108)),new Ee(24,new me(2,43)),new Ee(18,new me(2,15),new me(2,16)),new Ee(22,new me(2,11),new me(2,12))),new Ie(6,Int32Array.from([6,34]),new Ee(18,new me(2,68)),new Ee(16,new me(4,27)),new Ee(24,new me(4,19)),new Ee(28,new me(4,15))),new Ie(7,Int32Array.from([6,22,38]),new Ee(20,new me(2,78)),new Ee(18,new me(4,31)),new Ee(18,new me(2,14),new me(4,15)),new Ee(26,new me(4,13),new me(1,14))),new Ie(8,Int32Array.from([6,24,42]),new Ee(24,new me(2,97)),new Ee(22,new me(2,38),new me(2,39)),new Ee(22,new me(4,18),new me(2,19)),new Ee(26,new me(4,14),new me(2,15))),new Ie(9,Int32Array.from([6,26,46]),new Ee(30,new me(2,116)),new Ee(22,new me(3,36),new me(2,37)),new Ee(20,new me(4,16),new me(4,17)),new Ee(24,new me(4,12),new me(4,13))),new Ie(10,Int32Array.from([6,28,50]),new Ee(18,new me(2,68),new me(2,69)),new Ee(26,new me(4,43),new me(1,44)),new Ee(24,new me(6,19),new me(2,20)),new Ee(28,new me(6,15),new me(2,16))),new Ie(11,Int32Array.from([6,30,54]),new Ee(20,new me(4,81)),new Ee(30,new me(1,50),new me(4,51)),new Ee(28,new me(4,22),new me(4,23)),new Ee(24,new me(3,12),new me(8,13))),new Ie(12,Int32Array.from([6,32,58]),new Ee(24,new me(2,92),new me(2,93)),new Ee(22,new me(6,36),new me(2,37)),new Ee(26,new me(4,20),new me(6,21)),new Ee(28,new me(7,14),new me(4,15))),new Ie(13,Int32Array.from([6,34,62]),new Ee(26,new me(4,107)),new Ee(22,new me(8,37),new me(1,38)),new Ee(24,new me(8,20),new me(4,21)),new Ee(22,new me(12,11),new me(4,12))),new Ie(14,Int32Array.from([6,26,46,66]),new Ee(30,new me(3,115),new me(1,116)),new Ee(24,new me(4,40),new me(5,41)),new Ee(20,new me(11,16),new me(5,17)),new Ee(24,new me(11,12),new me(5,13))),new Ie(15,Int32Array.from([6,26,48,70]),new Ee(22,new me(5,87),new me(1,88)),new Ee(24,new me(5,41),new me(5,42)),new Ee(30,new me(5,24),new me(7,25)),new Ee(24,new me(11,12),new me(7,13))),new Ie(16,Int32Array.from([6,26,50,74]),new Ee(24,new me(5,98),new me(1,99)),new Ee(28,new me(7,45),new me(3,46)),new Ee(24,new me(15,19),new me(2,20)),new Ee(30,new me(3,15),new me(13,16))),new Ie(17,Int32Array.from([6,30,54,78]),new Ee(28,new me(1,107),new me(5,108)),new Ee(28,new me(10,46),new me(1,47)),new Ee(28,new me(1,22),new me(15,23)),new Ee(28,new me(2,14),new me(17,15))),new Ie(18,Int32Array.from([6,30,56,82]),new Ee(30,new me(5,120),new me(1,121)),new Ee(26,new me(9,43),new me(4,44)),new Ee(28,new me(17,22),new me(1,23)),new Ee(28,new me(2,14),new me(19,15))),new Ie(19,Int32Array.from([6,30,58,86]),new Ee(28,new me(3,113),new me(4,114)),new Ee(26,new me(3,44),new me(11,45)),new Ee(26,new me(17,21),new me(4,22)),new Ee(26,new me(9,13),new me(16,14))),new Ie(20,Int32Array.from([6,34,62,90]),new Ee(28,new me(3,107),new me(5,108)),new Ee(26,new me(3,41),new me(13,42)),new Ee(30,new me(15,24),new me(5,25)),new Ee(28,new me(15,15),new me(10,16))),new Ie(21,Int32Array.from([6,28,50,72,94]),new Ee(28,new me(4,116),new me(4,117)),new Ee(26,new me(17,42)),new Ee(28,new me(17,22),new me(6,23)),new Ee(30,new me(19,16),new me(6,17))),new Ie(22,Int32Array.from([6,26,50,74,98]),new Ee(28,new me(2,111),new me(7,112)),new Ee(28,new me(17,46)),new Ee(30,new me(7,24),new me(16,25)),new Ee(24,new me(34,13))),new Ie(23,Int32Array.from([6,30,54,78,102]),new Ee(30,new me(4,121),new me(5,122)),new Ee(28,new me(4,47),new me(14,48)),new Ee(30,new me(11,24),new me(14,25)),new Ee(30,new me(16,15),new me(14,16))),new Ie(24,Int32Array.from([6,28,54,80,106]),new Ee(30,new me(6,117),new me(4,118)),new Ee(28,new me(6,45),new me(14,46)),new Ee(30,new me(11,24),new me(16,25)),new Ee(30,new me(30,16),new me(2,17))),new Ie(25,Int32Array.from([6,32,58,84,110]),new Ee(26,new me(8,106),new me(4,107)),new Ee(28,new me(8,47),new me(13,48)),new Ee(30,new me(7,24),new me(22,25)),new Ee(30,new me(22,15),new me(13,16))),new Ie(26,Int32Array.from([6,30,58,86,114]),new Ee(28,new me(10,114),new me(2,115)),new Ee(28,new me(19,46),new me(4,47)),new Ee(28,new me(28,22),new me(6,23)),new Ee(30,new me(33,16),new me(4,17))),new Ie(27,Int32Array.from([6,34,62,90,118]),new Ee(30,new me(8,122),new me(4,123)),new Ee(28,new me(22,45),new me(3,46)),new Ee(30,new me(8,23),new me(26,24)),new Ee(30,new me(12,15),new me(28,16))),new Ie(28,Int32Array.from([6,26,50,74,98,122]),new Ee(30,new me(3,117),new me(10,118)),new Ee(28,new me(3,45),new me(23,46)),new Ee(30,new me(4,24),new me(31,25)),new Ee(30,new me(11,15),new me(31,16))),new Ie(29,Int32Array.from([6,30,54,78,102,126]),new Ee(30,new me(7,116),new me(7,117)),new Ee(28,new me(21,45),new me(7,46)),new Ee(30,new me(1,23),new me(37,24)),new Ee(30,new me(19,15),new me(26,16))),new Ie(30,Int32Array.from([6,26,52,78,104,130]),new Ee(30,new me(5,115),new me(10,116)),new Ee(28,new me(19,47),new me(10,48)),new Ee(30,new me(15,24),new me(25,25)),new Ee(30,new me(23,15),new me(25,16))),new Ie(31,Int32Array.from([6,30,56,82,108,134]),new Ee(30,new me(13,115),new me(3,116)),new Ee(28,new me(2,46),new me(29,47)),new Ee(30,new me(42,24),new me(1,25)),new Ee(30,new me(23,15),new me(28,16))),new Ie(32,Int32Array.from([6,34,60,86,112,138]),new Ee(30,new me(17,115)),new Ee(28,new me(10,46),new me(23,47)),new Ee(30,new me(10,24),new me(35,25)),new Ee(30,new me(19,15),new me(35,16))),new Ie(33,Int32Array.from([6,30,58,86,114,142]),new Ee(30,new me(17,115),new me(1,116)),new Ee(28,new me(14,46),new me(21,47)),new Ee(30,new me(29,24),new me(19,25)),new Ee(30,new me(11,15),new me(46,16))),new Ie(34,Int32Array.from([6,34,62,90,118,146]),new Ee(30,new me(13,115),new me(6,116)),new Ee(28,new me(14,46),new me(23,47)),new Ee(30,new me(44,24),new me(7,25)),new Ee(30,new me(59,16),new me(1,17))),new Ie(35,Int32Array.from([6,30,54,78,102,126,150]),new Ee(30,new me(12,121),new me(7,122)),new Ee(28,new me(12,47),new me(26,48)),new Ee(30,new me(39,24),new me(14,25)),new Ee(30,new me(22,15),new me(41,16))),new Ie(36,Int32Array.from([6,24,50,76,102,128,154]),new Ee(30,new me(6,121),new me(14,122)),new Ee(28,new me(6,47),new me(34,48)),new Ee(30,new me(46,24),new me(10,25)),new Ee(30,new me(2,15),new me(64,16))),new Ie(37,Int32Array.from([6,28,54,80,106,132,158]),new Ee(30,new me(17,122),new me(4,123)),new Ee(28,new me(29,46),new me(14,47)),new Ee(30,new me(49,24),new me(10,25)),new Ee(30,new me(24,15),new me(46,16))),new Ie(38,Int32Array.from([6,32,58,84,110,136,162]),new Ee(30,new me(4,122),new me(18,123)),new Ee(28,new me(13,46),new me(32,47)),new Ee(30,new me(48,24),new me(14,25)),new Ee(30,new me(42,15),new me(32,16))),new Ie(39,Int32Array.from([6,26,54,82,110,138,166]),new Ee(30,new me(20,117),new me(4,118)),new Ee(28,new me(40,47),new me(7,48)),new Ee(30,new me(43,24),new me(22,25)),new Ee(30,new me(10,15),new me(67,16))),new Ie(40,Int32Array.from([6,30,58,86,114,142,170]),new Ee(30,new me(19,118),new me(6,119)),new Ee(28,new me(18,47),new me(31,48)),new Ee(30,new me(34,24),new me(34,25)),new Ee(30,new me(20,15),new me(61,16)))],function(t){t[t.DATA_MASK_000=0]="DATA_MASK_000",t[t.DATA_MASK_001=1]="DATA_MASK_001",t[t.DATA_MASK_010=2]="DATA_MASK_010",t[t.DATA_MASK_011=3]="DATA_MASK_011",t[t.DATA_MASK_100=4]="DATA_MASK_100",t[t.DATA_MASK_101=5]="DATA_MASK_101",t[t.DATA_MASK_110=6]="DATA_MASK_110",t[t.DATA_MASK_111=7]="DATA_MASK_111"}(X||(X={}));class _e{constructor(t,e){this.value=t,this.isMasked=e}unmaskBitMatrix(t,e){for(let r=0;r!(t+e&1)))],[X.DATA_MASK_001,new _e(X.DATA_MASK_001,((t,e)=>!(1&t)))],[X.DATA_MASK_010,new _e(X.DATA_MASK_010,((t,e)=>e%3==0))],[X.DATA_MASK_011,new _e(X.DATA_MASK_011,((t,e)=>(t+e)%3==0))],[X.DATA_MASK_100,new _e(X.DATA_MASK_100,((t,e)=>!(Math.floor(t/2)+Math.floor(e/3)&1)))],[X.DATA_MASK_101,new _e(X.DATA_MASK_101,((t,e)=>t*e%6==0))],[X.DATA_MASK_110,new _e(X.DATA_MASK_110,((t,e)=>t*e%6<3))],[X.DATA_MASK_111,new _e(X.DATA_MASK_111,((t,e)=>!(t+e+t*e%3&1)))]]);class Se{constructor(t){const e=t.getHeight();if(e<21||1!=(3&e))throw new m;this.bitMatrix=t}readFormatInformation(){if(null!==this.parsedFormatInfo&&void 0!==this.parsedFormatInfo)return this.parsedFormatInfo;let t=0;for(let e=0;e<6;e++)t=this.copyBit(e,8,t);t=this.copyBit(7,8,t),t=this.copyBit(8,8,t),t=this.copyBit(8,7,t);for(let e=5;e>=0;e--)t=this.copyBit(8,e,t);const e=this.bitMatrix.getHeight();let r=0;const n=e-7;for(let t=e-1;t>=n;t--)r=this.copyBit(8,t,r);for(let t=e-8;t=0;e--)for(let i=t-9;i>=n;i--)r=this.copyBit(i,e,r);let i=Ie.decodeVersionInformation(r);if(null!==i&&i.getDimensionForVersion()===t)return this.parsedVersion=i,i;r=0;for(let e=5;e>=0;e--)for(let i=t-9;i>=n;i--)r=this.copyBit(e,i,r);if(i=Ie.decodeVersionInformation(r),null!==i&&i.getDimensionForVersion()===t)return this.parsedVersion=i,i;throw new m}copyBit(t,e,r){return(this.isMirror?this.bitMatrix.get(e,t):this.bitMatrix.get(t,e))?r<<1|1:r<<1}readCodewords(){const t=this.readFormatInformation(),e=this.readVersion(),r=_e.values.get(t.getDataMask()),n=this.bitMatrix.getHeight();r.unmaskBitMatrix(this.bitMatrix,n);const i=e.buildFunctionPattern();let s=!0;const o=new Uint8Array(e.getTotalCodewords());let a=0,h=0,l=0;for(let t=n-1;t>0;t-=2){6===t&&t--;for(let e=0;e=0;){if(o[c].codewords.length===l)break;c--}c++;const d=l-n.getECCodewordsPerBlock();let u=0;for(let e=0;et.available())throw new m;const n=new Uint8Array(2*r);let i=0;for(;r>0;){const e=t.readBits(13);let s=e/96<<8&4294967295|e%96;s+=s<959?41377:42657,n[i]=s>>8&255,n[i+1]=255&s,i+=2,r--}try{e.append(S.decode(n,p.GB2312))}catch(t){throw new m(t)}}static decodeKanjiSegment(t,e,r){if(13*r>t.available())throw new m;const n=new Uint8Array(2*r);let i=0;for(;r>0;){const e=t.readBits(13);let s=e/192<<8&4294967295|e%192;s+=s<7936?33088:49472,n[i]=s>>8,n[i+1]=s,i+=2,r--}try{e.append(S.decode(n,p.SHIFT_JIS))}catch(t){throw new m(t)}}static decodeByteSegment(t,e,r,n,i,s){if(8*r>t.available())throw new m;const o=new Uint8Array(r);for(let e=0;e=Re.ALPHANUMERIC_CHARS.length)throw new m;return Re.ALPHANUMERIC_CHARS[t]}static decodeAlphanumericSegment(t,e,r,n){const i=e.length();for(;r>1;){if(t.available()<11)throw new m;const n=t.readBits(11);e.append(Re.toAlphaNumericChar(Math.floor(n/45))),e.append(Re.toAlphaNumericChar(n%45)),r-=2}if(1===r){if(t.available()<6)throw new m;e.append(Re.toAlphaNumericChar(t.readBits(6)))}if(n)for(let t=i;t=3;){if(t.available()<10)throw new m;const n=t.readBits(10);if(n>=1e3)throw new m;e.append(Re.toAlphaNumericChar(Math.floor(n/100))),e.append(Re.toAlphaNumericChar(Math.floor(n/10)%10)),e.append(Re.toAlphaNumericChar(n%10)),r-=3}if(2===r){if(t.available()<7)throw new m;const r=t.readBits(7);if(r>=100)throw new m;e.append(Re.toAlphaNumericChar(Math.floor(r/10))),e.append(Re.toAlphaNumericChar(r%10))}else if(1===r){if(t.available()<4)throw new m;const r=t.readBits(4);if(r>=10)throw new m;e.append(Re.toAlphaNumericChar(r))}}static parseECIValue(t){const e=t.readBits(8);if(!(128&e))return 127&e;if(128==(192&e)){return(63&e)<<8&4294967295|t.readBits(8)}if(192==(224&e)){return(31&e)<<16&4294967295|t.readBits(16)}throw new m}}Re.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Re.GB2312_SUBSET=1;class Ne{constructor(t){this.mirrored=t}isMirrored(){return this.mirrored}applyMirroredCorrection(t){if(!this.mirrored||null===t||t.length<3)return;const e=t[0];t[0]=t[2],t[2]=e}}class ye{constructor(){this.rsDecoder=new $(Q.QR_CODE_FIELD_256)}decodeBooleanArray(t,e){return this.decodeBitMatrix(R.parseFromBooleanArray(t),e)}decodeBitMatrix(t,e){const r=new Se(t);let n=null;try{return this.decodeBitMatrixParser(r,e)}catch(t){n=t}try{r.remask(),r.setMirror(!0),r.readVersion(),r.readFormatInformation(),r.mirror();const t=this.decodeBitMatrixParser(r,e);return t.setOther(new Ne(!0)),t}catch(t){if(null!==n)throw n;throw t}}decodeBitMatrixParser(t,e){const r=t.readVersion(),n=t.readFormatInformation().getErrorCorrectionLevel(),i=t.readCodewords(),s=pe.getDataBlocks(i,r,n);let o=0;for(const t of s)o+=t.getNumDataCodewords();const a=new Uint8Array(o);let h=0;for(const t of s){const e=t.getCodewords(),r=t.getNumDataCodewords();this.correctErrors(e,r);for(let t=0;t=r)return!1;return!0}crossCheckVertical(t,e,r,n){const i=this.image,s=i.getHeight(),o=this.crossCheckStateCount;o[0]=0,o[1]=0,o[2]=0;let a=t;for(;a>=0&&i.get(e,a)&&o[1]<=r;)o[1]++,a--;if(a<0||o[1]>r)return NaN;for(;a>=0&&!i.get(e,a)&&o[0]<=r;)o[0]++,a--;if(o[0]>r)return NaN;for(a=t+1;ar)return NaN;for(;ar)return NaN;const h=o[0]+o[1]+o[2];return 5*Math.abs(h-n)>=2*n?NaN:this.foundPatternCross(o)?Oe.centerFromEnd(o,a):NaN}handlePossibleCenter(t,e,r){const n=t[0]+t[1]+t[2],i=Oe.centerFromEnd(t,r),s=this.crossCheckVertical(e,i,2*t[1],n);if(!isNaN(s)){const e=(t[0]+t[1]+t[2])/3;for(const t of this.possibleCenters)if(t.aboutEquals(e,s,i))return t.combineEstimate(s,i,e);const r=new De(i,s,e);this.possibleCenters.push(r),null!==this.resultPointCallback&&void 0!==this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(r)}return null}}class Me extends nt{constructor(t,e,r,n){super(t,e),this.estimatedModuleSize=r,this.count=n,void 0===n&&(this.count=1)}getEstimatedModuleSize(){return this.estimatedModuleSize}getCount(){return this.count}aboutEquals(t,e,r){if(Math.abs(e-this.getY())<=t&&Math.abs(r-this.getX())<=t){const e=Math.abs(t-this.estimatedModuleSize);return e<=1||e<=this.estimatedModuleSize}return!1}combineEstimate(t,e,r){const n=this.count+1,i=(this.count*this.getX()+e)/n,s=(this.count*this.getY()+t)/n,o=(this.count*this.estimatedModuleSize+r)/n;return new Me(i,s,o,n)}}class be{constructor(t){this.bottomLeft=t[0],this.topLeft=t[1],this.topRight=t[2]}getBottomLeft(){return this.bottomLeft}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}}class Be{constructor(t,e){this.image=t,this.resultPointCallback=e,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=e}getImage(){return this.image}getPossibleCenters(){return this.possibleCenters}find(t){const e=null!=t&&void 0!==t.get(E.TRY_HARDER),r=null!=t&&void 0!==t.get(E.PURE_BARCODE),n=this.image,i=n.getHeight(),s=n.getWidth();let o=Math.floor(3*i/(4*Be.MAX_MODULES));(oh[2]&&(t+=e-h[2]-o,i=s-1)}e=0,h[0]=0,h[1]=0,h[2]=0,h[3]=0,h[4]=0}else h[0]=h[2],h[1]=h[3],h[2]=h[4],h[3]=1,h[4]=0,e=3;else h[++e]++;if(Be.foundPatternCross(h)){!0===this.handlePossibleCenter(h,t,s,r)&&(o=h[0],this.hasSkipped&&(a=this.haveMultiplyConfirmedCenters()))}}const l=this.selectBestPatterns();return nt.orderBestPatterns(l),new be(l)}static centerFromEnd(t,e){return e-t[4]-t[3]-t[2]/2}static foundPatternCross(t){let e=0;for(let r=0;r<5;r++){const n=t[r];if(0===n)return!1;e+=n}if(e<7)return!1;const r=e/7,n=r/2;return Math.abs(r-t[0])=s&&e>=s&&o.get(e-s,t-s);)i[2]++,s++;if(t=s&&e>=s&&!o.get(e-s,t-s)&&i[1]<=r;)i[1]++,s++;if(tr)return!1;for(;t>=s&&e>=s&&o.get(e-s,t-s)&&i[0]<=r;)i[0]++,s++;if(i[0]>r)return!1;const a=o.getHeight(),h=o.getWidth();for(s=1;t+s=a||e+s>=h)return!1;for(;t+s=a||e+s>=h||i[3]>=r)return!1;for(;t+s=r)return!1;const l=i[0]+i[1]+i[2]+i[3]+i[4];return Math.abs(l-n)<2*n&&Be.foundPatternCross(i)}crossCheckVertical(t,e,r,n){const i=this.image,s=i.getHeight(),o=this.getCrossCheckStateCount();let a=t;for(;a>=0&&i.get(e,a);)o[2]++,a--;if(a<0)return NaN;for(;a>=0&&!i.get(e,a)&&o[1]<=r;)o[1]++,a--;if(a<0||o[1]>r)return NaN;for(;a>=0&&i.get(e,a)&&o[0]<=r;)o[0]++,a--;if(o[0]>r)return NaN;for(a=t+1;a=r)return NaN;for(;a=r)return NaN;const h=o[0]+o[1]+o[2]+o[3]+o[4];return 5*Math.abs(h-n)>=2*n?NaN:Be.foundPatternCross(o)?Be.centerFromEnd(o,a):NaN}crossCheckHorizontal(t,e,r,n){const i=this.image,s=i.getWidth(),o=this.getCrossCheckStateCount();let a=t;for(;a>=0&&i.get(a,e);)o[2]++,a--;if(a<0)return NaN;for(;a>=0&&!i.get(a,e)&&o[1]<=r;)o[1]++,a--;if(a<0||o[1]>r)return NaN;for(;a>=0&&i.get(a,e)&&o[0]<=r;)o[0]++,a--;if(o[0]>r)return NaN;for(a=t+1;a=r)return NaN;for(;a=r)return NaN;const h=o[0]+o[1]+o[2]+o[3]+o[4];return 5*Math.abs(h-n)>=n?NaN:Be.foundPatternCross(o)?Be.centerFromEnd(o,a):NaN}handlePossibleCenter(t,e,r,n){const i=t[0]+t[1]+t[2]+t[3]+t[4];let s=Be.centerFromEnd(t,r),o=this.crossCheckVertical(e,Math.floor(s),t[2],i);if(!isNaN(o)&&(s=this.crossCheckHorizontal(Math.floor(s),Math.floor(o),t[2],i),!isNaN(s)&&(!n||this.crossCheckDiagonal(Math.floor(o),Math.floor(s),t[2],i)))){const t=i/7;let e=!1;const r=this.possibleCenters;for(let n=0,i=r.length;n=Be.CENTER_QUORUM){if(null!=t)return this.hasSkipped=!0,Math.floor((Math.abs(t.getX()-e.getX())-Math.abs(t.getY()-e.getY()))/2);t=e}return 0}haveMultiplyConfirmedCenters(){let t=0,e=0;const r=this.possibleCenters.length;for(const r of this.possibleCenters)r.getCount()>=Be.CENTER_QUORUM&&(t++,e+=r.getEstimatedModuleSize());if(t<3)return!1;const n=e/r;let i=0;for(const t of this.possibleCenters)i+=Math.abs(t.getEstimatedModuleSize()-n);return i<=.05*e}selectBestPatterns(){const t=this.possibleCenters.length;if(t<3)throw new N;const e=this.possibleCenters;let r;if(t>3){let n=0,i=0;for(const t of this.possibleCenters){const e=t.getEstimatedModuleSize();n+=e,i+=e*e}r=n/t;let s=Math.sqrt(i/t-r*r);e.sort(((t,e)=>{const n=Math.abs(e.getEstimatedModuleSize()-r),i=Math.abs(t.getEstimatedModuleSize()-r);return ni?1:0}));const o=Math.max(.2*r,s);for(let t=0;t3;t++){const n=e[t];Math.abs(n.getEstimatedModuleSize()-r)>o&&(e.splice(t,1),t--)}}if(e.length>3){let t=0;for(const r of e)t+=r.getEstimatedModuleSize();r=t/e.length,e.sort(((t,e)=>{if(e.getCount()===t.getCount()){const n=Math.abs(e.getEstimatedModuleSize()-r),i=Math.abs(t.getEstimatedModuleSize()-r);return ni?-1:0}return e.getCount()-t.getCount()})),e.splice(3)}return[e[0],e[1],e[2]]}}Be.CENTER_QUORUM=2,Be.MIN_SKIP=3,Be.MAX_MODULES=57;class Pe{constructor(t){this.image=t}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(t){this.resultPointCallback=null==t?null:t.get(E.NEED_RESULT_POINT_CALLBACK);const e=new Be(this.image,this.resultPointCallback).find(t);return this.processFinderPatternInfo(e)}processFinderPatternInfo(t){const e=t.getTopLeft(),r=t.getTopRight(),n=t.getBottomLeft(),i=this.calculateModuleSize(e,r,n);if(i<1)throw new N("No pattern found in proccess finder.");const s=Pe.computeDimension(e,r,n,i),o=Ie.getProvisionalVersionForDimension(s),a=o.getDimensionForVersion()-7;let h=null;if(o.getAlignmentPatternCenters().length>0){const t=r.getX()-e.getX()+n.getX(),s=r.getY()-e.getY()+n.getY(),o=1-3/a,l=Math.floor(e.getX()+o*(t-e.getX())),c=Math.floor(e.getY()+o*(s-e.getY()));for(let t=4;t<=16;t<<=1)try{h=this.findAlignmentInRegion(i,l,c,t);break}catch(t){if(!(t instanceof N))throw t}}const l=Pe.createTransform(e,r,n,h,s),c=Pe.sampleGrid(this.image,l,s);let d;return d=null===h?[n,e,r]:[n,e,r,h],new it(c,d)}static createTransform(t,e,r,n,i){const s=i-3.5;let o,a,h,l;return null!==n?(o=n.getX(),a=n.getY(),h=s-3,l=h):(o=e.getX()-t.getX()+r.getX(),a=e.getY()-t.getY()+r.getY(),h=s,l=s),ht.quadrilateralToQuadrilateral(3.5,3.5,s,3.5,h,l,3.5,s,t.getX(),t.getY(),e.getX(),e.getY(),o,a,r.getX(),r.getY())}static sampleGrid(t,e,r){return ct.getInstance().sampleGridWithTransform(t,r,r,e)}static computeDimension(t,e,r,n){const i=et.round(nt.distance(t,e)/n),s=et.round(nt.distance(t,r)/n);let o=Math.floor((i+s)/2)+7;switch(3&o){case 0:o++;break;case 2:o--;break;case 3:throw new N("Dimensions could be not found.")}return o}calculateModuleSize(t,e,r){return(this.calculateModuleSizeOneWay(t,e)+this.calculateModuleSizeOneWay(t,r))/2}calculateModuleSizeOneWay(t,e){const r=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.getX()),Math.floor(t.getY()),Math.floor(e.getX()),Math.floor(e.getY())),n=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.getX()),Math.floor(e.getY()),Math.floor(t.getX()),Math.floor(t.getY()));return isNaN(r)?n/7:isNaN(n)?r/7:(r+n)/14}sizeOfBlackWhiteBlackRunBothWays(t,e,r,n){let i=this.sizeOfBlackWhiteBlackRun(t,e,r,n),s=1,o=t-(r-t);o<0?(s=t/(t-o),o=0):o>=this.image.getWidth()&&(s=(this.image.getWidth()-1-t)/(o-t),o=this.image.getWidth()-1);let a=Math.floor(e-(n-e)*s);return s=1,a<0?(s=e/(e-a),a=0):a>=this.image.getHeight()&&(s=(this.image.getHeight()-1-e)/(a-e),a=this.image.getHeight()-1),o=Math.floor(t+(o-t)*s),i+=this.sizeOfBlackWhiteBlackRun(t,e,o,a),i-1}sizeOfBlackWhiteBlackRun(t,e,r,n){const i=Math.abs(n-e)>Math.abs(r-t);if(i){let i=t;t=e,e=i,i=r,r=n,n=i}const s=Math.abs(r-t),o=Math.abs(n-e);let a=-s/2;const h=t0){if(u===n)break;u+=l,a-=s}}return 2===c?et.distance(r+h,n,t,e):NaN}findAlignmentInRegion(t,e,r,n){const i=Math.floor(n*t),s=Math.max(0,e-i),o=Math.min(this.image.getWidth()-1,e+i);if(o-s<3*t)throw new N("Alignment top exceeds estimated module size.");const a=Math.max(0,r-i),h=Math.min(this.image.getHeight()-1,r+i);if(h-a<3*t)throw new N("Alignment bottom exceeds estimated module size.");return new Oe(this.image,s,a,o-s,h-a,t,this.resultPointCallback).find()}}class Le{constructor(){this.decoder=new ye}getDecoder(){return this.decoder}decode(t,e){let r,n;if(null!=e&&void 0!==e.get(E.PURE_BARCODE)){const i=Le.extractPureBits(t.getBlackMatrix());r=this.decoder.decodeBitMatrix(i,e),n=Le.NO_POINTS}else{const i=new Pe(t.getBlackMatrix()).detect(e);r=this.decoder.decodeBitMatrix(i.getBits(),e),n=i.getPoints()}r.getOther()instanceof Ne&&r.getOther().applyMirroredCorrection(n);const i=new v(r.getText(),r.getRawBytes(),void 0,n,x.QR_CODE,void 0),s=r.getByteSegments();null!==s&&i.putMetadata(z.BYTE_SEGMENTS,s);const o=r.getECLevel();return null!==o&&i.putMetadata(z.ERROR_CORRECTION_LEVEL,o),r.hasStructuredAppend()&&(i.putMetadata(z.STRUCTURED_APPEND_SEQUENCE,r.getStructuredAppendSequenceNumber()),i.putMetadata(z.STRUCTURED_APPEND_PARITY,r.getStructuredAppendParity())),i}reset(){}static extractPureBits(t){const e=t.getTopLeftOnBit(),r=t.getBottomRightOnBit();if(null===e||null===r)throw new N;const n=this.moduleSize(e,t);let i=e[1],s=r[1],o=e[0],a=r[0];if(o>=a||i>=s)throw new N;if(s-i!=a-o&&(a=o+(s-i),a>=t.getWidth()))throw new N;const h=Math.round((a-o+1)/n),l=Math.round((s-i+1)/n);if(h<=0||l<=0)throw new N;if(l!==h)throw new N;const c=Math.floor(n/2);i+=c,o+=c;const d=o+Math.floor((h-1)*n)-a;if(d>0){if(d>c)throw new N;o-=d}const u=i+Math.floor((l-1)*n)-s;if(u>0){if(u>c)throw new N;i-=u}const g=new R(h,l);for(let e=0;e0;){const o=ke.findGuardPattern(t,i,--n,r,!1,s,h);if(null==o){n++;break}e=o}o[0]=new nt(e[0],n),o[1]=new nt(e[1],n),a=!0;break}}let l=n+1;if(a){let n=0,i=Int32Array.from([Math.trunc(o[0].getX()),Math.trunc(o[1].getX())]);for(;lke.SKIPPED_ROW_COUNT_MAX)break;n++}}l-=n+1,o[2]=new nt(i[0],l),o[3]=new nt(i[1],l)}return l-n0&&h++s?n-s:s-n;if(h>r)return 1/0;a+=h}return a/i}}ke.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),ke.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),ke.MAX_AVG_VARIANCE=.42,ke.MAX_INDIVIDUAL_VARIANCE=.8,ke.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),ke.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),ke.MAX_PIXEL_DRIFT=3,ke.MAX_PATTERN_DRIFT=5,ke.SKIPPED_ROW_COUNT_MAX=25,ke.ROW_STEP=5,ke.BARCODE_MIN_HEIGHT=10;class xe{constructor(t,e){if(0===e.length)throw new a;this.field=t;let r=e.length;if(r>1&&0===e[0]){let t=1;for(;tr.length){let t=e;e=r,r=t}let n=new Int32Array(r.length),i=r.length-e.length;d.arraycopy(r,0,n,0,i);for(let t=i;t=0;e--){let r=this.getCoefficient(e);0!==r&&(r<0?(t.append(" - "),r=-r):t.length()>0&&t.append(" + "),0!==e&&1===r||t.append(r),0!==e&&(1===e?t.append("x"):(t.append("x^"),t.append(e))))}return t.toString()}}class Ve{add(t,e){return(t+e)%this.modulus}subtract(t,e){return(this.modulus+t-e)%this.modulus}exp(t){return this.expTable[t]}log(t){if(0===t)throw new a;return this.logTable[t]}inverse(t){if(0===t)throw new q;return this.expTable[this.modulus-this.logTable[t]-1]}multiply(t,e){return 0===t||0===e?0:this.expTable[(this.logTable[t]+this.logTable[e])%(this.modulus-1)]}getSize(){return this.modulus}equals(t){return t===this}}class He extends Ve{constructor(t,e){super(),this.modulus=t,this.expTable=new Int32Array(t),this.logTable=new Int32Array(t);let r=1;for(let n=0;n0;t--){let r=n.evaluateAt(this.field.exp(t));i[e-t]=r,0!==r&&(s=!0)}if(!s)return 0;let o=this.field.getOne();if(null!=r)for(const e of r){let r=this.field.exp(t.length-1-e),n=new xe(this.field,new Int32Array([this.field.subtract(0,r),1]));o=o.multiply(n)}let a=new xe(this.field,i),h=this.runEuclideanAlgorithm(this.field.buildMonomial(e,1),a,e),c=h[0],d=h[1],u=this.findErrorLocations(c),g=this.findErrorMagnitudes(d,c,u);for(let e=0;e=Math.round(r/2);){let t=n,e=s;if(n=i,s=o,n.isZero())throw l.getChecksumInstance();i=t;let r=this.field.getZero(),a=n.getCoefficient(n.getDegree()),h=this.field.inverse(a);for(;i.getDegree()>=n.getDegree()&&!i.isZero();){let t=i.getDegree()-n.getDegree(),e=this.field.multiply(i.getCoefficient(i.getDegree()),h);r=r.add(this.field.buildMonomial(t,e)),i=i.subtract(n.multiplyByMonomial(t,e))}o=r.multiply(s).subtract(e).negative()}let a=o.getCoefficient(0);if(0===a)throw l.getChecksumInstance();let h=this.field.inverse(a);return[o.multiply(h),i.multiply(h)]}findErrorLocations(t){let e=t.getDegree(),r=new Int32Array(e),n=0;for(let i=1;i0){let e=r?this.topLeft:this.topRight,i=Math.trunc(e.getY()-t);i<0&&(i=0);let o=new nt(e.getX(),i);r?n=o:s=o}if(e>0){let t=r?this.bottomLeft:this.bottomRight,n=Math.trunc(t.getY()+e);n>=this.image.getHeight()&&(n=this.image.getHeight()-1);let s=new nt(t.getX(),n);r?i=s:o=s}return new Xe(this.image,n,i,s,o)}getMinX(){return this.minX}getMaxX(){return this.maxX}getMinY(){return this.minY}getMaxY(){return this.maxY}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}getBottomLeft(){return this.bottomLeft}getBottomRight(){return this.bottomRight}}class Ge{constructor(t,e,r,n){this.columnCount=t,this.errorCorrectionLevel=n,this.rowCountUpperPart=e,this.rowCountLowerPart=r,this.rowCount=e+r}getColumnCount(){return this.columnCount}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getRowCount(){return this.rowCount}getRowCountUpperPart(){return this.rowCountUpperPart}getRowCountLowerPart(){return this.rowCountLowerPart}}class We{constructor(){this.buffer=""}static form(t,e){let r=-1;return t.replace(/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g,(function(t,n,i,s,o,a){if("%%"===t)return"%";if(void 0===e[++r])return;t=s?parseInt(s.substr(1)):void 0;let h,l=o?parseInt(o.substr(1)):void 0;switch(a){case"s":h=e[r];break;case"c":h=e[r][0];break;case"f":h=parseFloat(e[r]).toFixed(t);break;case"p":h=parseFloat(e[r]).toPrecision(t);break;case"e":h=parseFloat(e[r]).toExponential(t);break;case"x":h=parseInt(e[r]).toString(l||16);break;case"d":h=parseFloat(parseInt(e[r],l||10).toPrecision(t)).toFixed(0)}h="object"==typeof h?JSON.stringify(h):(+h).toString(l);let c=parseInt(i),d=i&&i[0]+""=="0"?"0":" ";for(;h.length=0&&(e=this.codewords[n],null!=e))return e;if(n=this.imageRowToCodewordIndex(t)+r,nr,getValue:()=>n};i.getValue()>t?(t=i.getValue(),e=[],e.push(i.getKey())):i.getValue()===t&&e.push(i.getKey())}return Fe.toIntArray(e)}getConfidence(t){return this.values.get(t)}}class Ze extends ze{constructor(t,e){super(t),this._isLeft=e}setRowNumbers(){for(let t of this.getCodewords())null!=t&&t.setRowNumberAsRowIndicatorColumn()}adjustCompleteIndicatorColumnRowNumbers(t){let e=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(e,t);let r=this.getBoundingBox(),n=this._isLeft?r.getTopLeft():r.getTopRight(),i=this._isLeft?r.getBottomLeft():r.getBottomRight(),s=this.imageRowToCodewordIndex(Math.trunc(n.getY())),o=this.imageRowToCodewordIndex(Math.trunc(i.getY())),a=-1,h=1,l=0;for(let r=s;r=t.getRowCount()||i>r)e[r]=null;else{let t;t=h>2?(h-2)*i:i;let s=t>=r;for(let n=1;n<=t&&!s;n++)s=null!=e[r-n];s?e[r]=null:(a=n.getRowNumber(),l=1)}}}getRowHeights(){let t=this.getBarcodeMetadata();if(null==t)return null;this.adjustIncompleteIndicatorColumnRowNumbers(t);let e=new Int32Array(t.getRowCount());for(let t of this.getCodewords())if(null!=t){let r=t.getRowNumber();if(r>=e.length)continue;e[r]++}return e}adjustIncompleteIndicatorColumnRowNumbers(t){let e=this.getBoundingBox(),r=this._isLeft?e.getTopLeft():e.getTopRight(),n=this._isLeft?e.getBottomLeft():e.getBottomRight(),i=this.imageRowToCodewordIndex(Math.trunc(r.getY())),s=this.imageRowToCodewordIndex(Math.trunc(n.getY())),o=this.getCodewords(),a=-1;for(let e=i;e=t.getRowCount()?o[e]=null:a=r.getRowNumber())}}getBarcodeMetadata(){let t=this.getCodewords(),e=new Ye,r=new Ye,n=new Ye,i=new Ye;for(let s of t){if(null==s)continue;s.setRowNumberAsRowIndicatorColumn();let t=s.getValue()%30,o=s.getRowNumber();switch(this._isLeft||(o+=2),o%3){case 0:r.setValue(3*t+1);break;case 1:i.setValue(t/3),n.setValue(t%3);break;case 2:e.setValue(t+1)}}if(0===e.getValue().length||0===r.getValue().length||0===n.getValue().length||0===i.getValue().length||e.getValue()[0]<1||r.getValue()[0]+n.getValue()[0]Fe.MAX_ROWS_IN_BARCODE)return null;let s=new Ge(e.getValue()[0],r.getValue()[0],n.getValue()[0],i.getValue()[0]);return this.removeIncorrectCodewords(t,s),s}removeIncorrectCodewords(t,e){for(let r=0;re.getRowCount())t[r]=null;else switch(this._isLeft||(s+=2),s%3){case 0:3*i+1!==e.getRowCountUpperPart()&&(t[r]=null);break;case 1:Math.trunc(i/3)===e.getErrorCorrectionLevel()&&i%3===e.getRowCountLowerPart()||(t[r]=null);break;case 2:i+1!==e.getColumnCount()&&(t[r]=null)}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+"\n"+super.toString()}}class Ke{constructor(t,e){this.ADJUST_ROW_NUMBER_SKIP=2,this.barcodeMetadata=t,this.barcodeColumnCount=t.getColumnCount(),this.boundingBox=e,this.detectionResultColumns=new Array(this.barcodeColumnCount+2)}getDetectionResultColumns(){this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]),this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount+1]);let t,e=Fe.MAX_CODEWORDS_IN_BARCODE;do{t=e,e=this.adjustRowNumbersAndGetCount()}while(e>0&&e0&&i0&&(o[0]=r[e-1],o[4]=i[e-1],o[5]=s[e-1]),e>1&&(o[8]=r[e-2],o[10]=i[e-2],o[11]=s[e-2]),e>=1;r=1&e,Qe.RATIOS_TABLE[t]||(Qe.RATIOS_TABLE[t]=new Array(Fe.BARS_IN_MODULE)),Qe.RATIOS_TABLE[t][Fe.BARS_IN_MODULE-n-1]=Math.fround(i/Fe.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(t){let e=Qe.getDecodedCodewordValue(Qe.sampleBitCounts(t));return-1!==e?e:Qe.getClosestDecodedValue(t)}static sampleBitCounts(t){let e=et.sum(t),r=new Int32Array(Fe.BARS_IN_MODULE),n=0,i=0;for(let s=0;s1)for(let n=0;n=n)break}enew Array(Fe.BARS_IN_MODULE)));class je{constructor(){this.segmentCount=-1,this.fileSize=-1,this.timestamp=-1,this.checksum=-1}getSegmentIndex(){return this.segmentIndex}setSegmentIndex(t){this.segmentIndex=t}getFileId(){return this.fileId}setFileId(t){this.fileId=t}getOptionalData(){return this.optionalData}setOptionalData(t){this.optionalData=t}isLastSegment(){return this.lastSegment}setLastSegment(t){this.lastSegment=t}getSegmentCount(){return this.segmentCount}setSegmentCount(t){this.segmentCount=t}getSender(){return this.sender||null}setSender(t){this.sender=t}getAddressee(){return this.addressee||null}setAddressee(t){this.addressee=t}getFileName(){return this.fileName}setFileName(t){this.fileName=t}getFileSize(){return this.fileSize}setFileSize(t){this.fileSize=t}getChecksum(){return this.checksum}setChecksum(t){this.checksum=t}getTimestamp(){return this.timestamp}setTimestamp(t){this.timestamp=t}}class Je{static parseLong(t,e=void 0){return parseInt(t,e)}}class $e extends s{}$e.kind="NullPointerException";class tr{writeBytes(t){this.writeBytesOffset(t,0,t.length)}writeBytesOffset(t,e,r){if(null==t)throw new $e;if(e<0||e>t.length||r<0||e+r>t.length||e+r<0)throw new u;if(0!==r)for(let n=0;n0&&this.grow(t)}grow(t){let e=this.buf.length<<1;if(e-t<0&&(e=t),e<0){if(t<0)throw new er;e=w.MAX_VALUE}this.buf=f.copyOfUint8Array(this.buf,e)}write(t){this.ensureCapacity(this.count+1),this.buf[this.count]=t,this.count+=1}writeBytesOffset(t,e,r){if(e<0||e>t.length||r<0||e+r-t.length>0)throw new u;this.ensureCapacity(this.count+r),d.arraycopy(t,e,this.buf,this.count,r),this.count+=r}writeTo(t){t.writeBytesOffset(this.buf,0,this.count)}reset(){this.count=0}toByteArray(){return f.copyOfUint8Array(this.buf,this.count)}size(){return this.count}toString(t){return t?"string"==typeof t?this.toString_string(t):this.toString_number(t):this.toString_void()}toString_void(){return new String(this.buf).toString()}toString_string(t){return new String(this.buf).toString()}toString_number(t){return new String(this.buf).toString()}close(){}}function nr(){if("undefined"!=typeof window)return window.BigInt||null;if("undefined"!=typeof global)return global.BigInt||null;if("undefined"!=typeof self)return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let ir;function sr(t){if(void 0===ir&&(ir=nr()),null===ir)throw new Error("BigInt is not supported!");return ir(t)}!function(t){t[t.ALPHA=0]="ALPHA",t[t.LOWER=1]="LOWER",t[t.MIXED=2]="MIXED",t[t.PUNCT=3]="PUNCT",t[t.ALPHA_SHIFT=4]="ALPHA_SHIFT",t[t.PUNCT_SHIFT=5]="PUNCT_SHIFT"}(W||(W={}));class or{static decode(t,e){let r=new T(""),n=I.ISO8859_1;r.enableDecoding(n);let i=1,s=t[i++],o=new je;for(;it[0])throw m.getFormatInstance();let n=new Int32Array(or.NUMBER_OF_SEQUENCE_CODEWORDS);for(let r=0;r0){for(let t=0;t<6;++t)s.write(Number(sr(a)>>sr(8*(5-t))));a=0,o=0}}n===e[0]&&r0){for(let t=0;t<6;++t)s.write(Number(sr(a)>>sr(8*(5-t))));a=0,o=0}}}return i.append(S.decode(s.toByteArray(),r)),n}static numericCompaction(t,e,r){let n=0,i=!1,s=new Int32Array(or.MAX_NUMERIC_CODEWORDS);for(;e0&&(r.append(or.decodeBase900toBase10(s,n)),n=0)}return e}static decodeBase900toBase10(t,e){let r=sr(0);for(let n=0;n@[\\]_`~!\r\t,:\n-.$/\"|*()?{}'",or.MIXED_CHARS="0123456789&\r\t,:#-.$/+%*=^",or.EXP900=nr()?function(){let t=[];t[0]=sr(1);let e=sr(900);t[1]=e;for(let r=2;r<16;r++)t[r]=t[r-1]*e;return t}():[],or.NUMBER_OF_SEQUENCE_CODEWORDS=2;class ar{constructor(){}static decode(t,e,r,n,i,s,o){let a,h=new Xe(t,e,r,n,i),l=null,c=null;for(let r=!0;;r=!1){if(null!=e&&(l=ar.getRowIndicatorColumn(t,h,e,!0,s,o)),null!=n&&(c=ar.getRowIndicatorColumn(t,h,n,!1,s,o)),a=ar.merge(l,c),null==a)throw N.getNotFoundInstance();let i=a.getBoundingBox();if(!r||null==i||!(i.getMinY()h.getMaxY()))break;h=i}a.setBoundingBox(h);let d=a.getBarcodeColumnCount()+1;a.setDetectionResultColumn(0,l),a.setDetectionResultColumn(d,c);let u=null!=l;for(let e=1;e<=d;e++){let r,n=u?e:d-e;if(void 0!==a.getDetectionResultColumn(n))continue;r=0===n||n===d?new Ze(h,0===n):new ze(h),a.setDetectionResultColumn(n,r);let i=-1,l=i;for(let e=h.getMinY();e<=h.getMaxY();e++){if(i=ar.getStartColumn(a,n,e,u),i<0||i>h.getMaxX()){if(-1===l)continue;i=l}let c=ar.detectCodeword(t,h.getMinX(),h.getMaxX(),u,i,e,s,o);null!=c&&(r.setCodeword(e,c),l=i,s=Math.min(s,c.getWidth()),o=Math.max(o,c.getWidth()))}}return ar.createDecoderResult(a)}static merge(t,e){if(null==t&&null==e)return null;let r=ar.getBarcodeMetadata(t,e);if(null==r)return null;let n=Xe.merge(ar.adjustBoundingBox(t),ar.adjustBoundingBox(e));return new Ke(r,n)}static adjustBoundingBox(t){if(null==t)return null;let e=t.getRowHeights();if(null==e)return null;let r=ar.getMax(e),n=0;for(let t of e)if(n+=r-t,t>0)break;let i=t.getCodewords();for(let t=0;n>0&&null==i[t];t++)n--;let s=0;for(let t=e.length-1;t>=0&&(s+=r-e[t],!(e[t]>0));t--);for(let t=i.length-1;s>0&&null==i[t];t--)s--;return t.getBoundingBox().addMissingRows(n,s,t.isLeft())}static getMax(t){let e=-1;for(let r of t)e=Math.max(e,r);return e}static getBarcodeMetadata(t,e){let r,n;return null==t||null==(r=t.getBarcodeMetadata())?null==e?null:e.getBarcodeMetadata():null==e||null==(n=e.getBarcodeMetadata())?r:r.getColumnCount()!==n.getColumnCount()&&r.getErrorCorrectionLevel()!==n.getErrorCorrectionLevel()&&r.getRowCount()!==n.getRowCount()?null:r}static getRowIndicatorColumn(t,e,r,n,i,s){let o=new Ze(e,n);for(let a=0;a<2;a++){let h=0===a?1:-1,l=Math.trunc(Math.trunc(r.getX()));for(let a=Math.trunc(Math.trunc(r.getY()));a<=e.getMaxY()&&a>=e.getMinY();a+=h){let e=ar.detectCodeword(t,0,t.getWidth(),n,l,a,i,s);null!=e&&(o.setCodeword(a,e),l=n?e.getStartX():e.getEndX())}}return o}static adjustCodewordCount(t,e){let r=e[0][1],n=r.getValue(),i=t.getBarcodeColumnCount()*t.getBarcodeRowCount()-ar.getNumberOfECCodeWords(t.getBarcodeECLevel());if(0===n.length){if(i<1||i>Fe.MAX_CODEWORDS_IN_BARCODE)throw N.getNotFoundInstance();r.setValue(i)}else n[0]!==i&&r.setValue(i)}static createDecoderResult(t){let e=ar.createBarcodeMatrix(t);ar.adjustCodewordCount(t,e);let r=new Array,n=new Int32Array(t.getBarcodeRowCount()*t.getBarcodeColumnCount()),i=[],s=new Array;for(let o=0;o0;){for(let t=0;tnew Array(t.getBarcodeColumnCount()+2)));for(let t=0;t=0){if(n>=e.length)continue;e[n][r].setValue(t.getValue())}}r++}return e}static isValidBarcodeColumn(t,e){return e>=0&&e<=t.getBarcodeColumnCount()+1}static getStartColumn(t,e,r,n){let i=n?1:-1,s=null;if(ar.isValidBarcodeColumn(t,e-i)&&(s=t.getDetectionResultColumn(e-i).getCodeword(r)),null!=s)return n?s.getEndX():s.getStartX();if(s=t.getDetectionResultColumn(e).getCodewordNearby(r),null!=s)return n?s.getStartX():s.getEndX();if(ar.isValidBarcodeColumn(t,e-i)&&(s=t.getDetectionResultColumn(e-i).getCodewordNearby(r)),null!=s)return n?s.getEndX():s.getStartX();let o=0;for(;ar.isValidBarcodeColumn(t,e-i);){e-=i;for(let r of t.getDetectionResultColumn(e).getCodewords())if(null!=r)return(n?r.getEndX():r.getStartX())+i*o*(r.getEndX()-r.getStartX());o++}return n?t.getBoundingBox().getMinX():t.getBoundingBox().getMaxX()}static detectCodeword(t,e,r,n,i,s,o,a){i=ar.adjustCodewordStartColumn(t,e,r,n,i,s);let h,l=ar.getModuleBitCount(t,e,r,n,i,s);if(null==l)return null;let c=et.sum(l);if(n)h=i+c;else{for(let t=0;t=e)&&h=e:oar.CODEWORD_SKEW_SIZE)return i;o+=a}a=-a,n=!n}return o}static checkCodewordSkew(t,e,r){return e-ar.CODEWORD_SKEW_SIZE<=t&&t<=r+ar.CODEWORD_SKEW_SIZE}static decodeCodewords(t,e,r){if(0===t.length)throw m.getFormatInstance();let n=1<r/2+ar.MAX_ERRORS||r<0||r>ar.MAX_EC_CODEWORDS)throw l.getChecksumInstance();return ar.errorCorrection.decode(t,r,e)}static verifyCodewordCount(t,e){if(t.length<4)throw m.getFormatInstance();let r=t[0];if(r>t.length)throw m.getFormatInstance();if(0===r){if(!(e>=1;return e}static getCodewordBucketNumber(t){return t instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(t):this.getCodewordBucketNumber_number(t)}static getCodewordBucketNumber_number(t){return ar.getCodewordBucketNumber(ar.getBitCountForCodeword(t))}static getCodewordBucketNumber_Int32Array(t){return(t[0]-t[2]+t[4]-t[6]+9)%9}static toString(t){let e=new We;for(let r=0;rt))}static getMaxWidth(t,e){return null==t||null==e?0:Math.trunc(Math.abs(t.getX()-e.getX()))}static getMinWidth(t,e){return null==t||null==e?w.MAX_VALUE:Math.trunc(Math.abs(t.getX()-e.getX()))}static getMaxCodewordWidth(t){return Math.floor(Math.max(Math.max(hr.getMaxWidth(t[0],t[4]),hr.getMaxWidth(t[6],t[2])*Fe.MODULES_IN_CODEWORD/Fe.MODULES_IN_STOP_PATTERN),Math.max(hr.getMaxWidth(t[1],t[5]),hr.getMaxWidth(t[7],t[3])*Fe.MODULES_IN_CODEWORD/Fe.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(t){return Math.floor(Math.min(Math.min(hr.getMinWidth(t[0],t[4]),hr.getMinWidth(t[6],t[2])*Fe.MODULES_IN_CODEWORD/Fe.MODULES_IN_STOP_PATTERN),Math.min(hr.getMinWidth(t[1],t[5]),hr.getMinWidth(t[7],t[3])*Fe.MODULES_IN_CODEWORD/Fe.MODULES_IN_STOP_PATTERN)))}reset(){}}class lr extends s{}lr.kind="ReaderException";class cr{decode(t,e){return this.setHints(e),this.decodeInternal(t)}decodeWithState(t){return null!==this.readers&&void 0!==this.readers||this.setHints(null),this.decodeInternal(t)}setHints(t){this.hints=t;const e=null!=t&&void 0!==t.get(E.TRY_HARDER),r=null==t?null:t.get(E.POSSIBLE_FORMATS),n=new Array;if(null!=r){const i=r.some((t=>t===x.UPC_A||t===x.UPC_E||t===x.EAN_13||t===x.EAN_8||t===x.CODABAR||t===x.CODE_39||t===x.CODE_93||t===x.CODE_128||t===x.ITF||t===x.RSS_14||t===x.RSS_EXPANDED));i&&!e&&n.push(new se(t)),r.includes(x.QR_CODE)&&n.push(new Le),r.includes(x.DATA_MATRIX)&&n.push(new we),r.includes(x.AZTEC)&&n.push(new gt),r.includes(x.PDF_417)&&n.push(new hr),i&&e&&n.push(new se(t))}0===n.length&&(e||n.push(new se(t)),n.push(new Le),n.push(new we),n.push(new gt),n.push(new hr),e&&n.push(new se(t))),this.readers=n}reset(){if(null!==this.readers)for(const t of this.readers)t.reset()}decodeInternal(t){if(null===this.readers)throw new lr("No readers where selected, nothing can be read.");for(const e of this.readers)try{return e.decode(t,this.hints)}catch(t){if(t instanceof lr)continue}throw new N("No MultiFormat Readers were able to detect the code.")}}var dr;!function(t){t[t.ERROR_CORRECTION=0]="ERROR_CORRECTION",t[t.CHARACTER_SET=1]="CHARACTER_SET",t[t.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",t[t.DATA_MATRIX_COMPACT=3]="DATA_MATRIX_COMPACT",t[t.MIN_SIZE=4]="MIN_SIZE",t[t.MAX_SIZE=5]="MAX_SIZE",t[t.MARGIN=6]="MARGIN",t[t.PDF417_COMPACT=7]="PDF417_COMPACT",t[t.PDF417_COMPACTION=8]="PDF417_COMPACTION",t[t.PDF417_DIMENSIONS=9]="PDF417_DIMENSIONS",t[t.AZTEC_LAYERS=10]="AZTEC_LAYERS",t[t.QR_VERSION=11]="QR_VERSION",t[t.GS1_FORMAT=12]="GS1_FORMAT",t[t.FORCE_C40=13]="FORCE_C40"}(dr||(dr={}));var ur=dr;class gr{constructor(t){this.field=t,this.cachedGenerators=[],this.cachedGenerators.push(new K(t,Int32Array.from([1])))}buildGenerator(t){const e=this.cachedGenerators;if(t>=e.length){let r=e[e.length-1];const n=this.field;for(let i=e.length;i<=t;i++){const t=r.multiply(new K(n,Int32Array.from([1,n.exp(i-1+n.getGeneratorBase())])));e.push(t),r=t}}return e[t]}encode(t,e){if(0===e)throw new a("No error correction bytes");const r=t.length-e;if(r<=0)throw new a("No data bytes provided");const n=this.buildGenerator(e),i=new Int32Array(r);d.arraycopy(t,0,i,0,r);let s=new K(this.field,i);s=s.multiplyByMonomial(e,1);const o=s.divide(n)[1].getCoefficients(),h=e-o.length;for(let e=0;e=5&&(r+=fr.N1+(n-5)),n=1,o=i)}n>=5&&(r+=fr.N1+(n-5))}return r}}fr.N1=3,fr.N2=3,fr.N3=40,fr.N4=10;class wr{constructor(t,e){this.width=t,this.height=e;const r=new Array(e);for(let n=0;n!==e;n++)r[n]=new Uint8Array(t);this.bytes=r}getHeight(){return this.height}getWidth(){return this.width}get(t,e){return this.bytes[e][t]}getArray(){return this.bytes}setNumber(t,e,r){this.bytes[e][t]=r}setBoolean(t,e,r){this.bytes[e][t]=r?1:0}clear(t){for(const e of this.bytes)f.fill(e,t)}equals(t){if(!(t instanceof wr))return!1;const e=t;if(this.width!==e.width)return!1;if(this.height!==e.height)return!1;for(let t=0,r=this.height;t>\n"),t.toString()}setMode(t){this.mode=t}setECLevel(t){this.ecLevel=t}setVersion(t){this.version=t}setMaskPattern(t){this.maskPattern=t}setMatrix(t){this.matrix=t}static isValidMaskPattern(t){return t>=0&&t0;){for(6===s&&(s-=1);o>=0&&o=r;)t^=e<=0)for(let t=0;t!==r;t++){const r=n[t];r>=0&&Er.isEmpty(e.get(r,i))&&Er.embedPositionAdjustmentPattern(r-2,i-2,e)}}}}Er.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),Er.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),Er.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),Er.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),Er.VERSION_INFO_POLY=7973,Er.TYPE_INFO_POLY=1335,Er.TYPE_INFO_MASK_PATTERN=21522;class mr{constructor(t,e){this.dataBytes=t,this.errorCorrectionBytes=e}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class Ir{constructor(){}static calculateMaskPenalty(t){return fr.applyMaskPenaltyRule1(t)+fr.applyMaskPenaltyRule2(t)+fr.applyMaskPenaltyRule3(t)+fr.applyMaskPenaltyRule4(t)}static encode(t,e,r=null){let n=Ir.DEFAULT_BYTE_MODE_ENCODING;const i=null!==r&&void 0!==r.get(ur.CHARACTER_SET);i&&(n=r.get(ur.CHARACTER_SET).toString());const s=this.chooseMode(t,n),o=new C;if(s===Te.BYTE&&(i||Ir.DEFAULT_BYTE_MODE_ENCODING!==n)){const t=I.getCharacterSetECIByName(n);void 0!==t&&this.appendECI(t,o)}this.appendModeInfo(s,o);const a=new C;let h;if(this.appendBytes(t,s,a,n),null!==r&&void 0!==r.get(ur.QR_VERSION)){const t=Number.parseInt(r.get(ur.QR_VERSION).toString(),10);h=Ie.getVersionForNumber(t);const n=this.calculateBitsNeeded(s,o,a,h);if(!this.willFit(n,h,e))throw new Ar("Data too big for requested version")}else h=this.recommendVersion(e,s,o,a);const l=new C;l.appendBitArray(o);const c=s===Te.BYTE?a.getSizeInBytes():t.length;this.appendLengthInfo(c,h,s,l),l.appendBitArray(a);const d=h.getECBlocksForLevel(e),u=h.getTotalCodewords()-d.getTotalECCodewords();this.terminateBits(u,l);const g=this.interleaveWithECBytes(l,h.getTotalCodewords(),u,d.getNumBlocks()),f=new Cr;f.setECLevel(e),f.setMode(s),f.setVersion(h);const w=h.getDimensionForVersion(),A=new wr(w,w),E=this.chooseMaskPattern(g,e,h,A);return f.setMaskPattern(E),Er.buildMatrix(g,e,h,E,A),f.setMatrix(A),f}static recommendVersion(t,e,r,n){const i=this.calculateBitsNeeded(e,r,n,Ie.getVersionForNumber(1)),s=this.chooseVersion(i,t),o=this.calculateBitsNeeded(e,r,n,s);return this.chooseVersion(o,t)}static calculateBitsNeeded(t,e,r,n){return e.getSize()+t.getCharacterCountBits(n)+r.getSize()}static getAlphanumericCode(t){return t159)&&(r<224||r>235))return!1}return!0}static chooseMaskPattern(t,e,r,n){let i=Number.MAX_SAFE_INTEGER,s=-1;for(let o=0;o=(t+7)/8}static terminateBits(t,e){const r=8*t;if(e.getSize()>r)throw new Ar("data bits cannot fit in the QR Code"+e.getSize()+" > "+r);for(let t=0;t<4&&e.getSize()0)for(let t=n;t<8;t++)e.appendBit(!1);const i=t-e.getSizeInBytes();for(let t=0;t=r)throw new Ar("Block ID too large");const o=t%r,a=r-o,h=Math.floor(t/r),l=h+1,c=Math.floor(e/r),d=c+1,u=h-c,g=l-d;if(u!==g)throw new Ar("EC bytes mismatch");if(r!==a+o)throw new Ar("RS blocks mismatch");if(t!==(c+u)*a+(d+g)*o)throw new Ar("Total bytes mismatch");n=1<=0&&e<=9}static appendNumericBytes(t,e){const r=t.length;let n=0;for(;n=33088&&n<=40956?i=n-33088:n>=57408&&n<=60351&&(i=n-49472),-1===i)throw new Ar("Invalid byte sequence");const s=192*(i>>8)+(255&i);e.appendBits(s,13)}}static appendECI(t,e){e.appendBits(Te.ECI.getBits(),4),e.appendBits(t.getValue(),8)}}Ir.ALPHANUMERIC_TABLE=Int32Array.from([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,36,-1,-1,-1,37,38,-1,-1,-1,-1,39,40,-1,41,42,43,0,1,2,3,4,5,6,7,8,9,44,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1]),Ir.DEFAULT_BYTE_MODE_ENCODING=I.UTF8.getName();class _r{write(t,e,r,n=null){if(0===t.length)throw new a("Found empty contents");if(e<0||r<0)throw new a("Requested dimensions are too small: "+e+"x"+r);let i=Ce.L,s=_r.QUIET_ZONE_SIZE;null!==n&&(void 0!==n.get(ur.ERROR_CORRECTION)&&(i=Ce.fromString(n.get(ur.ERROR_CORRECTION).toString())),void 0!==n.get(ur.MARGIN)&&(s=Number.parseInt(n.get(ur.MARGIN).toString(),10)));const o=Ir.encode(t,i,n);return this.renderResult(o,e,r,s)}writeToDom(t,e,r,n,i=null){"string"==typeof t&&(t=document.querySelector(t));const s=this.write(e,r,n,i);t&&t.appendChild(s)}renderResult(t,e,r,n){const i=t.getMatrix();if(null===i)throw new J;const s=i.getWidth(),o=i.getHeight(),a=s+2*n,h=o+2*n,l=Math.max(e,a),c=Math.max(r,h),d=Math.min(Math.floor(l/a),Math.floor(c/h)),u=Math.floor((l-s*d)/2),g=Math.floor((c-o*d)/2),f=this.createSVGElement(l,c);for(let t=0,e=g;te||i+o>r)throw new a("Crop rectangle does not fit within image data.");h&&this.reverseHorizontal(s,o)}getRow(t,e){if(t<0||t>=this.getHeight())throw new a("Requested row is outside the image: "+t);const r=this.getWidth();(null==e||e.length>16&255,s=r>>7&510,o=255&r;i[e]=(n+s+o)/4&255}this.luminances=i}else this.luminances=t;if(void 0===n&&(this.dataWidth=e),void 0===i&&(this.dataHeight=r),void 0===s&&(this.left=0),void 0===o&&(this.top=0),this.left+e>this.dataWidth||this.top+r>this.dataHeight)throw new a("Crop rectangle does not fit within image data.")}getRow(t,e){if(t<0||t>=this.getHeight())throw new a("Requested row is outside the image: "+t);const r=this.getWidth();(null==e||e.length=0&&this.noBit(r,e)&&this.utah(e,r,t++),e-=2,r+=2}while(e>=0&&r=0&&r=0);e+=3,r++}while(e{let r=1;for(let n=0;n<255;n++)e[n]=r,t[r]=n,r*=2,r>=256&&(r^=301);return{LOG:t,ALOG:e}})([],[]);var Br;t.DataMatrixSymbolShapeHint=void 0,(Br=t.DataMatrixSymbolShapeHint||(t.DataMatrixSymbolShapeHint={}))[Br.FORCE_NONE=0]="FORCE_NONE",Br[Br.FORCE_SQUARE=1]="FORCE_SQUARE",Br[Br.FORCE_RECTANGLE=2]="FORCE_RECTANGLE";const Pr="[)>05",Lr="[)>06",Fr="";class vr{static encodeECC200(t,e){if(t.length!==e.getDataCapacity())throw new Error("The number of codewords does not match the selected symbol");const r=new T;r.append(t);const n=e.getInterleavedBlockCount();if(1===n){const n=this.createECCBlock(t,e.getErrorCodewords());r.append(n)}else{const i=[];for(let t=0;t0;t--)0!==s&&0!==n[t]?i[t]=i[t-1]^br[(Mr[s]+Mr[n[t]])%255]:i[t]=i[t-1];0!==s&&0!==n[0]?i[0]=br[(Mr[s]+Mr[n[0]])%255]:i[0]=0}const s=[];for(let t=0;tString.fromCharCode(t))).join("")}}class kr{getEncodingMode(){return 0}encode(t){if(Yr.determineConsecutiveDigitCount(t.getMessage(),t.pos)>=2)t.writeCodeword(this.encodeASCIIDigits(t.getMessage().charCodeAt(t.pos),t.getMessage().charCodeAt(t.pos+1))),t.pos+=2;else{const e=t.getCurrentChar(),r=Yr.lookAheadTest(t.getMessage(),t.pos,this.getEncodingMode());if(r!==this.getEncodingMode())switch(r){case 5:return t.writeCodeword(231),void t.signalEncoderChange(5);case 1:return t.writeCodeword(230),void t.signalEncoderChange(1);case 3:t.writeCodeword(238),t.signalEncoderChange(3);break;case 2:t.writeCodeword(239),t.signalEncoderChange(2);break;case 4:t.writeCodeword(240),t.signalEncoderChange(4);break;default:throw new Error("Illegal mode: "+r)}else Yr.isExtendedASCII(e)?(t.writeCodeword(235),t.writeCodeword(e-128+1),t.pos++):(t.writeCodeword(e+1),t.pos++)}}encodeASCIIDigits(t,e){if(Yr.isDigit(t)&&Yr.isDigit(e)){return 10*(t-48)+(e-48)+130}throw new Error("not digits: "+t+e)}}class xr{getEncodingMode(){return 5}encode(t){const e=new T;for(e.append(0);t.hasMoreCharacters();){const r=t.getCurrentChar();e.append(r),t.pos++;if(Yr.lookAheadTest(t.getMessage(),t.pos,this.getEncodingMode())!==this.getEncodingMode()){t.signalEncoderChange(0);break}}const r=e.length()-1,n=t.getCodewordCount()+r+1;t.updateSymbolInfo(n);const i=t.getSymbolInfo().getDataCapacity()-n>0;if(t.hasMoreCharacters()||i)if(r<=249)e.setCharAt(0,p.getCharAt(r));else{if(!(r<=1555))throw new Error("Message length not in valid ranges: "+r);e.setCharAt(0,p.getCharAt(Math.floor(r/250)+249)),e.insert(1,p.getCharAt(r%250))}for(let r=0,n=e.length();r3||1!==o))&&(t.pos=n)}e.length()>0&&t.writeCodeword(230),this.handleEOD(t,e)}encode(t){const e=new T;for(;t.hasMoreCharacters();){const r=t.getCurrentChar();t.pos++;let n=this.encodeChar(r,e);const i=2*Math.floor(e.length()/3),s=t.getCodewordCount()+i;t.updateSymbolInfo(s);const o=t.getSymbolInfo().getDataCapacity()-s;if(!t.hasMoreCharacters()){const r=new T;for(e.length()%3==2&&2!==o&&(n=this.backtrackOneCharacter(t,e,r,n));e.length()%3==1&&(n>3||1!==o);)n=this.backtrackOneCharacter(t,e,r,n);break}if(e.length()%3==0){if(Yr.lookAheadTest(t.getMessage(),t.pos,this.getEncodingMode())!==this.getEncodingMode()){t.signalEncoderChange(0);break}}}this.handleEOD(t,e)}backtrackOneCharacter(t,e,r,n){const i=e.length(),s=e.toString().substring(0,i-n);e.setLengthToZero(),e.append(s),t.pos--;const o=t.getCurrentChar();return n=this.encodeChar(o,r),t.resetSymbolInfo(),n}writeNextTriplet(t,e){t.writeCodewords(this.encodeToCodewords(e.toString()));const r=e.toString().substring(3);e.setLengthToZero(),e.append(r)}handleEOD(t,e){const r=Math.floor(e.length()/3*2),n=e.length()%3,i=t.getCodewordCount()+r;t.updateSymbolInfo(i);const s=t.getSymbolInfo().getDataCapacity()-i;if(2===n){for(e.append("\0");e.length()>=3;)this.writeNextTriplet(t,e);t.hasMoreCharacters()&&t.writeCodeword(254)}else if(1===s&&1===n){for(;e.length()>=3;)this.writeNextTriplet(t,e);t.hasMoreCharacters()&&t.writeCodeword(254),t.pos--}else{if(0!==n)throw new Error("Unexpected case. Please report!");for(;e.length()>=3;)this.writeNextTriplet(t,e);(s>0||t.hasMoreCharacters())&&t.writeCodeword(254)}t.signalEncoderChange(0)}encodeChar(t,e){if(t===" ".charCodeAt(0))return e.append(3),1;if(t>="0".charCodeAt(0)&&t<="9".charCodeAt(0))return e.append(t-48+4),1;if(t>="A".charCodeAt(0)&&t<="Z".charCodeAt(0))return e.append(t-65+14),1;if(t<" ".charCodeAt(0))return e.append(0),e.append(t),2;if(t<="/".charCodeAt(0))return e.append(1),e.append(t-33),2;if(t<="@".charCodeAt(0))return e.append(1),e.append(t-58+15),2;if(t<="_".charCodeAt(0))return e.append(1),e.append(t-91+22),2;if(t<=127)return e.append(2),e.append(t-96),2;e.append("1");let r=2;return r+=this.encodeChar(t-128,e),r}encodeToCodewords(t){const e=1600*t.charCodeAt(0)+40*t.charCodeAt(1)+t.charCodeAt(2)+1,r=e/256,n=e%256,i=new T;return i.append(r),i.append(n),i.toString()}}class Hr{getEncodingMode(){return 4}encode(t){const e=new T;for(;t.hasMoreCharacters();){const r=t.getCurrentChar();this.encodeChar(r,e),t.pos++;if(e.length()>=4){t.writeCodewords(this.encodeToCodewords(e.toString()));const r=e.toString().substring(4);e.setLengthToZero(),e.append(r);if(Yr.lookAheadTest(t.getMessage(),t.pos,this.getEncodingMode())!==this.getEncodingMode()){t.signalEncoderChange(0);break}}}e.append(p.getCharAt(31)),this.handleEOD(t,e)}handleEOD(t,e){try{const r=e.length();if(0===r)return;if(1===r){t.updateSymbolInfo();let e=t.getSymbolInfo().getDataCapacity()-t.getCodewordCount();const r=t.getRemainingCharacters();if(r>e&&(t.updateSymbolInfo(t.getCodewordCount()+1),e=t.getSymbolInfo().getDataCapacity()-t.getCodewordCount()),r<=e&&e<=2)return}if(r>4)throw new Error("Count must not exceed 4");const n=r-1,i=this.encodeToCodewords(e.toString());let s=!t.hasMoreCharacters()&&n<=2;if(n<=2){t.updateSymbolInfo(t.getCodewordCount()+n);t.getSymbolInfo().getDataCapacity()-t.getCodewordCount()>=3&&(s=!1,t.updateSymbolInfo(t.getCodewordCount()+i.length))}s?(t.resetSymbolInfo(),t.pos-=n):t.writeCodewords(i)}finally{t.signalEncoderChange(0)}}encodeChar(t,e){t>=" ".charCodeAt(0)&&t<="?".charCodeAt(0)?e.append(t):t>="@".charCodeAt(0)&&t<="^".charCodeAt(0)?e.append(p.getCharAt(t-64)):Yr.illegalCharacter(p.getCharAt(t))}encodeToCodewords(t){const e=t.length;if(0===e)throw new Error("StringBuilder must not be empty");const r=(t.charAt(0).charCodeAt(0)<<18)+((e>=2?t.charAt(1).charCodeAt(0):0)<<12)+((e>=3?t.charAt(2).charCodeAt(0):0)<<6)+(e>=4?t.charAt(3).charCodeAt(0):0),n=r>>16&255,i=r>>8&255,s=255&r,o=new T;return o.append(n),e>=2&&o.append(i),e>=3&&o.append(s),o.toString()}}class Ur{constructor(t,e,r,n,i,s,o=0,a=0){this.rectangular=t,this.dataCapacity=e,this.errorCodewords=r,this.matrixWidth=n,this.matrixHeight=i,this.dataRegions=s,this.rsBlockData=o,this.rsBlockError=a}static lookup(t,e=0,r=null,n=null,i=!0){for(const i of Xr)if((1!==e||!i.rectangular)&&(2!==e||i.rectangular)&&(null==r||!(i.getSymbolWidth()n.getWidth()||i.getSymbolHeight()>n.getHeight()))&&t<=i.dataCapacity)return i;if(i)throw new Error("Can't find a symbol arrangement that matches the message. Data codewords: "+t);return null}getHorizontalDataRegions(){switch(this.dataRegions){case 1:return 1;case 2:case 4:return 2;case 16:return 4;case 36:return 6;default:throw new Error("Cannot handle this number of data regions")}}getVerticalDataRegions(){switch(this.dataRegions){case 1:case 2:return 1;case 4:return 2;case 16:return 4;case 36:return 6;default:throw new Error("Cannot handle this number of data regions")}}getSymbolDataWidth(){return this.getHorizontalDataRegions()*this.matrixWidth}getSymbolDataHeight(){return this.getVerticalDataRegions()*this.matrixHeight}getSymbolWidth(){return this.getSymbolDataWidth()+2*this.getHorizontalDataRegions()}getSymbolHeight(){return this.getSymbolDataHeight()+2*this.getVerticalDataRegions()}getCodewordCount(){return this.dataCapacity+this.errorCodewords}getInterleavedBlockCount(){return this.rsBlockData?this.dataCapacity/this.rsBlockData:1}getDataCapacity(){return this.dataCapacity}getErrorCodewords(){return this.errorCodewords}getDataLengthForInterleavedBlock(t){return this.rsBlockData}getErrorLengthForInterleavedBlock(t){return this.rsBlockError}}const Xr=[new Ur(!1,3,5,8,8,1),new Ur(!1,5,7,10,10,1),new Ur(!0,5,7,16,6,1),new Ur(!1,8,10,12,12,1),new Ur(!0,10,11,14,6,2),new Ur(!1,12,12,14,14,1),new Ur(!0,16,14,24,10,1),new Ur(!1,18,14,16,16,1),new Ur(!1,22,18,18,18,1),new Ur(!0,22,18,16,10,2),new Ur(!1,30,20,20,20,1),new Ur(!0,32,24,16,14,2),new Ur(!1,36,24,22,22,1),new Ur(!1,44,28,24,24,1),new Ur(!0,49,28,22,14,2),new Ur(!1,62,36,14,14,4),new Ur(!1,86,42,16,16,4),new Ur(!1,114,48,18,18,4),new Ur(!1,144,56,20,20,4),new Ur(!1,174,68,22,22,4),new Ur(!1,204,84,24,24,4,102,42),new Ur(!1,280,112,14,14,16,140,56),new Ur(!1,368,144,16,16,16,92,36),new Ur(!1,456,192,18,18,16,114,48),new Ur(!1,576,224,20,20,16,144,56),new Ur(!1,696,272,22,22,16,174,68),new Ur(!1,816,336,24,24,16,136,56),new Ur(!1,1050,408,18,18,36,175,68),new Ur(!1,1304,496,20,20,36,163,62),new class extends Ur{constructor(){super(!1,1558,620,22,22,36,-1,62)}getInterleavedBlockCount(){return 10}getDataLengthForInterleavedBlock(t){return t<=8?156:155}}];class Gr{constructor(t){this.msg=t,this.pos=0,this.skipAtEnd=0;const e=t.split("").map((t=>t.charCodeAt(0))),r=new T;for(let n=0,i=e.length;nthis.symbolInfo.getDataCapacity())&&(this.symbolInfo=Ur.lookup(t,this.shape,this.minSize,this.maxSize,!0))}resetSymbolInfo(){this.symbolInfo=null}}class Wr extends Vr{getEncodingMode(){return 3}encode(t){const e=new T;for(;t.hasMoreCharacters();){const r=t.getCurrentChar();t.pos++,this.encodeChar(r,e);if(e.length()%3==0){this.writeNextTriplet(t,e);if(Yr.lookAheadTest(t.getMessage(),t.pos,this.getEncodingMode())!==this.getEncodingMode()){t.signalEncoderChange(0);break}}}this.handleEOD(t,e)}encodeChar(t,e){switch(t){case 13:e.append(0);break;case"*".charCodeAt(0):e.append(1);break;case">".charCodeAt(0):e.append(2);break;case" ".charCodeAt(0):e.append(3);break;default:t>="0".charCodeAt(0)&&t<="9".charCodeAt(0)?e.append(t-48+4):t>="A".charCodeAt(0)&&t<="Z".charCodeAt(0)?e.append(t-65+14):Yr.illegalCharacter(p.getCharAt(t))}return 1}handleEOD(t,e){t.updateSymbolInfo();const r=t.getSymbolInfo().getDataCapacity()-t.getCodewordCount(),n=e.length();t.pos-=n,(t.getRemainingCharacters()>1||r>1||t.getRemainingCharacters()!==r)&&t.writeCodeword(254),t.getNewEncoding()<0&&t.signalEncoderChange(0)}}class zr extends Vr{getEncodingMode(){return 2}encodeChar(t,e){if(t===" ".charCodeAt(0))return e.append(3),1;if(t>="0".charCodeAt(0)&&t<="9".charCodeAt(0))return e.append(t-48+4),1;if(t>="a".charCodeAt(0)&&t<="z".charCodeAt(0))return e.append(t-97+14),1;if(t<" ".charCodeAt(0))return e.append(0),e.append(t),2;if(t<="/".charCodeAt(0))return e.append(1),e.append(t-33),2;if(t<="@".charCodeAt(0))return e.append(1),e.append(t-58+15),2;if(t>="[".charCodeAt(0)&&t<="_".charCodeAt(0))return e.append(1),e.append(t-91+22),2;if(t==="`".charCodeAt(0))return e.append(2),e.append(0),2;if(t<="Z".charCodeAt(0))return e.append(2),e.append(t-65+1),2;if(t<=127)return e.append(2),e.append(t-123+27),2;e.append("1");let r=2;return r+=this.encodeChar(t-128,e),r}}class Yr{static randomize253State(t){const e=129+(149*t%253+1);return e<=254?e:e-254}static encodeHighLevel(t,e=0,r=null,n=null,i=!1){const s=new Vr,o=[new kr,s,new zr,new Wr,new Hr,new xr],a=new Gr(t);a.setSymbolShape(e),a.setSizeConstraints(r,n),t.startsWith(Pr)&&t.endsWith(Fr)?(a.writeCodeword(236),a.setSkipAtEnd(2),a.pos+=7):t.startsWith(Lr)&&t.endsWith(Fr)&&(a.writeCodeword(237),a.setSkipAtEnd(2),a.pos+=7);let h=0;for(i&&(s.encodeMaximal(a),h=a.getNewEncoding(),a.resetEncoderSignal());a.hasMoreCharacters();)o[h].encode(a),a.getNewEncoding()>=0&&(h=a.getNewEncoding(),a.resetEncoderSignal());const l=a.getCodewordCount();a.updateSymbolInfo();const c=a.getSymbolInfo().getDataCapacity();l=t.length)return r;let n;0===r?n=[0,1,1,1,1,1.25]:(n=[1,2,2,2,2,2.25],n[r]=0);let i=0;const s=new Uint8Array(6),o=[];for(;;){if(e+i===t.length){f.fill(s,0),f.fill(o,0);const t=this.findMinimums(n,o,w.MAX_VALUE,s),e=this.getMinimumCount(s);if(o[0]===t)return 0;if(1===e){if(s[5]>0)return 5;if(s[4]>0)return 4;if(s[2]>0)return 2;if(s[3]>0)return 3}return 1}const r=t.charCodeAt(e+i);if(i++,this.isDigit(r)?n[0]+=.5:this.isExtendedASCII(r)?(n[0]=Math.ceil(n[0]),n[0]+=2):(n[0]=Math.ceil(n[0]),n[0]++),this.isNativeC40(r)?n[1]+=2/3:this.isExtendedASCII(r)?n[1]+=8/3:n[1]+=4/3,this.isNativeText(r)?n[2]+=2/3:this.isExtendedASCII(r)?n[2]+=8/3:n[2]+=4/3,this.isNativeX12(r)?n[3]+=2/3:this.isExtendedASCII(r)?n[3]+=13/3:n[3]+=10/3,this.isNativeEDIFACT(r)?n[4]+=3/4:this.isExtendedASCII(r)?n[4]+=4.25:n[4]+=3.25,this.isSpecialB256(r)?n[5]+=4:n[5]++,i>=4){if(f.fill(s,0),f.fill(o,0),this.findMinimums(n,o,w.MAX_VALUE,s),o[0]s&&(r=s,f.fill(n,0)),r===s&&(n[i]=n[i]+1)}return r}static getMinimumCount(t){let e=0;for(let r=0;r<6;r++)e+=t[r];return e||0}static isDigit(t){return t>="0".charCodeAt(0)&&t<="9".charCodeAt(0)}static isExtendedASCII(t){return t>=128&&t<=255}static isNativeC40(t){return t===" ".charCodeAt(0)||t>="0".charCodeAt(0)&&t<="9".charCodeAt(0)||t>="A".charCodeAt(0)&&t<="Z".charCodeAt(0)}static isNativeText(t){return t===" ".charCodeAt(0)||t>="0".charCodeAt(0)&&t<="9".charCodeAt(0)||t>="a".charCodeAt(0)&&t<="z".charCodeAt(0)}static isNativeX12(t){return this.isX12TermSep(t)||t===" ".charCodeAt(0)||t>="0".charCodeAt(0)&&t<="9".charCodeAt(0)||t>="A".charCodeAt(0)&&t<="Z".charCodeAt(0)}static isX12TermSep(t){return 13===t||t==="*".charCodeAt(0)||t===">".charCodeAt(0)}static isNativeEDIFACT(t){return t>=" ".charCodeAt(0)&&t<="^".charCodeAt(0)}static isSpecialB256(t){return!1}static determineConsecutiveDigitCount(t,e=0){const r=t.length;let n=e;for(;nnew Zr(Rr.forName(t)))),this.encoders=[];const n=[];n.push(new Zr(Nr.ISO_8859_1));let i=null!=e&&e.name.startsWith("UTF");for(let e=0;e=this.bytes.length)return!1;for(let r=0;r=this.length())throw new Error(""+t);if(this.isECI(t))throw new Error("value at "+t+" is not a character but an ECI");return this.isFNC1(t)?this.fnc1:this.bytes[t]}subSequence(t,e){if(t<0||t>e||e>this.length())throw new Error(""+t);const r=new T;for(let n=t;n=this.length())throw new Error(""+t);return this.bytes[t]>255&&this.bytes[t]<=999}isFNC1(t){if(t<0||t>=this.length())throw new Error(""+t);return 1e3===this.bytes[t]}getECIValue(t){if(t<0||t>=this.length())throw new Error(""+t);if(!this.isECI(t))throw new Error("value at "+t+" is not an ECI but a character");return this.bytes[t]-256}addEdge(t,e,r){(null==t[e][r.encoderIndex]||t[e][r.encoderIndex].cachedTotalSize>r.cachedTotalSize)&&(t[e][r.encoderIndex]=r)}addEdges(t,e,r,n,i,s){const o=t.charAt(n).charCodeAt(0);let a=0,h=e.length();e.getPriorityEncoderIndex()>=0&&(o===s||e.canEncode(o,e.getPriorityEncoderIndex()))&&(a=e.getPriorityEncoderIndex(),h=a+1);for(let t=a;t=0;e--)a.unshift(255&t[e])}(null===h.previous?0:h.previous.encoderIndex)!==h.encoderIndex&&a.unshift(256+e.getECIValue(h.encoderIndex)),h=h.previous}const l=[];for(let t=0;t","?","@","[","\\","]","^","_"];class $r{static isExtendedASCII(t,e){return t!==e&&t>=128&&t<=255}static isInC40Shift1Set(t){return t<=31}static isInC40Shift2Set(t,e){for(const e of Jr)if(e.charCodeAt(0)===t)return!0;return t===e}static isInTextShift1Set(t){return this.isInC40Shift1Set(t)}static isInTextShift2Set(t,e){return this.isInC40Shift2Set(t,e)}static encodeHighLevel(t,e=null,r=-1,n=0){let i=0;return t.startsWith(Pr)&&t.endsWith(Fr)?(i=5,t=t.substring(7,t.length-2)):t.startsWith(Lr)&&t.endsWith(Fr)&&(i=6,t=t.substring(7,t.length-2)),decodeURIComponent(escape(String.fromCharCode(...this.encode(t,e,r,n,i))))}static encode(t,e,r,n,i){return this.encodeMinimally(new rn(t,e,r,n,i)).getBytes()}static addEdge(t,e){const r=e.fromPosition+e.characterLength;(null===t[r][e.getEndMode()]||t[r][e.getEndMode()].cachedTotalSize>e.cachedTotalSize)&&(t[r][e.getEndMode()]=e)}static getNumberOfC40Words(t,e,r,n){let i=0;for(let s=e;s=128&&(r&&Yr.isNativeC40(t-128)||!r&&Yr.isNativeText(t-128))?i+=3:i+=4}else i+=2;if(i%3==0||(i-2)%3==0&&s+1===t.length())return n[0]=s-e+1,Math.ceil(i/3)}return n[0]=0,0}static addEdges(t,e,r,n){if(t.isECI(r))return void this.addEdge(e,new en(t,jr.ASCII,r,1,n));const i=t.charAt(r);if(null===n||n.getEndMode()!==jr.EDF){Yr.isDigit(i)&&t.haveNCharacters(r,2)&&Yr.isDigit(t.charAt(r+1))?this.addEdge(e,new en(t,jr.ASCII,r,2,n)):this.addEdge(e,new en(t,jr.ASCII,r,1,n));const s=[jr.C40,jr.TEXT];for(const i of s){const s=[];$r.getNumberOfC40Words(t,r,i===jr.C40,s)>0&&this.addEdge(e,new en(t,i,r,s[0],n))}t.haveNCharacters(r,3)&&Yr.isNativeX12(t.charAt(r))&&Yr.isNativeX12(t.charAt(r+1))&&Yr.isNativeX12(t.charAt(r+2))&&this.addEdge(e,new en(t,jr.X12,r,3,n)),this.addEdge(e,new en(t,jr.B256,r,1,n))}let s;for(s=0;s<3;s++){const i=r+s;if(!t.haveNCharacters(i,1)||!Yr.isNativeEDIFACT(t.charAt(i)))break;this.addEdge(e,new en(t,jr.EDF,r,s+1,n))}3===s&&t.haveNCharacters(r,4)&&Yr.isNativeEDIFACT(t.charAt(r+3))&&this.addEdge(e,new en(t,jr.EDF,r,4,n))}static encodeMinimally(t){const e=t.length(),r=Array(e+1).fill(null).map((()=>Array(6).fill(0)));this.addEdges(t,r,0,null);for(let n=1;n<=e;n++){for(let i=0;i<6;i++)null!==r[n][i]&&n=1&&t<=3?s.cachedTotalSize+1:s.cachedTotalSize;o0&&(r+=this.prepend(en.getBytes(232),n));for(let t=0;t=0;r--)e.unshift(t[r]);return t.length}randomize253State(t){const e=129+(149*t%253+1);return e<=254?e:e-254}applyRandomPattern(t,e,r){for(let n=0;n0&&this.getCodewordsRemaining(this.cachedTotalSize+t)<=2-t)return jr.ASCII}if(this.mode===jr.C40||this.mode===jr.TEXT||this.mode===jr.X12){if(this.fromPosition+this.characterLength>=this.input.length()&&0===this.getCodewordsRemaining(this.cachedTotalSize))return jr.ASCII;if(1===this.getLastASCII()&&0===this.getCodewordsRemaining(this.cachedTotalSize+1))return jr.ASCII}return this.mode}getMode(){return this.mode}getLastASCII(){const t=this.input.length(),e=this.fromPosition+this.characterLength;return t-e>4||e>=t?0:t-e==1?$r.isExtendedASCII(this.input.charAt(e),this.input.getFNC1Character())?0:1:t-e==2?$r.isExtendedASCII(this.input.charAt(e),this.input.getFNC1Character())||$r.isExtendedASCII(this.input.charAt(e+1),this.input.getFNC1Character())?0:Yr.isDigit(this.input.charAt(e))&&Yr.isDigit(this.input.charAt(e+1))?1:2:t-e==3?Yr.isDigit(this.input.charAt(e))&&Yr.isDigit(this.input.charAt(e+1))&&!$r.isExtendedASCII(this.input.charAt(e+2),this.input.getFNC1Character())||Yr.isDigit(this.input.charAt(e+1))&&Yr.isDigit(this.input.charAt(e+2))&&!$r.isExtendedASCII(this.input.charAt(e),this.input.getFNC1Character())?2:0:Yr.isDigit(this.input.charAt(e))&&Yr.isDigit(this.input.charAt(e+1))&&Yr.isDigit(this.input.charAt(e+2))&&Yr.isDigit(this.input.charAt(e+3))?2:0}getMinSymbolSize(t){switch(this.input.getShapeHint()){case 1:for(const e of this.squareCodewordCapacities)if(e>=t)return e;break;case 2:for(const e of this.rectangularCodewordCapacities)if(e>=t)return e}for(const e of this.allCodewordCapacities)if(e>=t)return e;return this.allCodewordCapacities[this.allCodewordCapacities.length-1]}getCodewordsRemaining(t){return this.getMinSymbolSize(t)-t}static getBytes(t,e){const r=new Uint8Array(e?2:1);return r[0]=t,e&&(r[1]=e),r}setC40Word(t,e,r,n,i){const s=1600*(255&r)+40*(255&n)+(255&i)+1;t[e]=s/256,t[e+1]=s%256}getX12Value(t){return 13===t?0:42===t?1:62===t?2:32===t?3:t>=48&&t<=57?t-44:t>=65&&t<=90?t-51:t}getX12Words(){if(this.characterLength%3!=0)throw new Error("X12 words must be a multiple of 3");const t=new Uint8Array(this.characterLength/3*2);for(let e=0;e=33&&r<=47?r-33:r>=48&&r<=57?r-44:r>=58&&r<=64?r-43:r>=65&&r<=90?r-64:r>=91&&r<=95?r-69:96===r?0:r>=97&&r<=122?r-83:r>=123&&r<=127?r-96:r}getC40Words(t,e){const r=[];for(let n=0;n>16&255,e[i+1]=s>>8&255,e[i+2]=255&s}return e}getLatchBytes(){switch(this.getPreviousMode()){case jr.ASCII:case jr.B256:switch(this.mode){case jr.B256:return en.getBytes(231);case jr.C40:return en.getBytes(230);case jr.TEXT:return en.getBytes(239);case jr.X12:return en.getBytes(238);case jr.EDF:return en.getBytes(240)}break;case jr.C40:case jr.TEXT:case jr.X12:if(this.mode!==this.getPreviousMode())switch(this.mode){case jr.ASCII:return en.getBytes(254);case jr.B256:return en.getBytes(254,231);case jr.C40:return en.getBytes(254,230);case jr.TEXT:return en.getBytes(254,239);case jr.X12:return en.getBytes(254,238);case jr.EDF:return en.getBytes(254,240)}break;case jr.EDF:if(this.mode!==jr.EDF)throw new Error("Cannot switch from EDF to "+this.mode)}return new Uint8Array(0)}getDataBytes(){switch(this.mode){case jr.ASCII:return this.input.isECI(this.fromPosition)?en.getBytes(241,this.input.getECIValue(this.fromPosition)+1):$r.isExtendedASCII(this.input.charAt(this.fromPosition),this.input.getFNC1Character())?en.getBytes(235,this.input.charAt(this.fromPosition)-127):2===this.characterLength?en.getBytes(10*this.input.charAt(this.fromPosition)+this.input.charAt(this.fromPosition+1)+130):this.input.isFNC1(this.fromPosition)?en.getBytes(232):en.getBytes(this.input.charAt(this.fromPosition)+1);case jr.B256:return en.getBytes(this.input.charAt(this.fromPosition));case jr.C40:return this.getC40Words(!0,this.input.getFNC1Character());case jr.TEXT:return this.getC40Words(!1,this.input.getFNC1Character());case jr.X12:return this.getX12Words();case jr.EDF:return this.getEDFBytes()}}}class rn extends qr{constructor(t,e,r,n,i){super(t,e,r),this.shape=n,this.macroId=i}getMacroId(){return this.macroId}getShapeHint(){return this.shape}}class nn{isCompact(){return this.compact}setCompact(t){this.compact=t}getSize(){return this.size}setSize(t){this.size=t}getLayers(){return this.layers}setLayers(t){this.layers=t}getCodeWords(){return this.codeWords}setCodeWords(t){this.codeWords=t}getMatrix(){return this.matrix}setMatrix(t){this.matrix=t}}class sn{static singletonList(t){return[t]}static min(t,e){return t.sort(e)[0]}}class on{constructor(t){this.previous=t}getPrevious(){return this.previous}}class an extends on{constructor(t,e,r){super(t),this.value=e,this.bitCount=r}appendTo(t,e){t.appendBits(this.value,this.bitCount)}add(t,e){return new an(this,t,e)}addBinaryShift(t,e){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new an(this,t,e)}toString(){let t=this.value&(1<"}}class hn extends an{constructor(t,e,r){super(t,0,0),this.binaryShiftStart=e,this.binaryShiftByteCount=r}appendTo(t,e){for(let r=0;r62?t.appendBits(this.binaryShiftByteCount-31,16):0===r?t.appendBits(Math.min(this.binaryShiftByteCount,31),5):t.appendBits(this.binaryShiftByteCount-31,5)),t.appendBits(e[this.binaryShiftStart+r],8)}addBinaryShift(t,e){return new hn(this,t,e)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function ln(t,e,r){return new an(t,e,r)}const cn=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],dn=new an(null,0,0),un=[Int32Array.from([0,327708,327710,327709,656318]),Int32Array.from([590318,0,327710,327709,656318]),Int32Array.from([262158,590300,0,590301,932798]),Int32Array.from([327709,327708,656318,0,327710]),Int32Array.from([327711,656380,656382,656381,0])];const gn=function(t){for(let e of t)f.fill(e,-1);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}(f.createInt32Array(6,6));class fn{constructor(t,e,r,n){this.token=t,this.mode=e,this.binaryShiftByteCount=r,this.bitCount=n}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(t,e){let r=this.bitCount,n=this.token;if(t!==this.mode){let e=un[this.mode][t];n=ln(n,65535&e,e>>16),r+=e>>16}let i=2===t?4:5;return n=ln(n,e,i),new fn(n,t,0,r+i)}shiftAndAppend(t,e){let r=this.token,n=2===this.mode?4:5;return r=ln(r,gn[this.mode][t],n),r=ln(r,e,5),new fn(r,this.mode,0,this.bitCount+n+5)}addBinaryShiftChar(t){let e=this.token,r=this.mode,n=this.bitCount;if(4===this.mode||2===this.mode){let t=un[r][0];e=ln(e,65535&t,t>>16),n+=t>>16,r=0}let i=0===this.binaryShiftByteCount||31===this.binaryShiftByteCount?18:62===this.binaryShiftByteCount?9:8,s=new fn(e,r,this.binaryShiftByteCount+1,n+i);return 2078===s.binaryShiftByteCount&&(s=s.endBinaryShift(t+1)),s}endBinaryShift(t){if(0===this.binaryShiftByteCount)return this;let e=this.token;return e=function(t,e,r){return new hn(t,e,r)}(e,t-this.binaryShiftByteCount,this.binaryShiftByteCount),new fn(e,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(t){let e=this.bitCount+(un[this.mode][t.mode]>>16);return this.binaryShiftByteCountt.binaryShiftByteCount&&t.binaryShiftByteCount>0&&(e+=10),e<=t.bitCount}toBitArray(t){let e=[];for(let r=this.endBinaryShift(t.length).token;null!==r;r=r.getPrevious())e.unshift(r);let r=new C;for(const n of e)n.appendTo(r,t);return r}toString(){return p.format("%s bits=%d bytes=%d",cn[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(t){return t.binaryShiftByteCount>62?21:t.binaryShiftByteCount>31?20:t.binaryShiftByteCount>0?10:0}}fn.INITIAL_STATE=new fn(dn,0,0,0);const wn=function(t){const e=p.getCharCode(" "),r=p.getCharCode("."),n=p.getCharCode(",");t[0][e]=1;const i=p.getCharCode("Z"),s=p.getCharCode("A");for(let e=s;e<=i;e++)t[0][e]=e-s+2;t[1][e]=1;const o=p.getCharCode("z"),a=p.getCharCode("a");for(let e=a;e<=o;e++)t[1][e]=e-a+2;t[2][e]=1;const h=p.getCharCode("9"),l=p.getCharCode("0");for(let e=l;e<=h;e++)t[2][e]=e-l+2;t[2][n]=12,t[2][r]=13;const c=["\0"," ","","","","","","","","\b","\t","\n","\v","\f","\r","","","","","","@","\\","^","_","`","|","~",""];for(let e=0;e","?","[","]","{","}"];for(let e=0;e0&&(t[4][p.getCharCode(d[e])]=e);return t}(f.createInt32Array(5,256));class Cn{constructor(t){this.text=t}encode(){const t=p.getCharCode(" "),e=p.getCharCode("\n");let r=sn.singletonList(fn.INITIAL_STATE);for(let n=0;n0?(r=Cn.updateStateListForPair(r,n,i),n++):r=this.updateStateListForChar(r,n)}return sn.min(r,((t,e)=>t.getBitCount()-e.getBitCount())).toBitArray(this.text)}updateStateListForChar(t,e){const r=[];for(let n of t)this.updateStateForChar(n,e,r);return Cn.simplifyStates(r)}updateStateForChar(t,e,r){let n=255&this.text[e],i=wn[t.getMode()][n]>0,s=null;for(let o=0;o<=4;o++){let a=wn[o][n];if(a>0){if(null==s&&(s=t.endBinaryShift(e)),!i||o===t.getMode()||2===o){const t=s.latchAndAppend(o,a);r.push(t)}if(!i&&gn[t.getMode()][o]>=0){const t=s.shiftAndAppend(o,a);r.push(t)}}}if(t.getBinaryShiftByteCount()>0||0===wn[t.getMode()][n]){let n=t.addBinaryShiftChar(e);r.push(n)}}static updateStateListForPair(t,e,r){const n=[];for(let i of t)this.updateStateForPair(i,e,r,n);return this.simplifyStates(n)}static updateStateForPair(t,e,r,n){let i=t.endBinaryShift(e);if(n.push(i.latchAndAppend(4,r)),4!==t.getMode()&&n.push(i.shiftAndAppend(4,r)),3===r||4===r){let t=i.latchAndAppend(2,16-r).latchAndAppend(2,1);n.push(t)}if(t.getBinaryShiftByteCount()>0){let r=t.addBinaryShiftChar(e).addBinaryShiftChar(e+1);n.push(r)}}static simplifyStates(t){let e=[];for(const r of t){let t=!0;for(const n of e){if(n.isBetterThanOrEqualTo(r)){t=!1;break}r.isBetterThanOrEqualTo(n)&&(e=e.filter((t=>t!==n)))}t&&e.push(r)}return e}}class An{constructor(){}static encodeBytes(t){return An.encode(t,An.DEFAULT_EC_PERCENT,An.DEFAULT_AZTEC_LAYERS)}static encode(t,e,r){let n,i,s,o,h,l=new Cn(t).encode(),c=w.truncDivision(l.getSize()*e,100)+11,d=l.getSize()+c;if(r!==An.DEFAULT_AZTEC_LAYERS){if(n=r<0,i=Math.abs(r),i>(n?An.MAX_NB_BITS_COMPACT:An.MAX_NB_BITS))throw new a(p.format("Illegal value %s for layers",r));s=An.totalBitsInLayer(i,n),o=An.WORD_SIZE[i];let t=s-s%o;if(h=An.stuffBits(l,o),h.getSize()+c>t)throw new a("Data to large for user specified layer");if(n&&h.getSize()>64*o)throw new a("Data to large for user specified layer")}else{o=0,h=null;for(let t=0;;t++){if(t>An.MAX_NB_BITS)throw new a("Data too large for an Aztec code");if(n=t<=3,i=n?t+1:t,s=An.totalBitsInLayer(i,n),d>s)continue;null!=h&&o===An.WORD_SIZE[i]||(o=An.WORD_SIZE[i],h=An.stuffBits(l,o));let e=s-s%o;if(!(n&&h.getSize()>64*o)&&h.getSize()+c<=e)break}}let u,g=An.generateCheckWords(h,s,o),f=h.getSize()/o,C=An.generateModeMessage(n,i,f),A=(n?11:14)+4*i,E=new Int32Array(A);if(n){u=A;for(let t=0;t=n||t.get(s+r))&&(o|=1< +