vue-qrcode-reader-d831402f.js 106 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307
  1. import { m as mountComponent, u as usePopupState } from "./mount-component-2b0f7b23.js";
  2. import { p as popupSharedProps, P as Popup } from "./index-eef3af38.js";
  3. import { c as createNamespace, e as extend, z as makeStringProp, n as numericProp, G as unknownProp, y as pick, N as inBrowser, i as isObject } from "./index-487cde8c.js";
  4. import { d as defineComponent, c as createVNode, m as mergeProps, r as ref, w as watch, o as onMounted, G as onUnmounted, a as computed, j as openBlock, b as createElementBlock, e as createBaseVNode, O as normalizeStyle, h as withDirectives, v as vShow, P as renderSlot } from "./index-5e4623ce.js";
  5. const [name, bem] = createNamespace("notify");
  6. const popupInheritProps = ["lockScroll", "position", "show", "teleport", "zIndex"];
  7. const notifyProps = extend({}, popupSharedProps, {
  8. type: makeStringProp("danger"),
  9. color: String,
  10. message: numericProp,
  11. position: makeStringProp("top"),
  12. className: unknownProp,
  13. background: String,
  14. lockScroll: Boolean
  15. });
  16. var stdin_default = defineComponent({
  17. name,
  18. props: notifyProps,
  19. emits: ["update:show"],
  20. setup(props, {
  21. emit,
  22. slots
  23. }) {
  24. const updateShow = (show) => emit("update:show", show);
  25. return () => createVNode(Popup, mergeProps({
  26. "class": [bem([props.type]), props.className],
  27. "style": {
  28. color: props.color,
  29. background: props.background
  30. },
  31. "overlay": false,
  32. "duration": 0.2,
  33. "onUpdate:show": updateShow
  34. }, pick(props, popupInheritProps)), {
  35. default: () => [slots.default ? slots.default() : props.message]
  36. });
  37. }
  38. });
  39. let timer;
  40. let instance;
  41. const parseOptions = (message) => isObject(message) ? message : {
  42. message
  43. };
  44. function initInstance() {
  45. ({
  46. instance
  47. } = mountComponent({
  48. setup() {
  49. const {
  50. state,
  51. toggle
  52. } = usePopupState();
  53. return () => createVNode(stdin_default, mergeProps(state, {
  54. "onUpdate:show": toggle
  55. }), null);
  56. }
  57. }));
  58. }
  59. const getDefaultOptions = () => ({
  60. type: "danger",
  61. color: void 0,
  62. message: "",
  63. onClose: void 0,
  64. onClick: void 0,
  65. onOpened: void 0,
  66. duration: 3e3,
  67. position: void 0,
  68. className: "",
  69. lockScroll: false,
  70. background: void 0
  71. });
  72. let currentOptions = getDefaultOptions();
  73. const closeNotify = () => {
  74. if (instance) {
  75. instance.toggle(false);
  76. }
  77. };
  78. function showNotify(options) {
  79. if (!inBrowser) {
  80. return;
  81. }
  82. if (!instance) {
  83. initInstance();
  84. }
  85. options = extend({}, currentOptions, parseOptions(options));
  86. instance.open(options);
  87. clearTimeout(timer);
  88. if (options.duration > 0) {
  89. timer = setTimeout(closeNotify, options.duration);
  90. }
  91. return instance;
  92. }
  93. var Dr = (r, o, i) => {
  94. if (!o.has(r))
  95. throw TypeError("Cannot " + i);
  96. }, Cr = (r, o, i) => (Dr(r, o, "read from private field"), i ? i.call(r) : o.get(r)), Co = (r, o, i) => {
  97. if (o.has(r))
  98. throw TypeError("Cannot add the same private member more than once");
  99. o instanceof WeakSet ? o.add(r) : o.set(r, i);
  100. }, $o = (r, o, i, c) => (Dr(r, o, "write to private field"), o.set(r, i), i);
  101. const xr = [
  102. ["aztec", "Aztec"],
  103. ["code_128", "Code128"],
  104. ["code_39", "Code39"],
  105. ["code_93", "Code93"],
  106. ["codabar", "Codabar"],
  107. ["databar", "DataBar"],
  108. ["databar_expanded", "DataBarExpanded"],
  109. ["data_matrix", "DataMatrix"],
  110. ["dx_film_edge", "DXFilmEdge"],
  111. ["ean_13", "EAN-13"],
  112. ["ean_8", "EAN-8"],
  113. ["itf", "ITF"],
  114. ["maxi_code", "MaxiCode"],
  115. ["micro_qr_code", "MicroQRCode"],
  116. ["pdf417", "PDF417"],
  117. ["qr_code", "QRCode"],
  118. ["rm_qr_code", "rMQRCode"],
  119. ["upc_a", "UPC-A"],
  120. ["upc_e", "UPC-E"],
  121. ["linear_codes", "Linear-Codes"],
  122. ["matrix_codes", "Matrix-Codes"]
  123. ], _o = [...xr, ["unknown"]].map((r) => r[0]), it = new Map(
  124. xr
  125. );
  126. function So(r) {
  127. for (const [o, i] of it)
  128. if (r === i)
  129. return o;
  130. return "unknown";
  131. }
  132. function Po(r) {
  133. if (Rr(r))
  134. return {
  135. width: r.naturalWidth,
  136. height: r.naturalHeight
  137. };
  138. if (Ir(r))
  139. return {
  140. width: r.width.baseVal.value,
  141. height: r.height.baseVal.value
  142. };
  143. if (kr(r))
  144. return {
  145. width: r.videoWidth,
  146. height: r.videoHeight
  147. };
  148. if (Ur(r))
  149. return {
  150. width: r.width,
  151. height: r.height
  152. };
  153. if (jr(r))
  154. return {
  155. width: r.displayWidth,
  156. height: r.displayHeight
  157. };
  158. if (Fr(r))
  159. return {
  160. width: r.width,
  161. height: r.height
  162. };
  163. if (Wr(r))
  164. return {
  165. width: r.width,
  166. height: r.height
  167. };
  168. throw new TypeError(
  169. "The provided value is not of type '(Blob or HTMLCanvasElement or HTMLImageElement or HTMLVideoElement or ImageBitmap or ImageData or OffscreenCanvas or SVGImageElement or VideoFrame)'."
  170. );
  171. }
  172. function Rr(r) {
  173. try {
  174. return r instanceof HTMLImageElement;
  175. } catch (o) {
  176. return false;
  177. }
  178. }
  179. function Ir(r) {
  180. try {
  181. return r instanceof SVGImageElement;
  182. } catch (o) {
  183. return false;
  184. }
  185. }
  186. function kr(r) {
  187. try {
  188. return r instanceof HTMLVideoElement;
  189. } catch (o) {
  190. return false;
  191. }
  192. }
  193. function Fr(r) {
  194. try {
  195. return r instanceof HTMLCanvasElement;
  196. } catch (o) {
  197. return false;
  198. }
  199. }
  200. function Ur(r) {
  201. try {
  202. return r instanceof ImageBitmap;
  203. } catch (o) {
  204. return false;
  205. }
  206. }
  207. function Wr(r) {
  208. try {
  209. return r instanceof OffscreenCanvas;
  210. } catch (o) {
  211. return false;
  212. }
  213. }
  214. function jr(r) {
  215. try {
  216. return r instanceof VideoFrame;
  217. } catch (o) {
  218. return false;
  219. }
  220. }
  221. function Lr(r) {
  222. try {
  223. return r instanceof Blob;
  224. } catch (o) {
  225. return false;
  226. }
  227. }
  228. function To(r) {
  229. try {
  230. return r instanceof ImageData;
  231. } catch (o) {
  232. return false;
  233. }
  234. }
  235. function Eo(r, o) {
  236. try {
  237. const i = new OffscreenCanvas(r, o);
  238. if (i.getContext("2d") instanceof OffscreenCanvasRenderingContext2D)
  239. return i;
  240. throw void 0;
  241. } catch (i) {
  242. const c = document.createElement("canvas");
  243. return c.width = r, c.height = o, c;
  244. }
  245. }
  246. async function Hr(r) {
  247. if (Rr(r) && !await Do(r))
  248. throw new DOMException(
  249. "Failed to load or decode HTMLImageElement.",
  250. "InvalidStateError"
  251. );
  252. if (Ir(r) && !await xo(r))
  253. throw new DOMException(
  254. "Failed to load or decode SVGImageElement.",
  255. "InvalidStateError"
  256. );
  257. if (jr(r) && Ro(r))
  258. throw new DOMException("VideoFrame is closed.", "InvalidStateError");
  259. if (kr(r) && (r.readyState === 0 || r.readyState === 1))
  260. throw new DOMException("Invalid element or state.", "InvalidStateError");
  261. if (Ur(r) && ko(r))
  262. throw new DOMException(
  263. "The image source is detached.",
  264. "InvalidStateError"
  265. );
  266. const { width: o, height: i } = Po(r);
  267. if (o === 0 || i === 0)
  268. return null;
  269. const c = Eo(o, i).getContext("2d");
  270. c.drawImage(r, 0, 0);
  271. try {
  272. return c.getImageData(0, 0, o, i);
  273. } catch (l) {
  274. throw new DOMException("Source would taint origin.", "SecurityError");
  275. }
  276. }
  277. async function Oo(r) {
  278. let o;
  279. try {
  280. if (globalThis.createImageBitmap)
  281. o = await createImageBitmap(r);
  282. else if (globalThis.Image) {
  283. o = new Image();
  284. let i = "";
  285. try {
  286. i = URL.createObjectURL(r), o.src = i, await o.decode();
  287. } finally {
  288. URL.revokeObjectURL(i);
  289. }
  290. } else
  291. return r;
  292. } catch (i) {
  293. throw new DOMException(
  294. "Failed to load or decode Blob.",
  295. "InvalidStateError"
  296. );
  297. }
  298. return await Hr(o);
  299. }
  300. function Mo(r) {
  301. const { width: o, height: i } = r;
  302. if (o === 0 || i === 0)
  303. return null;
  304. const c = r.getContext("2d");
  305. try {
  306. return c.getImageData(0, 0, o, i);
  307. } catch (l) {
  308. throw new DOMException("Source would taint origin.", "SecurityError");
  309. }
  310. }
  311. async function Ao(r) {
  312. if (Lr(r))
  313. return await Oo(r);
  314. if (To(r)) {
  315. if (Io(r))
  316. throw new DOMException(
  317. "The image data has been detached.",
  318. "InvalidStateError"
  319. );
  320. return r;
  321. }
  322. return Fr(r) || Wr(r) ? Mo(r) : await Hr(r);
  323. }
  324. async function Do(r) {
  325. try {
  326. return await r.decode(), true;
  327. } catch (o) {
  328. return false;
  329. }
  330. }
  331. async function xo(r) {
  332. var o;
  333. try {
  334. return await ((o = r.decode) == null ? void 0 : o.call(r)), true;
  335. } catch (i) {
  336. return false;
  337. }
  338. }
  339. function Ro(r) {
  340. return r.format === null;
  341. }
  342. function Io(r) {
  343. return r.data.buffer.byteLength === 0;
  344. }
  345. function ko(r) {
  346. return r.width === 0 && r.height === 0;
  347. }
  348. function $r(r, o) {
  349. return r instanceof DOMException ? new DOMException(`${o}: ${r.message}`, r.name) : r instanceof Error ? new r.constructor(`${o}: ${r.message}`) : new Error(`${o}: ${r}`);
  350. }
  351. const _r = [
  352. "Aztec",
  353. "Codabar",
  354. "Code128",
  355. "Code39",
  356. "Code93",
  357. "DataBar",
  358. "DataBarExpanded",
  359. "DataMatrix",
  360. "DXFilmEdge",
  361. "EAN-13",
  362. "EAN-8",
  363. "ITF",
  364. "Linear-Codes",
  365. "Matrix-Codes",
  366. "MaxiCode",
  367. "MicroQRCode",
  368. "None",
  369. "PDF417",
  370. "QRCode",
  371. "rMQRCode",
  372. "UPC-A",
  373. "UPC-E"
  374. ];
  375. function Fo(r) {
  376. return r.join("|");
  377. }
  378. function Uo(r) {
  379. const o = Sr(r);
  380. let i = 0, c = _r.length - 1;
  381. for (; i <= c; ) {
  382. const l = Math.floor((i + c) / 2), h = _r[l], v = Sr(h);
  383. if (v === o)
  384. return h;
  385. v < o ? i = l + 1 : c = l - 1;
  386. }
  387. return "None";
  388. }
  389. function Sr(r) {
  390. return r.toLowerCase().replace(/_-\[\]/g, "");
  391. }
  392. function Wo(r, o) {
  393. return r.Binarizer[o];
  394. }
  395. function jo(r, o) {
  396. return r.CharacterSet[o];
  397. }
  398. const Lo = [
  399. "Text",
  400. "Binary",
  401. "Mixed",
  402. "GS1",
  403. "ISO15434",
  404. "UnknownECI"
  405. ];
  406. function Ho(r) {
  407. return Lo[r.value];
  408. }
  409. function Bo(r, o) {
  410. return r.EanAddOnSymbol[o];
  411. }
  412. function Vo(r, o) {
  413. return r.TextMode[o];
  414. }
  415. const Ee = {
  416. formats: [],
  417. tryHarder: true,
  418. tryRotate: true,
  419. tryInvert: true,
  420. tryDownscale: true,
  421. binarizer: "LocalAverage",
  422. isPure: false,
  423. downscaleFactor: 3,
  424. downscaleThreshold: 500,
  425. minLineCount: 2,
  426. maxNumberOfSymbols: 255,
  427. tryCode39ExtendedMode: false,
  428. validateCode39CheckSum: false,
  429. validateITFCheckSum: false,
  430. returnCodabarStartEnd: false,
  431. returnErrors: false,
  432. eanAddOnSymbol: "Read",
  433. textMode: "Plain",
  434. characterSet: "Unknown"
  435. };
  436. function Br(r, o) {
  437. return {
  438. ...o,
  439. formats: Fo(o.formats),
  440. binarizer: Wo(r, o.binarizer),
  441. eanAddOnSymbol: Bo(
  442. r,
  443. o.eanAddOnSymbol
  444. ),
  445. textMode: Vo(r, o.textMode),
  446. characterSet: jo(
  447. r,
  448. o.characterSet
  449. )
  450. };
  451. }
  452. function Vr(r) {
  453. return {
  454. ...r,
  455. format: Uo(r.format),
  456. eccLevel: r.eccLevel,
  457. contentType: Ho(r.contentType)
  458. };
  459. }
  460. const qo = {
  461. locateFile: (r, o) => {
  462. const i = r.match(/_(.+?)\.wasm$/);
  463. return i ? `https://fastly.jsdelivr.net/npm/zxing-wasm@1.1.3/dist/${i[1]}/${r}` : o + r;
  464. }
  465. };
  466. let Ut = /* @__PURE__ */ new WeakMap();
  467. function Bt(r, o) {
  468. var i;
  469. const c = Ut.get(r);
  470. if (c != null && c.modulePromise && o === void 0)
  471. return c.modulePromise;
  472. const l = (i = c == null ? void 0 : c.moduleOverrides) != null ? i : qo, h = r({
  473. ...l
  474. });
  475. return Ut.set(r, {
  476. moduleOverrides: l,
  477. modulePromise: h
  478. }), h;
  479. }
  480. async function zo(r, o, i = Ee) {
  481. const c = {
  482. ...Ee,
  483. ...i
  484. }, l = await Bt(r), { size: h } = o, v = new Uint8Array(await o.arrayBuffer()), g = l._malloc(h);
  485. l.HEAPU8.set(v, g);
  486. const b = l.readBarcodesFromImage(
  487. g,
  488. h,
  489. Br(l, c)
  490. );
  491. l._free(g);
  492. const p = [];
  493. for (let C = 0; C < b.size(); ++C)
  494. p.push(
  495. Vr(b.get(C))
  496. );
  497. return p;
  498. }
  499. async function Go(r, o, i = Ee) {
  500. const c = {
  501. ...Ee,
  502. ...i
  503. }, l = await Bt(r), {
  504. data: h,
  505. width: v,
  506. height: g,
  507. data: { byteLength: b }
  508. } = o, p = l._malloc(b);
  509. l.HEAPU8.set(h, p);
  510. const C = l.readBarcodesFromPixmap(
  511. p,
  512. v,
  513. g,
  514. Br(l, c)
  515. );
  516. l._free(p);
  517. const S = [];
  518. for (let $ = 0; $ < C.size(); ++$)
  519. S.push(
  520. Vr(C.get($))
  521. );
  522. return S;
  523. }
  524. ({
  525. ...Ee,
  526. formats: [...Ee.formats]
  527. });
  528. var ut = (() => {
  529. var r = typeof document < "u" && document.currentScript ? document.currentScript.src : void 0;
  530. return function(o = {}) {
  531. var i = o, c, l;
  532. i.ready = new Promise((e, t) => {
  533. c = e, l = t;
  534. });
  535. var h = Object.assign({}, i), v = "./this.program", g = typeof window == "object", b = typeof importScripts == "function";
  536. typeof process == "object" && typeof process.versions == "object" && process.versions.node;
  537. var p = "";
  538. function C(e) {
  539. return i.locateFile ? i.locateFile(e, p) : p + e;
  540. }
  541. var S;
  542. (g || b) && (b ? p = self.location.href : typeof document < "u" && document.currentScript && (p = document.currentScript.src), r && (p = r), p.indexOf("blob:") !== 0 ? p = p.substr(0, p.replace(/[?#].*/, "").lastIndexOf("/") + 1) : p = "", b && (S = (e) => {
  543. var t = new XMLHttpRequest();
  544. return t.open("GET", e, false), t.responseType = "arraybuffer", t.send(null), new Uint8Array(t.response);
  545. })), i.print || console.log.bind(console);
  546. var $ = i.printErr || console.error.bind(console);
  547. Object.assign(i, h), h = null, i.arguments && i.arguments, i.thisProgram && (v = i.thisProgram), i.quit && i.quit;
  548. var F;
  549. i.wasmBinary && (F = i.wasmBinary), typeof WebAssembly != "object" && Z("no native wasm support detected");
  550. var U, W = false, R, D, X, I, M, A, le, oe;
  551. function be() {
  552. var e = U.buffer;
  553. i.HEAP8 = R = new Int8Array(e), i.HEAP16 = X = new Int16Array(e), i.HEAPU8 = D = new Uint8Array(e), i.HEAPU16 = I = new Uint16Array(e), i.HEAP32 = M = new Int32Array(e), i.HEAPU32 = A = new Uint32Array(e), i.HEAPF32 = le = new Float32Array(e), i.HEAPF64 = oe = new Float64Array(e);
  554. }
  555. var Ce = [], Oe = [], Me = [];
  556. function Le() {
  557. if (i.preRun)
  558. for (typeof i.preRun == "function" && (i.preRun = [i.preRun]); i.preRun.length; )
  559. ft(i.preRun.shift());
  560. yt(Ce);
  561. }
  562. function lt() {
  563. yt(Oe);
  564. }
  565. function dt() {
  566. if (i.postRun)
  567. for (typeof i.postRun == "function" && (i.postRun = [i.postRun]); i.postRun.length; )
  568. Ae(i.postRun.shift());
  569. yt(Me);
  570. }
  571. function ft(e) {
  572. Ce.unshift(e);
  573. }
  574. function ht(e) {
  575. Oe.unshift(e);
  576. }
  577. function Ae(e) {
  578. Me.unshift(e);
  579. }
  580. var te = 0, ve = null;
  581. function pt(e) {
  582. var t;
  583. te++, (t = i.monitorRunDependencies) === null || t === void 0 || t.call(i, te);
  584. }
  585. function de(e) {
  586. var t;
  587. if (te--, (t = i.monitorRunDependencies) === null || t === void 0 || t.call(i, te), te == 0 && ve) {
  588. var n = ve;
  589. ve = null, n();
  590. }
  591. }
  592. function Z(e) {
  593. var t;
  594. (t = i.onAbort) === null || t === void 0 || t.call(i, e), e = "Aborted(" + e + ")", $(e), W = true, e += ". Build with -sASSERTIONS for more info.";
  595. var n = new WebAssembly.RuntimeError(e);
  596. throw l(n), n;
  597. }
  598. var mt = "data:application/octet-stream;base64,", He = (e) => e.startsWith(mt), fe;
  599. fe = "zxing_reader.wasm", He(fe) || (fe = C(fe));
  600. function Be(e) {
  601. if (e == fe && F)
  602. return new Uint8Array(F);
  603. if (S)
  604. return S(e);
  605. throw "both async and sync fetching of the wasm failed";
  606. }
  607. function vt(e) {
  608. return !F && (g || b) && typeof fetch == "function" ? fetch(e, {
  609. credentials: "same-origin"
  610. }).then((t) => {
  611. if (!t.ok)
  612. throw "failed to load wasm binary file at '" + e + "'";
  613. return t.arrayBuffer();
  614. }).catch(() => Be(e)) : Promise.resolve().then(() => Be(e));
  615. }
  616. function Ve(e, t, n) {
  617. return vt(e).then((a) => WebAssembly.instantiate(a, t)).then((a) => a).then(n, (a) => {
  618. $(`failed to asynchronously prepare wasm: ${a}`), Z(a);
  619. });
  620. }
  621. function an(e, t, n, a) {
  622. return !e && typeof WebAssembly.instantiateStreaming == "function" && !He(t) && typeof fetch == "function" ? fetch(t, {
  623. credentials: "same-origin"
  624. }).then((s) => {
  625. var u = WebAssembly.instantiateStreaming(s, n);
  626. return u.then(a, function(d) {
  627. return $(`wasm streaming compile failed: ${d}`), $("falling back to ArrayBuffer instantiation"), Ve(t, n, a);
  628. });
  629. }) : Ve(t, n, a);
  630. }
  631. function on() {
  632. var e = {
  633. a: Ga
  634. };
  635. function t(a, s) {
  636. return z = a.exports, U = z.ia, be(), er = z.ma, ht(z.ja), de(), z;
  637. }
  638. pt();
  639. function n(a) {
  640. t(a.instance);
  641. }
  642. if (i.instantiateWasm)
  643. try {
  644. return i.instantiateWasm(e, t);
  645. } catch (a) {
  646. $(`Module.instantiateWasm callback failed with error: ${a}`), l(a);
  647. }
  648. return an(F, fe, e, n).catch(l), {};
  649. }
  650. var yt = (e) => {
  651. for (; e.length > 0; )
  652. e.shift()(i);
  653. };
  654. i.noExitRuntime;
  655. var qe = [], Ne = 0, sn = (e) => {
  656. var t = new gt(e);
  657. return t.get_caught() || (t.set_caught(true), Ne--), t.set_rethrown(false), qe.push(t), pr(t.excPtr), t.get_exception_ptr();
  658. }, ie = 0, cn = () => {
  659. j(0, 0);
  660. var e = qe.pop();
  661. hr(e.excPtr), ie = 0;
  662. };
  663. function gt(e) {
  664. this.excPtr = e, this.ptr = e - 24, this.set_type = function(t) {
  665. A[this.ptr + 4 >> 2] = t;
  666. }, this.get_type = function() {
  667. return A[this.ptr + 4 >> 2];
  668. }, this.set_destructor = function(t) {
  669. A[this.ptr + 8 >> 2] = t;
  670. }, this.get_destructor = function() {
  671. return A[this.ptr + 8 >> 2];
  672. }, this.set_caught = function(t) {
  673. t = t ? 1 : 0, R[this.ptr + 12 >> 0] = t;
  674. }, this.get_caught = function() {
  675. return R[this.ptr + 12 >> 0] != 0;
  676. }, this.set_rethrown = function(t) {
  677. t = t ? 1 : 0, R[this.ptr + 13 >> 0] = t;
  678. }, this.get_rethrown = function() {
  679. return R[this.ptr + 13 >> 0] != 0;
  680. }, this.init = function(t, n) {
  681. this.set_adjusted_ptr(0), this.set_type(t), this.set_destructor(n);
  682. }, this.set_adjusted_ptr = function(t) {
  683. A[this.ptr + 16 >> 2] = t;
  684. }, this.get_adjusted_ptr = function() {
  685. return A[this.ptr + 16 >> 2];
  686. }, this.get_exception_ptr = function() {
  687. var t = vr(this.get_type());
  688. if (t)
  689. return A[this.excPtr >> 2];
  690. var n = this.get_adjusted_ptr();
  691. return n !== 0 ? n : this.excPtr;
  692. };
  693. }
  694. var un = (e) => {
  695. throw ie || (ie = e), ie;
  696. }, wt = (e) => {
  697. var t = ie;
  698. if (!t)
  699. return Ue(0), 0;
  700. var n = new gt(t);
  701. n.set_adjusted_ptr(t);
  702. var a = n.get_type();
  703. if (!a)
  704. return Ue(0), t;
  705. for (var s in e) {
  706. var u = e[s];
  707. if (u === 0 || u === a)
  708. break;
  709. var d = n.ptr + 16;
  710. if (mr(u, a, d))
  711. return Ue(u), t;
  712. }
  713. return Ue(a), t;
  714. }, ln = () => wt([]), dn = (e) => wt([e]), fn = (e, t) => wt([e, t]), hn = () => {
  715. var e = qe.pop();
  716. e || Z("no exception to throw");
  717. var t = e.excPtr;
  718. throw e.get_rethrown() || (qe.push(e), e.set_rethrown(true), e.set_caught(false), Ne++), ie = t, ie;
  719. }, pn = (e, t, n) => {
  720. var a = new gt(e);
  721. throw a.init(t, n), ie = e, Ne++, ie;
  722. }, mn = () => Ne, ze = {}, bt = (e) => {
  723. for (; e.length; ) {
  724. var t = e.pop(), n = e.pop();
  725. n(t);
  726. }
  727. };
  728. function Ct(e) {
  729. return this.fromWireType(M[e >> 2]);
  730. }
  731. var $e = {}, ye = {}, Ge = {}, Nt, Ye = (e) => {
  732. throw new Nt(e);
  733. }, ge = (e, t, n) => {
  734. e.forEach(function(f) {
  735. Ge[f] = t;
  736. });
  737. function a(f) {
  738. var m = n(f);
  739. m.length !== e.length && Ye("Mismatched type converter count");
  740. for (var w = 0; w < e.length; ++w)
  741. re(e[w], m[w]);
  742. }
  743. var s = new Array(t.length), u = [], d = 0;
  744. t.forEach((f, m) => {
  745. ye.hasOwnProperty(f) ? s[m] = ye[f] : (u.push(f), $e.hasOwnProperty(f) || ($e[f] = []), $e[f].push(() => {
  746. s[m] = ye[f], ++d, d === u.length && a(s);
  747. }));
  748. }), u.length === 0 && a(s);
  749. }, vn = (e) => {
  750. var t = ze[e];
  751. delete ze[e];
  752. var n = t.rawConstructor, a = t.rawDestructor, s = t.fields, u = s.map((d) => d.getterReturnType).concat(s.map((d) => d.setterArgumentType));
  753. ge([e], u, (d) => {
  754. var f = {};
  755. return s.forEach((m, w) => {
  756. var _ = m.fieldName, T = d[w], E = m.getter, O = m.getterContext, L = d[w + s.length], q = m.setter, k = m.setterContext;
  757. f[_] = {
  758. read: (J) => T.fromWireType(E(O, J)),
  759. write: (J, y) => {
  760. var P = [];
  761. q(k, J, L.toWireType(P, y)), bt(P);
  762. }
  763. };
  764. }), [{
  765. name: t.name,
  766. fromWireType: (m) => {
  767. var w = {};
  768. for (var _ in f)
  769. w[_] = f[_].read(m);
  770. return a(m), w;
  771. },
  772. toWireType: (m, w) => {
  773. for (var _ in f)
  774. if (!(_ in w))
  775. throw new TypeError(`Missing field: "${_}"`);
  776. var T = n();
  777. for (_ in f)
  778. f[_].write(T, w[_]);
  779. return m !== null && m.push(a, T), T;
  780. },
  781. argPackAdvance: ne,
  782. readValueFromPointer: Ct,
  783. destructorFunction: a
  784. }];
  785. });
  786. }, yn = (e, t, n, a, s) => {
  787. }, gn = () => {
  788. for (var e = new Array(256), t = 0; t < 256; ++t)
  789. e[t] = String.fromCharCode(t);
  790. zt = e;
  791. }, zt, Y = (e) => {
  792. for (var t = "", n = e; D[n]; )
  793. t += zt[D[n++]];
  794. return t;
  795. }, _e, x = (e) => {
  796. throw new _e(e);
  797. };
  798. function wn(e, t) {
  799. let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
  800. var a = t.name;
  801. if (e || x(`type "${a}" must have a positive integer typeid pointer`), ye.hasOwnProperty(e)) {
  802. if (n.ignoreDuplicateRegistrations)
  803. return;
  804. x(`Cannot register type '${a}' twice`);
  805. }
  806. if (ye[e] = t, delete Ge[e], $e.hasOwnProperty(e)) {
  807. var s = $e[e];
  808. delete $e[e], s.forEach((u) => u());
  809. }
  810. }
  811. function re(e, t) {
  812. let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
  813. if (!("argPackAdvance" in t))
  814. throw new TypeError("registerType registeredInstance requires argPackAdvance");
  815. return wn(e, t, n);
  816. }
  817. var ne = 8, bn = (e, t, n, a) => {
  818. t = Y(t), re(e, {
  819. name: t,
  820. fromWireType: function(s) {
  821. return !!s;
  822. },
  823. toWireType: function(s, u) {
  824. return u ? n : a;
  825. },
  826. argPackAdvance: ne,
  827. readValueFromPointer: function(s) {
  828. return this.fromWireType(D[s]);
  829. },
  830. destructorFunction: null
  831. });
  832. }, Cn = (e) => ({
  833. count: e.count,
  834. deleteScheduled: e.deleteScheduled,
  835. preservePointerOnDelete: e.preservePointerOnDelete,
  836. ptr: e.ptr,
  837. ptrType: e.ptrType,
  838. smartPtr: e.smartPtr,
  839. smartPtrType: e.smartPtrType
  840. }), $t = (e) => {
  841. function t(n) {
  842. return n.$$.ptrType.registeredClass.name;
  843. }
  844. x(t(e) + " instance already deleted");
  845. }, _t = false, Gt = (e) => {
  846. }, $n = (e) => {
  847. e.smartPtr ? e.smartPtrType.rawDestructor(e.smartPtr) : e.ptrType.registeredClass.rawDestructor(e.ptr);
  848. }, Yt = (e) => {
  849. e.count.value -= 1;
  850. var t = e.count.value === 0;
  851. t && $n(e);
  852. }, Jt = (e, t, n) => {
  853. if (t === n)
  854. return e;
  855. if (n.baseClass === void 0)
  856. return null;
  857. var a = Jt(e, t, n.baseClass);
  858. return a === null ? null : n.downcast(a);
  859. }, Qt = {}, _n = () => Object.keys(Re).length, Sn = () => {
  860. var e = [];
  861. for (var t in Re)
  862. Re.hasOwnProperty(t) && e.push(Re[t]);
  863. return e;
  864. }, De = [], St = () => {
  865. for (; De.length; ) {
  866. var e = De.pop();
  867. e.$$.deleteScheduled = false, e.delete();
  868. }
  869. }, xe, Pn = (e) => {
  870. xe = e, De.length && xe && xe(St);
  871. }, Tn = () => {
  872. i.getInheritedInstanceCount = _n, i.getLiveInheritedInstances = Sn, i.flushPendingDeletes = St, i.setDelayFunction = Pn;
  873. }, Re = {}, En = (e, t) => {
  874. for (t === void 0 && x("ptr should not be undefined"); e.baseClass; )
  875. t = e.upcast(t), e = e.baseClass;
  876. return t;
  877. }, On = (e, t) => (t = En(e, t), Re[t]), Je = (e, t) => {
  878. (!t.ptrType || !t.ptr) && Ye("makeClassHandle requires ptr and ptrType");
  879. var n = !!t.smartPtrType, a = !!t.smartPtr;
  880. return n !== a && Ye("Both smartPtrType and smartPtr must be specified"), t.count = {
  881. value: 1
  882. }, Ie(Object.create(e, {
  883. $$: {
  884. value: t,
  885. writable: true
  886. }
  887. }));
  888. };
  889. function Mn(e) {
  890. var t = this.getPointee(e);
  891. if (!t)
  892. return this.destructor(e), null;
  893. var n = On(this.registeredClass, t);
  894. if (n !== void 0) {
  895. if (n.$$.count.value === 0)
  896. return n.$$.ptr = t, n.$$.smartPtr = e, n.clone();
  897. var a = n.clone();
  898. return this.destructor(e), a;
  899. }
  900. function s() {
  901. return this.isSmartPointer ? Je(this.registeredClass.instancePrototype, {
  902. ptrType: this.pointeeType,
  903. ptr: t,
  904. smartPtrType: this,
  905. smartPtr: e
  906. }) : Je(this.registeredClass.instancePrototype, {
  907. ptrType: this,
  908. ptr: e
  909. });
  910. }
  911. var u = this.registeredClass.getActualType(t), d = Qt[u];
  912. if (!d)
  913. return s.call(this);
  914. var f;
  915. this.isConst ? f = d.constPointerType : f = d.pointerType;
  916. var m = Jt(t, this.registeredClass, f.registeredClass);
  917. return m === null ? s.call(this) : this.isSmartPointer ? Je(f.registeredClass.instancePrototype, {
  918. ptrType: f,
  919. ptr: m,
  920. smartPtrType: this,
  921. smartPtr: e
  922. }) : Je(f.registeredClass.instancePrototype, {
  923. ptrType: f,
  924. ptr: m
  925. });
  926. }
  927. var Ie = (e) => typeof FinalizationRegistry > "u" ? (Ie = (t) => t, e) : (_t = new FinalizationRegistry((t) => {
  928. Yt(t.$$);
  929. }), Ie = (t) => {
  930. var n = t.$$, a = !!n.smartPtr;
  931. if (a) {
  932. var s = {
  933. $$: n
  934. };
  935. _t.register(t, s, t);
  936. }
  937. return t;
  938. }, Gt = (t) => _t.unregister(t), Ie(e)), An = () => {
  939. Object.assign(Qe.prototype, {
  940. isAliasOf(e) {
  941. if (!(this instanceof Qe) || !(e instanceof Qe))
  942. return false;
  943. var t = this.$$.ptrType.registeredClass, n = this.$$.ptr;
  944. e.$$ = e.$$;
  945. for (var a = e.$$.ptrType.registeredClass, s = e.$$.ptr; t.baseClass; )
  946. n = t.upcast(n), t = t.baseClass;
  947. for (; a.baseClass; )
  948. s = a.upcast(s), a = a.baseClass;
  949. return t === a && n === s;
  950. },
  951. clone() {
  952. if (this.$$.ptr || $t(this), this.$$.preservePointerOnDelete)
  953. return this.$$.count.value += 1, this;
  954. var e = Ie(Object.create(Object.getPrototypeOf(this), {
  955. $$: {
  956. value: Cn(this.$$)
  957. }
  958. }));
  959. return e.$$.count.value += 1, e.$$.deleteScheduled = false, e;
  960. },
  961. delete() {
  962. this.$$.ptr || $t(this), this.$$.deleteScheduled && !this.$$.preservePointerOnDelete && x("Object already scheduled for deletion"), Gt(this), Yt(this.$$), this.$$.preservePointerOnDelete || (this.$$.smartPtr = void 0, this.$$.ptr = void 0);
  963. },
  964. isDeleted() {
  965. return !this.$$.ptr;
  966. },
  967. deleteLater() {
  968. return this.$$.ptr || $t(this), this.$$.deleteScheduled && !this.$$.preservePointerOnDelete && x("Object already scheduled for deletion"), De.push(this), De.length === 1 && xe && xe(St), this.$$.deleteScheduled = true, this;
  969. }
  970. });
  971. };
  972. function Qe() {
  973. }
  974. var ke = (e, t) => Object.defineProperty(t, "name", {
  975. value: e
  976. }), Xt = (e, t, n) => {
  977. if (e[t].overloadTable === void 0) {
  978. var a = e[t];
  979. e[t] = function() {
  980. return e[t].overloadTable.hasOwnProperty(arguments.length) || x(`Function '${n}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[t].overloadTable})!`), e[t].overloadTable[arguments.length].apply(this, arguments);
  981. }, e[t].overloadTable = [], e[t].overloadTable[a.argCount] = a;
  982. }
  983. }, Pt = (e, t, n) => {
  984. i.hasOwnProperty(e) ? ((n === void 0 || i[e].overloadTable !== void 0 && i[e].overloadTable[n] !== void 0) && x(`Cannot register public name '${e}' twice`), Xt(i, e, e), i.hasOwnProperty(n) && x(`Cannot register multiple overloads of a function with the same number of arguments (${n})!`), i[e].overloadTable[n] = t) : (i[e] = t, n !== void 0 && (i[e].numArguments = n));
  985. }, Dn = 48, xn = 57, Rn = (e) => {
  986. if (e === void 0)
  987. return "_unknown";
  988. e = e.replace(/[^a-zA-Z0-9_]/g, "$");
  989. var t = e.charCodeAt(0);
  990. return t >= Dn && t <= xn ? `_${e}` : e;
  991. };
  992. function In(e, t, n, a, s, u, d, f) {
  993. this.name = e, this.constructor = t, this.instancePrototype = n, this.rawDestructor = a, this.baseClass = s, this.getActualType = u, this.upcast = d, this.downcast = f, this.pureVirtualFunctions = [];
  994. }
  995. var Tt = (e, t, n) => {
  996. for (; t !== n; )
  997. t.upcast || x(`Expected null or instance of ${n.name}, got an instance of ${t.name}`), e = t.upcast(e), t = t.baseClass;
  998. return e;
  999. };
  1000. function kn(e, t) {
  1001. if (t === null)
  1002. return this.isReference && x(`null is not a valid ${this.name}`), 0;
  1003. t.$$ || x(`Cannot pass "${Dt(t)}" as a ${this.name}`), t.$$.ptr || x(`Cannot pass deleted object as a pointer of type ${this.name}`);
  1004. var n = t.$$.ptrType.registeredClass, a = Tt(t.$$.ptr, n, this.registeredClass);
  1005. return a;
  1006. }
  1007. function Fn(e, t) {
  1008. var n;
  1009. if (t === null)
  1010. return this.isReference && x(`null is not a valid ${this.name}`), this.isSmartPointer ? (n = this.rawConstructor(), e !== null && e.push(this.rawDestructor, n), n) : 0;
  1011. (!t || !t.$$) && x(`Cannot pass "${Dt(t)}" as a ${this.name}`), t.$$.ptr || x(`Cannot pass deleted object as a pointer of type ${this.name}`), !this.isConst && t.$$.ptrType.isConst && x(`Cannot convert argument of type ${t.$$.smartPtrType ? t.$$.smartPtrType.name : t.$$.ptrType.name} to parameter type ${this.name}`);
  1012. var a = t.$$.ptrType.registeredClass;
  1013. if (n = Tt(t.$$.ptr, a, this.registeredClass), this.isSmartPointer)
  1014. switch (t.$$.smartPtr === void 0 && x("Passing raw pointer to smart pointer is illegal"), this.sharingPolicy) {
  1015. case 0:
  1016. t.$$.smartPtrType === this ? n = t.$$.smartPtr : x(`Cannot convert argument of type ${t.$$.smartPtrType ? t.$$.smartPtrType.name : t.$$.ptrType.name} to parameter type ${this.name}`);
  1017. break;
  1018. case 1:
  1019. n = t.$$.smartPtr;
  1020. break;
  1021. case 2:
  1022. if (t.$$.smartPtrType === this)
  1023. n = t.$$.smartPtr;
  1024. else {
  1025. var s = t.clone();
  1026. n = this.rawShare(n, se.toHandle(() => s.delete())), e !== null && e.push(this.rawDestructor, n);
  1027. }
  1028. break;
  1029. default:
  1030. x("Unsupporting sharing policy");
  1031. }
  1032. return n;
  1033. }
  1034. function Un(e, t) {
  1035. if (t === null)
  1036. return this.isReference && x(`null is not a valid ${this.name}`), 0;
  1037. t.$$ || x(`Cannot pass "${Dt(t)}" as a ${this.name}`), t.$$.ptr || x(`Cannot pass deleted object as a pointer of type ${this.name}`), t.$$.ptrType.isConst && x(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);
  1038. var n = t.$$.ptrType.registeredClass, a = Tt(t.$$.ptr, n, this.registeredClass);
  1039. return a;
  1040. }
  1041. function Zt(e) {
  1042. return this.fromWireType(A[e >> 2]);
  1043. }
  1044. var Wn = () => {
  1045. Object.assign(Xe.prototype, {
  1046. getPointee(e) {
  1047. return this.rawGetPointee && (e = this.rawGetPointee(e)), e;
  1048. },
  1049. destructor(e) {
  1050. var t;
  1051. (t = this.rawDestructor) === null || t === void 0 || t.call(this, e);
  1052. },
  1053. argPackAdvance: ne,
  1054. readValueFromPointer: Zt,
  1055. deleteObject(e) {
  1056. e !== null && e.delete();
  1057. },
  1058. fromWireType: Mn
  1059. });
  1060. };
  1061. function Xe(e, t, n, a, s, u, d, f, m, w, _) {
  1062. this.name = e, this.registeredClass = t, this.isReference = n, this.isConst = a, this.isSmartPointer = s, this.pointeeType = u, this.sharingPolicy = d, this.rawGetPointee = f, this.rawConstructor = m, this.rawShare = w, this.rawDestructor = _, !s && t.baseClass === void 0 ? a ? (this.toWireType = kn, this.destructorFunction = null) : (this.toWireType = Un, this.destructorFunction = null) : this.toWireType = Fn;
  1063. }
  1064. var Kt = (e, t, n) => {
  1065. i.hasOwnProperty(e) || Ye("Replacing nonexistant public symbol"), i[e].overloadTable !== void 0 && n !== void 0 ? i[e].overloadTable[n] = t : (i[e] = t, i[e].argCount = n);
  1066. }, jn = (e, t, n) => {
  1067. var a = i["dynCall_" + e];
  1068. return n && n.length ? a.apply(null, [t].concat(n)) : a.call(null, t);
  1069. }, Ze = [], er, H = (e) => {
  1070. var t = Ze[e];
  1071. return t || (e >= Ze.length && (Ze.length = e + 1), Ze[e] = t = er.get(e)), t;
  1072. }, Ln = (e, t, n) => {
  1073. if (e.includes("j"))
  1074. return jn(e, t, n);
  1075. var a = H(t).apply(null, n);
  1076. return a;
  1077. }, Hn = (e, t) => {
  1078. var n = [];
  1079. return function() {
  1080. return n.length = 0, Object.assign(n, arguments), Ln(e, t, n);
  1081. };
  1082. }, ee = (e, t) => {
  1083. e = Y(e);
  1084. function n() {
  1085. return e.includes("j") ? Hn(e, t) : H(t);
  1086. }
  1087. var a = n();
  1088. return typeof a != "function" && x(`unknown function pointer with signature ${e}: ${t}`), a;
  1089. }, Bn = (e, t) => {
  1090. var n = ke(t, function(a) {
  1091. this.name = t, this.message = a;
  1092. var s = new Error(a).stack;
  1093. s !== void 0 && (this.stack = this.toString() + `
  1094. ` + s.replace(/^Error(:[^\n]*)?\n/, ""));
  1095. });
  1096. return n.prototype = Object.create(e.prototype), n.prototype.constructor = n, n.prototype.toString = function() {
  1097. return this.message === void 0 ? this.name : `${this.name}: ${this.message}`;
  1098. }, n;
  1099. }, tr, rr = (e) => {
  1100. var t = fr(e), n = Y(t);
  1101. return ce(t), n;
  1102. }, Ke = (e, t) => {
  1103. var n = [], a = {};
  1104. function s(u) {
  1105. if (!a[u] && !ye[u]) {
  1106. if (Ge[u]) {
  1107. Ge[u].forEach(s);
  1108. return;
  1109. }
  1110. n.push(u), a[u] = true;
  1111. }
  1112. }
  1113. throw t.forEach(s), new tr(`${e}: ` + n.map(rr).join([", "]));
  1114. }, Vn = (e, t, n, a, s, u, d, f, m, w, _, T, E) => {
  1115. _ = Y(_), u = ee(s, u), f && (f = ee(d, f)), w && (w = ee(m, w)), E = ee(T, E);
  1116. var O = Rn(_);
  1117. Pt(O, function() {
  1118. Ke(`Cannot construct ${_} due to unbound types`, [a]);
  1119. }), ge([e, t, n], a ? [a] : [], function(L) {
  1120. L = L[0];
  1121. var q, k;
  1122. a ? (q = L.registeredClass, k = q.instancePrototype) : k = Qe.prototype;
  1123. var J = ke(_, function() {
  1124. if (Object.getPrototypeOf(this) !== y)
  1125. throw new _e("Use 'new' to construct " + _);
  1126. if (P.constructor_body === void 0)
  1127. throw new _e(_ + " has no accessible constructor");
  1128. var br = P.constructor_body[arguments.length];
  1129. if (br === void 0)
  1130. throw new _e(`Tried to invoke ctor of ${_} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(P.constructor_body).toString()}) parameters instead!`);
  1131. return br.apply(this, arguments);
  1132. }), y = Object.create(k, {
  1133. constructor: {
  1134. value: J
  1135. }
  1136. });
  1137. J.prototype = y;
  1138. var P = new In(_, J, y, E, q, u, f, w);
  1139. if (P.baseClass) {
  1140. var N, G;
  1141. (G = (N = P.baseClass).__derivedClasses) !== null && G !== void 0 || (N.__derivedClasses = []), P.baseClass.__derivedClasses.push(P);
  1142. }
  1143. var Se = new Xe(_, P, true, false, false), rt = new Xe(_ + "*", P, false, false, false), wr = new Xe(_ + " const*", P, false, true, false);
  1144. return Qt[e] = {
  1145. pointerType: rt,
  1146. constPointerType: wr
  1147. }, Kt(O, J), [Se, rt, wr];
  1148. });
  1149. }, Et = (e, t) => {
  1150. for (var n = [], a = 0; a < e; a++)
  1151. n.push(A[t + a * 4 >> 2]);
  1152. return n;
  1153. };
  1154. function qn(e) {
  1155. for (var t = 1; t < e.length; ++t)
  1156. if (e[t] !== null && e[t].destructorFunction === void 0)
  1157. return true;
  1158. return false;
  1159. }
  1160. function Ot(e, t, n, a, s, u) {
  1161. var d = t.length;
  1162. d < 2 && x("argTypes array size mismatch! Must at least get return value and 'this' types!");
  1163. var f = t[1] !== null && n !== null, m = qn(t), w = t[0].name !== "void", _ = d - 2, T = new Array(_), E = [], O = [], L = function() {
  1164. arguments.length !== _ && x(`function ${e} called with ${arguments.length} arguments, expected ${_}`), O.length = 0;
  1165. var q;
  1166. E.length = f ? 2 : 1, E[0] = s, f && (q = t[1].toWireType(O, this), E[1] = q);
  1167. for (var k = 0; k < _; ++k)
  1168. T[k] = t[k + 2].toWireType(O, arguments[k]), E.push(T[k]);
  1169. var J = a.apply(null, E);
  1170. function y(P) {
  1171. if (m)
  1172. bt(O);
  1173. else
  1174. for (var N = f ? 1 : 2; N < t.length; N++) {
  1175. var G = N === 1 ? q : T[N - 2];
  1176. t[N].destructorFunction !== null && t[N].destructorFunction(G);
  1177. }
  1178. if (w)
  1179. return t[0].fromWireType(P);
  1180. }
  1181. return y(J);
  1182. };
  1183. return ke(e, L);
  1184. }
  1185. var Nn = (e, t, n, a, s, u) => {
  1186. var d = Et(t, n);
  1187. s = ee(a, s), ge([], [e], function(f) {
  1188. f = f[0];
  1189. var m = `constructor ${f.name}`;
  1190. if (f.registeredClass.constructor_body === void 0 && (f.registeredClass.constructor_body = []), f.registeredClass.constructor_body[t - 1] !== void 0)
  1191. throw new _e(`Cannot register multiple constructors with identical number of parameters (${t - 1}) for class '${f.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);
  1192. return f.registeredClass.constructor_body[t - 1] = () => {
  1193. Ke(`Cannot construct ${f.name} due to unbound types`, d);
  1194. }, ge([], d, (w) => (w.splice(1, 0, null), f.registeredClass.constructor_body[t - 1] = Ot(m, w, null, s, u), [])), [];
  1195. });
  1196. }, nr = (e) => {
  1197. e = e.trim();
  1198. const t = e.indexOf("(");
  1199. return t !== -1 ? e.substr(0, t) : e;
  1200. }, zn = (e, t, n, a, s, u, d, f, m) => {
  1201. var w = Et(n, a);
  1202. t = Y(t), t = nr(t), u = ee(s, u), ge([], [e], function(_) {
  1203. _ = _[0];
  1204. var T = `${_.name}.${t}`;
  1205. t.startsWith("@@") && (t = Symbol[t.substring(2)]), f && _.registeredClass.pureVirtualFunctions.push(t);
  1206. function E() {
  1207. Ke(`Cannot call ${T} due to unbound types`, w);
  1208. }
  1209. var O = _.registeredClass.instancePrototype, L = O[t];
  1210. return L === void 0 || L.overloadTable === void 0 && L.className !== _.name && L.argCount === n - 2 ? (E.argCount = n - 2, E.className = _.name, O[t] = E) : (Xt(O, t, T), O[t].overloadTable[n - 2] = E), ge([], w, function(q) {
  1211. var k = Ot(T, q, _, u, d);
  1212. return O[t].overloadTable === void 0 ? (k.argCount = n - 2, O[t] = k) : O[t].overloadTable[n - 2] = k, [];
  1213. }), [];
  1214. });
  1215. };
  1216. function Gn() {
  1217. Object.assign(ar.prototype, {
  1218. get(e) {
  1219. return this.allocated[e];
  1220. },
  1221. has(e) {
  1222. return this.allocated[e] !== void 0;
  1223. },
  1224. allocate(e) {
  1225. var t = this.freelist.pop() || this.allocated.length;
  1226. return this.allocated[t] = e, t;
  1227. },
  1228. free(e) {
  1229. this.allocated[e] = void 0, this.freelist.push(e);
  1230. }
  1231. });
  1232. }
  1233. function ar() {
  1234. this.allocated = [void 0], this.freelist = [];
  1235. }
  1236. var K = new ar(), Mt = (e) => {
  1237. e >= K.reserved && --K.get(e).refcount === 0 && K.free(e);
  1238. }, Yn = () => {
  1239. for (var e = 0, t = K.reserved; t < K.allocated.length; ++t)
  1240. K.allocated[t] !== void 0 && ++e;
  1241. return e;
  1242. }, Jn = () => {
  1243. K.allocated.push({
  1244. value: void 0
  1245. }, {
  1246. value: null
  1247. }, {
  1248. value: true
  1249. }, {
  1250. value: false
  1251. }), K.reserved = K.allocated.length, i.count_emval_handles = Yn;
  1252. }, se = {
  1253. toValue: (e) => (e || x("Cannot use deleted val. handle = " + e), K.get(e).value),
  1254. toHandle: (e) => {
  1255. switch (e) {
  1256. case void 0:
  1257. return 1;
  1258. case null:
  1259. return 2;
  1260. case true:
  1261. return 3;
  1262. case false:
  1263. return 4;
  1264. default:
  1265. return K.allocate({
  1266. refcount: 1,
  1267. value: e
  1268. });
  1269. }
  1270. }
  1271. }, Qn = (e, t) => {
  1272. t = Y(t), re(e, {
  1273. name: t,
  1274. fromWireType: (n) => {
  1275. var a = se.toValue(n);
  1276. return Mt(n), a;
  1277. },
  1278. toWireType: (n, a) => se.toHandle(a),
  1279. argPackAdvance: ne,
  1280. readValueFromPointer: Ct,
  1281. destructorFunction: null
  1282. });
  1283. }, Xn = (e, t, n) => {
  1284. switch (t) {
  1285. case 1:
  1286. return n ? function(a) {
  1287. return this.fromWireType(R[a >> 0]);
  1288. } : function(a) {
  1289. return this.fromWireType(D[a >> 0]);
  1290. };
  1291. case 2:
  1292. return n ? function(a) {
  1293. return this.fromWireType(X[a >> 1]);
  1294. } : function(a) {
  1295. return this.fromWireType(I[a >> 1]);
  1296. };
  1297. case 4:
  1298. return n ? function(a) {
  1299. return this.fromWireType(M[a >> 2]);
  1300. } : function(a) {
  1301. return this.fromWireType(A[a >> 2]);
  1302. };
  1303. default:
  1304. throw new TypeError(`invalid integer width (${t}): ${e}`);
  1305. }
  1306. }, Zn = (e, t, n, a) => {
  1307. t = Y(t);
  1308. function s() {
  1309. }
  1310. s.values = {}, re(e, {
  1311. name: t,
  1312. constructor: s,
  1313. fromWireType: function(u) {
  1314. return this.constructor.values[u];
  1315. },
  1316. toWireType: (u, d) => d.value,
  1317. argPackAdvance: ne,
  1318. readValueFromPointer: Xn(t, n, a),
  1319. destructorFunction: null
  1320. }), Pt(t, s);
  1321. }, At = (e, t) => {
  1322. var n = ye[e];
  1323. return n === void 0 && x(t + " has unknown type " + rr(e)), n;
  1324. }, Kn = (e, t, n) => {
  1325. var a = At(e, "enum");
  1326. t = Y(t);
  1327. var s = a.constructor, u = Object.create(a.constructor.prototype, {
  1328. value: {
  1329. value: n
  1330. },
  1331. constructor: {
  1332. value: ke(`${a.name}_${t}`, function() {
  1333. })
  1334. }
  1335. });
  1336. s.values[n] = u, s[t] = u;
  1337. }, Dt = (e) => {
  1338. if (e === null)
  1339. return "null";
  1340. var t = typeof e;
  1341. return t === "object" || t === "array" || t === "function" ? e.toString() : "" + e;
  1342. }, ea = (e, t) => {
  1343. switch (t) {
  1344. case 4:
  1345. return function(n) {
  1346. return this.fromWireType(le[n >> 2]);
  1347. };
  1348. case 8:
  1349. return function(n) {
  1350. return this.fromWireType(oe[n >> 3]);
  1351. };
  1352. default:
  1353. throw new TypeError(`invalid float width (${t}): ${e}`);
  1354. }
  1355. }, ta = (e, t, n) => {
  1356. t = Y(t), re(e, {
  1357. name: t,
  1358. fromWireType: (a) => a,
  1359. toWireType: (a, s) => s,
  1360. argPackAdvance: ne,
  1361. readValueFromPointer: ea(t, n),
  1362. destructorFunction: null
  1363. });
  1364. }, ra = (e, t, n, a, s, u, d) => {
  1365. var f = Et(t, n);
  1366. e = Y(e), e = nr(e), s = ee(a, s), Pt(e, function() {
  1367. Ke(`Cannot call ${e} due to unbound types`, f);
  1368. }, t - 1), ge([], f, function(m) {
  1369. var w = [m[0], null].concat(m.slice(1));
  1370. return Kt(e, Ot(e, w, null, s, u), t - 1), [];
  1371. });
  1372. }, na = (e, t, n) => {
  1373. switch (t) {
  1374. case 1:
  1375. return n ? (a) => R[a >> 0] : (a) => D[a >> 0];
  1376. case 2:
  1377. return n ? (a) => X[a >> 1] : (a) => I[a >> 1];
  1378. case 4:
  1379. return n ? (a) => M[a >> 2] : (a) => A[a >> 2];
  1380. default:
  1381. throw new TypeError(`invalid integer width (${t}): ${e}`);
  1382. }
  1383. }, aa = (e, t, n, a, s) => {
  1384. t = Y(t);
  1385. var u = (_) => _;
  1386. if (a === 0) {
  1387. var d = 32 - 8 * n;
  1388. u = (_) => _ << d >>> d;
  1389. }
  1390. var f = t.includes("unsigned"), m = (_, T) => {
  1391. }, w;
  1392. f ? w = function(_, T) {
  1393. return m(T, this.name), T >>> 0;
  1394. } : w = function(_, T) {
  1395. return m(T, this.name), T;
  1396. }, re(e, {
  1397. name: t,
  1398. fromWireType: u,
  1399. toWireType: w,
  1400. argPackAdvance: ne,
  1401. readValueFromPointer: na(t, n, a !== 0),
  1402. destructorFunction: null
  1403. });
  1404. }, oa = (e, t, n) => {
  1405. var a = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array], s = a[t];
  1406. function u(d) {
  1407. var f = A[d >> 2], m = A[d + 4 >> 2];
  1408. return new s(R.buffer, m, f);
  1409. }
  1410. n = Y(n), re(e, {
  1411. name: n,
  1412. fromWireType: u,
  1413. argPackAdvance: ne,
  1414. readValueFromPointer: u
  1415. }, {
  1416. ignoreDuplicateRegistrations: true
  1417. });
  1418. }, or = (e, t, n, a) => {
  1419. if (!(a > 0))
  1420. return 0;
  1421. for (var s = n, u = n + a - 1, d = 0; d < e.length; ++d) {
  1422. var f = e.charCodeAt(d);
  1423. if (f >= 55296 && f <= 57343) {
  1424. var m = e.charCodeAt(++d);
  1425. f = 65536 + ((f & 1023) << 10) | m & 1023;
  1426. }
  1427. if (f <= 127) {
  1428. if (n >= u)
  1429. break;
  1430. t[n++] = f;
  1431. } else if (f <= 2047) {
  1432. if (n + 1 >= u)
  1433. break;
  1434. t[n++] = 192 | f >> 6, t[n++] = 128 | f & 63;
  1435. } else if (f <= 65535) {
  1436. if (n + 2 >= u)
  1437. break;
  1438. t[n++] = 224 | f >> 12, t[n++] = 128 | f >> 6 & 63, t[n++] = 128 | f & 63;
  1439. } else {
  1440. if (n + 3 >= u)
  1441. break;
  1442. t[n++] = 240 | f >> 18, t[n++] = 128 | f >> 12 & 63, t[n++] = 128 | f >> 6 & 63, t[n++] = 128 | f & 63;
  1443. }
  1444. }
  1445. return t[n] = 0, n - s;
  1446. }, ia = (e, t, n) => or(e, D, t, n), ir = (e) => {
  1447. for (var t = 0, n = 0; n < e.length; ++n) {
  1448. var a = e.charCodeAt(n);
  1449. a <= 127 ? t++ : a <= 2047 ? t += 2 : a >= 55296 && a <= 57343 ? (t += 4, ++n) : t += 3;
  1450. }
  1451. return t;
  1452. }, sr = typeof TextDecoder < "u" ? new TextDecoder("utf8") : void 0, sa = (e, t, n) => {
  1453. for (var a = t + n, s = t; e[s] && !(s >= a); )
  1454. ++s;
  1455. if (s - t > 16 && e.buffer && sr)
  1456. return sr.decode(e.subarray(t, s));
  1457. for (var u = ""; t < s; ) {
  1458. var d = e[t++];
  1459. if (!(d & 128)) {
  1460. u += String.fromCharCode(d);
  1461. continue;
  1462. }
  1463. var f = e[t++] & 63;
  1464. if ((d & 224) == 192) {
  1465. u += String.fromCharCode((d & 31) << 6 | f);
  1466. continue;
  1467. }
  1468. var m = e[t++] & 63;
  1469. if ((d & 240) == 224 ? d = (d & 15) << 12 | f << 6 | m : d = (d & 7) << 18 | f << 12 | m << 6 | e[t++] & 63, d < 65536)
  1470. u += String.fromCharCode(d);
  1471. else {
  1472. var w = d - 65536;
  1473. u += String.fromCharCode(55296 | w >> 10, 56320 | w & 1023);
  1474. }
  1475. }
  1476. return u;
  1477. }, xt = (e, t) => e ? sa(D, e, t) : "", ca = (e, t) => {
  1478. t = Y(t);
  1479. var n = t === "std::string";
  1480. re(e, {
  1481. name: t,
  1482. fromWireType(a) {
  1483. var s = A[a >> 2], u = a + 4, d;
  1484. if (n)
  1485. for (var f = u, m = 0; m <= s; ++m) {
  1486. var w = u + m;
  1487. if (m == s || D[w] == 0) {
  1488. var _ = w - f, T = xt(f, _);
  1489. d === void 0 ? d = T : (d += "\0", d += T), f = w + 1;
  1490. }
  1491. }
  1492. else {
  1493. for (var E = new Array(s), m = 0; m < s; ++m)
  1494. E[m] = String.fromCharCode(D[u + m]);
  1495. d = E.join("");
  1496. }
  1497. return ce(a), d;
  1498. },
  1499. toWireType(a, s) {
  1500. s instanceof ArrayBuffer && (s = new Uint8Array(s));
  1501. var u, d = typeof s == "string";
  1502. d || s instanceof Uint8Array || s instanceof Uint8ClampedArray || s instanceof Int8Array || x("Cannot pass non-string to std::string"), n && d ? u = ir(s) : u = s.length;
  1503. var f = kt(4 + u + 1), m = f + 4;
  1504. if (A[f >> 2] = u, n && d)
  1505. ia(s, m, u + 1);
  1506. else if (d)
  1507. for (var w = 0; w < u; ++w) {
  1508. var _ = s.charCodeAt(w);
  1509. _ > 255 && (ce(m), x("String has UTF-16 code units that do not fit in 8 bits")), D[m + w] = _;
  1510. }
  1511. else
  1512. for (var w = 0; w < u; ++w)
  1513. D[m + w] = s[w];
  1514. return a !== null && a.push(ce, f), f;
  1515. },
  1516. argPackAdvance: ne,
  1517. readValueFromPointer: Zt,
  1518. destructorFunction(a) {
  1519. ce(a);
  1520. }
  1521. });
  1522. }, cr = typeof TextDecoder < "u" ? new TextDecoder("utf-16le") : void 0, ua = (e, t) => {
  1523. for (var n = e, a = n >> 1, s = a + t / 2; !(a >= s) && I[a]; )
  1524. ++a;
  1525. if (n = a << 1, n - e > 32 && cr)
  1526. return cr.decode(D.subarray(e, n));
  1527. for (var u = "", d = 0; !(d >= t / 2); ++d) {
  1528. var f = X[e + d * 2 >> 1];
  1529. if (f == 0)
  1530. break;
  1531. u += String.fromCharCode(f);
  1532. }
  1533. return u;
  1534. }, la = (e, t, n) => {
  1535. var a;
  1536. if ((a = n) !== null && a !== void 0 || (n = 2147483647), n < 2)
  1537. return 0;
  1538. n -= 2;
  1539. for (var s = t, u = n < e.length * 2 ? n / 2 : e.length, d = 0; d < u; ++d) {
  1540. var f = e.charCodeAt(d);
  1541. X[t >> 1] = f, t += 2;
  1542. }
  1543. return X[t >> 1] = 0, t - s;
  1544. }, da = (e) => e.length * 2, fa = (e, t) => {
  1545. for (var n = 0, a = ""; !(n >= t / 4); ) {
  1546. var s = M[e + n * 4 >> 2];
  1547. if (s == 0)
  1548. break;
  1549. if (++n, s >= 65536) {
  1550. var u = s - 65536;
  1551. a += String.fromCharCode(55296 | u >> 10, 56320 | u & 1023);
  1552. } else
  1553. a += String.fromCharCode(s);
  1554. }
  1555. return a;
  1556. }, ha = (e, t, n) => {
  1557. var a;
  1558. if ((a = n) !== null && a !== void 0 || (n = 2147483647), n < 4)
  1559. return 0;
  1560. for (var s = t, u = s + n - 4, d = 0; d < e.length; ++d) {
  1561. var f = e.charCodeAt(d);
  1562. if (f >= 55296 && f <= 57343) {
  1563. var m = e.charCodeAt(++d);
  1564. f = 65536 + ((f & 1023) << 10) | m & 1023;
  1565. }
  1566. if (M[t >> 2] = f, t += 4, t + 4 > u)
  1567. break;
  1568. }
  1569. return M[t >> 2] = 0, t - s;
  1570. }, pa = (e) => {
  1571. for (var t = 0, n = 0; n < e.length; ++n) {
  1572. var a = e.charCodeAt(n);
  1573. a >= 55296 && a <= 57343 && ++n, t += 4;
  1574. }
  1575. return t;
  1576. }, ma = (e, t, n) => {
  1577. n = Y(n);
  1578. var a, s, u, d, f;
  1579. t === 2 ? (a = ua, s = la, d = da, u = () => I, f = 1) : t === 4 && (a = fa, s = ha, d = pa, u = () => A, f = 2), re(e, {
  1580. name: n,
  1581. fromWireType: (m) => {
  1582. for (var w = A[m >> 2], _ = u(), T, E = m + 4, O = 0; O <= w; ++O) {
  1583. var L = m + 4 + O * t;
  1584. if (O == w || _[L >> f] == 0) {
  1585. var q = L - E, k = a(E, q);
  1586. T === void 0 ? T = k : (T += "\0", T += k), E = L + t;
  1587. }
  1588. }
  1589. return ce(m), T;
  1590. },
  1591. toWireType: (m, w) => {
  1592. typeof w != "string" && x(`Cannot pass non-string to C++ string type ${n}`);
  1593. var _ = d(w), T = kt(4 + _ + t);
  1594. return A[T >> 2] = _ >> f, s(w, T + 4, _ + t), m !== null && m.push(ce, T), T;
  1595. },
  1596. argPackAdvance: ne,
  1597. readValueFromPointer: Ct,
  1598. destructorFunction(m) {
  1599. ce(m);
  1600. }
  1601. });
  1602. }, va = (e, t, n, a, s, u) => {
  1603. ze[e] = {
  1604. name: Y(t),
  1605. rawConstructor: ee(n, a),
  1606. rawDestructor: ee(s, u),
  1607. fields: []
  1608. };
  1609. }, ya = (e, t, n, a, s, u, d, f, m, w) => {
  1610. ze[e].fields.push({
  1611. fieldName: Y(t),
  1612. getterReturnType: n,
  1613. getter: ee(a, s),
  1614. getterContext: u,
  1615. setterArgumentType: d,
  1616. setter: ee(f, m),
  1617. setterContext: w
  1618. });
  1619. }, ga = (e, t) => {
  1620. t = Y(t), re(e, {
  1621. isVoid: true,
  1622. name: t,
  1623. argPackAdvance: 0,
  1624. fromWireType: () => {
  1625. },
  1626. toWireType: (n, a) => {
  1627. }
  1628. });
  1629. }, Rt = [], wa = (e, t, n, a) => (e = Rt[e], t = se.toValue(t), e(null, t, n, a)), ba = {}, Ca = (e) => {
  1630. var t = ba[e];
  1631. return t === void 0 ? Y(e) : t;
  1632. }, ur = () => {
  1633. if (typeof globalThis == "object")
  1634. return globalThis;
  1635. function e(t) {
  1636. t.$$$embind_global$$$ = t;
  1637. var n = typeof $$$embind_global$$$ == "object" && t.$$$embind_global$$$ == t;
  1638. return n || delete t.$$$embind_global$$$, n;
  1639. }
  1640. if (typeof $$$embind_global$$$ == "object" || (typeof global == "object" && e(global) ? $$$embind_global$$$ = global : typeof self == "object" && e(self) && ($$$embind_global$$$ = self), typeof $$$embind_global$$$ == "object"))
  1641. return $$$embind_global$$$;
  1642. throw Error("unable to get global object.");
  1643. }, $a = (e) => e === 0 ? se.toHandle(ur()) : (e = Ca(e), se.toHandle(ur()[e])), _a = (e) => {
  1644. var t = Rt.length;
  1645. return Rt.push(e), t;
  1646. }, Sa = (e, t) => {
  1647. for (var n = new Array(e), a = 0; a < e; ++a)
  1648. n[a] = At(A[t + a * 4 >> 2], "parameter " + a);
  1649. return n;
  1650. }, Pa = Reflect.construct, Ta = (e, t, n) => {
  1651. var a = [], s = e.toWireType(a, n);
  1652. return a.length && (A[t >> 2] = se.toHandle(a)), s;
  1653. }, Ea = (e, t, n) => {
  1654. var a = Sa(e, t), s = a.shift();
  1655. e--;
  1656. var u = new Array(e), d = (m, w, _, T) => {
  1657. for (var E = 0, O = 0; O < e; ++O)
  1658. u[O] = a[O].readValueFromPointer(T + E), E += a[O].argPackAdvance;
  1659. for (var L = n === 1 ? Pa(w, u) : w.apply(m, u), O = 0; O < e; ++O) {
  1660. var q, k;
  1661. (q = (k = a[O]).deleteObject) === null || q === void 0 || q.call(k, u[O]);
  1662. }
  1663. return Ta(s, _, L);
  1664. }, f = `methodCaller<(${a.map((m) => m.name).join(", ")}) => ${s.name}>`;
  1665. return _a(ke(f, d));
  1666. }, Oa = (e) => {
  1667. e > 4 && (K.get(e).refcount += 1);
  1668. }, Ma = (e) => {
  1669. var t = se.toValue(e);
  1670. bt(t), Mt(e);
  1671. }, Aa = (e, t) => {
  1672. e = At(e, "_emval_take_value");
  1673. var n = e.readValueFromPointer(t);
  1674. return se.toHandle(n);
  1675. }, Da = () => {
  1676. Z("");
  1677. }, xa = (e, t, n) => D.copyWithin(e, t, t + n), Ra = () => 2147483648, Ia = (e) => {
  1678. var t = U.buffer, n = (e - t.byteLength + 65535) / 65536;
  1679. try {
  1680. return U.grow(n), be(), 1;
  1681. } catch (a) {
  1682. }
  1683. }, ka = (e) => {
  1684. var t = D.length;
  1685. e >>>= 0;
  1686. var n = Ra();
  1687. if (e > n)
  1688. return false;
  1689. for (var a = (m, w) => m + (w - m % w) % w, s = 1; s <= 4; s *= 2) {
  1690. var u = t * (1 + 0.2 / s);
  1691. u = Math.min(u, e + 100663296);
  1692. var d = Math.min(n, a(Math.max(e, u), 65536)), f = Ia(d);
  1693. if (f)
  1694. return true;
  1695. }
  1696. return false;
  1697. }, It = {}, Fa = () => v || "./this.program", Fe = () => {
  1698. if (!Fe.strings) {
  1699. var e = (typeof navigator == "object" && navigator.languages && navigator.languages[0] || "C").replace("-", "_") + ".UTF-8", t = {
  1700. USER: "web_user",
  1701. LOGNAME: "web_user",
  1702. PATH: "/",
  1703. PWD: "/",
  1704. HOME: "/home/web_user",
  1705. LANG: e,
  1706. _: Fa()
  1707. };
  1708. for (var n in It)
  1709. It[n] === void 0 ? delete t[n] : t[n] = It[n];
  1710. var a = [];
  1711. for (var n in t)
  1712. a.push(`${n}=${t[n]}`);
  1713. Fe.strings = a;
  1714. }
  1715. return Fe.strings;
  1716. }, Ua = (e, t) => {
  1717. for (var n = 0; n < e.length; ++n)
  1718. R[t++ >> 0] = e.charCodeAt(n);
  1719. R[t >> 0] = 0;
  1720. }, Wa = (e, t) => {
  1721. var n = 0;
  1722. return Fe().forEach((a, s) => {
  1723. var u = t + n;
  1724. A[e + s * 4 >> 2] = u, Ua(a, u), n += a.length + 1;
  1725. }), 0;
  1726. }, ja = (e, t) => {
  1727. var n = Fe();
  1728. A[e >> 2] = n.length;
  1729. var a = 0;
  1730. return n.forEach((s) => a += s.length + 1), A[t >> 2] = a, 0;
  1731. }, La = (e) => e, et = (e) => e % 4 === 0 && (e % 100 !== 0 || e % 400 === 0), Ha = (e, t) => {
  1732. for (var n = 0, a = 0; a <= t; n += e[a++])
  1733. ;
  1734. return n;
  1735. }, lr = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], dr = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], Ba = (e, t) => {
  1736. for (var n = new Date(e.getTime()); t > 0; ) {
  1737. var a = et(n.getFullYear()), s = n.getMonth(), u = (a ? lr : dr)[s];
  1738. if (t > u - n.getDate())
  1739. t -= u - n.getDate() + 1, n.setDate(1), s < 11 ? n.setMonth(s + 1) : (n.setMonth(0), n.setFullYear(n.getFullYear() + 1));
  1740. else
  1741. return n.setDate(n.getDate() + t), n;
  1742. }
  1743. return n;
  1744. };
  1745. function Va(e, t, n) {
  1746. var a = ir(e) + 1, s = new Array(a);
  1747. return or(e, s, 0, s.length), s;
  1748. }
  1749. var qa = (e, t) => {
  1750. R.set(e, t);
  1751. }, Na = (e, t, n, a) => {
  1752. var s = A[a + 40 >> 2], u = {
  1753. tm_sec: M[a >> 2],
  1754. tm_min: M[a + 4 >> 2],
  1755. tm_hour: M[a + 8 >> 2],
  1756. tm_mday: M[a + 12 >> 2],
  1757. tm_mon: M[a + 16 >> 2],
  1758. tm_year: M[a + 20 >> 2],
  1759. tm_wday: M[a + 24 >> 2],
  1760. tm_yday: M[a + 28 >> 2],
  1761. tm_isdst: M[a + 32 >> 2],
  1762. tm_gmtoff: M[a + 36 >> 2],
  1763. tm_zone: s ? xt(s) : ""
  1764. }, d = xt(n), f = {
  1765. "%c": "%a %b %d %H:%M:%S %Y",
  1766. "%D": "%m/%d/%y",
  1767. "%F": "%Y-%m-%d",
  1768. "%h": "%b",
  1769. "%r": "%I:%M:%S %p",
  1770. "%R": "%H:%M",
  1771. "%T": "%H:%M:%S",
  1772. "%x": "%m/%d/%y",
  1773. "%X": "%H:%M:%S",
  1774. "%Ec": "%c",
  1775. "%EC": "%C",
  1776. "%Ex": "%m/%d/%y",
  1777. "%EX": "%H:%M:%S",
  1778. "%Ey": "%y",
  1779. "%EY": "%Y",
  1780. "%Od": "%d",
  1781. "%Oe": "%e",
  1782. "%OH": "%H",
  1783. "%OI": "%I",
  1784. "%Om": "%m",
  1785. "%OM": "%M",
  1786. "%OS": "%S",
  1787. "%Ou": "%u",
  1788. "%OU": "%U",
  1789. "%OV": "%V",
  1790. "%Ow": "%w",
  1791. "%OW": "%W",
  1792. "%Oy": "%y"
  1793. };
  1794. for (var m in f)
  1795. d = d.replace(new RegExp(m, "g"), f[m]);
  1796. var w = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], _ = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
  1797. function T(y, P, N) {
  1798. for (var G = typeof y == "number" ? y.toString() : y || ""; G.length < P; )
  1799. G = N[0] + G;
  1800. return G;
  1801. }
  1802. function E(y, P) {
  1803. return T(y, P, "0");
  1804. }
  1805. function O(y, P) {
  1806. function N(Se) {
  1807. return Se < 0 ? -1 : Se > 0 ? 1 : 0;
  1808. }
  1809. var G;
  1810. return (G = N(y.getFullYear() - P.getFullYear())) === 0 && (G = N(y.getMonth() - P.getMonth())) === 0 && (G = N(y.getDate() - P.getDate())), G;
  1811. }
  1812. function L(y) {
  1813. switch (y.getDay()) {
  1814. case 0:
  1815. return new Date(y.getFullYear() - 1, 11, 29);
  1816. case 1:
  1817. return y;
  1818. case 2:
  1819. return new Date(y.getFullYear(), 0, 3);
  1820. case 3:
  1821. return new Date(y.getFullYear(), 0, 2);
  1822. case 4:
  1823. return new Date(y.getFullYear(), 0, 1);
  1824. case 5:
  1825. return new Date(y.getFullYear() - 1, 11, 31);
  1826. case 6:
  1827. return new Date(y.getFullYear() - 1, 11, 30);
  1828. }
  1829. }
  1830. function q(y) {
  1831. var P = Ba(new Date(y.tm_year + 1900, 0, 1), y.tm_yday), N = new Date(P.getFullYear(), 0, 4), G = new Date(P.getFullYear() + 1, 0, 4), Se = L(N), rt = L(G);
  1832. return O(Se, P) <= 0 ? O(rt, P) <= 0 ? P.getFullYear() + 1 : P.getFullYear() : P.getFullYear() - 1;
  1833. }
  1834. var k = {
  1835. "%a": (y) => w[y.tm_wday].substring(0, 3),
  1836. "%A": (y) => w[y.tm_wday],
  1837. "%b": (y) => _[y.tm_mon].substring(0, 3),
  1838. "%B": (y) => _[y.tm_mon],
  1839. "%C": (y) => {
  1840. var P = y.tm_year + 1900;
  1841. return E(P / 100 | 0, 2);
  1842. },
  1843. "%d": (y) => E(y.tm_mday, 2),
  1844. "%e": (y) => T(y.tm_mday, 2, " "),
  1845. "%g": (y) => q(y).toString().substring(2),
  1846. "%G": (y) => q(y),
  1847. "%H": (y) => E(y.tm_hour, 2),
  1848. "%I": (y) => {
  1849. var P = y.tm_hour;
  1850. return P == 0 ? P = 12 : P > 12 && (P -= 12), E(P, 2);
  1851. },
  1852. "%j": (y) => E(y.tm_mday + Ha(et(y.tm_year + 1900) ? lr : dr, y.tm_mon - 1), 3),
  1853. "%m": (y) => E(y.tm_mon + 1, 2),
  1854. "%M": (y) => E(y.tm_min, 2),
  1855. "%n": () => `
  1856. `,
  1857. "%p": (y) => y.tm_hour >= 0 && y.tm_hour < 12 ? "AM" : "PM",
  1858. "%S": (y) => E(y.tm_sec, 2),
  1859. "%t": () => " ",
  1860. "%u": (y) => y.tm_wday || 7,
  1861. "%U": (y) => {
  1862. var P = y.tm_yday + 7 - y.tm_wday;
  1863. return E(Math.floor(P / 7), 2);
  1864. },
  1865. "%V": (y) => {
  1866. var P = Math.floor((y.tm_yday + 7 - (y.tm_wday + 6) % 7) / 7);
  1867. if ((y.tm_wday + 371 - y.tm_yday - 2) % 7 <= 2 && P++, P) {
  1868. if (P == 53) {
  1869. var N = (y.tm_wday + 371 - y.tm_yday) % 7;
  1870. N != 4 && (N != 3 || !et(y.tm_year)) && (P = 1);
  1871. }
  1872. } else {
  1873. P = 52;
  1874. var G = (y.tm_wday + 7 - y.tm_yday - 1) % 7;
  1875. (G == 4 || G == 5 && et(y.tm_year % 400 - 1)) && P++;
  1876. }
  1877. return E(P, 2);
  1878. },
  1879. "%w": (y) => y.tm_wday,
  1880. "%W": (y) => {
  1881. var P = y.tm_yday + 7 - (y.tm_wday + 6) % 7;
  1882. return E(Math.floor(P / 7), 2);
  1883. },
  1884. "%y": (y) => (y.tm_year + 1900).toString().substring(2),
  1885. "%Y": (y) => y.tm_year + 1900,
  1886. "%z": (y) => {
  1887. var P = y.tm_gmtoff, N = P >= 0;
  1888. return P = Math.abs(P) / 60, P = P / 60 * 100 + P % 60, (N ? "+" : "-") + ("0000" + P).slice(-4);
  1889. },
  1890. "%Z": (y) => y.tm_zone,
  1891. "%%": () => "%"
  1892. };
  1893. d = d.replace(/%%/g, "\0\0");
  1894. for (var m in k)
  1895. d.includes(m) && (d = d.replace(new RegExp(m, "g"), k[m](u)));
  1896. d = d.replace(/\0\0/g, "%");
  1897. var J = Va(d);
  1898. return J.length > t ? 0 : (qa(J, e), J.length - 1);
  1899. }, za = (e, t, n, a, s) => Na(e, t, n, a);
  1900. Nt = i.InternalError = class extends Error {
  1901. constructor(e) {
  1902. super(e), this.name = "InternalError";
  1903. }
  1904. }, gn(), _e = i.BindingError = class extends Error {
  1905. constructor(e) {
  1906. super(e), this.name = "BindingError";
  1907. }
  1908. }, An(), Tn(), Wn(), tr = i.UnboundTypeError = Bn(Error, "UnboundTypeError"), Gn(), Jn();
  1909. var Ga = {
  1910. s: sn,
  1911. u: cn,
  1912. b: ln,
  1913. g: dn,
  1914. q: fn,
  1915. J: hn,
  1916. f: pn,
  1917. V: mn,
  1918. d: un,
  1919. da: vn,
  1920. Q: yn,
  1921. _: bn,
  1922. ca: Vn,
  1923. ba: Nn,
  1924. w: zn,
  1925. Y: Qn,
  1926. x: Zn,
  1927. h: Kn,
  1928. L: ta,
  1929. M: ra,
  1930. t: aa,
  1931. o: oa,
  1932. K: ca,
  1933. C: ma,
  1934. A: va,
  1935. ea: ya,
  1936. $: ga,
  1937. R: wa,
  1938. ha: Mt,
  1939. fa: $a,
  1940. Z: Ea,
  1941. N: Oa,
  1942. O: Ma,
  1943. aa: Aa,
  1944. B: Da,
  1945. X: xa,
  1946. W: ka,
  1947. T: Wa,
  1948. U: ja,
  1949. E: uo,
  1950. D: Za,
  1951. F: co,
  1952. n: lo,
  1953. a: Ya,
  1954. e: eo,
  1955. m: Xa,
  1956. k: ro,
  1957. H: io,
  1958. v: ao,
  1959. G: so,
  1960. z: ho,
  1961. P: mo,
  1962. l: to,
  1963. j: Ka,
  1964. c: Qa,
  1965. p: Ja,
  1966. I: oo,
  1967. r: fo,
  1968. i: no,
  1969. y: po,
  1970. ga: La,
  1971. S: za
  1972. }, z = on(), ce = i._free = (e) => (ce = i._free = z.ka)(e), kt = i._malloc = (e) => (kt = i._malloc = z.la)(e), fr = (e) => (fr = z.na)(e), j = (e, t) => (j = z.oa)(e, t), Ue = (e) => (Ue = z.pa)(e), B = () => (B = z.qa)(), V = (e) => (V = z.ra)(e), hr = (e) => (hr = z.sa)(e), pr = (e) => (pr = z.ta)(e), mr = (e, t, n) => (mr = z.ua)(e, t, n), vr = (e) => (vr = z.va)(e);
  1973. i.dynCall_viijii = (e, t, n, a, s, u, d) => (i.dynCall_viijii = z.wa)(e, t, n, a, s, u, d);
  1974. var yr = i.dynCall_jiiii = (e, t, n, a, s) => (yr = i.dynCall_jiiii = z.xa)(e, t, n, a, s);
  1975. i.dynCall_iiiiij = (e, t, n, a, s, u, d) => (i.dynCall_iiiiij = z.ya)(e, t, n, a, s, u, d), i.dynCall_iiiiijj = (e, t, n, a, s, u, d, f, m) => (i.dynCall_iiiiijj = z.za)(e, t, n, a, s, u, d, f, m), i.dynCall_iiiiiijj = (e, t, n, a, s, u, d, f, m, w) => (i.dynCall_iiiiiijj = z.Aa)(e, t, n, a, s, u, d, f, m, w);
  1976. function Ya(e, t) {
  1977. var n = B();
  1978. try {
  1979. return H(e)(t);
  1980. } catch (a) {
  1981. if (V(n), a !== a + 0)
  1982. throw a;
  1983. j(1, 0);
  1984. }
  1985. }
  1986. function Ja(e, t, n, a) {
  1987. var s = B();
  1988. try {
  1989. H(e)(t, n, a);
  1990. } catch (u) {
  1991. if (V(s), u !== u + 0)
  1992. throw u;
  1993. j(1, 0);
  1994. }
  1995. }
  1996. function Qa(e, t, n) {
  1997. var a = B();
  1998. try {
  1999. H(e)(t, n);
  2000. } catch (s) {
  2001. if (V(a), s !== s + 0)
  2002. throw s;
  2003. j(1, 0);
  2004. }
  2005. }
  2006. function Xa(e, t, n, a) {
  2007. var s = B();
  2008. try {
  2009. return H(e)(t, n, a);
  2010. } catch (u) {
  2011. if (V(s), u !== u + 0)
  2012. throw u;
  2013. j(1, 0);
  2014. }
  2015. }
  2016. function Za(e, t, n, a, s) {
  2017. var u = B();
  2018. try {
  2019. return H(e)(t, n, a, s);
  2020. } catch (d) {
  2021. if (V(u), d !== d + 0)
  2022. throw d;
  2023. j(1, 0);
  2024. }
  2025. }
  2026. function Ka(e, t) {
  2027. var n = B();
  2028. try {
  2029. H(e)(t);
  2030. } catch (a) {
  2031. if (V(n), a !== a + 0)
  2032. throw a;
  2033. j(1, 0);
  2034. }
  2035. }
  2036. function eo(e, t, n) {
  2037. var a = B();
  2038. try {
  2039. return H(e)(t, n);
  2040. } catch (s) {
  2041. if (V(a), s !== s + 0)
  2042. throw s;
  2043. j(1, 0);
  2044. }
  2045. }
  2046. function to(e) {
  2047. var t = B();
  2048. try {
  2049. H(e)();
  2050. } catch (n) {
  2051. if (V(t), n !== n + 0)
  2052. throw n;
  2053. j(1, 0);
  2054. }
  2055. }
  2056. function ro(e, t, n, a, s) {
  2057. var u = B();
  2058. try {
  2059. return H(e)(t, n, a, s);
  2060. } catch (d) {
  2061. if (V(u), d !== d + 0)
  2062. throw d;
  2063. j(1, 0);
  2064. }
  2065. }
  2066. function no(e, t, n, a, s, u, d, f, m, w, _) {
  2067. var T = B();
  2068. try {
  2069. H(e)(t, n, a, s, u, d, f, m, w, _);
  2070. } catch (E) {
  2071. if (V(T), E !== E + 0)
  2072. throw E;
  2073. j(1, 0);
  2074. }
  2075. }
  2076. function ao(e, t, n, a, s, u, d) {
  2077. var f = B();
  2078. try {
  2079. return H(e)(t, n, a, s, u, d);
  2080. } catch (m) {
  2081. if (V(f), m !== m + 0)
  2082. throw m;
  2083. j(1, 0);
  2084. }
  2085. }
  2086. function oo(e, t, n, a, s) {
  2087. var u = B();
  2088. try {
  2089. H(e)(t, n, a, s);
  2090. } catch (d) {
  2091. if (V(u), d !== d + 0)
  2092. throw d;
  2093. j(1, 0);
  2094. }
  2095. }
  2096. function io(e, t, n, a, s, u) {
  2097. var d = B();
  2098. try {
  2099. return H(e)(t, n, a, s, u);
  2100. } catch (f) {
  2101. if (V(d), f !== f + 0)
  2102. throw f;
  2103. j(1, 0);
  2104. }
  2105. }
  2106. function so(e, t, n, a, s, u, d, f) {
  2107. var m = B();
  2108. try {
  2109. return H(e)(t, n, a, s, u, d, f);
  2110. } catch (w) {
  2111. if (V(m), w !== w + 0)
  2112. throw w;
  2113. j(1, 0);
  2114. }
  2115. }
  2116. function co(e, t, n, a) {
  2117. var s = B();
  2118. try {
  2119. return H(e)(t, n, a);
  2120. } catch (u) {
  2121. if (V(s), u !== u + 0)
  2122. throw u;
  2123. j(1, 0);
  2124. }
  2125. }
  2126. function uo(e, t, n, a) {
  2127. var s = B();
  2128. try {
  2129. return H(e)(t, n, a);
  2130. } catch (u) {
  2131. if (V(s), u !== u + 0)
  2132. throw u;
  2133. j(1, 0);
  2134. }
  2135. }
  2136. function lo(e) {
  2137. var t = B();
  2138. try {
  2139. return H(e)();
  2140. } catch (n) {
  2141. if (V(t), n !== n + 0)
  2142. throw n;
  2143. j(1, 0);
  2144. }
  2145. }
  2146. function fo(e, t, n, a, s, u, d, f) {
  2147. var m = B();
  2148. try {
  2149. H(e)(t, n, a, s, u, d, f);
  2150. } catch (w) {
  2151. if (V(m), w !== w + 0)
  2152. throw w;
  2153. j(1, 0);
  2154. }
  2155. }
  2156. function ho(e, t, n, a, s, u, d, f, m, w, _, T) {
  2157. var E = B();
  2158. try {
  2159. return H(e)(t, n, a, s, u, d, f, m, w, _, T);
  2160. } catch (O) {
  2161. if (V(E), O !== O + 0)
  2162. throw O;
  2163. j(1, 0);
  2164. }
  2165. }
  2166. function po(e, t, n, a, s, u, d, f, m, w, _, T, E, O, L, q) {
  2167. var k = B();
  2168. try {
  2169. H(e)(t, n, a, s, u, d, f, m, w, _, T, E, O, L, q);
  2170. } catch (J) {
  2171. if (V(k), J !== J + 0)
  2172. throw J;
  2173. j(1, 0);
  2174. }
  2175. }
  2176. function mo(e, t, n, a, s) {
  2177. var u = B();
  2178. try {
  2179. return yr(e, t, n, a, s);
  2180. } catch (d) {
  2181. if (V(u), d !== d + 0)
  2182. throw d;
  2183. j(1, 0);
  2184. }
  2185. }
  2186. var tt;
  2187. ve = function e() {
  2188. tt || gr(), tt || (ve = e);
  2189. };
  2190. function gr() {
  2191. if (te > 0 || (Le(), te > 0))
  2192. return;
  2193. function e() {
  2194. tt || (tt = true, i.calledRun = true, !W && (lt(), c(i), i.onRuntimeInitialized && i.onRuntimeInitialized(), dt()));
  2195. }
  2196. i.setStatus ? (i.setStatus("Running..."), setTimeout(function() {
  2197. setTimeout(function() {
  2198. i.setStatus("");
  2199. }, 1), e();
  2200. }, 1)) : e();
  2201. }
  2202. if (i.preInit)
  2203. for (typeof i.preInit == "function" && (i.preInit = [i.preInit]); i.preInit.length > 0; )
  2204. i.preInit.pop()();
  2205. return gr(), o.ready;
  2206. };
  2207. })();
  2208. function Yo(r) {
  2209. return Bt(
  2210. ut,
  2211. r
  2212. );
  2213. }
  2214. async function Jo(r, o) {
  2215. return zo(
  2216. ut,
  2217. r,
  2218. o
  2219. );
  2220. }
  2221. async function Qo(r, o) {
  2222. return Go(
  2223. ut,
  2224. r,
  2225. o
  2226. );
  2227. }
  2228. var je;
  2229. class Vt extends EventTarget {
  2230. constructor(o = {}) {
  2231. var i;
  2232. super(), Co(this, je, void 0);
  2233. try {
  2234. const c = (i = o == null ? void 0 : o.formats) == null ? void 0 : i.filter(
  2235. (l) => l !== "unknown"
  2236. );
  2237. if ((c == null ? void 0 : c.length) === 0)
  2238. throw new TypeError("Hint option provided, but is empty.");
  2239. c == null || c.forEach((l) => {
  2240. if (!it.has(l))
  2241. throw new TypeError(
  2242. `Failed to read the 'formats' property from 'BarcodeDetectorOptions': The provided value '${l}' is not a valid enum value of type BarcodeFormat.`
  2243. );
  2244. }), $o(this, je, c != null ? c : []), Yo().then((l) => {
  2245. this.dispatchEvent(
  2246. new CustomEvent("load", {
  2247. detail: l
  2248. })
  2249. );
  2250. }).catch((l) => {
  2251. this.dispatchEvent(new CustomEvent("error", { detail: l }));
  2252. });
  2253. } catch (c) {
  2254. throw $r(
  2255. c,
  2256. "Failed to construct 'BarcodeDetector'"
  2257. );
  2258. }
  2259. }
  2260. static async getSupportedFormats() {
  2261. return _o.filter((o) => o !== "unknown");
  2262. }
  2263. async detect(o) {
  2264. try {
  2265. const i = await Ao(o);
  2266. if (i === null)
  2267. return [];
  2268. let c;
  2269. try {
  2270. Lr(i) ? c = await Jo(i, {
  2271. tryHarder: true,
  2272. formats: Cr(this, je).map((l) => it.get(l))
  2273. }) : c = await Qo(i, {
  2274. tryHarder: true,
  2275. formats: Cr(this, je).map((l) => it.get(l))
  2276. });
  2277. } catch (l) {
  2278. throw console.error(l), new DOMException(
  2279. "Barcode detection service unavailable.",
  2280. "NotSupportedError"
  2281. );
  2282. }
  2283. return c.map((l) => {
  2284. const {
  2285. topLeft: { x: h, y: v },
  2286. topRight: { x: g, y: b },
  2287. bottomLeft: { x: p, y: C },
  2288. bottomRight: { x: S, y: $ }
  2289. } = l.position, F = Math.min(h, g, p, S), U = Math.min(v, b, C, $), W = Math.max(h, g, p, S), R = Math.max(v, b, C, $);
  2290. return {
  2291. boundingBox: new DOMRectReadOnly(
  2292. F,
  2293. U,
  2294. W - F,
  2295. R - U
  2296. ),
  2297. rawValue: l.text,
  2298. format: So(l.format),
  2299. cornerPoints: [
  2300. {
  2301. x: h,
  2302. y: v
  2303. },
  2304. {
  2305. x: g,
  2306. y: b
  2307. },
  2308. {
  2309. x: S,
  2310. y: $
  2311. },
  2312. {
  2313. x: p,
  2314. y: C
  2315. }
  2316. ]
  2317. };
  2318. });
  2319. } catch (i) {
  2320. throw $r(
  2321. i,
  2322. "Failed to execute 'detect' on 'BarcodeDetector'"
  2323. );
  2324. }
  2325. }
  2326. }
  2327. je = /* @__PURE__ */ new WeakMap();
  2328. const qt = (r, o, i = "error") => {
  2329. let c, l;
  2330. const h = new Promise(
  2331. (v, g) => {
  2332. c = v, l = g, r.addEventListener(o, c), r.addEventListener(i, l);
  2333. }
  2334. );
  2335. return h.finally(() => {
  2336. r.removeEventListener(o, c), r.removeEventListener(i, l);
  2337. }), h;
  2338. }, Pr = (r) => new Promise((o) => setTimeout(o, r));
  2339. class qr extends Error {
  2340. constructor() {
  2341. super("this browser has no Stream API support"), this.name = "StreamApiNotSupportedError";
  2342. }
  2343. }
  2344. class Zo extends Error {
  2345. constructor() {
  2346. super(
  2347. "camera access is only permitted in secure context. Use HTTPS or localhost rather than HTTP."
  2348. ), this.name = "InsecureContextError";
  2349. }
  2350. }
  2351. class Ko extends Error {
  2352. constructor() {
  2353. super(
  2354. "Loading camera stream timed out after 6 seconds. If you are on iOS in PWA mode, this is a known issue (see https://github.com/gruhn/vue-qrcode-reader/issues/298)"
  2355. ), this.name = "StreamLoadTimeoutError";
  2356. }
  2357. }
  2358. let Wt;
  2359. function Nr(r) {
  2360. window.BarcodeDetector === void 0 ? (console.debug("[vue-qrcode-reader] BarcodeDetector not available: will use polyfill."), Wt = new Vt({ formats: r })) : (console.debug("[vue-qrcode-reader] BarcodeDetector available: will use native API."), Wt = new window.BarcodeDetector({ formats: r }));
  2361. }
  2362. const ei = async (r, {
  2363. detectHandler: o,
  2364. locateHandler: i,
  2365. minDelay: c,
  2366. formats: l
  2367. }) => {
  2368. console.debug("[vue-qrcode-reader] start scanning"), Nr(l);
  2369. const h = (v) => async (g) => {
  2370. if (r.readyState === 0)
  2371. console.debug("[vue-qrcode-reader] stop scanning: video element readyState is 0");
  2372. else {
  2373. const { lastScanned: b, contentBefore: p, lastScanHadContent: C } = v;
  2374. if (g - b < c)
  2375. window.requestAnimationFrame(h(v));
  2376. else {
  2377. const S = await Wt.detect(r), $ = S.some((W) => !p.includes(W.rawValue));
  2378. $ && o(S);
  2379. const F = S.length > 0;
  2380. F && i(S), !F && C && i(S);
  2381. const U = {
  2382. lastScanned: g,
  2383. lastScanHadContent: F,
  2384. // It can happen that a QR code is constantly in view of the camera but
  2385. // maybe a scanned frame is a bit blurry and we detect nothing but in the
  2386. // next frame we detect the code again. We also want to avoid emitting
  2387. // a `detect` event in such a case. So we don't reset `contentBefore`,
  2388. // if we detect nothing, only if we detect something new.
  2389. contentBefore: $ ? S.map((W) => W.rawValue) : p
  2390. };
  2391. window.requestAnimationFrame(h(U));
  2392. }
  2393. }
  2394. };
  2395. h({
  2396. lastScanned: performance.now(),
  2397. contentBefore: [],
  2398. lastScanHadContent: false
  2399. })(performance.now());
  2400. }, zr = async (r, o = ["qr_code"]) => await new Vt({ formats: o }).detect(r);
  2401. var Gr = {}, Q = {};
  2402. Object.defineProperty(Q, "__esModule", {
  2403. value: true
  2404. });
  2405. Q.compactObject = Qr;
  2406. Q.deprecated = di;
  2407. var ni = Q.detectBrowser = fi;
  2408. Q.disableLog = ci;
  2409. Q.disableWarnings = ui;
  2410. Q.extractVersion = st;
  2411. Q.filterStats = hi;
  2412. Q.log = li;
  2413. Q.walkStats = ct;
  2414. Q.wrapPeerConnectionEvent = si;
  2415. function ai(r, o, i) {
  2416. return o = oi(o), o in r ? Object.defineProperty(r, o, { value: i, enumerable: true, configurable: true, writable: true }) : r[o] = i, r;
  2417. }
  2418. function oi(r) {
  2419. var o = ii(r, "string");
  2420. return pe(o) === "symbol" ? o : String(o);
  2421. }
  2422. function ii(r, o) {
  2423. if (pe(r) !== "object" || r === null)
  2424. return r;
  2425. var i = r[Symbol.toPrimitive];
  2426. if (i !== void 0) {
  2427. var c = i.call(r, o || "default");
  2428. if (pe(c) !== "object")
  2429. return c;
  2430. throw new TypeError("@@toPrimitive must return a primitive value.");
  2431. }
  2432. return (o === "string" ? String : Number)(r);
  2433. }
  2434. function pe(r) {
  2435. "@babel/helpers - typeof";
  2436. return pe = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o) {
  2437. return typeof o;
  2438. } : function(o) {
  2439. return o && typeof Symbol == "function" && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
  2440. }, pe(r);
  2441. }
  2442. var Yr = true, Jr = true;
  2443. function st(r, o, i) {
  2444. var c = r.match(o);
  2445. return c && c.length >= i && parseInt(c[i], 10);
  2446. }
  2447. function si(r, o, i) {
  2448. if (r.RTCPeerConnection) {
  2449. var c = r.RTCPeerConnection.prototype, l = c.addEventListener;
  2450. c.addEventListener = function(v, g) {
  2451. if (v !== o)
  2452. return l.apply(this, arguments);
  2453. var b = function(C) {
  2454. var S = i(C);
  2455. S && (g.handleEvent ? g.handleEvent(S) : g(S));
  2456. };
  2457. return this._eventMap = this._eventMap || {}, this._eventMap[o] || (this._eventMap[o] = /* @__PURE__ */ new Map()), this._eventMap[o].set(g, b), l.apply(this, [v, b]);
  2458. };
  2459. var h = c.removeEventListener;
  2460. c.removeEventListener = function(v, g) {
  2461. if (v !== o || !this._eventMap || !this._eventMap[o])
  2462. return h.apply(this, arguments);
  2463. if (!this._eventMap[o].has(g))
  2464. return h.apply(this, arguments);
  2465. var b = this._eventMap[o].get(g);
  2466. return this._eventMap[o].delete(g), this._eventMap[o].size === 0 && delete this._eventMap[o], Object.keys(this._eventMap).length === 0 && delete this._eventMap, h.apply(this, [v, b]);
  2467. }, Object.defineProperty(c, "on" + o, {
  2468. get: function() {
  2469. return this["_on" + o];
  2470. },
  2471. set: function(g) {
  2472. this["_on" + o] && (this.removeEventListener(o, this["_on" + o]), delete this["_on" + o]), g && this.addEventListener(o, this["_on" + o] = g);
  2473. },
  2474. enumerable: true,
  2475. configurable: true
  2476. });
  2477. }
  2478. }
  2479. function ci(r) {
  2480. return typeof r != "boolean" ? new Error("Argument type: " + pe(r) + ". Please use a boolean.") : (Yr = r, r ? "adapter.js logging disabled" : "adapter.js logging enabled");
  2481. }
  2482. function ui(r) {
  2483. return typeof r != "boolean" ? new Error("Argument type: " + pe(r) + ". Please use a boolean.") : (Jr = !r, "adapter.js deprecation warnings " + (r ? "disabled" : "enabled"));
  2484. }
  2485. function li() {
  2486. if ((typeof window > "u" ? "undefined" : pe(window)) === "object") {
  2487. if (Yr)
  2488. return;
  2489. typeof console < "u" && typeof console.log == "function" && console.log.apply(console, arguments);
  2490. }
  2491. }
  2492. function di(r, o) {
  2493. Jr && console.warn(r + " is deprecated, please use " + o + " instead.");
  2494. }
  2495. function fi(r) {
  2496. var o = {
  2497. browser: null,
  2498. version: null
  2499. };
  2500. if (typeof r > "u" || !r.navigator || !r.navigator.userAgent)
  2501. return o.browser = "Not a browser.", o;
  2502. var i = r.navigator;
  2503. if (i.mozGetUserMedia)
  2504. o.browser = "firefox", o.version = st(i.userAgent, /Firefox\/(\d+)\./, 1);
  2505. else if (i.webkitGetUserMedia || r.isSecureContext === false && r.webkitRTCPeerConnection)
  2506. o.browser = "chrome", o.version = st(i.userAgent, /Chrom(e|ium)\/(\d+)\./, 2);
  2507. else if (r.RTCPeerConnection && i.userAgent.match(/AppleWebKit\/(\d+)\./))
  2508. o.browser = "safari", o.version = st(i.userAgent, /AppleWebKit\/(\d+)\./, 1), o.supportsUnifiedPlan = r.RTCRtpTransceiver && "currentDirection" in r.RTCRtpTransceiver.prototype;
  2509. else
  2510. return o.browser = "Not a supported browser.", o;
  2511. return o;
  2512. }
  2513. function Tr(r) {
  2514. return Object.prototype.toString.call(r) === "[object Object]";
  2515. }
  2516. function Qr(r) {
  2517. return Tr(r) ? Object.keys(r).reduce(function(o, i) {
  2518. var c = Tr(r[i]), l = c ? Qr(r[i]) : r[i], h = c && !Object.keys(l).length;
  2519. return l === void 0 || h ? o : Object.assign(o, ai({}, i, l));
  2520. }, {}) : r;
  2521. }
  2522. function ct(r, o, i) {
  2523. !o || i.has(o.id) || (i.set(o.id, o), Object.keys(o).forEach(function(c) {
  2524. c.endsWith("Id") ? ct(r, r.get(o[c]), i) : c.endsWith("Ids") && o[c].forEach(function(l) {
  2525. ct(r, r.get(l), i);
  2526. });
  2527. }));
  2528. }
  2529. function hi(r, o, i) {
  2530. var c = i ? "outbound-rtp" : "inbound-rtp", l = /* @__PURE__ */ new Map();
  2531. if (o === null)
  2532. return l;
  2533. var h = [];
  2534. return r.forEach(function(v) {
  2535. v.type === "track" && v.trackIdentifier === o.id && h.push(v);
  2536. }), h.forEach(function(v) {
  2537. r.forEach(function(g) {
  2538. g.type === c && g.trackId === v.id && ct(r, g, l);
  2539. });
  2540. }), l;
  2541. }
  2542. Object.defineProperty(Gr, "__esModule", {
  2543. value: true
  2544. });
  2545. var pi = Gr.shimGetUserMedia = yi, mi = vi(Q);
  2546. function Xr(r) {
  2547. if (typeof WeakMap != "function")
  2548. return null;
  2549. var o = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new WeakMap();
  2550. return (Xr = function(l) {
  2551. return l ? i : o;
  2552. })(r);
  2553. }
  2554. function vi(r, o) {
  2555. if (r && r.__esModule)
  2556. return r;
  2557. if (r === null || he(r) !== "object" && typeof r != "function")
  2558. return { default: r };
  2559. var i = Xr(o);
  2560. if (i && i.has(r))
  2561. return i.get(r);
  2562. var c = {}, l = Object.defineProperty && Object.getOwnPropertyDescriptor;
  2563. for (var h in r)
  2564. if (h !== "default" && Object.prototype.hasOwnProperty.call(r, h)) {
  2565. var v = l ? Object.getOwnPropertyDescriptor(r, h) : null;
  2566. v && (v.get || v.set) ? Object.defineProperty(c, h, v) : c[h] = r[h];
  2567. }
  2568. return c.default = r, i && i.set(r, c), c;
  2569. }
  2570. function he(r) {
  2571. "@babel/helpers - typeof";
  2572. return he = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o) {
  2573. return typeof o;
  2574. } : function(o) {
  2575. return o && typeof Symbol == "function" && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
  2576. }, he(r);
  2577. }
  2578. var Er = mi.log;
  2579. function yi(r, o) {
  2580. var i = r && r.navigator;
  2581. if (i.mediaDevices) {
  2582. var c = function(p) {
  2583. if (he(p) !== "object" || p.mandatory || p.optional)
  2584. return p;
  2585. var C = {};
  2586. return Object.keys(p).forEach(function(S) {
  2587. if (!(S === "require" || S === "advanced" || S === "mediaSource")) {
  2588. var $ = he(p[S]) === "object" ? p[S] : {
  2589. ideal: p[S]
  2590. };
  2591. $.exact !== void 0 && typeof $.exact == "number" && ($.min = $.max = $.exact);
  2592. var F = function(R, D) {
  2593. return R ? R + D.charAt(0).toUpperCase() + D.slice(1) : D === "deviceId" ? "sourceId" : D;
  2594. };
  2595. if ($.ideal !== void 0) {
  2596. C.optional = C.optional || [];
  2597. var U = {};
  2598. typeof $.ideal == "number" ? (U[F("min", S)] = $.ideal, C.optional.push(U), U = {}, U[F("max", S)] = $.ideal, C.optional.push(U)) : (U[F("", S)] = $.ideal, C.optional.push(U));
  2599. }
  2600. $.exact !== void 0 && typeof $.exact != "number" ? (C.mandatory = C.mandatory || {}, C.mandatory[F("", S)] = $.exact) : ["min", "max"].forEach(function(W) {
  2601. $[W] !== void 0 && (C.mandatory = C.mandatory || {}, C.mandatory[F(W, S)] = $[W]);
  2602. });
  2603. }
  2604. }), p.advanced && (C.optional = (C.optional || []).concat(p.advanced)), C;
  2605. }, l = function(p, C) {
  2606. if (o.version >= 61)
  2607. return C(p);
  2608. if (p = JSON.parse(JSON.stringify(p)), p && he(p.audio) === "object") {
  2609. var S = function(R, D, X) {
  2610. D in R && !(X in R) && (R[X] = R[D], delete R[D]);
  2611. };
  2612. p = JSON.parse(JSON.stringify(p)), S(p.audio, "autoGainControl", "googAutoGainControl"), S(p.audio, "noiseSuppression", "googNoiseSuppression"), p.audio = c(p.audio);
  2613. }
  2614. if (p && he(p.video) === "object") {
  2615. var $ = p.video.facingMode;
  2616. $ = $ && (he($) === "object" ? $ : {
  2617. ideal: $
  2618. });
  2619. var F = o.version < 66;
  2620. if ($ && ($.exact === "user" || $.exact === "environment" || $.ideal === "user" || $.ideal === "environment") && !(i.mediaDevices.getSupportedConstraints && i.mediaDevices.getSupportedConstraints().facingMode && !F)) {
  2621. delete p.video.facingMode;
  2622. var U;
  2623. if ($.exact === "environment" || $.ideal === "environment" ? U = ["back", "rear"] : ($.exact === "user" || $.ideal === "user") && (U = ["front"]), U)
  2624. return i.mediaDevices.enumerateDevices().then(function(W) {
  2625. W = W.filter(function(D) {
  2626. return D.kind === "videoinput";
  2627. });
  2628. var R = W.find(function(D) {
  2629. return U.some(function(X) {
  2630. return D.label.toLowerCase().includes(X);
  2631. });
  2632. });
  2633. return !R && W.length && U.includes("back") && (R = W[W.length - 1]), R && (p.video.deviceId = $.exact ? {
  2634. exact: R.deviceId
  2635. } : {
  2636. ideal: R.deviceId
  2637. }), p.video = c(p.video), Er("chrome: " + JSON.stringify(p)), C(p);
  2638. });
  2639. }
  2640. p.video = c(p.video);
  2641. }
  2642. return Er("chrome: " + JSON.stringify(p)), C(p);
  2643. }, h = function(p) {
  2644. return o.version >= 64 ? p : {
  2645. name: {
  2646. PermissionDeniedError: "NotAllowedError",
  2647. PermissionDismissedError: "NotAllowedError",
  2648. InvalidStateError: "NotAllowedError",
  2649. DevicesNotFoundError: "NotFoundError",
  2650. ConstraintNotSatisfiedError: "OverconstrainedError",
  2651. TrackStartError: "NotReadableError",
  2652. MediaDeviceFailedDueToShutdown: "NotAllowedError",
  2653. MediaDeviceKillSwitchOn: "NotAllowedError",
  2654. TabCaptureError: "AbortError",
  2655. ScreenCaptureError: "AbortError",
  2656. DeviceCaptureError: "AbortError"
  2657. }[p.name] || p.name,
  2658. message: p.message,
  2659. constraint: p.constraint || p.constraintName,
  2660. toString: function() {
  2661. return this.name + (this.message && ": ") + this.message;
  2662. }
  2663. };
  2664. }, v = function(p, C, S) {
  2665. l(p, function($) {
  2666. i.webkitGetUserMedia($, C, function(F) {
  2667. S && S(h(F));
  2668. });
  2669. });
  2670. };
  2671. if (i.getUserMedia = v.bind(i), i.mediaDevices.getUserMedia) {
  2672. var g = i.mediaDevices.getUserMedia.bind(i.mediaDevices);
  2673. i.mediaDevices.getUserMedia = function(b) {
  2674. return l(b, function(p) {
  2675. return g(p).then(function(C) {
  2676. if (p.audio && !C.getAudioTracks().length || p.video && !C.getVideoTracks().length)
  2677. throw C.getTracks().forEach(function(S) {
  2678. S.stop();
  2679. }), new DOMException("", "NotFoundError");
  2680. return C;
  2681. }, function(C) {
  2682. return Promise.reject(h(C));
  2683. });
  2684. });
  2685. };
  2686. }
  2687. }
  2688. }
  2689. var Zr = {};
  2690. Object.defineProperty(Zr, "__esModule", {
  2691. value: true
  2692. });
  2693. var gi = Zr.shimGetUserMedia = Ci, wi = bi(Q);
  2694. function Kr(r) {
  2695. if (typeof WeakMap != "function")
  2696. return null;
  2697. var o = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new WeakMap();
  2698. return (Kr = function(l) {
  2699. return l ? i : o;
  2700. })(r);
  2701. }
  2702. function bi(r, o) {
  2703. if (r && r.__esModule)
  2704. return r;
  2705. if (r === null || Pe(r) !== "object" && typeof r != "function")
  2706. return { default: r };
  2707. var i = Kr(o);
  2708. if (i && i.has(r))
  2709. return i.get(r);
  2710. var c = {}, l = Object.defineProperty && Object.getOwnPropertyDescriptor;
  2711. for (var h in r)
  2712. if (h !== "default" && Object.prototype.hasOwnProperty.call(r, h)) {
  2713. var v = l ? Object.getOwnPropertyDescriptor(r, h) : null;
  2714. v && (v.get || v.set) ? Object.defineProperty(c, h, v) : c[h] = r[h];
  2715. }
  2716. return c.default = r, i && i.set(r, c), c;
  2717. }
  2718. function Pe(r) {
  2719. "@babel/helpers - typeof";
  2720. return Pe = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o) {
  2721. return typeof o;
  2722. } : function(o) {
  2723. return o && typeof Symbol == "function" && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
  2724. }, Pe(r);
  2725. }
  2726. function Ci(r, o) {
  2727. var i = r && r.navigator, c = r && r.MediaStreamTrack;
  2728. if (i.getUserMedia = function(b, p, C) {
  2729. wi.deprecated("navigator.getUserMedia", "navigator.mediaDevices.getUserMedia"), i.mediaDevices.getUserMedia(b).then(p, C);
  2730. }, !(o.version > 55 && "autoGainControl" in i.mediaDevices.getSupportedConstraints())) {
  2731. var l = function(p, C, S) {
  2732. C in p && !(S in p) && (p[S] = p[C], delete p[C]);
  2733. }, h = i.mediaDevices.getUserMedia.bind(i.mediaDevices);
  2734. if (i.mediaDevices.getUserMedia = function(b) {
  2735. return Pe(b) === "object" && Pe(b.audio) === "object" && (b = JSON.parse(JSON.stringify(b)), l(b.audio, "autoGainControl", "mozAutoGainControl"), l(b.audio, "noiseSuppression", "mozNoiseSuppression")), h(b);
  2736. }, c && c.prototype.getSettings) {
  2737. var v = c.prototype.getSettings;
  2738. c.prototype.getSettings = function() {
  2739. var b = v.apply(this, arguments);
  2740. return l(b, "mozAutoGainControl", "autoGainControl"), l(b, "mozNoiseSuppression", "noiseSuppression"), b;
  2741. };
  2742. }
  2743. if (c && c.prototype.applyConstraints) {
  2744. var g = c.prototype.applyConstraints;
  2745. c.prototype.applyConstraints = function(b) {
  2746. return this.kind === "audio" && Pe(b) === "object" && (b = JSON.parse(JSON.stringify(b)), l(b, "autoGainControl", "mozAutoGainControl"), l(b, "noiseSuppression", "mozNoiseSuppression")), g.apply(this, [b]);
  2747. };
  2748. }
  2749. }
  2750. }
  2751. var ae = {};
  2752. Object.defineProperty(ae, "__esModule", {
  2753. value: true
  2754. });
  2755. ae.shimAudioContext = Di;
  2756. ae.shimCallbacksAPI = Ti;
  2757. ae.shimConstraints = rn;
  2758. ae.shimCreateOfferLegacy = Ai;
  2759. var $i = ae.shimGetUserMedia = Ei;
  2760. ae.shimLocalStreamsAPI = Si;
  2761. ae.shimRTCIceServerUrls = Oi;
  2762. ae.shimRemoteStreamsAPI = Pi;
  2763. ae.shimTrackEventTransceiver = Mi;
  2764. var en = _i(Q);
  2765. function tn(r) {
  2766. if (typeof WeakMap != "function")
  2767. return null;
  2768. var o = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new WeakMap();
  2769. return (tn = function(l) {
  2770. return l ? i : o;
  2771. })(r);
  2772. }
  2773. function _i(r, o) {
  2774. if (r && r.__esModule)
  2775. return r;
  2776. if (r === null || me(r) !== "object" && typeof r != "function")
  2777. return { default: r };
  2778. var i = tn(o);
  2779. if (i && i.has(r))
  2780. return i.get(r);
  2781. var c = {}, l = Object.defineProperty && Object.getOwnPropertyDescriptor;
  2782. for (var h in r)
  2783. if (h !== "default" && Object.prototype.hasOwnProperty.call(r, h)) {
  2784. var v = l ? Object.getOwnPropertyDescriptor(r, h) : null;
  2785. v && (v.get || v.set) ? Object.defineProperty(c, h, v) : c[h] = r[h];
  2786. }
  2787. return c.default = r, i && i.set(r, c), c;
  2788. }
  2789. function me(r) {
  2790. "@babel/helpers - typeof";
  2791. return me = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o) {
  2792. return typeof o;
  2793. } : function(o) {
  2794. return o && typeof Symbol == "function" && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
  2795. }, me(r);
  2796. }
  2797. function Si(r) {
  2798. if (!(me(r) !== "object" || !r.RTCPeerConnection)) {
  2799. if ("getLocalStreams" in r.RTCPeerConnection.prototype || (r.RTCPeerConnection.prototype.getLocalStreams = function() {
  2800. return this._localStreams || (this._localStreams = []), this._localStreams;
  2801. }), !("addStream" in r.RTCPeerConnection.prototype)) {
  2802. var o = r.RTCPeerConnection.prototype.addTrack;
  2803. r.RTCPeerConnection.prototype.addStream = function(c) {
  2804. var l = this;
  2805. this._localStreams || (this._localStreams = []), this._localStreams.includes(c) || this._localStreams.push(c), c.getAudioTracks().forEach(function(h) {
  2806. return o.call(l, h, c);
  2807. }), c.getVideoTracks().forEach(function(h) {
  2808. return o.call(l, h, c);
  2809. });
  2810. }, r.RTCPeerConnection.prototype.addTrack = function(c) {
  2811. for (var l = this, h = arguments.length, v = new Array(h > 1 ? h - 1 : 0), g = 1; g < h; g++)
  2812. v[g - 1] = arguments[g];
  2813. return v && v.forEach(function(b) {
  2814. l._localStreams ? l._localStreams.includes(b) || l._localStreams.push(b) : l._localStreams = [b];
  2815. }), o.apply(this, arguments);
  2816. };
  2817. }
  2818. "removeStream" in r.RTCPeerConnection.prototype || (r.RTCPeerConnection.prototype.removeStream = function(c) {
  2819. var l = this;
  2820. this._localStreams || (this._localStreams = []);
  2821. var h = this._localStreams.indexOf(c);
  2822. if (h !== -1) {
  2823. this._localStreams.splice(h, 1);
  2824. var v = c.getTracks();
  2825. this.getSenders().forEach(function(g) {
  2826. v.includes(g.track) && l.removeTrack(g);
  2827. });
  2828. }
  2829. });
  2830. }
  2831. }
  2832. function Pi(r) {
  2833. if (!(me(r) !== "object" || !r.RTCPeerConnection) && ("getRemoteStreams" in r.RTCPeerConnection.prototype || (r.RTCPeerConnection.prototype.getRemoteStreams = function() {
  2834. return this._remoteStreams ? this._remoteStreams : [];
  2835. }), !("onaddstream" in r.RTCPeerConnection.prototype))) {
  2836. Object.defineProperty(r.RTCPeerConnection.prototype, "onaddstream", {
  2837. get: function() {
  2838. return this._onaddstream;
  2839. },
  2840. set: function(c) {
  2841. var l = this;
  2842. this._onaddstream && (this.removeEventListener("addstream", this._onaddstream), this.removeEventListener("track", this._onaddstreampoly)), this.addEventListener("addstream", this._onaddstream = c), this.addEventListener("track", this._onaddstreampoly = function(h) {
  2843. h.streams.forEach(function(v) {
  2844. if (l._remoteStreams || (l._remoteStreams = []), !l._remoteStreams.includes(v)) {
  2845. l._remoteStreams.push(v);
  2846. var g = new Event("addstream");
  2847. g.stream = v, l.dispatchEvent(g);
  2848. }
  2849. });
  2850. });
  2851. }
  2852. });
  2853. var o = r.RTCPeerConnection.prototype.setRemoteDescription;
  2854. r.RTCPeerConnection.prototype.setRemoteDescription = function() {
  2855. var c = this;
  2856. return this._onaddstreampoly || this.addEventListener("track", this._onaddstreampoly = function(l) {
  2857. l.streams.forEach(function(h) {
  2858. if (c._remoteStreams || (c._remoteStreams = []), !(c._remoteStreams.indexOf(h) >= 0)) {
  2859. c._remoteStreams.push(h);
  2860. var v = new Event("addstream");
  2861. v.stream = h, c.dispatchEvent(v);
  2862. }
  2863. });
  2864. }), o.apply(c, arguments);
  2865. };
  2866. }
  2867. }
  2868. function Ti(r) {
  2869. if (!(me(r) !== "object" || !r.RTCPeerConnection)) {
  2870. var o = r.RTCPeerConnection.prototype, i = o.createOffer, c = o.createAnswer, l = o.setLocalDescription, h = o.setRemoteDescription, v = o.addIceCandidate;
  2871. o.createOffer = function(p, C) {
  2872. var S = arguments.length >= 2 ? arguments[2] : arguments[0], $ = i.apply(this, [S]);
  2873. return C ? ($.then(p, C), Promise.resolve()) : $;
  2874. }, o.createAnswer = function(p, C) {
  2875. var S = arguments.length >= 2 ? arguments[2] : arguments[0], $ = c.apply(this, [S]);
  2876. return C ? ($.then(p, C), Promise.resolve()) : $;
  2877. };
  2878. var g = function(p, C, S) {
  2879. var $ = l.apply(this, [p]);
  2880. return S ? ($.then(C, S), Promise.resolve()) : $;
  2881. };
  2882. o.setLocalDescription = g, g = function(p, C, S) {
  2883. var $ = h.apply(this, [p]);
  2884. return S ? ($.then(C, S), Promise.resolve()) : $;
  2885. }, o.setRemoteDescription = g, g = function(p, C, S) {
  2886. var $ = v.apply(this, [p]);
  2887. return S ? ($.then(C, S), Promise.resolve()) : $;
  2888. }, o.addIceCandidate = g;
  2889. }
  2890. }
  2891. function Ei(r) {
  2892. var o = r && r.navigator;
  2893. if (o.mediaDevices && o.mediaDevices.getUserMedia) {
  2894. var i = o.mediaDevices, c = i.getUserMedia.bind(i);
  2895. o.mediaDevices.getUserMedia = function(l) {
  2896. return c(rn(l));
  2897. };
  2898. }
  2899. !o.getUserMedia && o.mediaDevices && o.mediaDevices.getUserMedia && (o.getUserMedia = (function(h, v, g) {
  2900. o.mediaDevices.getUserMedia(h).then(v, g);
  2901. }).bind(o));
  2902. }
  2903. function rn(r) {
  2904. return r && r.video !== void 0 ? Object.assign({}, r, {
  2905. video: en.compactObject(r.video)
  2906. }) : r;
  2907. }
  2908. function Oi(r) {
  2909. if (r.RTCPeerConnection) {
  2910. var o = r.RTCPeerConnection;
  2911. r.RTCPeerConnection = function(c, l) {
  2912. if (c && c.iceServers) {
  2913. for (var h = [], v = 0; v < c.iceServers.length; v++) {
  2914. var g = c.iceServers[v];
  2915. g.urls === void 0 && g.url ? (en.deprecated("RTCIceServer.url", "RTCIceServer.urls"), g = JSON.parse(JSON.stringify(g)), g.urls = g.url, delete g.url, h.push(g)) : h.push(c.iceServers[v]);
  2916. }
  2917. c.iceServers = h;
  2918. }
  2919. return new o(c, l);
  2920. }, r.RTCPeerConnection.prototype = o.prototype, "generateCertificate" in o && Object.defineProperty(r.RTCPeerConnection, "generateCertificate", {
  2921. get: function() {
  2922. return o.generateCertificate;
  2923. }
  2924. });
  2925. }
  2926. }
  2927. function Mi(r) {
  2928. me(r) === "object" && r.RTCTrackEvent && "receiver" in r.RTCTrackEvent.prototype && !("transceiver" in r.RTCTrackEvent.prototype) && Object.defineProperty(r.RTCTrackEvent.prototype, "transceiver", {
  2929. get: function() {
  2930. return {
  2931. receiver: this.receiver
  2932. };
  2933. }
  2934. });
  2935. }
  2936. function Ai(r) {
  2937. var o = r.RTCPeerConnection.prototype.createOffer;
  2938. r.RTCPeerConnection.prototype.createOffer = function(c) {
  2939. if (c) {
  2940. typeof c.offerToReceiveAudio < "u" && (c.offerToReceiveAudio = !!c.offerToReceiveAudio);
  2941. var l = this.getTransceivers().find(function(v) {
  2942. return v.receiver.track.kind === "audio";
  2943. });
  2944. c.offerToReceiveAudio === false && l ? l.direction === "sendrecv" ? l.setDirection ? l.setDirection("sendonly") : l.direction = "sendonly" : l.direction === "recvonly" && (l.setDirection ? l.setDirection("inactive") : l.direction = "inactive") : c.offerToReceiveAudio === true && !l && this.addTransceiver("audio", {
  2945. direction: "recvonly"
  2946. }), typeof c.offerToReceiveVideo < "u" && (c.offerToReceiveVideo = !!c.offerToReceiveVideo);
  2947. var h = this.getTransceivers().find(function(v) {
  2948. return v.receiver.track.kind === "video";
  2949. });
  2950. c.offerToReceiveVideo === false && h ? h.direction === "sendrecv" ? h.setDirection ? h.setDirection("sendonly") : h.direction = "sendonly" : h.direction === "recvonly" && (h.setDirection ? h.setDirection("inactive") : h.direction = "inactive") : c.offerToReceiveVideo === true && !h && this.addTransceiver("video", {
  2951. direction: "recvonly"
  2952. });
  2953. }
  2954. return o.apply(this, arguments);
  2955. };
  2956. }
  2957. function Di(r) {
  2958. me(r) !== "object" || r.AudioContext || (r.AudioContext = r.webkitAudioContext);
  2959. }
  2960. const xi = (r) => {
  2961. let o = false, i;
  2962. return (...c) => (o || (i = r(c), o = true), i);
  2963. };
  2964. function ue(r, o) {
  2965. if (r === false)
  2966. throw new Error(o != null ? o : "assertion failure");
  2967. }
  2968. function Or(r) {
  2969. throw new Error("this code should be unreachable");
  2970. }
  2971. const Ri = xi(() => {
  2972. const r = ni(window);
  2973. switch (r.browser) {
  2974. case "chrome":
  2975. pi(window, r);
  2976. break;
  2977. case "firefox":
  2978. gi(window, r);
  2979. break;
  2980. case "safari":
  2981. $i(window, r);
  2982. break;
  2983. default:
  2984. throw new qr();
  2985. }
  2986. });
  2987. let Te = Promise.resolve({ type: "stop", data: {} });
  2988. async function Mr(r, o, i) {
  2989. var g, b, p;
  2990. if (console.debug(
  2991. "[vue-qrcode-reader] starting camera with constraints: ",
  2992. JSON.stringify(o)
  2993. ), window.isSecureContext !== true)
  2994. throw new Zo();
  2995. if (((g = navigator == null ? void 0 : navigator.mediaDevices) == null ? void 0 : g.getUserMedia) === void 0)
  2996. throw new qr();
  2997. Ri(), console.debug("[vue-qrcode-reader] calling getUserMedia");
  2998. const c = await navigator.mediaDevices.getUserMedia({
  2999. audio: false,
  3000. video: o
  3001. });
  3002. r.srcObject !== void 0 ? r.srcObject = c : r.mozSrcObject !== void 0 ? r.mozSrcObject = c : window.URL.createObjectURL ? r.src = window.URL.createObjectURL(c) : window.webkitURL ? r.src = window.webkitURL.createObjectURL(c) : r.src = c.id, r.play(), console.debug("[vue-qrcode-reader] waiting for video element to load"), await Promise.race([
  3003. qt(r, "loadeddata"),
  3004. // On iOS devices in PWA mode, QrcodeStream works initially, but after
  3005. // killing and restarting the PWA, all video elements fail to load camera
  3006. // streams and never emit the `loadeddata` event. Looks like this is
  3007. // related to a WebKit issue (see #298). No workarounds at the moment.
  3008. // To at least detect this situation, we throw an error if the event
  3009. // has not been emitted after a 6 second timeout.
  3010. Pr(6e3).then(() => {
  3011. throw new Ko();
  3012. })
  3013. ]), console.debug("[vue-qrcode-reader] video element loaded"), await Pr(500);
  3014. const [l] = c.getVideoTracks(), h = (p = (b = l == null ? void 0 : l.getCapabilities) == null ? void 0 : b.call(l)) != null ? p : {};
  3015. let v = false;
  3016. return i && h.torch && (await l.applyConstraints({ advanced: [{ torch: true }] }), v = true), console.debug("[vue-qrcode-reader] camera ready"), {
  3017. type: "start",
  3018. data: {
  3019. videoEl: r,
  3020. stream: c,
  3021. capabilities: h,
  3022. constraints: o,
  3023. isTorchOn: v
  3024. }
  3025. };
  3026. }
  3027. async function Ii(r, {
  3028. constraints: o,
  3029. torch: i,
  3030. restart: c = false
  3031. }) {
  3032. Te = Te.then((h) => {
  3033. if (h.type === "start") {
  3034. const {
  3035. data: {
  3036. videoEl: v,
  3037. stream: g,
  3038. constraints: b,
  3039. isTorchOn: p
  3040. }
  3041. } = h;
  3042. return !c && r === v && o === b && i === p ? h : nn(v, g, p).then(
  3043. () => Mr(r, o, i)
  3044. );
  3045. } else if (h.type === "stop" || h.type === "failed")
  3046. return Mr(r, o, i);
  3047. Or();
  3048. }).catch((h) => (console.debug(`[vue-qrcode-reader] starting camera failed with "${h}"`), { type: "failed", error: h }));
  3049. const l = await Te;
  3050. if (l.type === "stop")
  3051. throw new Error("Something went wrong with the camera task queue (start task).");
  3052. if (l.type === "failed")
  3053. throw l.error;
  3054. if (l.type === "start")
  3055. return l.data.capabilities;
  3056. Or();
  3057. }
  3058. async function nn(r, o, i) {
  3059. console.debug("[vue-qrcode-reader] stopping camera"), r.src = "", r.srcObject = null, r.load(), await qt(r, "error");
  3060. for (const c of o.getTracks())
  3061. i != null || await c.applyConstraints({ advanced: [{ torch: false }] }), o.removeTrack(c), c.stop();
  3062. return {
  3063. type: "stop",
  3064. data: {}
  3065. };
  3066. }
  3067. async function ot() {
  3068. if (Te = Te.then((o) => {
  3069. if (o.type === "stop" || o.type === "failed")
  3070. return o;
  3071. const {
  3072. data: { videoEl: i, stream: c, isTorchOn: l }
  3073. } = o;
  3074. return nn(i, c, l);
  3075. }), (await Te).type === "start")
  3076. throw new Error("Something went wrong with the camera task queue (stop task).");
  3077. }
  3078. const ki = /* @__PURE__ */ defineComponent({
  3079. __name: "QrcodeStream",
  3080. props: {
  3081. // in this file: don't use `props.constraints` directly. Use `constraintsCached`.
  3082. constraints: {
  3083. type: Object,
  3084. default() {
  3085. return { facingMode: "environment" };
  3086. }
  3087. },
  3088. // in this file: don't use `props.formats` directly. Use `formatsCached`.
  3089. formats: {
  3090. type: Array,
  3091. default: () => ["qr_code"]
  3092. },
  3093. paused: {
  3094. type: Boolean,
  3095. default: false
  3096. },
  3097. torch: {
  3098. type: Boolean,
  3099. default: false
  3100. },
  3101. track: {
  3102. type: Function
  3103. }
  3104. },
  3105. emits: ["detect", "camera-on", "camera-off", "error"],
  3106. setup(r, { emit: o }) {
  3107. const i = r, c = o, l = ref(i.constraints), h = ref(i.formats);
  3108. watch(
  3109. () => i.constraints,
  3110. (I, M) => {
  3111. JSON.stringify(I) !== JSON.stringify(M) && (l.value = I);
  3112. },
  3113. { deep: true }
  3114. ), watch(
  3115. () => i.formats,
  3116. (I, M) => {
  3117. JSON.stringify(I) !== JSON.stringify(M) && (h.value = I);
  3118. },
  3119. { deep: true }
  3120. );
  3121. const v = ref(), g = ref(), b = ref(), p = ref(false), C = ref(false);
  3122. onMounted(() => {
  3123. C.value = true;
  3124. }), onUnmounted(() => {
  3125. ot();
  3126. });
  3127. const S = computed(() => ({
  3128. torch: i.torch,
  3129. constraints: l.value,
  3130. shouldStream: C.value && !i.paused
  3131. }));
  3132. watch(
  3133. S,
  3134. async (I) => {
  3135. const M = b.value;
  3136. ue(
  3137. M !== void 0,
  3138. "cameraSettings watcher should never be triggered when component is not mounted. Thus video element should always be defined."
  3139. );
  3140. const A = v.value;
  3141. ue(
  3142. A !== void 0,
  3143. "cameraSettings watcher should never be triggered when component is not mounted. Thus canvas should always be defined."
  3144. );
  3145. const le = A.getContext("2d");
  3146. if (ue(le !== null, "if cavnas is defined, canvas 2d context should also be non-null"), I.shouldStream) {
  3147. ot(), p.value = false;
  3148. try {
  3149. const oe = await Ii(M, I);
  3150. C.value ? (p.value = true, c("camera-on", oe)) : await ot();
  3151. } catch (oe) {
  3152. c("error", oe);
  3153. }
  3154. } else
  3155. A.width = M.videoWidth, A.height = M.videoHeight, le.drawImage(M, 0, 0, M.videoWidth, M.videoHeight), ot(), p.value = false, c("camera-off");
  3156. },
  3157. { deep: true }
  3158. ), watch(h, (I) => {
  3159. C.value && Nr(I);
  3160. });
  3161. const $ = computed(() => S.value.shouldStream && p.value);
  3162. watch($, (I) => {
  3163. if (I) {
  3164. ue(
  3165. v.value !== void 0,
  3166. "shouldScan watcher should only be triggered when component is mounted. Thus pause frame canvas is defined"
  3167. ), F(v.value), ue(
  3168. g.value !== void 0,
  3169. "shouldScan watcher should only be triggered when component is mounted. Thus tracking canvas is defined"
  3170. ), F(g.value);
  3171. const M = () => i.track === void 0 ? 500 : 40;
  3172. ue(
  3173. b.value !== void 0,
  3174. "shouldScan watcher should only be triggered when component is mounted. Thus video element is defined"
  3175. ), ei(b.value, {
  3176. detectHandler: (A) => c("detect", A),
  3177. formats: h.value,
  3178. locateHandler: U,
  3179. minDelay: M()
  3180. });
  3181. }
  3182. });
  3183. const F = (I) => {
  3184. const M = I.getContext("2d");
  3185. ue(M !== null, "canvas 2d context should always be non-null"), M.clearRect(0, 0, I.width, I.height);
  3186. }, U = (I) => {
  3187. const M = g.value;
  3188. ue(
  3189. M !== void 0,
  3190. "onLocate handler should only be called when component is mounted. Thus tracking canvas is always defined."
  3191. );
  3192. const A = b.value;
  3193. if (ue(
  3194. A !== void 0,
  3195. "onLocate handler should only be called when component is mounted. Thus video element is always defined."
  3196. ), I.length === 0 || i.track === void 0)
  3197. F(M);
  3198. else {
  3199. const le = A.offsetWidth, oe = A.offsetHeight, be = A.videoWidth, Ce = A.videoHeight, Oe = Math.max(le / be, oe / Ce), Me = be * Oe, Le = Ce * Oe, lt = Me / be, dt = Le / Ce, ft = (le - Me) / 2, ht = (oe - Le) / 2, Ae = ({ x: de, y: Z }) => ({
  3200. x: Math.floor(de * lt),
  3201. y: Math.floor(Z * dt)
  3202. }), te = ({ x: de, y: Z }) => ({
  3203. x: Math.floor(de + ft),
  3204. y: Math.floor(Z + ht)
  3205. }), ve = I.map((de) => {
  3206. const { boundingBox: Z, cornerPoints: mt } = de, { x: He, y: fe } = te(
  3207. Ae({
  3208. x: Z.x,
  3209. y: Z.y
  3210. })
  3211. ), { x: Be, y: vt } = Ae({
  3212. x: Z.width,
  3213. y: Z.height
  3214. });
  3215. return {
  3216. ...de,
  3217. cornerPoints: mt.map((Ve) => te(Ae(Ve))),
  3218. boundingBox: DOMRectReadOnly.fromRect({ x: He, y: fe, width: Be, height: vt })
  3219. };
  3220. });
  3221. M.width = A.offsetWidth, M.height = A.offsetHeight;
  3222. const pt = M.getContext("2d");
  3223. i.track(ve, pt);
  3224. }
  3225. }, W = {
  3226. width: "100%",
  3227. height: "100%",
  3228. position: "relative",
  3229. // notice that we use z-index only once for the wrapper div.
  3230. // If z-index is not defined, elements are stacked in the order they appear in the DOM.
  3231. // The first element is at the very bottom and subsequent elements are added on top.
  3232. "z-index": "0"
  3233. }, R = {
  3234. width: "100%",
  3235. height: "100%",
  3236. position: "absolute",
  3237. top: "0",
  3238. left: "0"
  3239. }, D = {
  3240. width: "100%",
  3241. height: "100%",
  3242. "object-fit": "cover"
  3243. }, X = computed(() => $.value ? D : {
  3244. ...D,
  3245. visibility: "hidden",
  3246. position: "absolute"
  3247. });
  3248. return (I, M) => (openBlock(), createElementBlock("div", { style: W }, [
  3249. createBaseVNode("video", {
  3250. ref_key: "videoRef",
  3251. ref: b,
  3252. style: normalizeStyle(X.value),
  3253. autoplay: "",
  3254. muted: "",
  3255. playsinline: ""
  3256. }, null, 4),
  3257. withDirectives(createBaseVNode("canvas", {
  3258. id: "qrcode-stream-pause-frame",
  3259. ref_key: "pauseFrameRef",
  3260. ref: v,
  3261. style: D
  3262. }, null, 512), [
  3263. [vShow, !$.value]
  3264. ]),
  3265. createBaseVNode("canvas", {
  3266. id: "qrcode-stream-tracking-layer",
  3267. ref_key: "trackingLayerRef",
  3268. ref: g,
  3269. style: R
  3270. }, null, 512),
  3271. createBaseVNode("div", { style: R }, [
  3272. renderSlot(I.$slots, "default")
  3273. ])
  3274. ]));
  3275. }
  3276. }), Fi = /* @__PURE__ */ defineComponent({
  3277. __name: "QrcodeCapture",
  3278. props: {
  3279. formats: {
  3280. type: Array,
  3281. default: () => ["qr_code"]
  3282. }
  3283. },
  3284. emits: ["detect"],
  3285. setup(r, { emit: o }) {
  3286. const i = r, c = o, l = (h) => {
  3287. if (!(!(h.target instanceof HTMLInputElement) || !h.target.files))
  3288. for (const v of Array.from(h.target.files))
  3289. zr(v, i.formats).then((g) => {
  3290. c("detect", g);
  3291. });
  3292. };
  3293. return (h, v) => (openBlock(), createElementBlock("input", {
  3294. onChange: l,
  3295. type: "file",
  3296. name: "image",
  3297. accept: "image/*",
  3298. capture: "environment",
  3299. multiple: ""
  3300. }, null, 32));
  3301. }
  3302. });
  3303. export {
  3304. Fi as F,
  3305. ki as k,
  3306. showNotify as s
  3307. };